1、异步的:
p.StartInfo.RedirectStandardError = true;
p.ErrorDataReceived += new DataReceivedEventHandler(OutputInfo);
p.Start();
p.BeginErrorReadLine();
private void OutputInfo(object sendProcess, DataReceivedEventArgs output){
if (!String.IsNullOrEmpty(output.Data))
{
//处理方法...
}
}
2、同步的
p.StartInfo.RedirectStandardError = true;
p.Start();
StreamReader sr = ffmpeg.StandardError;
p.WaitForExit();//之后就可以从sr里读了