Pack Header
byte 0 | byte 1 | byte 2 | byte 3 | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 |
0000 0000 0000 0000 0000 0001 start code |
1011 1010 PACK identifier |
byte 4 | byte 5 | byte 6 | byte 7 | byte 8 | byte 9 | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
01 | SCR 32..30 | 1 | SCR 29..15 | 1 | SCR 14..00 | 1 | SCR_ext | 1 |
byte 10 | byte 11 | byte 12 | byte 13 | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 |
Program_Mux_Rate | 1 | 1 | reserved | pack_stuffing_length |
PACK identifier -- 0xBA
- SCR and SCR_ext together are the System Clock Reference, a counter driven at 27MHz, used as a reference to synchronize streams. The clock is divided by 300 (to match the 90KHz clocks such as PTS/DTS), the quotient is SCR (33 bits), the remainder is SCR_ext (9 bits)
- Program_Mux_Rate -- This is a 22 bit integer specifying the rate at which the program stream target decoder receives the Program Stream during the pack in which it is included. The value of program_mux_rate is measured in units of 50 bytes/second. The value 0 is forbidden.
- pack_stuffing_length -- A 3 bit integer specifying the number of stuffing bytes which follow this field.
- stuffing byte -- This is a fixed 8-bit value equal to '1111 1111' that can be inserted by the encoder, for example to meet the requirements of the channel. It is discarded by the decoder.
Packetized Elementary Stream Headers
Depending on the Stream ID, a Packetized Elementary Stream (PES) header may contain various components.
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 (non MPEG audio, subpictures) | Yes |
1011 1110 0xBE |
Padding stream | No |
1011 1111 0xBF |
Private stream 2 (navigation data) | No |
110x xxxx 0xC0 - 0xDF |
MPEG-1 or MPEG-2 audio stream number x xxxx note: DVD allows only 8 audio streams |
Yes |
1110 xxxx 0xE0 - 0xEF |
MPEG-1 or MPEG-2 video stream number xxxx note: DVD allows only 1 video stream |
Yes |
The extension
byte 6 | byte 7 | byte 8 | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
10 | PES scrambling control | PES priority | data alignment indicator | copyright | original or copy | PTS DTS flags | ESCR flag | ES rate flag | DSM trick mode flag | additional copy info flag | PES CRC flag | PES extension flag | PES header data length |
The bit fields of the basic extension:
PES scrambling control -- 00 = not scrambled, others are user defined.
PES priority -- provides 2 priority levels, 0 and 1.
data alignment indicator -- if set to 1 indicates that the PES packet header is immediately followed by the video start code or audio syncword.
copyright -- 1 = packet contains copyrighted material.
original or copy -- 1 = original, 0 = copy.
PTS DTS flags -- Presentation Time Stamp / Decode Time Stamp. 00 = no PTS or DTS data present, 01 is forbidden.
if set to 10 the following data is appended to the header data field:
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 |
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 |
ESCR -- if set to 1 the following data is appended to the header data field:
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 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
00 | ESCR base 32..30 | 1 | ESCR base 29..15 | 1 | ESCR base 14..00 | 1 | ESCR ext | 1 |
ES rate -- if set to 1 the following data is appended to the header data field:
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | ES rate | 1 |
DSM trick mode - not used by DVD
additional copy info -- if set to 1 the following data is appended to the header data field:
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|
1 | additional copy info |
PES CRC flag -- if set to 1 the following data is appended to the header data field:
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
previous PES packet CRC |
PES extension flag -- if set to 1 the following data is appended to the header data field:
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|
PES private data flag | pack header field flag | program packet sequence counter flag | P-STD buffer flag | 111 | PES extension flag 2 |
PES private data flag -- if set to 1 16 bytes of user defined data is appended to the header data field.
pack header field flag -- if set to 1 the 8-bit pack field length value is appended to the header data field.
program packet sequence counter flag -- if set to 1 the following data is appended to the header data field:
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | packet sequence counter | 1 | MPEG1_MPEG2 identifier | original stuffing length |
P-STD buffer flag -- if set to 1 the following data is appended to the header data field:
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 |
PES extension flag 2 -- if set to 1 the following data is appended to the header data field:
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | PES extension field length | reserved |
The rest of the packet
Following all the extension data are optional stuffing bytes (0xFF), which are included in the header data length, and then the payload.
In the case of private streams the first byte of the payload is the sub-stream number.
參考來源
http://dvd.sourceforge.net/dvdinfo/packhdr.html
http://dvd.sourceforge.net/dvdinfo/pes-hdr.html
留言列表