FFMPEG with ASP.NET
Ok, since my friend Art has been posting a lot of articles on FFMPEG recently I figured since I was working tonight with some FFMPEG that I would post a snippet or two with how to work with FFMPEG with .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 & “FFMPEGScout\ffmpeg.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 & “ffmpeg\ffmpeg.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….