How to Run ffmpeg commands using .Net
-
Hi Friends, I have to run ffmpeg commands(userd to Transcode audio and video) from c#. Actually I'm trying to make one dll with one method which does this transcoding of audio and video. ex: c:\\ffmpeg\\bin\\ffmpeg.exe -i c:\\ffmpeg\\bin\\ish.mp4 -y sample.mp4 The above command generates one sample.mp4 video file by taknig ish.mp4 as input. This is not fixed commands will generate at runtime based on the input file. So I want to run this command from .net. I tried by using
string path = "C:\\ffmpeg\\bin\\ffmpeg.exe"; string fileargs = "ffmpeg -i ish.mp4 -s cif -vcodec h263 -acodec libamr_nb -ar 8000 -ac 1 -ab 12.2k sampleish12.3gp"; Process p = new Process(); p.StartInfo.FileName = path; p.StartInfo.Arguments = fileargs; p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = false; p.StartInfo.RedirectStandardOutput = false; p.Start(); p.WaitForExit(50000);
but it is not giving any output file Thanks HariBabu -
Hi Friends, I have to run ffmpeg commands(userd to Transcode audio and video) from c#. Actually I'm trying to make one dll with one method which does this transcoding of audio and video. ex: c:\\ffmpeg\\bin\\ffmpeg.exe -i c:\\ffmpeg\\bin\\ish.mp4 -y sample.mp4 The above command generates one sample.mp4 video file by taknig ish.mp4 as input. This is not fixed commands will generate at runtime based on the input file. So I want to run this command from .net. I tried by using
string path = "C:\\ffmpeg\\bin\\ffmpeg.exe"; string fileargs = "ffmpeg -i ish.mp4 -s cif -vcodec h263 -acodec libamr_nb -ar 8000 -ac 1 -ab 12.2k sampleish12.3gp"; Process p = new Process(); p.StartInfo.FileName = path; p.StartInfo.Arguments = fileargs; p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = false; p.StartInfo.RedirectStandardOutput = false; p.Start(); p.WaitForExit(50000);
but it is not giving any output file Thanks HariBaburemove ffmpeg from your file args. This is how your command sent in code differs from your example.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )