ffmpeg给出0大小的输出文件

时间:2012-10-10 07:02:10

标签: c# ffmpeg

我正在使用ffmpeg进行音频转换。我试图将录制的音频转换为mp3格式。我得到了文件但是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(); 

1 个答案:

答案 0 :(得分: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();