I am just a beginner so please be gentle. I was given the following code which uploads a video file perfectly. I require it to save a thumbnail at the same time though.. Any ideas?
The 'Save Thumbnail' code below works when uploading an image. It generates a thumbnail perfectly, but not when I upload a video as it's obviously trying to use an image.
Protected Sub AjaxFileUpload1_UploadComplete(sender As Object, e As AjaxControlToolkit.AjaxFileUploadEventArgs) Handles AjaxFileUpload1.UploadComplete
'Save the original image
Dim filename As String = RemoveSpecialChars(e.FileName)
Dim imageFilename As String = DateTime.Now.Ticks.ToString() + "_" + filename
Dim acc As New accounts(Membership.GetUser.ProviderUserKey)
AjaxFileUpload1.SaveAs("E:\kunden\homepages\19\d664110395\www\BargainBoxes\catalog\videos\" & imageFilename)
End Sub
'Save a thumbnail of the image
Dim returnImage As System.Drawing.Image = Image.FromFile("E:\kunden\homepages\19\d664110395\www\BargainBoxes\catalog\videos\" & imageFilename)
Dim thumb As System.Drawing.Image = FixedSize(returnImage, 120, 120)
thumb.Save("E:\kunden\homepages\19\d664110395\www\pool-match-up\catalog\images\thumbnails\" & imageFilename, System.Drawing.Imaging.ImageFormat.Jpeg)
I would like it to show a thumbnail from the first frame of the video.
Many thanks for any advice at all.
Using ffmpeg you can grab a screenshot or many screenshots from a video at any time frame https://ffmpeg.org/download.html
check this to see how https://www.codeproject.com/Articles/24995/FFMPEG-using-ASP-NET in step 2 see "To create thumbnail use the following code.... "