***************************************
* ISO/IEC 11172(MPEG-1)/13818(MPEG-2) *
* MPEG Bit Stream Quick Reference *
***************************************
- values use big endian (network) byte/bit order
- general terms: integer = signed value
- general values: byte = 8-bit value; short/word = 16-bit value; long = 32-bit value
- fixed point values: value made up of an integer for whole numbers and an unsigned value for the decimal
- octal values: base-8 long unsigned values (values containing 8 and 9 are invalid)
FILE INFO
System Multiplex v1 Suffixes = ".m1s", ".mpeg", ".mpg", ".mpgx", ".mpm"
System Multiplex v2 Suffixes = ".m2s", ".mpeg", ".mpg", ".mpgx", ".mpm"
Elementary Video v1 Suffixes = ".m1v", ".mpgv", ".mpv", ".m75", ".m15"
Elementary Video v2 Suffixes = ".m2v", ".mpgv", ".mpv"
Elementary Audio v1 Suffixes = ".m1a", ".mpga", ".mpa"
Elementary Audio v2 Suffixes = ".m2a", ".mpga", ".mpa"
Elementary Audio Compression layer/level Suffixes = ".mpa", ".mp2", ".mp3"
System Multiplex or Elementary Video v1 MIME="video/mpeg"
System Multiplex or Elementary Video v2 MIME="video/mpeg2"
Elementary Audio MIME="audio/mpeg"
System Multiplex or Elementary Video/Audio Mac OS Type = "MPEG"
Elementary Audio layer/level III Mac OS Type = "MPG3"; QuickTime Mac OS Creator = "TVOD"
Developed for the compressing of moving pictures and associated audio and then the
combining of one or more elementary streams of video and audio, as well as, other
data into single or multiple streams which are suitable for storage or
transmission. This is specified in two forms: the Program Stream and the
Transport Stream. Each is optimised for a different set of applications such as
ATM networks, Video CDs, DBS, C-Band, SD-TV, HD-TV, DVD, etc.
ISO/IEC 11172-2 supports a maximum bit rate of 1.5 Mbits/sec (187.5 kB/sec).
ISO/IEC 13818-2 levels support bit rates from 3 Mbits/sec (375 kB/sec)
to 15 Mbits/sec (1.875 MB/sec).
ISO/IEC 14496-2 (MPEG-4 video) supports scalable bit rates from 10 kbits/sec (1.25 kB/sec)
to 6 Mbits/sec (750 kB/sec).
ISO/IEC 11172-1/13818-1 SYSTEM MULTIPLEX PROGRAM/TRANSPORT PACKETS/BLOCKS AND HEADER
- NOTE: a transport system multiplex retransmits header info more frequently for recovery
from data loss. Program streams are stored streams so this isn't necessary.
-> 4 bytes pack header start code = long hex value of 0x000001BA
-> 8 bits v1 pack header = byte clock and multiplex pack rate bit info
OR
-> 12 bits v2 pack header = 1 1/2 bytes clock and multiplex pack rate with extension bit info
- NOTE: pack header appears more than once
-> 4 bytes system header start code = long hex value of 0x000001BB
-> 16 bits packetized elementary stream length = short unsigned size of start code packet/block
-> variable bits system header = multiplex system bit info
- NOTE: only one system header per file bit stream
-> 4 bytes optional stream gap identifier = long hex value of 0x00000000
-> 10 bits stream gap = 1 1/4 bytes padding set to zero
- NOTE: can appear more than once or not at all
-> 4 bytes optional padding packet/block start code = long hex value of 0x000001BE
-> 16 bits packetized elementary stream length = short unsigned size of start code packet/block
-> variable bits padding = multiplex padding bits set to 1
- NOTE: can appear more than once or not at all
-> 4 bytes optional private 1 packet/block start code = long hex value of 0x000001BD
-> 16 bits packetized elementary stream length = short unsigned size of start code packet/block
-> 96 bits MPEG-1 PES header = 12 bytes PES bit info
OR
-> 24 - 392 bits MPEG-2 PES header = short PES bit info + byte unsigned PES header size + optional PES timecode/info
-> variable bits video sub-pictures = video sub-pictures bit data
-> 4 bytes optional private 2 packet/block start code = long hex value of 0x000001BF
-> 16 bits packetized elementary stream length = short unsigned size of start code packet/block
-> variable bits navigation = audio/video navigation bit info
-> 4 bytes optional audio 0 - 31 packet/block start code = long hex value of 0x000001C0 - 0x000001DF
-> 16 bits packetized elementary stream length = short unsigned size of start code packet/block
-> 96 bits MPEG-1 PES header = 12 bytes PES bit info
OR
-> 24 - 392 bits MPEG-2 PES header = short PES bit info + byte unsigned PES header size + optional PES timecode/info
-> variable bits elementary audio payload = elementary audio packets
- NOTE: audio packets/blocks appear more than once. DVD uses only audio 0 - 7 packets/blocks.
-> 4 bytes optional video 0 - 15 packet/block start code = long hex value of 0x000001E0 - 0x000001EF
-> 16 bits packetized elementary stream length = short unsigneed size of start code packet/block
-> 96 bits MPEG-1 PES header = 12 bytes PES bit info
OR
-> 24 - 392 bits MPEG-2 PES header = short PES bit info + byte unsigned PES header size + optional PES timecode/info
-> variable bits elementary video payload = elementary video header + other video start codes
- NOTE: video packets/blocks appear more than once. VCD/DVD uses only video 0 packets/blocks.
- NOTE: generally one packet/block contains at least one frame of video.
-> 4 bytes stream end start code = long hex value of 0x000001B9
- NOTE: only one stream end to terminate file bit stream
ISO/IEC 11172-2/13818-2 ELEMENTARY VIDEO HEADER
-> 4 bytes video sequence start code = long hex value of 0x000001B3
-> 12 bits horizontal pixels = 1 1/2 bytes unsigned video size
-> 12 bits vertical pixels = 1 1/2 bytes unsigned video size
-> 4 bits pixel aspect ratio = 1/2 byte unsigned aspect type
- v1 types are Reserved = 0; 1:1 = 1; 0.6735 = 2; 0.7031 = 3
- v1 types are 0.7615 = 4; 0.8055 = 5; 0.8437 = 6; 0.8935 = 7
- v1 types are 54:59 PAL = 8; 0.9815 = 9; 1.0255 = 10; 1.0695 = 11
- v1 types are 11:10 NTSC = 12; 1.1575 = 13; 1.2015 = 14; Reserved = 15
- v2 types are Reserved = 0; 1:1 = 1; 4:3 = 2; 16:9 = 3; 2.2:1 = 4
- v2 types are Reserved or v1 type = 5 - 15
-> 4 bits frame rate = 1/2 byte unsigned fps type
- types are Reserved = 0; 23.976 frames/sec = 1; 24 frames/sec = 2
- types are 25 frames/sec = 3; 29.97 frames/sec = 4; 30 frames/sec = 5
- types are 50 frames/sec = 6; 59.94 frames/sec = 7; 60 frames/sec = 8
- types are Reserved = 9 - 15
-> 18 bits picture rate = 2 1/4 bytes unsigned data bit rate in 400 bps units
-> 1 bit header marker flag = 1/8 byte boolean value
-> 10 bits VBV buffer size = 1 1/4 bytes unsigned decompression buffer in 16,000 byte units
-> 1 bit constrained parameter flag = 1/8 byte boolean value
-> 1 bit load intra quantizer matrix flag = 1/8 byte boolean value
-> 64 byte quantizer table - only if above is true otherwise no values
-> 1 bit load intra non quantizer matrix flag = 1/8 byte boolean value
-> 64 byte quantizer table - only if above is true otherwise no values
-> Continues with other MPEG video start codes and associated data like GOPs, slices and pictures
- NOTE: only one video header per file bit stream
ISO/IEC 11172-3/13818-3 ELEMENTARY AUDIO FRAME PACKET HEADER
-> 11 bits audio frame/packet sync marker = 1 3/8 bytes unsigned value of 2047
-> 2 bits audio version = 1/4 byte unsigned version type
- types are revision 2.5 = 0; Reserved = 1; version 2 = 2; version 1 = 3
-> 2 bits audio compression layer/level = 1/4 byte unsigned level type
- types are Reserved = 0; layer III = 1; layer II = 2; layer I = 3
-> 1 bit CRC data protection flag = 1/8 byte boolean type
- short unsigned CR check value added after header = 0; not used = 1
-> 4 bits audio packet rate/size = 1/2 bytes unsigned data bit rate type
- NOTE: L1 = layer I; L2 = layer II; L3 = layer III
- types are Reserved = 0; v1 - 32 kbps/v2 L2/3 - 8 kbps = 1
- types are v1 L1- 64kbps or v1 L2/v2 L1- 48kbps or v1 L3- 40kbps or v2 L2/3-16kbps or v2.5 L3-12kbps = 2
- types are v1 L1- 96kbps or v1 L2/v2 L1- 56kbps or v1 L3- 48kbps or v2 L2/3-24kbps or v2.5 L3-20kbps = 3
- types are v1 L1-128kbps or v1 L2/v2 L1- 64kbps or v1 L3- 56kbps or v2 L2/3-32kbps = 4
- types are v1 L1-160kbps or v1 L2/v2 L1- 80kbps or v1 L3- 64kbps or v2 L2/3-40kbps = 5
- types are v1 L1-192kbps or v1 L2/v2 L1- 96kbps or v1 L3- 80kbps or v2 L2/3-48kbps = 6
- types are v1 L1-224kbps or v1 L2/v2 L1-112kbps or v1 L3- 96kbps or v2 L2/3-56kbps = 7
- types are v1 L1-256kbps or v1 L2/v2 L1-128kbps or v1 L3-112kbps or v2 L2/3-64kbps = 8
- types are v1 L1-288kbps or v1 L2-160kbps or v1 L3-128kbps or v2 L1-144kbps or v2 L2/3-80kbps = 9
- types are v1 L1-320kbps or v1 L2-192kbps or v1 L3/v2 L1-160kbps or v2 L2/3-96kbps = 10
- types are v1 L1-352kbps or v1 L2-224kbps or v1 L3-192kbps or v2 L1-176kbps or v2 L2/3-112 kbps = 11
- types are v1 L1-384kbps or v1 L2-256kbps or v1 L3-224kbps or v2 L1-192kbps or v2 L2/3-128 kbps = 12
- types are v1 L1-416kbps or v1 L2-320kbps or v1 L3-256kbps or v2 L1-224kbps or v2 L2/v2.5 L3-144kbps = 13
- types are v1 L1-448kbps or v1 L2-384kbps or v1 L3-320kbps or v2 L1-256kbps/v2 L2/3-160kbps = 14
- types are Reserved = 15
- NOTE for L3: v1 sample rates require 64 kbps per channel; v2 sample rates require 32 kbps per channel
-> 2 bits audio sample rate = 1/4 byte unsigned rate type
- types are v1 - 44100 Hz/v2 - 22050 Hz/v2.5 - 11025 Hz = 0
- types are v1 - 48000 Hz/v2 - 24000 Hz/v2.5 - 12000 Hz = 1
- types are v1 - 32000 Hz/v2 - 16000 Hz/v2.5 - 8000 Hz = 2
- types are Reserved = 3
-> 1 bit frame/packet data padding space flag = 1/8 byte boolean type
- not used = 0; byte (L2/3) - long (L1) byte slot added at packet end = 1
-> 1 bit private flag = 1/8 byte boolean value
-> 2 bits audio channels = 1/4 byte unsigned channel type
- types are Stereo = 0; Joint Stereo = 1; Dual Monaural = 2; Monaural = 3
-> 2 bits audio joint stereo mode = 1/4 byte unsigned mode type
- types are none = 0; intensity = 1; ms = 2; intensity/ms = 3
-> 1 bit audio copyright flag = 1/8 byte boolean value
-> 1 bit audio original flag = 1/8 byte boolean value
-> 2 bits audio emphasis = 1/4 byte unsigned emphasis type
- types are none = 0; 50/15 ms = 1; Reserved = 2; CCIT J.17 = 3
-> Continues with associated compressed data/slots and possibly more MPEG audio frame packets