Posts tagged with "Windows Media"

Windows Media

Posted within Development on by Ryan Ball

Part of today was spent researching Windows Media Video (WMV) files and how I could interact with them in VB.Net. As with quite a few areas of .Net, this was one where the documentation was very difficult to track down.

I began my “research” by including FFmpeg within my project folder. By executing this via the code shown below I was able to loop through the 200+ video files hosted upon our streaming server and generate a thumbnail for each one. I did look at using SharpFFmpeg, a C# binding of FFmpeg, but its lack of documentation quickly made me look elsewhere.

Dim ExecutablePath As String = "C:\Web Server\Components\ffmpeg.exe"
Dim myProcess As New Diagnostics.Process()
Dim myProcessStartInfo As New Diagnostics.ProcessStartInfo(ExecutablePath)
myProcessStartInfo.Arguments = String.Format(" -an -y -t 0:0:0.001 -ss 00:00:5 -i ""{0}"" -f mjpeg -s 120x90 ""{1}""", FilePath, Thumbnail)
myProcessStartInfo.UseShellExecute = False
myProcessStartInfo.RedirectStandardInput = True
myProcessStartInfo.RedirectStandardOutput = True
myProcessStartInfo.RedirectStandardError = True
myProcess.StartInfo = myProcessStartInfo
Dim myStreamReader As StreamReader = myProcess.StandardOutput
Dim myString As String = myStreamReader.ReadToEnd()