How to decode mp3 into wav using lame in C/C++? - c++

I learned how to encode wav into an mp3 using lame_encode_buffer_interleaved from this question: Is there any LAME c++ wraper\simplifier (working on Linux Mac and Win from pure code)?
Now I want to decode the mp3 back into wav. I know there's lame_decode but I don't know how to use it since it requires two pcm buffers (pcm_l and pcm_r). I don't understand how to put them together into a well-formed wav file, because I don't really know how they works.
Now can someone provide a simple working example on decoding an mp3 into a wav using lame in C/C++?
Thanks.

Take a look into the lame frontend source code. Start at the lame_decoder() function in the .../frontend/lame_main.c file, it decodes an MP3 file and writes the wave header.

Related

Gstreamer record buffer to binary file

I have some question about Gstreamer. I want to use Gstreamer to write buffer to file descriptor when receiving audio/video. I've tried to look up in GstBuffer function but It's cannot decoding binary file to audio. (I've been using Audacity to convert this raw binary file to media.) Please suggest me to implement that.
PS. Sorry for my bad in English, I'll try to more practices. :)

How can I stream sound from the microphone in mp3 format?

I need a software that can stream audio with mp3 format.The audio will come from the microphone at the same time.
I have a software that can stream sound with alaw and ulaw codecs.
And I have an another program that can stream recorded mp3 file. Not capture from the microphone.
I can make stream with VLC.Dotnet wrapper but I didn't succeed with directshow.(namely microphone)
Here my Vlc.Dotnet code;
myVlcControl.Play("dshow://");
myVlcControl.Play(new Uri("dshow://"));
It did not work with this codes. I don't know what causes the problem.
My second software can stream sound that captures form microphone in real time. But its codec format is alaw not mp3. I did not find any converter that convert linear to mp3 file. I find a converter that convert linear to alaw. this is the link Linear to Alaw Codec
I know the LAME and NAudio but it converts wav file to mp3. I need linear to mp3(like in the link)
I am very confused. I really do not know which way to go.
1. Find a codec linear to mp3 (It's very complicated) ?
2. Learn VLC direct Show usage on .NET ?
Thank you so much in advance.
*VLC.DotNet, axVLCPlugin21, LAME, ffmpeg....
As soon as I've successfully solved this problem with VLC.Dotnet wrapper. The problem is compiling with x64 architectural. When I was compiled with x86 architectural, The problem solved.

Converting Wav in MP3

How can I convert WAV in MP3 using QtMultimedia?
There is some specific class for reading WAV and writing MP3 files?
As far as I know there is no MP3 encoder packaged with Qt. You'll have to use an external library.
Edit: this is confirmed by this thread at least as far as Qt4 is concerned (no idea about Qt5 though but I suspect it's the same).

FFMpeg- Raw compressed data to video

I'm trying to use FFMpeg to create a video. So far i've been playing with a multiplexing example:
http://ffmpeg.org/doxygen/trunk/muxing_8c-source.html, and i'm able to create a compressed video from an already existing video.
Because my program is going to run on an embedded platform I would like to use some custom code (generated by a colleague) to compress the video data and place it into the video file.
So I'm looking for a way to create a video file in c/c++ using ffmpeg in which i have full control over the compression part (to basically circumvent ffmpeg from doing the compression for me and inserting my own code).
To clarify i'm planning to use this to save film from an intelligent camera into a compressed h264 mpeg-4 file.
You could pipe the output with -vcodec rawvideo to your custom program, or write it as a codec and have ffmpeg handle it.
By the way, ffmpeg was superceded by avconv. ffmpeg only exists for backwards compatibility now.
Edit: apparently avconv is a newer fork of ffmpeg, and seems to have more support. Either way, the options are almost the same.

gstreamer mp3 demuxer

Any Idea what demuxer should be used for mp3 ? I trying to implement hello world program for playing an mp3.
mp3 streams are usually not muxed. You will use a bitstream parser (such as mp3parse) and then a mp3decoder (such as mad).