开发者

Converting wav to mp3 - ASP.NET

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开发者_如何学C commercially used.

Thanks


try this 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();
        }
 }


There's an article on CodeProject showing how to compress a wave file in C# using the Lame codec. It is a managed wrapper around the codec.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜