MPEG Headers Quick Reference

This is a quick reference to the various headers and streams found in MPEG/DVD. For a complete description you should get a copy of ISO/IEC 13818.
This is an incomplete work-in-progress

The header

Every stream or table begins with a 32-bit start code, codes 00 through B8 are video stream start codes (fully defined in 13818-2), and codes B9-FF are stream-id's
byte 0byte 1byte 2byte 3
0000 0000 0000 0000 0000 0001
Start code prefix
Start Code
-or-
Stream ID
Start Codeused for
0x00Picture
0x01 - 0xAFslice
0xB0reserved
0xB1reserved
0xB2user data
0xB3Sequence header
0xB4sequence error
0xB5extension
0xB6reserved
0xB7sequence end
0xB8Group of Pictures
Stream IDused for
0xB9Program end (terminates a program stream)
0xBAPack header
0xBBSystem Header
0xBCProgram Stream Map
0xBDPrivate stream 1
0xBEPadding stream
0xBFPrivate stream 2
0xC0 - 0xDFMPEG-1 or MPEG-2 audio stream
0xE0 - 0xEFMPEG-1 or MPEG-2 video stream
0xF0ECM Stream
0xF1EMM Stream
0xF2ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Annex A or ISO/IEC 13818-6_DSMCC_stream
0xF3ISO/IEC_13522_stream
0xF4ITU-T Rec. H.222.1 type A
0xF5ITU-T Rec. H.222.1 type B
0xF6ITU-T Rec. H.222.1 type C
0xF7ITU-T Rec. H.222.1 type D
0xF8ITU-T Rec. H.222.1 type E
0xF9ancillary_stream
0xFA - 0xFEreserved
0xFFProgram Stream Directory

Picture header (0100)

Variable length.
byte 4byte 5 byte 6byte 7
76543210 76543210 76543210 76543210
temporal sequence number frame type
1=I, 2=P
3=B, 4=D
VBV delay ---

additional fields appended beginning at byte 7 bit 2:
If frame type = 2 (P) or 3 (B) the following 4 bits are appended to the header:
3210
full_pel_forward_vectorforward_f_code
This field is used by MPEG-1 only, for MPEG-2 it should be set to 0 1 1 1

If frame type = 3 (B) the following 4 bits are appended to the header:
3210
full_pel_backward_vectorbackward_f_code
This field is used by MPEG-1 only, for MPEG-2 it should be set to 0 1 1 1

additionally if the next bit is "1" (extra_bit_picture) it is followed by 8 bits of "extra" data (discarded by decoders). This continues until a "0" bit is encountered.


Sequence header (01B3)

Variable length.
byte 4byte 5 byte 6byte 7
76543210 76543210 76543210 76543210
horizontal size vertical size aspect ratio frame rate
byte 8byte 9 byte 10byte 11
76543210 76543210 76543210 76543210
bit rate 1 VBV buffer size constrained parameters flag load intra quantiser matrix (load non-intra quantiser matrix)
If either load quantiser matrix flag is =1, it is immediately followed by the 64 byte table (moving the "load non-intra quantiser matrix" flag, in the case of "load intra quantiser matrix")
CodeMPEG-1 Aspect Ratio (PAR)
height / width
MPEG-2 Aspect Ratio (DAR)Frame Rate
0forbiddenforbiddenforbidden
11.0000SAR 1:1 (Square Samples)24000/1001 (23.976)
20.67354:324
30.7031 PAL 16:916:925
40.76152.21:130000/1001 (29.97)
50.8055reserved30
60.8437 NTSC 16:9reserved50
70.8935reserved60000/1001 (59.94)
80.9375 PAL 4:3reserved60
90.9815reservedreserved
101.0255reservedreserved
111.0695reservedreserved
121.1250 NTSC 4:3reservedreserved
131.1575reservedreserved
141.2015reservedreserved
15reservedreservedreserved

extension header (01B5)

There are a variety of extensions, denoted by the first 4 bits.

Sequence_Extension

Fixed length.
byte 4byte 5 byte 6byte 7 byte 8byte 9
76543210 76543210 76543210 76543210 76543210 76543210
0001 profile and level progressive_sequence chroma_format horizontal size extension vertical size extension bit rate extension 1 vbv buffer size extension low delay frame rate extension n frame rate extension d

Sequence_Display_Extension

Variable length.
With no color description information, the last 3 bits of byte 8 are not part of this table.
byte 4byte 5 byte 6byte 7 byte 8
76543210 76543210 76543210 76543210 76543210
0010 video format color description flag =0 display horizontal size 1 display vertical size  

With color description information, the last 3 bits of byte 11 are not part of this table.
byte 4byte 5 byte 6byte 7 byte 8byte 9 byte 10byte 11
76543210 76543210 76543210 76543210 76543210 76543210 76543210 76543210
0010 video format color description flag =1 color primaries transfer characteristics matrix coefficients display horizontal size 1 display vertical size  

Picture_Display_Extension

Variable length, depending on number of offsets encoded (see section 6.3.12 of ISO/IEC 13818-2).
For a single offset (the last 2 bits of byte 8 are not part of this table).
byte 4byte 5 byte 6byte 7 byte 8
76543210 76543210 76543210 76543210 76543210
0111 frame_center_horizontal_offset[1] 1 frame_center_vertical_offset[1] 1  

For two offsets.
byte 4byte 5 byte 6byte 7 byte 8byte 9 byte 10byte 11 byte 12
76543210 76543210 76543210 76543210 76543210 76543210 76543210 76543210 76543210
0111 frame_center_horizontal_offset[1] 1 frame_center_vertical_offset[1] 1 frame_center_horizontal_offset[2] 1 frame_center_vertical_offset[2] 1

For three offsets (the maximum, the last 6 bits of byte 17 are not part of this table).
byte 4byte 5 byte 6byte 7 byte 8byte 9 byte 10byte 11 byte 12byte 13 byte 14byte 15 byte 16byte 17
76543210 76543210 76543210 76543210 76543210 76543210 76543210 76543210 76543210 76543210 76543210 76543210 76543210 76543210
0111 frame_center_horizontal_offset[1] 1 frame_center_vertical_offset[1] 1 frame_center_horizontal_offset[2] 1 frame_center_vertical_offset[2] 1 frame_center_horizontal_offset[3] 1 frame_center_vertical_offset[3] 1  

Picture_Coding_Extension

Variable length.
byte 4byte 5 byte 6
76543210 76543210 76543210
1000 f_code[0][0] (forward horizontal) f_code[0][1] (forward vertical) f_code[1][0] (backward horizontal) f_code[1][1] (backward vertical) intra_DC_precision picture_structure
byte 7
76543210
Top_Field_First frame_pred_frame_dct concealment_motion_vectors q_scale_type intra_vlc_format alternate_scan Repeat_First_Field chroma_420_type
byte 8byte 9 byte 10
76543210 76543210 76543210
progressive_frame composite_display =0 0 0 0 0 0 0
(not present)
=1 v_axis field_sequence sub_carrier burst_amplitude sub_carrier_phase 0 0

Group Of Pictures (GOP) (01B8)

Fixed length, contains 3 flags and the time stamp for the first frame.
byte 4byte 5 byte 6byte 7
76543210 76543210 76543210 76543210
drop frame flag hour (0-23) minute (0-59) 1 second (0-59) frame (0-59) closed GOP broken GOP 0 0 0 0 0
DVD-Video info home Copyright © 2001 - 2024 MPUCoder, all rights reserved.