0

我正在使用 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(); 
4

1 回答 1

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(); 
于 2012-10-10T07:39:38.170 回答