2012-10-10 39 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