## MPEG-1 Packetized Elementary Stream Headers

Depending on the Stream ID, a Packetized Elementary Stream (PES) header may contain various components.
Note: MPEG-1 PES headers are not used in DVD

### The header

byte 0 | byte 1 | byte 2 | byte 3 | byte 4 | byte 5
--- | --- | --- | --- | --- | ---
0000 0000 0000 0000 0000 0001 Start code | Stream ID | PES packet length

Stream ID's which pertain to DVD

Stream ID | Stream type | extension present?
--- | --- | ---
1011 1101 0xBD | Private stream 1 | Yes
1011 1110 0xBE | Padding stream | No
1011 1111 0xBF | Private stream 2 | No
110x xxxx 0xC0 - 0xDF | MPEG-1 audio stream number x xxxx | Yes
1110 xxxx 0xE0 - 0xEF | MPEG-1 video stream number xxxx | Yes

### The extension

The extension contains optional STD buffer size followed by optional PTS/DTS. If neither is present byte 6 contains 0x0f

STD buffer size field

byte 6 | byte 7
--- | ---
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
01 | P-STD buffer scale 0 = 128 bytes 1 = 1024 bytes | P-STD buffer size

PTS DTS field(s):
PTS only

7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
0010 | PTS 32..30 | 1 | PTS 29..15 | 1 | PTS 14..00 | 1

PTS and DTS

7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
0011 | PTS 32..30 | 1 | PTS 29..15 | 1 | PTS 14..00 | 1
0001 | DTS 32..30 | 1 | DTS 29..15 | 1 | DTS 14..00 | 1

presentation and decoder time stamps use the 90KHz clock (SCR / 300)

### The rest of the packet

Following all the extension data is the payload.
In the case of private streams the first byte of the payload is the sub-stream number.

DVD-Video info home | Copyright © 2001 - 2020 STN Software, all rights reserved.