2012-10-10 40 views
0

我正在使用ffmpeg進行音頻轉換。我試圖將錄製的音頻轉換爲mp3格式。我得到了文件,但有0大小。任何人都可以幫我解決這個問題嗎?ffmpeg給出0大小的輸出文件

這裏是我的代碼:

 Process ffmpegProcess; 
     string strInputFile; 
     string strOutputFile; 
     strInputFile = Page.MapPath("audio.wav"); 
     strOutputFile = Page.MapPath("audio.mp3"); 
     ffmpegProcess = new Process(); 

     string fileargs = " -i "; 
     fileargs += "\"" + strInputFile + "\""; 
     fileargs += " \"" + strOutputFile + "\""; 
     ffmpegProcess.StartInfo.Arguments = fileargs; 
     ffmpegProcess.StartInfo.FileName = Page.MapPath("ffmpeg.exe"); 
     ffmpegProcess.Start(); 

回答

0

試試這個:

Process ffmpegProcess; 
    string strInputFile; 
    string strOutputFile; 
    strInputFile = Page.MapPath("audio.wav"); 
    strOutputFile = Page.MapPath("audio.mp3"); 
    ffmpegProcess = new Process(); 

    string fileargs = " -i "; 
    fileargs += "\"" + strInputFile + "\""; 
    fileargs += "-ab 192 -f mp3"; 
    fileargs += " \"" + strOutputFile + "\""; 
    ffmpegProcess.StartInfo.Arguments = fileargs; 
    ffmpegProcess.StartInfo.FileName = Page.MapPath("ffmpeg.exe"); 
    ffmpegProcess.Start(); 
+0

謝謝你,但我收到同樣沒有任何變化。 – Sudha

+0

在控制檯窗口中是否出現錯誤? –

+1

現在它工作。我只是用「-f mp3」替換「-ab 192 -f mp3」。 – Sudha