Skip to main content

Topic: MP3 Header in LAME (Read 1236 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • ssriram
  • [*]
MP3 Header in LAME

I am trying to encode a raw pcm stream as mp3 with LAME before entering it into an FLV container. To encode the raw pcm stream as mp3, I am using the following functions: 

In both these functions, the mp3 encoded samples are stored in buffers of type unsigned char. My question(s):

1. Is it correct to assume that the first 32 bits of the buffer would be the MP3 header? In other words does the MP3 "frame" as output by the above function contain the header as well? I tried to output the contents of the mp3 buffer byte by byte. I see that most frames have 255 as the first element but some do not.

2. If the MP3 header is not part of the first 32 bits, how do I write the header? What is a Xing header? Is it a version of the MP3 header or ID3v2 tag?

3. Using the LAME API, how do we find the bitrate of the file?

I have been scratching my head on these issues for some time and some help would be most welcome.
  • Last Edit: 18 February, 2013, 07:27:20 AM by ssriram