wav to mp3 using media foundation NAudio 1.7 - c#-4.0

........
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 ?

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.

Related

is there any better way to play Mp3 than mciSendString?

is there any better way to play Mp3 than mciSendString?
mciSendString sucks, and hard to use in muilti-thread, eg.hard to get the current PlayingState
I'd suggest DirectShow or Windows Media Foundation, since both have flexible APIs for file based playback (you won't have to deal with reading the file and understanding the format, looking up codecs etc.) and still expose playback control. See these articles:
DirectShow and IGraphBuilder (very simple and straightforward) - How To Play a File
How to Play Media Files with Media Foundation
Link to example from the first link

Getting mp3 from Azure Media Services

I'm using Azure Media Services and I need to encode input audio files to mp3 output files. I've used Standart Encoder for encoding video files, but it seems Standart Encoder can't produce mp3 (I understand that it can encode audio with AAC and produce mp4 file with the audio but unfortunately I need exactly mp3).
So I'm trying to use Media Encoder Premium Workflow. In the documentation, I see that I need to use Workflow Designer tool but can't understand where I can get it. Could you please point me out where I can find it? Or maybe you can suggest other solution for getting mp3 after processing audio using Azure Media Services?
I see that you have considered Azure Functions. Since that does not appear to address your needs, please contact us via mepd#microsoft.com
We'll provide you the instructions on how to download the Workflow Designer, and use it.

How to build XML device description for a minimalistic but fully DLNA compatible audio renderer device?

I'm developing an embedded DLNA audio media renderer in C++ which will capture audio stream and use it as a source for LED controller to create visual effects.
Currently I have chosen gupnp library. Its documentation claims that it can generate C code "scaffold" if I feed it with a correct service description XML file.
I read DLNA specifications documentation but it's not easy to put all the absolute minimal requirements together. For now, I know only that I'll need ConnectionManager, RenderingControl and maybe AVTransport service but I'm not sure which methods will be absolutely required to allow the device to receive mp3/aac/wav audio streams from any DLNA media server/radio streamer etc. out there.
I'll be grateful for information where to find such a template or instructions for building a DLNA compatible XML audio renderer template (MediaRenderer:1 should work fine) with minimum required functions and variables to feed into UPNP generator tools (specifically, gupnp).

Media supported by Chromecast

It seems as if Chromecast is an implementation of Google Cast. As any implementation it can support more media than minimally required. I was able to play the following media that is not mentioned in the Google Cast SDK:
WAV file
Ogg Vorbis file
x264 movie in a Matroska container
Are there other containers and media format that Chromecast supports that are not mentioned in the Google Cast SDK?
I'm successfully playing back H264 Video / AAC Audio that is in a Matroska container.
I've also successfully tested a WAV file (http://www.nch.com.au/acm/11k16bitpcm.wav), and an Ogg Vorbis audio file (http://upload.wikimedia.org/wikipedia/en/4/45/ACDC_-_Back_In_Black-sample.ogg)

Convert a wma to wav programatically with Windows Media Encoder

Has anyone converted a WMA to a WAV using Windows Media Encoder? If so, do you have a short code snippet of how you did it? All samples I've seen have been for WAV to WMA, not the other way around.
The reason that all of the samples you've seen have been for WAV to WMA is that you're looking at Windows Media Encoder. You want to decode WMA to WAV. Look at the Windows Media Format SDK instead.

Resources