FFMPEG with .NET

23 May, 2009 ASP.NET,FFMPEG,VB.NET

After you have saved the file down here is how to do the conversion

‘If the video is not already in flv format we need to do a conversion of it

If ext.ToString() <> “.flv” Then

Dim AppPath As String = Request.PhysicalApplicationPath

Dim inputPath As String = savePath

Dim outputPath As String = saveConvertedPath

Dim fileargs As String = ” -i “”" & inputPath & “”" “”" & outputPath & “”"”

Dim proc As New Diagnostics.Process()

proc.StartInfo.FileName = AppPath & “FFMPEGScoutffmpeg.exe”

proc.StartInfo.Arguments = fileargs

proc.StartInfo.UseShellExecute = False

proc.StartInfo.CreateNoWindow = False

proc.StartInfo.RedirectStandardOutput = True

proc.Start()

proc.WaitForExit()

proc.Close()

End If

And here is how to snag the thumbnail

Dim AppPath As String = Request.PhysicalApplicationPath

Dim inputPath As String = savePath

Dim outputPath As String = saveConvertedPath

Dim fileargs As String = ” -i “”" & inputPath & “”" -s 108*80 -vframes 1 -f image2 -vcodec mjpeg “”" & outputPath & “”"”

Dim proc As New Diagnostics.Process()

proc.StartInfo.FileName = AppPath & “ffmpegffmpeg.exe”

proc.StartInfo.Arguments = fileargs

proc.StartInfo.UseShellExecute = False

proc.StartInfo.CreateNoWindow = False

proc.StartInfo.RedirectStandardOutput = False

proc.Start()

Alright, we will post in more detail later but I just wanted to put some snippets out there before I hit the sack….

Comments are closed.