我想在C#中使用FFMPEG從視頻文件中去除音頻。我知道做這樣的操作的代碼是什麼(據我所知),但我並不是100%確定需要將ffmpe.exe文件保存在我的項目中以及如何訪問它。 到目前爲止我的代碼如下:在C#中使用FFMPEG#
public void stripAudioTest(string videoFilename, ExportProgressWindow callback, string destinationAudioFile)
{
string FFMPEG_PATH = "*************"; //not sure what to put here??????
string strParam = " -i " + videoFileName + " -ab 160k -ar 44100 -f wav -vn " + destinationAudioFile;
process(FFMPEG_PATH, strParam);
callback.Increment(100);
}
public void process(string Path_FFMPEG, string strParam)
{
try
{
Process ffmpeg = new Process();
ffmpeg.StartInfo.UseShellExecute = false;
ffmpeg.StartInfo.RedirectStandardOutput = true;
ffmpeg.StartInfo.FileName = Path_FFMPEG;
ffmpeg.StartInfo.Arguments = strParam;
ffmpeg.Start();
ffmpeg.WaitForExit();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}`
如果任何人有任何想法,請讓我知道。任何幫助!
['Application.ExecutablePath'](http://msdn.microsoft.com/en-us/library/system.windows.forms.application.executablepath.aspx )返回「_啓動應用程序的可執行文件的路徑,包括可執行文件的名稱。」所以這將返回類似'... \ bin \ MyApp.EXE \ ffmpeg.exe'這將無效。 –
@MichaelMinton - 你說得對,我會編輯。 –
感謝您的幫助!我很感激! –