All numbers are big-endian. The MPEG-2 pack header below is checked against the DVD-Video information pages. The MPEG-1 pack, the system header and the program stream map come from memory of ISO/IEC 11172-1 and ITU-T H.222.0, because those texts are PDFs and were not opened.
MPEG-2 pack header
| Bits | Name | Meaning |
|---|---|---|
| 32 | pack_start_code | 00 00 01 BA. |
| 2 | marker | 01. |
| 3 | SCR[32..30] | System clock reference base. |
| 1 | marker | 1. |
| 15 | SCR[29..15] | |
| 1 | marker | 1. |
| 15 | SCR[14..0] | |
| 1 | marker | 1. |
| 9 | SCR_extension | The 27 MHz clock divided by 300 gives the 33-bit base and this 9-bit extension. |
| 1 | marker | 1. |
| 22 | program_mux_rate | In units of 50 bytes per second. Zero is forbidden. |
| 2 | marker | Two 1 bits. |
| 5 | reserved | |
| 3 | pack_stuffing_length | Number of stuffing bytes that follow. |
| 0 to 7 bytes | stuffing | FF; discarded. |
The fixed part is 14 bytes. A system header follows if the next start code is
00 00 01 BB.
MPEG-1 pack header
| Bits | Name | Meaning |
|---|---|---|
| 32 | pack_start_code | 00 00 01 BA. |
| 4 | marker | 0010. These bits distinguish MPEG-1 from MPEG-2. |
| 3 | SCR[32..30] | |
| 1 | marker | 1. |
| 15 | SCR[29..15] | |
| 1 | marker | 1. |
| 15 | SCR[14..0] | |
| 1 | marker | 1. |
| 1 | marker | 1. |
| 22 | mux_rate | In units of 50 bytes per second. |
| 1 | marker | 1. |
The total is 12 bytes. The difference is seen in the two bits after the start code:
00 for MPEG-1 and 01 for MPEG-2.
System header
| Bits | Name | Meaning |
|---|---|---|
| 32 | system_header_start_code | 00 00 01 BB. |
| 16 | header_length | Bytes after this field. |
| 1 | marker | 1. |
| 22 | rate_bound | Upper bound of the mux rate. |
| 1 | marker | 1. |
| 6 | audio_bound | Upper bound of active audio streams. |
| 1 | fixed_flag | 1 if the bit rate is fixed. |
| 1 | CSPS_flag | 1 if the stream is a constrained system parameter stream. |
| 1 | system_audio_lock_flag | Audio locked to the system clock. |
| 1 | system_video_lock_flag | Video locked to the system clock. |
| 1 | marker | 1. |
| 5 | video_bound | Upper bound of active video streams. |
| 1 | packet_rate_restriction_flag | MPEG-2 only; reserved in MPEG-1. |
| 7 | reserved | |
| Repeated while the next bit is 1: | ||
| 8 | stream_id | The stream, or B8 / B9 for all audio or all video. |
| 2 | marker | 11. |
| 1 | P-STD_buffer_bound_scale | 0 for audio (units of 128 bytes), 1 for video (1024 bytes). |
| 13 | P-STD_buffer_size_bound | Decoder buffer bound. |
Program stream map
MPEG-2 only, stream ID BC. It says what the streams are.
| Bits | Name | Meaning |
|---|---|---|
| 24 | start code prefix | 00 00 01. |
| 8 | map_stream_id | BC. |
| 16 | program_stream_map_length | Bytes after this field. |
| 1 | current_next_indicator | 1 if the map is current. |
| 2 | reserved | |
| 5 | program_stream_map_version | Changes when the map changes. |
| 7 | reserved | |
| 1 | marker | 1. |
| 16 | program_stream_info_length | Bytes of descriptors. |
| n | descriptors | |
| 16 | elementary_stream_map_length | Bytes of the following stream entries. |
| Each stream: | ||
| 8 | stream_type | As in the transport stream table. |
| 8 | elementary_stream_id | The stream ID. |
| 16 | elementary_stream_info_length | Bytes of descriptors. |
| n | descriptors | |
| 32 | CRC_32 | At the end of the map. |
A program stream directory, stream ID FF, also exists; its layout is in
H.222.0 and is not given here.
End code
00 00 01 B9 ends the program stream.