Question

........

using (var reader = new MediaFoundationReader("\\track.wav"))
{

  MediaFoundationEncoder.EncodeToMp3(reader, "\\outputfile.mp3", 192000);

}
...........

Here, in this code when I am trying to convert wav file to mp3 it is throwing exception like,- 'No suitable MP3 encoders available'. I have tested it by passing different bit rates but no use. I have Fraunhofer mp3 codecs and lame installed on my pc with windows 7 os. But converting wav to wma and mp4 is working fine.Please correct me where I am going wrong. By using Acm and lame I am able to convert wav to mp3 on my pc but i dont know why it is not possible with media foundation. And also is there any possibility to pass stream object to media foundation reader function ?

Was it helpful?

Solution

ACM and Media Foundation Transforms are two completely different things. You can have a codec as ACM but not MFT and the other way around. So just because you have an ACM MP3 encoder, doesn't mean you can encode MP3 with Media Foundation.

You can use the NAudioWpfDemo application that comes with the NAudio source to explore what Media Foundation Transforms are installed on your computer.

And no, there currently isn't support for creating a MediaFoundationReader from a stream.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top