MPEG transport stream


MPEG transport stream or simply transport stream is a standard digital container format for transmission and storage of audio, video, and Program and System Information Protocol data. 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, 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

A transport stream encapsulates a number of other substreams, often packetized elementary streams which in turn wrap the main data stream using the MPEG codec or any number of non-MPEG codecs, 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 188-byte sections and interleaved together; because of 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 and filled with padding bytes when not enough data exists.

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. The 188-byte packet size was originally chosen for compatibility with Asynchronous Transfer Mode systems.

Packet identifier (PID)

Each table or elementary stream in a transport stream is identified by a 13-bit packet identifier. 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.
DecimalHexadecimalDescription
00x0000Program association table contains a directory listing of all program map tables
10x0001Conditional access table contains a directory listing of all ITU-T Rec. H.222 entitlement management message streams used by program map tables
20x0002Transport stream description table contains descriptors relating to the overall transport stream
30x0003IPMP control information table contains a directory listing of all ISO/IEC 14496-13 control streams used by program map tables
4–150x0004-0x000FReserved for future use
16–310x0010-0x001FUsed by DVB metadata
  • 0x0010: NIT, ST
  • 0x0011: SDT, BAT, ST
  • 0x0012: EIT, ST, CIT
  • 0x0013: RST, ST
  • 0x0014: TDT, TOT, ST
  • 0x0015: network synchronization
  • 0x0016: RNT
  • 0x0017-0x001B: reserved for future use
  • 0x001C: inband signalling
  • 0x001D: measurement
  • 0x001E: DIT
  • 0x001F: SIT
32-81860x0020-0x1FFAMay be assigned as needed to program map tables, elementary streams and other data tables
81870x1FFBUsed by DigiCipher 2/ATSC MGT metadata
8188–81900x1FFC-0x1FFEMay be assigned as needed to program map tables, elementary streams and other data tables
81910x1FFFNull Packet

Programs

Transport stream has a concept of programs. Every program is described by a program map table. 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. A single program transport stream is referred to as a single-program transport stream.

Program specific information

There are 4 program specific information tables: program association, program map, conditional access, and network information. 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 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 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 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.

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 payload of null packets is all zeroes, and the receiver is expected to ignore its contents.

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 field to the standard 188-byte packets, resulting in a 192-byte packet. This is what is informally called M2TS stream. The Blu-ray Disc Association calls it "BDAV MPEG-2 transport stream". JVC called it TOD when used in HDD-based camcorders like GZ-HD7. The timecode allows quick access to any part of the stream either from a media player, or from a non-linear video editing system. It is also used to synchronize video streams from several cameras in a multiple-camera setup.

Use in Blu-ray

Filename extension.m2ts is used on Blu-ray Disc Video for files which contain an incompatible BDAV MPEG-2 transport stream due to the four additional octets added to every packet. Blu-ray Disc Video titles authored with menu support are in the BDMV format and contain audio, video, and other streams in a BDAV container, which is based on the MPEG-2 transport stream format. There is also the BDAV format, the consumer oriented alternative to the BDMV format used for movie releases. The BDAV format is used on BD-REs and BD-Rs for audio/video recording. Blu-ray Disc employs the MPEG-2 transport stream recording method. That 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 Video uses these modified MPEG-2 transport streams, compared to DVD's program streams that don't have the extra transport overhead.