转换WAV到MP3 - ASP.NETWAV、NET、ASP

2023-09-02 02:07:39 作者:腹黑甜心,你别逃

有没有办法为WAV文件转换为MP3在ASP.NET?我听说LAME,但还没有找到一个Web应用程序的任何实例。另外,我不知道这是否可以用于商业用途。

Is there a way to convert WAV files to MP3 in ASP.NET? I have heard of LAME but haven't found any examples for a web application. Also, I wasn't sure if it can be commercially used.

感谢

推荐答案

试试这个code:

public void mciConvertWavMP3(string fileName, bool waitFlag) {
        string outfile= "-b 32 --resample 22.05 -m m ""+pworkingDir+fileName + "" "" + pworkingDir+fileName.Replace(".wav",".mp3")+""";
        System.Diagnostics.ProcessStartInfo psi=new System.Diagnostics.ProcessStartInfo();
        psi.FileName="""+pworkingDir+"lame.exe"+""";
        psi.Arguments=outfile;
        psi.WindowStyle=System.Diagnostics.ProcessWindowStyle.Minimized;
        System.Diagnostics.Process p=System.Diagnostics.Process.Start(psi);
        if (waitFlag)
        {
        p.WaitForExit();
        }
 }