MPEG transport stream#Use in Blu-ray
{{short description|Digital video format used for storage network transmission}}
{{redirect|MPEG-2 Systems|the program stream technology also specified in the MPEG-2 Systems standard|MPEG program stream}}
{{redirect|.ts|the programming language associated with the .ts file extension|TypeScript|the translation source files in Qt|Qt Linguist}}
{{redirect|SPTS|the American television production and distribution arm of Sony|Sony Pictures Television}}
{{distinguish|.m2ts}}
{{Infobox file format
| name = MPEG Transport Stream
| icon =
| logo =
| mime = video/MP2T{{cite IETF |rfc=3555 |title=MIME Type Registration of RTP Payload Formats |date=July 2003}}
| type code =
| uniform type = public.mpeg-2-transport-stream{{cite web |url=https://developer.apple.com/documentation/uniformtypeidentifiers/uttype/3551535-mpeg2transportstream |title=mpeg2TransportStream |work=Apple Developer Documentation |publisher=Apple Inc}}
| magic =
| owner = MPEG
| released = {{Start date and age|1995|07|10|df=yes}}
| latest release version = ISO/IEC 13818-1:2022
| latest release date = {{Start date and age|2022|09|df=yes}}
| genre = Container format
| container for = Audio, video, data
| contained by =
| extended from =
| standard = ISO/IEC 13818-1, ITU-T Recommendation H.222.0{{cite web
|url=http://www.itu.int/rec/T-REC-H.222.0-201410-I/en
|title=Recommendation H.222.0 (10/14)
|author=ITU-T
|date=October 2014}}
| open = Yes
}}
MPEG transport stream (MPEG-TS, MTS) or simply transport stream (TS) is a standard digital container format for transmission and storage of audio, video, and Program and System Information Protocol (PSIP) data.{{cite web|url=http://www.afterdawn.com/glossary/term.cfm/mpeg2_transport_stream |title=MPEG-2 Transport Stream |website=AfterDawn.com |access-date=8 June 2010}} It is used in broadcast systems such as DVB, ATSC and IPTV.
Transport stream specifies a container format encapsulating packetized elementary streams, with error correction and synchronization pattern features for maintaining transmission integrity when the communication channel carrying the stream is degraded.
Transport streams differ from the similarly named MPEG program stream in several important ways: program streams are designed for reasonably reliable media, such as discs (like DVDs), while transport streams are designed for less reliable transmission, namely terrestrial or satellite broadcast. Further, a transport stream may carry multiple programs.
Transport stream is specified in MPEG-2 Part 1, Systems, formally known as ISO/IEC standard 13818-1 or ITU-T Rec. H.222.0.
Overview
Image:MPEG Transport Stream HL.svg
A transport stream encapsulates a number of other substreams, often packetized elementary streams (PESs) which in turn wrap the main data stream using the MPEG codec or any number of non-MPEG codecs (such as AC3 or DTS audio, and MJPEG or JPEG 2000 video), text and pictures for subtitles, tables identifying the streams, and even broadcaster-specific information such as an electronic program guide. Many streams are often mixed together, such as several different television channels, or multiple angles of a movie.
Each stream is chopped into (at most) 188-byte sections and interleaved together. Due to the tiny packet size, streams can be interleaved with less latency and greater error resilience compared to program streams and other common containers such as AVI, MOV/MP4, and MKV, which generally wrap each frame into one packet. This is particularly important for videoconferencing, where large frames may introduce unacceptable audio delay.
Transport streams tend to be broadcast as constant bitrate (CBR) and filled with padding bytes when not enough data exists.{{efn|The Blu-ray format does not require CBR.}}
Elements
= 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, that may be followed with optional additional headers; the rest of the packet consists of payload. All header fields are read as 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),{{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}} 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 (ATM) systems.{{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}}{{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}}
class="wikitable"
|+ Partial transport stream packet format !Name !Number of bits !Description | |
colspan=4 style="text-align: center" |4-byte Transport Stream Header | |
Sync byte
|style="text-align:center;"|8 |style="text-align:right;"| |Bit pattern of 0x47 (ASCII char 'G') | |
Transport error indicator (TEI)
|style="text-align:center;"|1 |style="text-align:right;"| |Set when a demodulator can't correct errors from FEC data; indicating the packet is corrupt.{{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 }} | |
Payload unit start indicator (PUSI)
|style="text-align:center;"|1 |style="text-align:right;"| |Set when this packet contains the first byte of a new payload unit. For PSI packet data, the first byte of the payload will indicate where this new payload unit starts. For PES packet data, the new PES packet shall start at the start of the payload.{{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 }} 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;"| |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;"| |Packet Identifier, describing the payload data. | |
Transport scrambling control (TSC)
|style="text-align:center;"|2 |style="text-align:right;"| | '00' = Not scrambled. For DVB-CSA and ATSC DES only:{{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}} | |
Adaptation field control
|style="text-align:center;"|2 |style="text-align:right;"| |01 – no adaptation field, payload only, 10 – adaptation field only, no payload, 11 – adaptation field followed by payload, | |
Continuity counter
|style="text-align:center;"|4 |style="text-align:right;"| |Sequence number of payload packets (0x00 to 0x0F) within each stream (except PID 8191) | |
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 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;"| |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;"| |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;"| |Set when this stream should be considered "high priority" | |
PCR flag
|style="text-align:center;"|1 |style="text-align:right;"| |Set when PCR field is present | |
OPCR flag
|style="text-align:center;"|1 |style="text-align:right;"| |Set when OPCR field is present | |
Splicing point flag
|style="text-align:center;"|1 |style="text-align:right;"| |Set when splice countdown field is present | |
Transport private data flag
|style="text-align:center;"|1 |style="text-align:right;"| |Set when transport private data is present | |
Adaptation field extension flag
|style="text-align:center;"|1 |style="text-align:right;"| |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. 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 0xFF |
class="wikitable"
|+ Adaptation extension format !Name !Number of bits !Bitmask !Description |
Adaptation extension length
|style="text-align:center;"|8 | |The length of the header |
Legal time window (LTW) flag
|style="text-align:center;"|1 | | |
Piecewise rate flag
|style="text-align:center;"|1 | | |
Seamless splice flag
|style="text-align:center;"|1 | | |
Reserved
|style="text-align:center;"|5 | | |
colspan=4 style="text-align: center" |Optional fields |
colspan=4 |LTW flag set (2 bytes) |
LTW valid flag
|style="text-align:center;"|1 | | |
LTW offset
|style="text-align:center;"|15 | |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 | | |
Piecewise rate
|style="text-align:center;"|22 | |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 | |Indicates the parameters of the H.262 splice. |
DTS next access unit
|style="text-align:center;"|36 | |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. |
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. |
=Packet identifier (PID)=
Each table or elementary stream in a transport stream is identified by a 13-bit packet identifier (PID). A demultiplexer extracts elementary streams from the transport stream in part by looking for packets identified by the same PID. In most applications, time-division multiplexing will be used to decide how often a particular PID appears in the transport stream.
class="wikitable"
|+ Packet identifiers in use | ||
Decimal | Hexadecimal | Description |
---|---|---|
0
|0x0000 |Program association table (PAT) contains a directory listing of all program map tables | ||
1
|0x0001 |Conditional access table (CAT) contains a directory listing of all ITU-T Rec. H.222 entitlement management message streams used by program map tables | ||
2
|0x0002 |Transport stream description table (TSDT) contains descriptors relating to the overall transport stream | ||
3
|0x0003 |IPMP control information table contains a directory listing of all ISO/IEC 14496-13 control streams used by program map tables | ||
4–15
|0x0004-0x000F |Reserved for future use | ||
16–31
|0x0010-0x001F |Used by DVB metadata{{cite book |url=http://www.etsi.org/deliver/etsi_en/300400_300499/300468/01.13.01_40/en_300468v011301o.pdf |page=20 |section=5.1.3 Coding of PID and table_id fields |series=EN |volume=300 468 |edition=v1.13.1 |title=Digital Video Broadcasting (DVB); Specification for Service Information (SI) in DVB systems |website=Etsi.org|year=2012 |access-date=2016-10-13}}
| ||
32-8186
|0x0020-0x1FFA |May be assigned as needed to program map tables, elementary streams and other data tables | ||
8187
|0x1FFB |Used by DigiCipher 2/ATSC MGT metadata | ||
8188–8190
|0x1FFC-0x1FFE |May be assigned as needed to program map tables, elementary streams and other data tables | ||
8191
|0x1FFF |Null Packet (used for fixed bandwidth padding) |
=Programs=
Transport stream has a concept of programs. Every program is described by a program map table (PMT). The elementary streams associated with that program have PIDs listed in the PMT. Another PID is associated with the PMT itself. For instance, a transport stream used in digital television might contain three programs, to represent three television channels. Suppose each channel consists of one video stream, one or two audio streams, and any necessary metadata. A receiver wishing to decode one of the three channels merely has to decode the payloads of each PID associated with its program. It can discard the contents of all other PIDs. A transport stream with more than one program is referred to as a multi-program transport stream (MPTS). A single program transport stream is referred to as a single-program transport stream (SPTS).
=Program specific information=
{{Main article|Program-specific information}}
There are 4 program specific information (PSI) tables: program association (PAT), program map (PMT), conditional access (CAT), and network information (NIT). The MPEG-2 specification does not specify the format of the CAT and NIT.
=== PCR ===
To enable a decoder to present synchronized content, such as audio tracks matching the associated video, at least once each 100 ms, a program clock reference (PCR) is transmitted in the adaptation field of an MPEG-2 transport stream packet. The PID with the PCR for an MPEG-2 program is identified by the pcr_pid value in the associated PMT. The value of the PCR, when properly used, is employed to generate a system_timing_clock in the decoder. The system time clock (STC) decoder, when properly implemented, provides a highly accurate time base that is used to synchronize audio and video elementary streams. Timing in MPEG-2 references this clock. For example, the presentation time stamp (PTS) is intended to be relative to the PCR. The first 33 bits are based on a 90 kHz clock. The last 9 bits are based on a 27 MHz clock. The maximum jitter permitted for the PCR is {{no wrap|+/- 500 ns}}.
=Null packets=
Some transmission schemes, such as those in ATSC and DVB, impose strict constant bitrate requirements on the transport stream. In order to ensure that the stream maintains a constant bitrate, a multiplexer may need to insert some additional packets. The PID 0x1FFF is reserved for this purpose. The null packets have a payload that is filled with 0xFF, and the receiver is expected to ignore its contents.{{citation |url=http://www.img.lx.it.pt/~fp/cav/Additional_material/MPEG2_overview.pdf |title=A Guide to MPEG Fundamentals and Protocol Analysis |publisher=Tektronix |access-date=2020-04-23 |page=37}}
Use in digital video cameras
Transport Stream was originally designed for broadcast. Later it was adapted for use with digital video cameras, recorders and players by adding a 4-byte timecode (TC) field to the standard 188-byte packets, resulting in a 192-byte packet.{{citation |publisher=Blu-ray Disc Association |date=March 2005 | url=http://www.blu-raydisc.com/Assets/Downloadablefile/2b_bdrom_audiovisualapplication_0305-12955-15269.pdf |title=BD ROM – Audio Visual Application Format Specifications |archive-url=https://web.archive.org/web/20201103093732/http://www.blu-raydisc.com/Assets/Downloadablefile/2b_bdrom_audiovisualapplication_0305-12955-15269.pdf | archive-date=3 Nov 2020 | url-status=dead|pages=15–16 |access-date=26 July 2009}}{{citation |publisher=Blu-ray Disc Association |date=March 2008 |url=http://www.blu-raydisc.com/Assets/Downloadablefile/BD-RE_Part3_V2.1_WhitePaper_080406-15271.pdf |title=BD-RE – Audiovisual Application Format Specification for BD-RE 2.1 |archive-url=https://web.archive.org/web/20090206111829/http://www.blu-raydisc.com/Assets/Downloadablefile/BD-RE_Part3_V2.1_WhitePaper_080406-15271.pdf |url-status=dead |archive-date=6 February 2009 }} This is what is informally called M2TS stream, commonly found in HDV cameras. The Blu-ray Disc Association calls it "BDAV MPEG-2 transport stream". JVC called it TOD{{efn|Possibly an abbreviation for "Transport stream on disc".}} when used in HDD-based camcorders like GZ-HD7.{{cite web|title=Steve Mullen, M2TS primer|url=http://dvinfo.net/conf/showthread.php?t=105486|website=Dvinfo.net}}{{cite web |url=http://www.avchduser.com/articles/JVC_Everio_mod_files.jsp |title=Working with JVC Everio MOD & TOD files |url-status=usurped |archive-url=https://web.archive.org/web/20081023045657/http://www.avchduser.com/articles/JVC_Everio_mod_files.jsp |archive-date=23 October 2008}} The timecode allows quick access to any part of the stream either from a media player, or from a non-linear video editing system.{{cite web|url=http://forum.videohelp.com/threads/306126-HFS10-AVCHD-how-to-maintain-quality?p=1881643&viewfull=1#post1881643 |title=How MPEG-TS works|website=Forum.videohelp.com |access-date=2012-05-17}}{{self-published inline|date=May 2012}} It is also used to synchronize video streams from several cameras in a multiple-camera setup.
Use in Blu-ray
Blu-ray Disc video titles authored with menu support are in the Blu-ray Disc Movie (BDMV) format and contain audio, video, and other streams in a BDAV container, which is based on the MPEG-2 transport stream format.Afterdawn.com [http://www.afterdawn.com/glossary/terms/bd-mv.cfm Glossary – BD-MV (Blu-ray Movie) and BDAV container] {{webarchive|url=https://web.archive.org/web/20090218234755/http://www.afterdawn.com/glossary/terms/bd-mv.cfm |date=18 February 2009 }}, Retrieved on 26 July 2009Afterdawn.com [http://www.afterdawn.com/glossary/terms/bdav.cfm Glossary – BDAV container], Retrieved on 26 July 2009 Blu-ray Disc video uses these modified MPEG-2 transport streams, compared to DVD's program streams that don't have the extra transport overhead.
There is also the BDAV (Blu-ray Disc Audio/Visual) format, the consumer-oriented alternative to the BDMV format used for movie releases. The BDAV format is used on Blu-ray Disc recordable for audio/video recording.{{efn|Filename extension .m2ts is used on Blu-ray Disc video files which contain an incompatible BDAV MPEG-2 transport stream due to the four additional octets added to every packet.Videohelp.com [http://www.videohelp.com/hd What is Blu-ray Disc and HD DVD?] {{webarchive|url=https://web.archive.org/web/20091224035325/http://www.videohelp.com/hd |date=24 December 2009 }}, Retrieved on 26 July 2009}} Blu-ray Disc employs the MPEG-2 transport stream recording method. This enables transport streams of a BDAV converted digital broadcast to be recorded as they are with minimal alteration of the packets. It also enables simple stream cut style editing of a BDAV converted digital broadcast that is recorded as is and where the data can be edited just by discarding unwanted packets from the stream. Although it is quite natural, a function for high-speed and easy-to-use retrieval is built in.Blu-ray Disc Association (August 2004) [http://www.blu-raydisc.com/Assets/Downloadablefile/general_bluraydiscformat-15263.pdf Blu-ray Disc Format, White paper] (PDF) Page 22, Retrieved on 28 July 2009
See also
Notes
{{Notelist}}
References
{{Reflist}}
External links
- [http://www.itu.int/rec/T-REC-H.222.0 ITU-T H.222.0 | ISO/IEC 13818-1 Systems Spec Documents]
- [http://www.itu.int/rec/T-REC-H.222.0-201808-S/en Latest free copy of the spec, August 2018]
- [http://mpeg.chiariglione.org/faq/mp4-sys/mp4-sys.htm MPEG-4 Systems FAQ]
- [https://tsduck.io/ TSDuck] – Free open-source tool to manipulate MPEG transport streams.
{{compression formats}}
{{MPEG}}
{{Use dmy dates|date=August 2019}}
{{DEFAULTSORT:Mpeg Transport Stream}}