如何在C#windows窗体中合并除ffmpeg以外的音频和视频

时间:2018-01-31 12:30:42

标签: c# winforms audio video ffmpeg

我尝试使用ffmpeg合并音频和视频以下是我的代码, 问题是长视频需要花费太多时间,还有其他方法可以合并音频和视频文件

        string Path_FFMPEG = Application.StartupPath + "\\ffmpeg.exe";
        string Wavefile = applicationPath + @"\Vizipp_Video_" + currentDateTime + ".wav"; ;
        string videoFile = applicationPath + @"\Vizipp_Video_" + currentDateTime + ".avi";
        string strResult = applicationPath + @"\Vizipp_Video_" + currentDateTime + ".mpg";

        System.Diagnostics.Process proc = new System.Diagnostics.Process();


            proc.StartInfo.Arguments = string.Format("-i {0} -i {1} {2}", Wavefile, videoFile, strResult);
            proc.StartInfo.UseShellExecute = false;
            proc.StartInfo.CreateNoWindow = false;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.StartInfo.RedirectStandardError = true;
            proc.StartInfo.FileName = Path_FFMPEG;
            proc.Start();
            //string StdOutVideo = proc.StandardOutput.ReadToEnd();
            //string StdErrVideo = proc.StandardError.ReadToEnd();
            MessageBox.Show("Please wait while we are processing on your video recording...", "Vizipp", MessageBoxButtons.OK, MessageBoxIcon.Information);

1 个答案:

答案 0 :(得分:0)

将-codec副本添加到FFmpeg命令。这假定最终容器支持编解码器。您可能需要至少编码音频(-vcodec copy -acodec aac)