Introduction
Every Layer I frame starts with the same four bytes as a Layer II or Layer III frame: the layer field says which one it is. The header is the only part a reader needs to find the next frame, because a Layer I frame has a length fixed by its bit rate, sample rate and padding.
Fields
| Bits | Width | Field | Meaning |
|---|---|---|---|
| 31–21 | 11 | sync | eleven ones |
| 20–19 | 2 | version | 11 MPEG-1, 10 MPEG-2, 00 MPEG-2.5, 01 reserved |
| 18–17 | 2 | layer | 11 for Layer I (10 is Layer II, 01 Layer III, 00 reserved) |
| 16 | 1 | protection | 0 a 16-bit CRC follows the header; 1 none |
| 15–12 | 4 | bitrate | an index into the bit rate table |
| 11–10 | 2 | sample rate | an index into the sample rate table |
| 9 | 1 | padding | 1 adds one slot, which in Layer I is 4 bytes, to the frame |
| 8 | 1 | private | free for applications |
| 7–6 | 2 | mode | 00 stereo, 01 joint stereo (intensity stereo), 10 dual channel, 11 single channel |
| 5–4 | 2 | mode extension | only in joint stereo: the bound |
| 3 | 1 | copyright | 1 means copyrighted |
| 2 | 1 | original | 1 original, 0 copy |
| 1–0 | 2 | emphasis | 00 none, 01 50/15 µs, 10 reserved, 11 CCITT J.17 |
Bit rates
In kilobits a second. Index 0 is free format; index 15 is not allowed. Any bit rate may be used with any channel mode in Layer I.
| Index | MPEG-1 Layer I | MPEG-2 and 2.5 Layer I |
|---|---|---|
| 0 | free format | free format |
| 1 | 32 | 32 |
| 2 | 64 | 48 |
| 3 | 96 | 56 |
| 4 | 128 | 64 |
| 5 | 160 | 80 |
| 6 | 192 | 96 |
| 7 | 224 | 112 |
| 8 | 256 | 128 |
| 9 | 288 | 144 |
| 10 | 320 | 160 |
| 11 | 352 | 176 |
| 12 | 384 | 192 |
| 13 | 416 | 224 |
| 14 | 448 | 256 |
| 15 | not allowed | not allowed |
Sample rates
| Index | MPEG-1 | MPEG-2 | MPEG-2.5 |
|---|---|---|---|
| 0 | 44,100 Hz | 22,050 Hz | 11,025 Hz |
| 1 | 48,000 Hz | 24,000 Hz | 12,000 Hz |
| 2 | 32,000 Hz | 16,000 Hz | 8,000 Hz |
| 3 | reserved | ||
The joint stereo bound
In joint stereo the mode extension gives the subband from which the two channels share their allocation and samples. Below the bound each channel has its own allocation and samples; from the bound upward, one allocation and one set of samples serves both channels, and each channel only has its own scalefactor, which is intensity stereo.
| Mode extension | Bound |
|---|---|
00 | subband 4 |
01 | subband 8 |
10 | subband 12 |
11 | subband 16 |
In the other modes the bound is 32: every subband has its own allocation in every channel. In single channel mode there is one channel.
Frame length
A frame holds 384 samples per channel at every sample rate, and is a whole number of 4-byte slots. Its length in bytes, with the bit rate in bits a second, is (⌊12 × bit rate / sample rate⌋ + padding) × 4. A free-format frame has no length in its header: a reader measures it by finding the next frame, and every frame of the file has the same length, apart from the padding slot.
At 44,100 Hz and 128 kbit/s, 12 × 128,000 / 44,100 is 34.83, so a frame is 34 slots (136 bytes), or 35 slots (140 bytes) with padding.
CRC
A CRC is present when the protection bit is 0, in the two bytes right after the header.
It is a CRC-16 with the polynomial X16 + X15 + X2 + 1
(0x8005), starting at 0xFFFF. It covers the last two bytes of the
header (bit rate to emphasis) and then the whole bit allocation: 4 bits for each subband
of each channel below the bound, and 4 bits for each subband from the bound up. The
stored CRC bytes themselves, and the first two header bytes, are not covered.
An example
The header FF FF 80 64:
| Field | Bits | Value |
|---|---|---|
| sync | 11111111 111 | eleven ones |
| version | 11 | MPEG-1 |
| layer | 11 | Layer I |
| protection | 1 | no CRC |
| bitrate | 1000 | 256 kbit/s |
| sample rate | 00 | 44,100 Hz |
| padding | 0 | not padded |
| private | 0 | |
| mode | 01 | joint stereo |
| mode extension | 10 | bound at subband 12 |
| copyright, original | 0, 1 | not copyrighted, original |
| emphasis | 00 | none |
The frame is ⌊12 × 256,000 / 44,100⌋ = 69 slots, 276 bytes.