var args = argsBuild.ToString();
                var ffmpegProcess = new Process();
                ffmpegProcess.StartInfo.FileName = Cmd;
                ffmpegProcess.StartInfo.Arguments = args;

                // 禁用操作系统外壳程序,异步时需做这些配置
                ffmpegProcess.StartInfo.UseShellExecute = false;
                ffmpegProcess.StartInfo.CreateNoWindow = true;
                ffmpegProcess.StartInfo.RedirectStandardOutput = true;
                ffmpegProcess.StartInfo.RedirectStandardError = true;
                ffmpegProcess.Start();
            // 异步获取命令行内容  
                ffmpegProcess.BeginOutputReadLine();
                ffmpegProcess.BeginErrorReadLine();
                // 为异步获取订阅事件
                ffmpegProcess.ErrorDataReceived += FfmpegProcess_ErrorDataReceived;
                //为异步获取订阅事件
                ffmpegProcess.OutputDataReceived += FfmpegProcess_OutputDataReceived;

                void FfmpegProcess_ErrorDataReceived(object sender, DataReceivedEventArgs e)
                {
                  //每次输出都会触发
                }
               void FfmpegProcess_OutputDataReceived(object sender, DataReceivedEventArgs e)
                {
                    //输出完毕时触发
 
                }

 

相关文章:

  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2021-10-19
  • 2021-09-23
  • 2021-10-11
猜你喜欢
  • 2022-12-23
  • 2022-02-04
  • 2022-12-23
  • 2021-07-17
  • 2021-11-11
  • 2021-08-02
  • 2021-06-11
相关资源
相似解决方案