79412791

Date: 2025-02-04 19:18:46
Score: 1
Natty:
Report link

The bit-rate is the audio_size_in_bits / duration_in_seconds.

If we talk about an MP3 file recording in 128 kb/s (kilo-bits per second), it refers to the target average or constant bit rate that the encoder was aiming for. This bit-rate is defined in each individual frame MPEG frame. For MPEG Layer III (MP3) with 1152 samples at 44.1 kHz, each frame is 25–26 ms.

MP3 files can be encoded with a Constant Bit Rate (CBR), or a Variable Bit Rate (VBR). In CBR mode each frame is encoded with the same bit-rate in each frame, with VBR this is variable. In VBR mode, the bit-rate varies per frame, but on average it should get close to the defined target encoding bit-rate.

Some MP3's are encoded with the presence of a Lame (Xing) Header Information, which can be used to extract to derive some of the encoding settings. Especially with a VBR encoded MP3, without a Lame (Xing) Header, it is difficult to determine what the encoded bit-rate setting was.

To use just the file size to calculate the bitrate in not a reliable method, as audio files may carry non audio date, like metadata (which can include lengthy album art), and may include padding (unused / reserved space).

To determine the actual encoding bit-rate, requires able to decode relevant portions of the MP3. I wrote a JavaScript module music-metadata, which can be used to extract the bit-rate and other information from MP3 files, as well as from other audio files. An example how to do that I provided in this answer.

Reasons:
  • Contains signature (1):
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: Borewit