Wednesday, October 31, 2007

Generating Video Thumbnail Using VB.NET

I have finally get a snapshot/thumbnail of a given video using FFMPEG.

If you wish to do accomplish the same thing follow instruction below:


Download the zip file containg ffmpeg and corresponding files.

Copy the dll and the exe to your bin folder.

Give your .NET user (probably Network Service) full permission to ffmpeg.exe. This step may not be neccesary or may vary depending on your Windows security settings.

Paste this code in your codebehind

' Generate thumbnail
Dim p As Process
Dim pInfo As New ProcessStartInfo()
pInfo.FileName = "\bin\ffmpeg.exe"
pInfo.WindowStyle = ProcessWindowStyle.Hidden
pInfo.Arguments = String.Format("-y -i ""{0}"" -f mjpeg -ss 5 -vframes 1 ""{1}""", , )

p = Process.Start(pInfo)
While (Not p.HasExited)
System.Threading.Thread.Sleep(10)
End While

Hope this helps.

2 comments:

joemill00077711 said...

An fascinating dialogue is value comment. I think that you must write more on this matter, it may not be a taboo subject however usually persons are not enough to speak on such topics. To the next. Cheers casino blackjack

Anonymous said...

You’ve got some interesting points in this article. I would have never considered any of these if I didn’t come across this. Thanks!. psiprograms.com