2011-01-20 11 views
3

で実行してください。こんにちは誰かがFFmpegに対してC#で次のコマンドを実行する方法を教えてもらえますか?ffmpegコマンドをC#

mkfifo temp1.a 
mkfifo temp1.v 
mkfifo temp2.a 
mkfifo temp2.v 
mkfifo all.a 
mkfifo all.v 
ffmpeg -i input1.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp1.a < /dev/null & 
ffmpeg -i input2.flv -vn -f u16le -acodec pcm_s16le -ac 2 -ar 44100 - > temp2.a < /dev/null & 
ffmpeg -i input1.flv -an -f yuv4mpegpipe - > temp1.v < /dev/null & 
{ ffmpeg -i input2.flv -an -f yuv4mpegpipe - < /dev/null | tail -n +2 > temp2.v ; } & 
cat temp1.a temp2.a > all.a & 
cat temp1.v temp2.v > all.v & 
ffmpeg -f u16le -acodec pcm_s16le -ac 2 -ar 44100 -i all.a \ 
     -f yuv4mpegpipe -i all.v \ 
     -sameq -y output.flv 
rm temp[12].[av] all.[av] 

ありがとうございます。

答えて

1

Process.StartメソッドをSystem.Diagnostics名前空間から使用できます。

+0

こんにちはグレッグ、私に戻ってきてくれてありがとう。私はexeファイルを実行する方法を知っています。私が持っている問題は、コマンドを実行する方法を理解していない、exeファイルの1引数として実行するか、引数を分割してexeを複数回呼び出すことです。それは私が立ち往生しているものです。 – Paul

0

ffmpegの実行可能ファイルを公式サイトからダウンロードし、アプリケーションの起動パスに置き、を使用してそれらをエコーし​​た後、必要に応じて引数を渡すことができます。

例: -

exeファイルpath- ffprobe.exe -hide_banner -show_format -show_streams -pretty {} video_file

private static string Execute(string exePath, string parameters) 
{ 
string result = String.Empty; 

using (Process p = new Process()) 
{ 
    p.StartInfo.UseShellExecute = false; 
    p.StartInfo.CreateNoWindow = true; 
    p.StartInfo.RedirectStandardOutput = true; 
    p.StartInfo.FileName = exePath; 
    p.StartInfo.Arguments = parameters; 
    p.Start(); 
    p.WaitForExit(); 

    result = p.StandardOutput.ReadToEnd(); 
} 

return result; 
} 
関連する問題