Tahir Mulla
Tahir Mulla

Reputation: 11

how to merge Audio and video in C# windows form other than ffmpeg

Im trying to merge audio and video using ffmpeg following is my code, problem is it take too much time for long video,is there any other way of merging audio and video files

        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);

Upvotes: 1

Views: 1344

Answers (1)

szatmary
szatmary

Reputation: 31110

Add -codec copy to your FFmpeg command. This assumes that the final container supports the codecs. You may need to encode audio at least (-vcodec copy -acodec aac)

Upvotes: 1

Related Questions