2

So, I'm trying to run a command line, but it doesn't seem to do anything, i have no idea what i am missing, it is supposed to take an .asf video and convert it to .mp4, any idea will be useful, thanks.

string path1 = @"""C:\Users\Programacion\Desktop\vid.asf""";
string path2 = @"""C:\Users\Programacion\Desktop\vid.mp4""";

 private void butConvert_Click(object sender, EventArgs e)
        {            
            string strCmdText;
            strCmdText = "/C ffmpeg.exe -i " + path1 + " -vcodec mpeg4 -b:v 1200k -flags +aic+mv4 " + path2 + " -loglevel panic";
            System.Diagnostics.Process.Start(@"C:\Users\Programacion\documents\visual studio 2010\Projects\VideosDVR\VideosDVR\ffmpeg.exe", strCmdText);
    }
MSV123
  • 39
  • 8
  • 1
    That will execute `..\VideosDVR\ffmpeg.exe /C ffmpeg.exe -i ...`, is the double .exe intentional? – H H May 30 '14 at 15:23
  • Hi, no, even without the ".exe" nothing happens – MSV123 May 30 '14 at 15:38
  • Solved, you were absolutely right I didn't know that "ffmpeg.exe" was being sent twice, so I quit the "/C ffmpeg.exe" part from de string and that's it, thank you very much Henk. – MSV123 May 30 '14 at 16:23

3 Answers3

0

You don't appear to be waiting for the process to complete.

var process = Process.Start(...);
process.WaitForExit();
T McKeown
  • 12,971
  • 1
  • 25
  • 32
  • But something should still be happening, like the .mp4 showing up. – H H May 30 '14 at 15:24
  • no exception? I assume your main process is still running after you run this code? So yeah you're right you wouldn't need to wait as long as your application is still running and doesn't kill any child processes. – T McKeown May 30 '14 at 15:28
0

Try this:

System.Diagnostics.Process.Start(@"""C:\Users\Programacion\documents\visual studio 2010\Projects\VideosDVR\VideosDVR\ffmpeg.exe""", strCmdText);

Note: " is added before driver root: "C: and after ffmg.ext"

Ivandro Jao
  • 2,731
  • 5
  • 24
  • 23
-1

you can use arguments with Process.Start for example

System.Diagnostics.Process.Start("iexplore.exe","http://google.co.uk");

so in your case I think it would be

System.Diagnostics.Process.Start("ffmpeg.exe","strCmdText")

note - you would need to specify the full path of ffmpeg.exe or add it to the environment variables list of your machine

car1bo
  • 1
  • 3