【发布时间】:2014-01-01 04:23:12
【问题描述】:
我有用于 ffmpeg 命令调用的 c# 控制台应用程序。在这里
class Program
{
static void Main(string[] args)
{
ProcessStartInfo cmd = new ProcessStartInfo("cmd.exe");
cmd.RedirectStandardInput = true;
cmd.RedirectStandardOutput = true;
cmd.RedirectStandardError = true;
cmd.UseShellExecute = false;
cmd.CreateNoWindow = true;
cmd.WindowStyle = ProcessWindowStyle.Hidden;
Process console = Process.Start(cmd);
console.StandardInput.WriteLine(@"cd C:\Users\vishnu.aravind");
console.StandardInput.WriteLine(@"ffmpeg -i sunp.avi -i Alarm03.wav -c:v copy -c:a aac -strict experimental output.avi");
string errors = console.StandardError.ReadToEnd();
Console.WriteLine("Video file is created.");
Console.Read();
}
}
如果我删除这行代码
string errors = console.StandardError.ReadToEnd();
这个程序可以正常工作。否则它会挂起。我需要错误信息,如果有的话,怎么办,请帮忙。
【问题讨论】:
标签: c# process cmd stderr system.diagnostics