Every extension starts with the start code 00 00 01 B5 and a 4-bit
identifier. MPEG-2 adds these to the MPEG-1 syntax, and their presence is what marks a
stream as MPEG-2.
Extension identifiers
| Value | Extension |
|---|---|
| 1 | Sequence extension |
| 2 | Sequence display extension |
| 3 | Quant matrix extension |
| 4 | Copyright extension |
| 5 | Sequence scalable extension |
| 7 | Picture display extension |
| 8 | Picture coding extension |
| 9 | Picture spatial scalable extension |
| 10 | Picture temporal scalable extension |
| 11 | Camera parameters extension |
| 12 | ITU-T extension |
The field lists of extensions 11 and 12 could not be confirmed from public sources and are not given here.
Sequence extension
Identifier 1, directly after the sequence header. Bits follow the 4-bit identifier.
| Bits | Name | Description |
|---|---|---|
| 8 | profile_and_level_indication | see profiles and levels |
| 1 | progressive_sequence | 1 if every frame is progressive |
| 2 | chroma_format | see the table below |
| 2 | horizontal_size_extension | top 2 bits of the width |
| 2 | vertical_size_extension | top 2 bits of the height |
| 12 | bit_rate_extension | top 12 bits of the bit rate |
| 1 | marker_bit | 1 |
| 8 | vbv_buffer_size_extension | top 8 bits of the buffer size |
| 1 | low_delay | 1 if there are no B pictures and big frames may underflow the buffer |
| 2 | frame_rate_extension_n | frame rate numerator minus 1 |
| 5 | frame_rate_extension_d | frame rate denominator minus 1 |
| chroma_format | Meaning |
|---|---|
| 0 | reserved |
| 1 | 4:2:0 |
| 2 | 4:2:2 |
| 3 | 4:4:4 |
Profiles and levels
profile_and_level_indication is one escape bit, then 3 bits of profile,
then 4 bits of level. With the escape bit clear:
| Profile bits | Profile | Chroma | Picture types |
|---|---|---|---|
| 1 | High | 4:2:0, 4:2:2 | I, P, B |
| 2 | Spatially Scalable | 4:2:0 | I, P, B |
| 3 | SNR Scalable | 4:2:0 | I, P, B |
| 4 | Main | 4:2:0 | I, P, B |
| 5 | Simple | 4:2:0 | I, P |
| Level bits | Level | Max size | Max rates | Max bit rate |
|---|---|---|---|---|
| 10 | Low | 352 × 288 | up to 30 Hz | 4 Mbit/s |
| 8 | Main | 720 × 576 | up to 30 Hz | 15 Mbit/s |
| 6 | High 1440 | 1440 × 1152 | up to 60 Hz | 60 Mbit/s |
| 4 | High | 1920 × 1152 | up to 60 Hz | 80 Mbit/s |
| 2 | High Progressive (from the 2010 amendment) |
With the escape bit set the whole byte is one code:
| Byte | Meaning |
|---|---|
| 0x82 | 4:2:2 profile at High level |
| 0x85 | 4:2:2 profile at Main level |
The escape range also carries Multi-view profile codes, whose exact values could not be confirmed from public sources.
Sequence display extension
Identifier 2.
| Bits | Name | Description |
|---|---|---|
| 3 | video_format | the source: see below |
| 1 | colour_description | 1 if the three colour fields follow |
| 8 + 8 + 8 | colour_primaries, transfer_characteristics, matrix_coefficients | only if colour_description is 1; see below |
| 14 | display_horizontal_size | the width of the area to show |
| 1 | marker_bit | 1 |
| 14 | display_vertical_size | the height of the area to show |
| video_format | Meaning |
|---|---|
| 0 | component |
| 1 | PAL |
| 2 | NTSC |
| 3 | SECAM |
| 4 | MAC |
| 5 | unspecified |
| 6, 7 | reserved |
| Code | colour_primaries | transfer_characteristics | matrix_coefficients |
|---|---|---|---|
| 0 | forbidden | forbidden | forbidden |
| 1 | BT.709 | BT.709 | BT.709 |
| 2 | unspecified | unspecified | unspecified |
| 3 | reserved | reserved | reserved |
| 4 | BT.470 System M | BT.470 System M (gamma 2.2) | FCC |
| 5 | BT.470 System B, G | BT.470 System B, G (gamma 2.8) | BT.470 System B, G |
| 6 | SMPTE 170M | SMPTE 170M | SMPTE 170M |
| 7 | SMPTE 240M | SMPTE 240M | SMPTE 240M |
| 8 | generic film | linear | reserved |
FFmpeg’s parser treats a coded 0 as 2 (unspecified), and when
colour_description is 0 it assumes 2 for all three. Later codes defined for
H.264 onwards are not part of H.262; this table lists the common values and could not be
read directly from the standard.
Quant matrix extension
Identifier 3. Each load flag is 1 bit, followed by 64 bytes in zig-zag order when set.
| Bits | Name |
|---|---|
| 1, then 8 × 64 | load_intra_quantiser_matrix, intra_quantiser_matrix |
| 1, then 8 × 64 | load_non_intra_quantiser_matrix, non_intra_quantiser_matrix |
| 1, then 8 × 64 | load_chroma_intra_quantiser_matrix, chroma_intra_quantiser_matrix |
| 1, then 8 × 64 | load_chroma_non_intra_quantiser_matrix, chroma_non_intra_quantiser_matrix |
Copyright extension
Identifier 4.
| Bits | Name | Description |
|---|---|---|
| 1 | copyright_flag | 1 if the following video is copyrighted |
| 8 | copyright_identifier | identifies the registration authority |
| 1 | original_or_copy | 1 for an original, 0 for a copy |
| 7 | reserved | |
| 1 | marker_bit | 1 |
| 20 | copyright_number_1 | first part of the copyright number |
| 1 | marker_bit | 1 |
| 22 | copyright_number_2 | second part |
| 1 | marker_bit | 1 |
| 22 | copyright_number_3 | third part |
Sequence scalable extension
Identifier 5.
| Bits | Name | Condition | Description |
|---|---|---|---|
| 2 | scalable_mode | 0 data partitioning, 1 spatial, 2 SNR, 3 temporal | |
| 4 | layer_id | this layer’s number | |
| 14 | lower_layer_prediction_horizontal_size | mode 1 | |
| 1 | marker_bit | mode 1 | 1 |
| 14 | lower_layer_prediction_vertical_size | mode 1 | |
| 5 | horizontal_subsampling_factor_m | mode 1 | |
| 5 | horizontal_subsampling_factor_n | mode 1 | |
| 5 | vertical_subsampling_factor_m | mode 1 | |
| 5 | vertical_subsampling_factor_n | mode 1 | |
| 1 | picture_mux_enable | mode 3 | |
| 1 | mux_to_progressive_sequence | mode 3 and mux enabled | |
| 3 | picture_mux_order | mode 3 | |
| 3 | picture_mux_factor | mode 3 |
Picture display extension
Identifier 7. For each of 1 to 3 frame centre offsets, as decided by the picture coding extension:
| Bits | Name | Description |
|---|---|---|
| 16 | frame_centre_horizontal_offset | signed offset from the coded centre |
| 1 | marker_bit | 1 |
| 16 | frame_centre_vertical_offset | signed offset |
| 1 | marker_bit | 1 |
Picture coding extension
Identifier 8, following every picture header.
| Bits | Name | Description |
|---|---|---|
| 4 × 4 | f_code[0][0], f_code[0][1], f_code[1][0], f_code[1][1] | motion vector ranges: forward and backward, horizontal and vertical. 15 means not used |
| 2 | intra_dc_precision | 0 to 3 for 8 to 11 bits |
| 2 | picture_structure | 1 top field, 2 bottom field, 3 frame; 0 reserved |
| 1 | top_field_first | in a frame picture, 1 if the top field comes first |
| 1 | frame_pred_frame_dct | 1 means frame prediction and frame DCT only |
| 1 | concealment_motion_vectors | 1 if intra macroblocks carry motion vectors for hiding errors |
| 1 | q_scale_type | which quantiser scale table is used |
| 1 | intra_vlc_format | which variable-length table intra blocks use |
| 1 | alternate_scan | 1 for the alternate scan order instead of zig-zag |
| 1 | repeat_first_field | 1 if the first field is shown again (3:2 pulldown) |
| 1 | chroma_420_type | 1 if the 4:2:0 chroma was subsampled over the frame rather than field by field |
| 1 | progressive_frame | 1 if the two fields were sampled at the same time |
| 1 | composite_display_flag | 1 if the five fields below follow, for material from an analogue composite source |
| 1 | v_axis | |
| 3 | field_sequence | |
| 1 | sub_carrier | |
| 7 | burst_amplitude | |
| 8 | sub_carrier_phase |
The field picture_structure has four possible values and only three used.
The number of frame centre offsets in a picture display extension comes from this
extension and the sequence: one for field pictures or a progressive sequence, otherwise
one, two or three depending on repeat_first_field, progressive_frame
and top_field_first.
Picture spatial scalable extension
Identifier 9.
| Bits | Name |
|---|---|
| 10 | lower_layer_temporal_reference |
| 1 | marker_bit |
| 15 | lower_layer_horizontal_offset |
| 1 | marker_bit |
| 15 | lower_layer_vertical_offset |
| 2 | spatial_temporal_weight_code_table_index |
| 1 | lower_layer_progressive_frame |
| 1 | lower_layer_deinterlaced_field_select |
Picture temporal scalable extension
Identifier 10. The reference decoder does not implement temporal scalability, and the
field list of this extension could not be confirmed from a public source. It is usually
given as reference_select_code (2 bits), forward_temporal_reference
(10 bits), a marker bit and backward_temporal_reference (10 bits).