1
在過去的4個小時中,我一直試圖將2個.mp4文件合併爲一個,在C#中使用ffmpeg。在C#中使用ffmpeg將兩個mp4視頻合併爲單個視頻不起作用
****我的代碼如下:****
public void MergeFiles(string strFile)
{
string strParam;
string Path_FFMPEG = Server.MapPath("~/Video_Clips/ffmpeg.exe");
//Merging two videos
String video1 = Server.MapPath("~/Videos/fast1.mp4");
String video2 = Server.MapPath("~/Videos/fast2.mp4");
String file = Server.MapPath("~/Videos/input.txt");
String strResult = Server.MapPath("~/Videos/ConvertedFiles/Output.mp4");
strParam = " -f concat -i " + file + " -c copy " + strResult;
process(Path_FFMPEG, strParam);
}
public void process(string Path_FFMPEG, string strParam)
{
try
{
Process ffmpeg = new Process();
ProcessStartInfo ffmpeg_StartInfo = new ProcessStartInfo(Path_FFMPEG, strParam);
ffmpeg_StartInfo.UseShellExecute = false;
ffmpeg_StartInfo.RedirectStandardError = true;
ffmpeg_StartInfo.RedirectStandardOutput = true;
ffmpeg.StartInfo = ffmpeg_StartInfo;
ffmpeg_StartInfo.CreateNoWindow = true;
ffmpeg.EnableRaisingEvents = true;
ffmpeg.Start();
ffmpeg.WaitForExit(30000);
//ffmpeg.WaitForExit();
ffmpeg.Close();
ffmpeg.Dispose();
ffmpeg = null;
}
catch (Exception ex)
{
}
}
我input.txt的文件如下:
文件的列表,以加入(評論)
文件「 d:/Kapil_WorkSpace/ExtraProjectSource/VideoDemo/VideoDemo/Videos/fast1.mp4'
文件 'd:/Kapil_WorkSpace/ExtraProjectSource/VideoDemo/VideoDemo/Videos/fast2.mp4'
請幫忙。提前致謝。
什麼是錯誤?粘貼ffmpeg命令的控制檯輸出。如果不可用,請添加'-report'並粘貼生成的.log文件。 – Mulvya
在哪裏添加'-report'?我不知道。請給點建議。謝謝 –
如何添加-report?我不知道。請幫助 –