In my application i am trying to convert my wmv file into swf file format. And its working on Command prombt very well and it created the output file also.
But when i write the code in c# (below mentioned) its not working. But no more errors or exceptions arise. But No outputs found(no new.swf file was created).
elango.sham
0 Points
25 Posts
Using FFMPEG Wmv to Swf: Not Working in C#: Need Help...
Oct 06, 2008 08:00 AM|LINK
Hai all,
In my application i am trying to convert my wmv file into swf file format. And its working on Command prombt very well and it created the output file also.
But when i write the code in c# (below mentioned) its not working. But no more errors or exceptions arise. But No outputs found(no new.swf file was created).
filargs =
"ffmpeg -i d:\\hai.wmv -s 480*360 -deinterlace -ab 32 -r 15 -ar 22050 -ac 1 d:\\hai.swf"; System.Diagnostics.Process proc = new System.Diagnostics.Process();proc.StartInfo.FileName ="D:\\ffmpeg\\ffmpeg.exe";proc.StartInfo.Arguments = filargs;
proc.StartInfo.UseShellExecute = false; proc.StartInfo.CreateNoWindow = false;proc.StartInfo.RedirectStandardOutput = false;proc.Start();
proc.WaitforExit(50000);
Thanks in Advance...
Sham
O11Y
Participant
1053 Points
315 Posts
Re: Using FFMPEG Wmv to Swf: Not Working in C#: Need Help...
Oct 06, 2008 08:33 AM|LINK
I've falled into this trap before...
proc.StartInfo.RedirectStandardOutput = false;
...Try redirecting StandardError too
elango.sham
0 Points
25 Posts
Re: Using FFMPEG Wmv to Swf: Not Working in C#: Need Help...
Oct 06, 2008 09:24 AM|LINK
thanks for reply,
proc.StartInfo.RedirectStandardError = false; proc.Start(); StreamReader standardError = proc.StandardError;proc.WaitForExit();
lblmsg.Text = standardError.ReadToEnd()
I am getting the error displayed on my label(lblmsg) - "StandardIn has not been redirected "
O11Y
Participant
1053 Points
315 Posts
Re: Using FFMPEG Wmv to Swf: Not Working in C#: Need Help...
Oct 06, 2008 09:28 AM|LINK
See my post here. The code I used worked after I redirected standard error:
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/486a8456-446e-4fb9-a45d-dae01ad9ce5d
elango.sham
0 Points
25 Posts
Re: Using FFMPEG Wmv to Swf: Not Working in C#: Need Help...
Oct 06, 2008 09:31 AM|LINK
O11Y
Participant
1053 Points
315 Posts
Re: Using FFMPEG Wmv to Swf: Not Working in C#: Need Help...
Oct 06, 2008 09:42 AM|LINK
This is an error with your console app:
gcc: 4.2.3 Unable to find a suitable output format for 'ffmpeg'
Try debugging at the command prompt
elango.sham
0 Points
25 Posts
Re: Using FFMPEG Wmv to Swf: Not Working in C#: Need Help...
Oct 06, 2008 10:22 AM|LINK
hai,
Atlast i find the solution.
Thanking you, for your help...
Ragards ...
Sham
elango.sham
0 Points
25 Posts
Re: Using FFMPEG Wmv to Swf: Not Working in C#: Need Help... Please....
Oct 15, 2008 11:42 AM|LINK
Hi,
I have written below code, and it wont produce the result(convert into .swf) when i upload .wmv file. But it is working in command prombt.
So please check and give solution for me.....
And if you dont mine why you are using (C:\\dbping)
postedfilename = FileUpload1.PostedFile.FileName;
SavePath = AppDomain.CurrentDomain.BaseDirectory + "Video\\"; string NewFName = postedfilename; NewFName = NewFName.Substring(NewFName.LastIndexOf("\\") + 1, NewFName.Length - NewFName.LastIndexOf(".")) + "." + NewFName.Substring(NewFName.LastIndexOf(".") + 1);Filenamewithpath = SavePath + NewFName;
//Save The fileFileUpload1.PostedFile.SaveAs(Filenamewithpath);
//Start Converting string inputfile, outputfile, filargs,dbfilename; string withoutext; //Get the file name without Extension withoutext = Path.GetFileNameWithoutExtension(Filenamewithpath); //Input file path of uploaded imageinputfile = SavePath + NewFName;
//output file format in swf outputfile = SavePath + "SWF\\" + withoutext+ ".swf";dbfilename = withoutext +
".swf"; //outputfile = "D:\\hai.swf"; //file orguments for FFMEPG filargs = "-i \""+ inputfile +"\" -s 480*360 -deinterlace -ab 32 -r 15 -ar 22050 -ac 1 \""+outputfile +"\""; string spath; //spath = Server.MapPath("."); spath = AppDomain.CurrentDomain.BaseDirectory; DirectoryInfo directoryInfo = new DirectoryInfo(Path.GetDirectoryName(Server.MapPath("ffmpeg"))); System.Diagnostics.ProcessStartInfo psi = new ProcessStartInfo("C:\\dbping");psi.WorkingDirectory =
"C:\\"; psi.ErrorDialog = false;psi.RedirectStandardOutput =
true; psi.RedirectStandardInput = true;psi.RedirectStandardError =
true; psi.UseShellExecute = false;psi.CreateNoWindow =
true; System.Diagnostics.Process proc = new System.Diagnostics.Process();proc.StartInfo = psi;
proc.StartInfo.FileName = spath + "ffmpeg\\ffmpeg.exe";proc.StartInfo.Arguments = filargs;
proc.StartInfo.UseShellExecute = false; try{
proc.Start();
StreamWriter standardInput = proc.StandardInput;StreamReader standardError = proc.StandardError;proc.WaitForExit();
//lblmsg.Text = standardError.ReadToEnd();}
catch (Exception ex){
Response.Write(ex.Message);
}
proc.Close();
Thanks and Regards
Sham
handle
Member
126 Points
36 Posts
Re: Using FFMPEG Wmv to Swf: Not Working in C#: Need Help...
Nov 11, 2008 01:57 PM|LINK
I am having the same problem as you are, can you share your solution?
Thanks
elango.sham
0 Points
25 Posts
Re: Using FFMPEG Wmv to Swf: Not Working in C#: Need Help...
Nov 13, 2008 04:44 AM|LINK
Hi,
Could you tell me exactly whats your problem...