Ray_Write
Ray_Write

Reputation: 131

Formula from mp3 Frame Length

I am working on an mp3 decoder, the formula to determine the length, in bytes, of an mp3 frame is

FrameSize = 144 * BitRate / (SampleRate + Padding)

I can't find anywhere that explains what the '144' represents.

Does anyone know?

Upvotes: 2

Views: 3068

Answers (1)

VC.One
VC.One

Reputation: 15881

The 144 represents total bytes-per-frame.

  • MP3 files are generally encoded as MPEG-1 Layer 3.

  • There are 1152 samples per frame in type Layer 3.

  • 1152 samples / 8 bits-per-byte = 144 bytes total.

Taking the formula for frame size (in bytes):

FrameSize = 144 * BitRate / (SampleRate + Padding)

We can see (for MP3 with 192 bitrate @ 44.1 khz):

144 * 192 / (44.1 + 0) = 626 bytes per audio frame (fraction parts are ignored).

Upvotes: 3

Related Questions