Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
MPEG transport stream
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Packet === A [[network packet]] is the basic unit of data in a transport stream, and a transport stream is merely a sequence of packets. Each packet starts with a [[sync byte]] and a [[Header (computing)|header]], that may be followed with optional additional headers; the rest of the packet consists of [[Payload (computing)|payload]]. All header fields are read as [[Endianness#Big-endian|big-endian]]. Packets are 188 bytes in length, but the communication medium may add additional information.{{efn|[[Forward error correction]] is added by [[ISDB]] & [[DVB]] (16 bytes) and [[ATSC]] (20 bytes),<ref>{{cite web|url=http://broadcastengineering.com/infrastructure/Atsc-transmission-digital-20050620/ |title=ATSC transmission |website=Broadcastengineering.com |date=2005-06-20 |access-date=2012-05-17}}</ref> while the [[M2TS]] format prefixes packets with a 4-byte copyright and timestamp tag.}} The 188-byte packet size was originally chosen for compatibility with [[Asynchronous Transfer Mode|Asynchronous Transfer Mode (ATM) systems]].<ref>{{cite web|url=http://mpeg.chiariglione.org/faq/mp2-sys/mp2-sys.htm#mp2-12 |title=MPEG Systems FAQ |website=Mpeg.chiariglione.org |access-date=2012-05-17}}</ref><ref>{{cite web|url=http://www.tek.com/datasheet/atsc-mpeg-transport-stream-monitor |title=ATSC MPEG Transport Stream Monitor |website=Tek.com |access-date=2012-05-17}}</ref> {|class="wikitable" |+ Partial transport stream packet format !Name !Number of bits ![[Bitmask]] ([[big-endian]]) !Description |- |colspan=4 style="text-align: center" |''4-byte Transport Stream Header'' |- |[[Sync byte]] |style="text-align:center;"|8 |style="text-align:right;"|<code>0xff000000</code> |Bit pattern of 0x47 (ASCII char 'G') |- |Transport error indicator (TEI) |style="text-align:center;"|1 |style="text-align:right;"|<code>0x800000</code> |Set when a [[demodulator]] can't correct errors from FEC data; indicating the packet is corrupt.<ref>{{cite web |url=http://www.coolstf.com/tsreader/support.html |title=TSReader |website=Coolstf.com |date=2008-04-07 |access-date=2012-05-17 |archive-url=https://web.archive.org/web/20100327060631/http://www.coolstf.com/tsreader/support.html |archive-date=27 March 2010 |url-status=dead }}</ref> |- |Payload unit start indicator (PUSI) |style="text-align:center;"|1 |style="text-align:right;"|<code>0x400000</code> |Set when this packet contains the first byte of a new payload unit. For [[Program-specific information|PSI]] packet data, the first byte of the payload will indicate where this new payload unit starts. For [[Packetized elementary stream|PES]] packet data, the new PES packet shall start at the start of the payload.<ref>{{Cite web |date=February 2000 |title=Information technology β Generic coding of moving pictures and associated audio information: systems |url=https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-H.222.0-200002-S!!PDF-E&type=items }}</ref> This field allows a receiver that started reading mid transmission to know when it can start extracting data. |- |Transport priority |style="text-align:center;"|1 |style="text-align:right;"|<code>0x200000</code> |Set when the current packet has a higher priority than other packets with the same PID. |- |PID |style="text-align:center;"|13 |style="text-align:right;"|<code>0x1fff00</code> |Packet Identifier, describing the payload data. |- |Transport scrambling control (TSC) |style="text-align:center;"|2 |style="text-align:right;"|<code>0xc0</code> | '00' = Not scrambled. For [[DVB-CSA]] and [[Data Encryption Standard|ATSC DES]] only:<ref>{{cite web|url=http://www.dvb.org/technology/standards/a125_CSA3_dTR101289.v1.2.1.pdf|title=Standards β DVB|website=Dvb.org|access-date=11 September 2012|archive-url=https://web.archive.org/web/20110313135150/http://www.dvb.org/technology/standards/a125_CSA3_dTR101289.v1.2.1.pdf|archive-date=13 March 2011|url-status=dead}}</ref><br />'01' <small>(0x40)</small> = Reserved for future use<br />'10' <small>(0x80)</small> = Scrambled with even key<br />'11' <small>(0xC0)</small> = Scrambled with odd key |- |Adaptation field control |style="text-align:center;"|2 |style="text-align:right;"|<code>0x30</code> |01 β no adaptation field, payload only, <br /> 10 β adaptation field only, no payload, <br /> 11 β adaptation field followed by payload, <br /> 00 β RESERVED for future use <ref>{{Cite web |url=http://www.abdn.ac.uk/erg/research/future-net/digital-video/mpeg2-trans.html |title=MPEG-2 Transmission |first=Gorry |last=Fairhurst |access-date=30 November 2018 |archive-url=https://web.archive.org/web/20170813122328/http://www.abdn.ac.uk/erg/research/future-net/digital-video/mpeg2-trans.html |archive-date=13 August 2017 |url-status=dead }}</ref> |- |Continuity counter |style="text-align:center;"|4 |style="text-align:right;"|<code>0xf</code> |Sequence number of payload packets <small>(0x00 to 0x0F)</small> within each stream (except PID 8191)<br/>Incremented per-PID, only when a payload flag is set. |- |colspan=4 style="text-align: center" |''Optional fields'' |- |Adaptation field |style="text-align:center;"|variable|| |Present if ''adaptation field control'' is 10 or 11. See below for format. |- |[[Payload (computing)|Payload]] data |style="text-align:center;"|variable|| |Present if ''adaptation field control'' is 01 or 11. Payload may be PES packets, program specific information (below), or other data. |} {|class="wikitable" |+ Adaptation field format !Name !Number of bits !Bitmask !Description |- |Adaptation field length |style="text-align:center;"|8|| |Number of bytes in the adaptation field immediately following this byte |- |Discontinuity indicator |style="text-align:center;"|1 |style="text-align:right;"|<code>0x80</code> |Set if current TS packet is in a discontinuity state with respect to either the continuity counter or the program clock reference |- |Random access indicator |style="text-align:center;"|1 |style="text-align:right;"|<code>0x40</code> |Set when the stream may be decoded without errors from this point |- |[[Elementary stream]] priority indicator |style="text-align:center;"|1 |style="text-align:right;"|<code>0x20</code> |Set when this stream should be considered "high priority" |- |PCR flag |style="text-align:center;"|1 |style="text-align:right;"|<code>0x10</code> |Set when PCR field is present |- |OPCR flag |style="text-align:center;"|1 |style="text-align:right;"|<code>0x08</code> |Set when OPCR field is present |- |Splicing point flag |style="text-align:center;"|1 |style="text-align:right;"|<code>0x04</code> |Set when splice countdown field is present |- |Transport private data flag |style="text-align:center;"|1 |style="text-align:right;"|<code>0x02</code> |Set when transport private data is present |- |Adaptation field extension flag |style="text-align:center;"|1 |style="text-align:right;"|<code>0x01</code> |Set when adaptation extension data is present |- |colspan=4 style="text-align: center" |''Optional fields'' |- |PCR |style="text-align:center;"|48|| |Program clock reference, stored as 33 bits base, 6 bits reserved, 9 bits extension.<br/>The value is calculated as base * 300 + extension. |- |OPCR |style="text-align:center;"|48|| |Original Program clock reference. Helps when one TS is copied into another |- |Splice countdown |style="text-align:center;"|8|| |Indicates how many TS packets from this one a splicing point occurs ([[Two's complement]] signed; may be negative) |- |Transport private data length |style="text-align:center;"|8|| |The length of the following field |- |Transport private data |style="text-align:center;"|variable|| |Private data |- |Adaptation extension |style="text-align:center;"|variable|| |See below |- |Stuffing bytes |style="text-align:center;"|variable|| |Always <code>0xFF</code> |} {|class="wikitable" |+ Adaptation extension format !Name !Number of bits !Bitmask !Description |- |Adaptation extension length |style="text-align:center;"|8 |<code>0xff00</code> |The length of the header |- |Legal time window (LTW) flag |style="text-align:center;"|1 |<code>0x0080</code> | |- |Piecewise rate flag |style="text-align:center;"|1 |<code>0x0040</code> | |- |Seamless splice flag |style="text-align:center;"|1 |<code>0x0020</code> | |- |Reserved |style="text-align:center;"|5 |<code>0x001f</code> | |- |colspan=4 style="text-align: center" |''Optional fields'' |- |colspan=4 |'''LTW flag set''' (2 bytes) |- |LTW valid flag |style="text-align:center;"|1 |<code>0x8000</code> | |- |LTW offset |style="text-align:center;"|15 |<code>0x7fff</code> |Extra information for rebroadcasters to determine the state of buffers when packets may be missing. |- |colspan=4 |'''Piecewise flag set''' (3 bytes) |- |Reserved |style="text-align:center;"|2 |<code>0xc00000</code> | |- |Piecewise rate |style="text-align:center;"|22 |<code>0x3fffff</code> |The rate of the stream, measured in 188-byte packets, to define the end-time of the LTW. |- |colspan=4 |'''Seamless splice flag set''' (5 bytes) |- |Splice type |style="text-align:center;"|4 |<code>0xf000000000</code> |Indicates the parameters of the H.262 splice. |- |DTS next access unit |style="text-align:center;"|36 |<code>0x0efffefffe</code> |The PES DTS of the splice point. Split up as multiple fields, 1 marker bit (0x1), 15 bits, 1 marker bit, 15 bits, and 1 marker bit, for 33 data bits total. |} <div style="clear:both" > {| class="wikitable" |+Payload format !Name !Number of bits !Bitmask !Description |- |Payload Pointer (optional) |8 |0xff |Present only if the Payload Unit Start Indicator (PUSI) flag is set, and the packet data type is PSI (not PES). It gives the index after this byte at which the new payload unit starts. Any payload byte before the index is part of the previous payload unit. |- |Actual Payload |variable | |The content of the payload. |} </div>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)