Process调用exe程序的问题
我的程序如下,需调用exe程序,同时需输入参数,此程序需处理一段时间,但总是运行到一段时间就停止了
Process p=new Process();
p.StartInfo.FileName= "ffmpeg.exe ";
p.StartInfo.Arguments= " -i cehua.wmv -ab 56 -ar 22050 -b 500 -r 15 -s 320*240 asf.flv ";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
if(p.Start())
{
p.WaitForExit();
}
------解决方案--------------------有可能是ffmpeg.exe程序本身的问题.
------解决方案--------------------Process p=new Process();
ProcessInfo info= new ProcessInfo();
info.FileName= "ffmpeg.exe ";
info.Arguments= " -i cehua.wmv -ab 56 -ar 22050 -b 500 -r 15 -s 320*240 asf.flv ";
info.UseShellExecute = false;
info.RedirectStandardInput = true;
info.RedirectStandardOutput = true;
info.RedirectStandardError = true;
info.CreateNoWindow = true;
try
{
p=p.Start(info);
if(p!=null)
{
p.WaitForExit();
}
}
catch
{
}