I tried the FFmpeg library but the code seems not working.
public void MergeVideos(string[] videoPaths, string outputFilePath) { // Combine video paths into FFmpeg command string command = "ffmpeg -i concat:" + string.Join("|", videoPaths[0]) + " -c copy " + outputFilePath; // Execute FFmpeg command ExecuteFFmpegCommand(command); } private void ExecuteFFmpegCommand(string command) { try { // Start the FFmpeg process Process ffmpegProcess = new Process { StartInfo = { FileName = "ffmpeg.exe", // Assuming ffmpeg.exe is in the PATH environment variable Arguments = command, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = false } }; // Subscribe to process output data events ffmpegProcess.OutputDataReceived += (sender, e) => Console.WriteLine(e.Data); ffmpegProcess.ErrorDataReceived += (sender, e) => Console.WriteLine(e.Data); // Start process and redirect output ffmpegProcess.Start(); ffmpegProcess.BeginOutputReadLine(); ffmpegProcess.BeginErrorReadLine(); // Wait for process to exit ffmpegProcess.WaitForExit(); }
Are there bugs in the above code? Or Is there some other easier way to do it?
Thanks.