Help - Search - Members - Calendar
Full Version: Calculating frame sizes
Hydrogenaudio Forums > Lossy Audio Compression > MP3 > MP3 - Tech
JensRex
I'm trying to calculate the frame size of an MP3 frame using this formula that I found here.

The formula is:
CODE
FrameLengthInBytes = 144 * BitRate / SampleRate + Padding
When inserting values I get:
CODE
144 * 128000 / 44100 + 0 = 417,95918367346938775510204081633
I was expecting a whole number. The result is very close to 418, but not quite there. Is the formula wrong? Should I Int() the number, or Round() it?
madah
You should always Trunc() or Int() it.

From the link you mentioned:

QUOTE
Example:
Layer III, BitRate=128000, SampleRate=441000, Padding=0
      ==>  FrameSize=417 bytes


So if Padding=1 the frame would be 418 bytes.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.