i am trying to run an ffmpeg command using c# and CMD.
I am creating and then executing a .bat file to do this. The .bat seems to create correctly, but when executed within c# it does not run correctly - It cannot find the image names. However when i exit the debugger and run the .bat the debugger created manually it works fine.
The images have just been created by the debugger, could this have something to do with it?
string command1= "ffmpeg -r 1/5 -i " + projectPrefix + "image-%%02d.bmp -i music.mp3 -qscale:v 2 -shortest -codec:a copy " + projectPrefix + "output.flv \n ffmpeg -i "+projectPrefix+"output.flv -vcodec wmv1 -acodec adpcm_ima_wav " + projectPrefix + ".wmv";
// Write the string to a file.
System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\Scott\desktop\"+projectPrefix+".bat");
file.WriteLine(command1);
file.Close();
Thread.Sleep(10000);
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(@"C:\Users\Scott\desktop\" + projectPrefix + ".bat");
psi.RedirectStandardOutput = true;
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
psi.UseShellExecute = false;
System.Diagnostics.Process listFiles;
listFiles = System.Diagnostics.Process.Start(psi);
System.IO.StreamReader myOutput = listFiles.StandardOutput;
listFiles.WaitForExit(2000);
if (listFiles.HasExited)
{
string output = myOutput.ReadToEnd();
}
Thanks