wma audio stream to mp3 stream using NAudio c#

后端 未结 2 437
礼貌的吻别
礼貌的吻别 2021-01-27 09:50

My task is to convert wma audio stream to mp3 stream using NAudio and Lame. The below code is working fine with file name but I want it to be done with memory stream. I search i

2条回答
  •  面向向阳花
    2021-01-27 10:53

    The easiest way to convert WMA to MP3 with NAudio is to use the Media Foundation based classes. If you are on Windows 8 and above, and MP3 encoder should be available.

    using (var reader = new MediaFoundationReader("test.wma"))
    {
        MediaFoundationEncoder.EncodeToMp3(reader, "test.mp3");
    }
    

    On systems without an MP3 encoder, I tend to use LAME.exe and stream the input audio through stdin. See my article here for more info on this approach.

提交回复
热议问题