MP3 Files and MPEG Audio Frames
An MP3 file stores MPEG Layer III audio frames together with optional tags and information for duration and seeking.
An MP3 file commonly stores a sequence of MPEG Layer III audio frames, with optional descriptive and navigation information around or within that sequence. Reading those frames is a different job from interpreting a general movie container with several soundtracks.
Each MPEG frame has a four-byte header describing such properties as MPEG version, layer, bitrate choice, sample-rate choice, and channel mode. The reader validates the fields and successive boundaries before passing frame data to the audio decoder.
One frame's duration and length
For MPEG-1 Layer III, one frame represents 1,152 sample frames per channel. At 44.1 kHz, that is 1,152 / 44,100 = approximately 26.122 ms.
For an ordinary 128 kb/s frame at that rate, the byte-length calculation is:
floor(144 × 128,000 / 44,100) + padding byte = 417 or 418 bytes
The padding-byte choices keeps the long-term stored rate aligned with the specified rate. Equal audio duration therefore need not mean exactly equal stored length, even in this constant-bitrate example.
| Information | Question it answers |
|---|---|
| Frame header | Which encoding parameters and boundary size apply? |
| Frame count | How much nominal decoded audio is represented? |
| Optional Xing/VBRI data | What duration or navigation summary was written? |
| ID3 metadata | What names, descriptions, or artwork accompany the recording? |
Encoder delay and end padding can require separate trimming information when interpreting the intended presented duration. Counting nominal frame samples and accounting for that valid interval are related but distinct steps.
Why a frame boundary is not always a clean cut
Layer III's bit reservoir allows encoded main data associated with a frame to occupy available space in earlier frames. Side information tells the decoder where that data begins relative to the present frame's main data.
Starting at an arbitrary visible header can therefore leave the decoder without bytes needed for the first audio it tries to reconstruct. A reader can need preceding frame data; cutting a file at that boundary does not necessarily create a clean independent excerpt.
This is a packing mechanism within the encoded stream, not a second audio track. Its purpose is to share the data allowance across varying coding demands.
Tags and timing belong to different interpretations
ID3 also calls its individual metadata records “frames.” An ID3 title frame carries text, while an MPEG audio frame represents sound. A music library can identify a file incorrectly because of its ID3 records even though the sound decodes normally.
For variable-bitrate audio, dividing the whole file by one observed frame's bitrate can misstate duration. Readers can instead examine frame information and optional summaries. In an Emby music case, keep title/tag problems separate from seek or duration problems: they lead to different structures in this same file.