Everything2
Near Matches
Ignore Exact
Full Text
Everything2

MPEG Audio Frame Header

created by kozmund

(thing) by kozmund (2.5 wk) (print)   ?   (I like it!) 1 C! Tue Feb 06 2001 at 1:06:54

This is my attempt to summarize the information needed to decode a MPEG audio frame header. I'm noding this out of the notes I made while researching with the exception of the bit rate table, which was copied from www.mp3-tech.org and reformated. This does not cover actual MPEG audio compression, just the audio frame headers. That being said, on with the show.

The MPEG audio frame header is 4 bytes long. Here's a run down of the fields, and what they mean.
AAAAAAAA AAABBCCD EEEEFFGH IIJJKLMM
A - 11 bits - Sync
These bits are all set. They're refered to as the sync bits, since you know you've found a frame header when you find 11 bits in a row that are all on.

B - 2 bits - MPEG Version
The value of these bits tell you what version of MPEG you're dealing with:
00 - MPEG version 2.5
01 - reserved (meaningless right now)
10 - MPEG version 2
11 - MPEG version 1

C - 2 bits - MPEG Layer
The value of these bits tells you what layer the audio data uses. Decoded as such:
00 - reserved (meaningless right now)
01 - Layer 3
10 - Layer 2
11 - Layer 1

D - 1 bit - Protected
If this bit is 0, the audio frame is protected by a 2 byte CRC checksum that follows the frame header.

E - 4 bits - Bit Rate
These bits, along with the MPEG version and layer, tell you the bit rate of the audio stream(in kbps). "Free" means it has a variable bit rate. "Bad" means the value is not allowed.
bits   V1-L1   V1-L2   V1-L3   V2-L1   V2-L2/L3
0000   free     free    free    free     free
0001    32       32      32      32       8
0010    64       48      40      48      16
0011    96       56      48      56      24
0100   128       64      56      64      32
0101   160       80      64      80      40
0110   192       96      80      96      48
0111   224      112      96     112      56
1000   256      128     112     128      64
1001   288      160     128     144      80
1010   320      192     160     160      96
1011   352      224     192     176     112
1100   384      256     224     192     128
1101   416      320     256     224     144
1110   448      384     320     256     160
1111   bad      bad     bad     bad     bad
F - 2 bits - Sampling Rate
These 2 bits, combined with the MPEG version, determine the sampling rate in Hz as follows:
bits    MPEG1    MPEG2    MPEG2.5
00      44100    22050     11025
01      48000    24000     12000
10      32000    16000      8000
11    reserved  reserved  reserved
G - 1 bit - Padding
If this bit is set, the frame is padded with one extra slot, otherwise the frame is not padded.

H - 1 bit - Private
As near as I can tell, players and encoders can use this bit for whatever they like. Just ignore it.

I - 2 bits - Channel Mode
These 2 bits determine what channels the audio uses as follows:
00 - Stereo
01 - Joint Stereo
10 - Dual Channel
11 - Mono Channel

J - 2 bits - Mode Extension
An extension to the channel mode setting, only used if the channel mode is joint stereo.
bits  Intensity Stereo   MS Stereo
00         off             off
01          on             off
10         off              on
11          on              on
K - 1 bit - Copyright
If this bit is 1, the audio data is copyrighted. Otherwise it's not. Well, in theory at least...

L - 1 bit - Original
If this bit is 1, it is the original media. Otherwise, it is a copy.

M - 2 bits - Emphasis
These 2 bits determine the audio emphasis.
00 - None
01 - 50/15 ms
10 - reserved
11 - CCIT J.17

Here's a quick example:
11111111 11111011 10010010 00000100
This frame would be MPEG 1, Layer 3(B is 11, and C is 01). The frame lacks a CRC checksum(D is 1). It has a bit rate of 128 and a sampling rate of 44100(E is 1001 and F is 00). The frame is padded(G is 1). It's channel mode is Stereo(I is 00 and J is 00). It's an original copy that is not copyrighted(K is 0 and L is 1). It has no emphasis(M is 00).


printable version
chaos

How to screw with people's heads at the mall Editor Log: February 2001 mpeg audio layer III MP3 Compression Code
Nintendo Sound Format Record company MPEG MP3
CRC software patent sampling rate bit rate
Ex Falso Quodlibet protected Hz program
Xing emphasis
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help


cooled by Rancid_Pickle

Cool Staff Picks
Things you could have written:
On Climbing in Nanjing to the Terrace of Phoenixes
Why do some people enjoy being in nature?
liquor
Romantic Period Music
Frame Breaking Act
Et tu, Brute?
Martial law baby
XML
Clement Attlee
Designing a Fantasy World
May 24, 2006
paisley underground
I pray to God I can find the other sock
New Writeups
locke baron
The fall of Earth(fiction)
BookReader
Fear the Cold(dream)
Pavlovna
Kathleen MacInnes(person)
stainedglass
1(fiction)
kalen
Three "T"s(idea)
octillion369
Undead(idea)
archiewood
Ico(fiction)
Heisenberg
Why I love Everything2(log)
octillion369
Death Knight(person)
XWiz
Are you hoping for a miracle?(review)
santo
The Host(review)
LostPsion
"Shut the Fuck Up" Theaters(idea)
beatrice
You've been slowly taking me over for nearly a year, do you know that?(idea)
Berek
YouTube(thing)
shaogo
How to Pretend to Have a Job(idea)
Everything 2 is brought to you by the letter C and The Everything Development Company