直接通过cmd,手打ffmpeg -i in.avi -vf drawtext="fontfile=arial.ttf: timecode='09:57:00:00': r=10: \x=(w+tw)/2:fontcolor=Red:fontsize=30" -an -y out.avi进行视频处理时该命令是能够正确完成功能的。
但是,在c#内部调用时该如何把那串字符正确的输入进去啊,怎么输都不对。
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.WorkingDirectory = Application.StartupPath;
proc.StartInfo.UseShellExecute = false; //use false if you want to hide the window
string command_line = "-i " + filename + " -vf drawtext=\"" + "fontfile=arial.ttf: timecode='09\\:57\\:00\\:00': r=10: \\x=(w+tw)/2:fontcolor=Red:fontsize=30\"" + "-an " + name1;
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.FileName = "ffmpeg";
proc.StartInfo.Arguments = command_line;
proc.Start();