string strParam;
string Path_FFMPEG = @"C:\Windows\system32\cmd.exe";
string WorkingDirectory = @"C:\Users\Braintech\documents\visual studio 2013\Projects\convertVideo\convertVideo";
string command1 = "ffmpeg -i video1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts";
string command2 = "ffmpeg -i video2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts";
string command3 = "ffmpeg -i" + "concat:intermediate1.ts|intermediate2.ts" + " -c copy -bsf:a aac_adtstoasc Output.mp4";
string Command = @"" + command1 + " & " + command2 + " & " + command3 + " ";
strParam = "ffmpeg -f concat -i " + file + " -c copy " + strResult;
process(Path_FFMPEG, Command, WorkingDirectory);
public static void process(string Path_FFMPEG, string Command, string WorkingDirectory)
{
try
{
Process ffmpeg = new Process();
ProcessStartInfo ffmpeg_StartInfo = new ProcessStartInfo(Path_FFMPEG, Command);
ffmpeg_StartInfo.WorkingDirectory = WorkingDirectory;
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.Close();
ffmpeg.Dispose();
ffmpeg = null;
}
catch (Exception ex)
{
}
}
我試圖用ffmpeg合併兩個視頻。但它是手動工作,但無法執行使用C#code.it工程時,我手動在cmd上運行該命令。但是當我試圖運行使用C#它不起作用。請幫助某人。 在此先感謝。使用ffmpeg連接兩個視頻。
我得回到它扮演Android應用視頻沒有擊中的視頻網址。所以我想在api中發送字節數組,並在視頻和播放中在客戶端進行轉換。 –
@SunilKumar將視頻加載到字節數組是一個可怕的想法,永遠不會工作;這不是你應該如何處理大文件。因此,無論您需要流媒體API('FileResult'知道這裏要做什麼),或者您需要多個小的請求(可怕的)。 –
@sunilKumar文件結果不在api控制器中運行 –