我尝试使用 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);
最佳答案
将 -codec 副本添加到您的 FFmpeg 命令中。这假设最终容器支持编解码器。您可能至少需要对音频进行编码(-vcodec copy -acodec aac)
关于c# - 如何在除ffmpeg之外的C# windows窗体中合并音频和视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48542265/