Answered by:
FFMPEG File Conversion

Question
-
User201849722 posted
Hello,
First, sorry if this isn't the right category. Didn't see one that fit better...
I'm using FFMPEG for the first time. I found a bit of code here and I've been modifying it to try and make it work for me.
The upload works. The *.avi file is uploaded to thevirtual path just fine. When it runs through and attempts the conversion to an FLV file, it doesn't error out - but it doesn't convert the file either.
The ffmpeg.exe and pthreadGC2.dllare in the same folder ({virtual_path}\upload\video). I do see a cmd window flash when the process starts but can make out anything displayed.
Here's my code:
========== File Upload ============
Protected Sub Submit1_ServerClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Submit1.ServerClick
If Not File1.PostedFile Is Nothing And File1.PostedFile.ContentLength > 0 Then
Dim GetFileName As String = File1.PostedFile.FileName
Dim fn As String = System.IO.Path.GetFileName(File1.PostedFile.FileName)
Dim SaveLocation As String = Server.MapPath("upload\video\") & fn
Try
File1.PostedFile.SaveAs(SaveLocation)
Label3.Visible = True
'After uploading the file, rename it
convert_Click(fn)
Label3.Text = ("The file has been uploaded.")
Catch Exc As Exception
Label4.Visible = True
Label4.Text = ("Error: " & Exc.Message)
End Try
Else
Label5.Visible = True
Label5.Text = ("Please select a file to upload.")
End If
End Sub
======== FFMEPG Conversion ===========
Protected Sub convert_Click(ByVal fn As String)
'converting video 1.wmv to video.flv
Dim ffmpeg As New Process
Dim video As String
Dim mpg As String
'Setup the string to hold the name of the video extention
video = Page.MapPath(fn) ' setting video input name with path
mpg = Page.MapPath("upload\video\" & Profile.UserName & ".flv")ffmpeg = New Process()
ffmpeg.StartInfo.Arguments = "-i " + video + "-target flv -metadata title=""my title"" " + mpg + "\"
ffmpeg.StartInfo.FileName = Page.MapPath("upload\video\ffmpeg.exe")
ffmpeg.StartInfo.UseShellExecute = False
ffmpeg.Start()
End Sub========== End Code ==========
Any idea on how I can make this work? Remember, I am a complete novice with this.
Tuesday, December 8, 2009 2:04 PM
Answers
-
User201849722 posted
I figured this out.
I had lots of issues in the line:
ffmpeg.StartInfo.Arguments = "-i " + video + "-target flv -metadata title=""my title"" " + mpg + "\"It should have been:
ffmpeg.StartInfo.Arguments = "-i " + """" + video + """" + " -y -target ntsc-vcd " + """" + mpg + """"
There were a could other things wrong but that was the main issue.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, December 9, 2009 11:24 AM
All replies
-
User201849722 posted
Sorry, my reference tag didn't work. Here is the link where I found the example:
http://forums.asp.net/p/1252223/2317598.aspx#2317598
Tuesday, December 8, 2009 2:52 PM -
User201849722 posted
I figured this out.
I had lots of issues in the line:
ffmpeg.StartInfo.Arguments = "-i " + video + "-target flv -metadata title=""my title"" " + mpg + "\"It should have been:
ffmpeg.StartInfo.Arguments = "-i " + """" + video + """" + " -y -target ntsc-vcd " + """" + mpg + """"
There were a could other things wrong but that was the main issue.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, December 9, 2009 11:24 AM