Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to get pure C++ Lame MP3 encoder - PCM to MP3 example?

Tags:

c++

mp3

lame

So all I need is a simple function that sets it up (eating incoming PCM RATE (for example: rate near to 44100) It's channels (for example: 2) and -bits (for example: 16) and desirable 128 kb\s rate) and another one that takes PCM data and encodes it into pure MP3 frames.

I know it looks like a silly homework task but I assure you - it is not.

I hope it will be of help to all C++ developers starting with MP3s.

So can anybody please help me with that?

like image 893
Rella Avatar asked Mar 10 '10 19:03

Rella


4 Answers

See the example I gave in your other question for the basic usage of Lame. It should contain everything you need.

like image 90
Mike Seymour Avatar answered Nov 16 '22 06:11

Mike Seymour


It's a long time since i messed with this, but Lame lib contains all you need to do it, check out lame.h , there is some test code you could look into.

like image 33
fn. Avatar answered Nov 16 '22 07:11

fn.


Personally, I'd be looking at ffmpeg's libavcodec. There's an example file containing an audio_encode_example which ought to be more or less what you're looking for.

See also this question.

Note that not all ffmpeg packagings include mp3 codec support (patent issues) by default, although there's usually some simple way of enabling it.

like image 25
timday Avatar answered Nov 16 '22 05:11

timday


GStreamer should definitely be able to handle this. If you are on Windows you can use the GStreamer Winbuilds to get started.

like image 27
StackedCrooked Avatar answered Nov 16 '22 05:11

StackedCrooked