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, which may be followed by 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 (ATM) systems.
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.
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 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 .
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. == M2TS ==