Transport Streams 101
A Transport Stream (TS) is comprised of one or more packetized and multiplexed compressed video signals and their associated audio, along with program descriptors and other data. In broadcast DTV, there are two essential parts to the final Transport Stream.
First is the actual packetized compressed audio and video data as well as the tables and other data required to locate and extract them. The second major part is called Program and System Information Protocol (PSIP), which is required by the DTV receiver.
The PSIP data is what enables the receiver to know what channel is being received as well as what analog channel is associated with it and the names of the major and minor channels. PSIP also carries viewer information such as program guides, time of day and ratings for the programs.
Packetized Elementary Stream
To combine or multiplex the various data streams that make up the TS, they need to be packetized. The Elementary Streams (ES) such as MPEG-2 video or AAC audio are encapsulated into defined serialized data bytes called Packetized Elementary Streams (PES). Once the elementary streams are packetized, they can be combined and multiplexed into a single data stream known as a TS. Each packet is 188B, or 1504b, long.
Packet Identifiers
With several different packets used for each program (e.g. MPEG-2 video, one or more AAC audio channels, metadata, etc.) and one or more programs, the number of packets can increase quickly. Because the individual streams are no longer separate but combined as packets, this requires a system to identify and sort through the packets to extract the correct program.
Packet Identifiers (PIDs) are used for this function and are attached to each packet in the TS. PID numbering is arranged to keep associated packets grouped together. For example, the MEPG-2 video would be PID 65, while the associated AC-3 audio is PID 68; another program has its MPEG-2 at PID 81 and AC-3 at PID 84.
Program Map Table
The Program Map Table (PMT) is a list of the PIDs used for each program and what they are; there is one PMT for each program within a TS. The PMT also has a PID and it is always the first (lowest number) PID for the program. In the above example, the program with PIDs 65 and 68 has a PMT with a PID 64, and the program with PIDs 81 and 84 has a PMT with a PID 80. The information contained within the PMT lists the PIDs for all the packets and a description of what the packet is (e.g. MPEG-2, AAC, AC-3, data, etc.).
Program Association Table
The Program Association Table (PAT) is a list of all programs contained within the TS. This is where the PIDs for the PMTs are found and is the first step in extracting the desired program from the stream.
Program Clock Reference
Program Clock Reference (PCR) is used to lock the local 27MHz clock to the one used to create the encoded stream. There is a PCR for each program within the TS, and it can share the same PID as one of the PES. The PCR is a time stamp and its value is derived from a counter, running at the encoder, taken at the moment the packet leaves the multiplexer.
Differences between the received time stamps and the local clock are seen as errors, and the local clock is adjusted or reset. If there is a fault with the PCR, then a number of errors can occur, such as loss of lip sync, picture freeze and dropped frames. The PCR is developed at the encoder from either the horizontal sync of an analog signal or the bit rate of an SDI input.
The PCR is a component of the TS and is used to keep the local 27MHz clock locked to the originating encoder’s clock. The encoder’s 27MHz clock is derived from the input video, either SDI or analog video. This means that the stability of the input video will determine the stability of the 27MHz clock and, therefore, the accuracy of the PCR for that program.
The Presentation Time Stamp (PTS) is part of the coded audio and video streams; this tells the decoder when this particular video or audio must be presented to the viewer. The time stamps are derived and compared to the 27MHz clock. The PTS is what keeps and locks the audio and video together and maintains lip sync.
Errors in the PCR can be introduced by the encoder/multiplexer or in the transmission path, including remultiplexers and network transmission errors. The tolerance for PCR is 500ns.
Program and System Information Protocol
Program and System Information Protocol (PISP) is the last item added to the TS. It provides much of the glue that holds the disparate elements of the stream together. PSIP contains the Terrestrial Virtual Channel Table (TVCT), Master Guide Table (MGT), Rating Region Table (RRT), System Time Table (STT) and Event Information Tables (EIT).
All of these provide for an easier user interface as well as tuning and channel branding:
- The TVCT indicates which DTV channels are associated with which analog TV channels and what frequencies and modulation modes are used. It also provides channel names and tuning information.
- The MGT lists all the other tables available in PSIP.
- RRT is where various types of program ratings are located for all the programs in the TS.
- STT provides time of day information referenced to UTC.
- EIT contains lists of TV programs and their start times contained in the TS.
Once the decoder is locked onto the data stream and the packets sorted, PSIP can begin to populate the receiver with its information. This information for the viewer consists of the System Time Table (STT), which supplies the current date and time from the station (the program guide is based on this clock time, so any offset or error can cause viewers to miss programs); the Region Rating Table (RRT), which supplies ratings of the programs within the TS so different types of program ratings can be transmitted (e.g. MPA, FCC, etc.); and the Event Information Tables (EIT) 0-3, which list the next 12 hours of programming.
The Terrestrial Virtual Channel Table (TVCT) contains a list of all the channels that are or will be online, plus their attributes. This includes the major and minor channel numbers and their names. Channel 6 analog also has Channel 35 digital, so the major channel is six for both analog and digital, and the minor channels are 0 for analog, one for the first digital channel, and so on. The minor channels do not have to be sequential and can be any number from one to 999. Stations might do this to denote different programming sources. Major and minor channel names also come from the PSIP, such as WREY for the major channel, and each minor channel has its own name as long as it fits in seven spaces.
A major component of PSIP is the Master Guide Table (MGT) that lists all the other tables within the PSIP as well as sizes and version numbers, so tables can be updated.
Demultiplexing the Stream
The multiplexer combines all the PES and the associated data packets into one continuous serial bit stream. To extract the PES and view it, we need to first demultiplex the stream to separate out the individual PES and convert them into Elementary Streams (ES) of compressed video and audio. From there, they can be decompressed, converted to analog and monitored.
To begin the demultiplexing process, the decoder’s 90kHz clock must be synchronized with the multiplexer’s, and to do that, the sync byte must be found in the TS. Every packet contains a sync byte at its start. The sync byte comprises 8 bits, and because all packets are 188 bytes long, the next sync word comes around in another 188 bytes. This repetition makes it easier to find the sync byte and lock to it.
Once the demultiplexer has seen the sync byte at least five times, it then knows it has a good lock on the clock and can examine the rest of the stream. Then the individual packets can be clocked in and their Packet Identifiers (PIDs) can be read and sorted.
Once the decoder is locked to the TS, the Program Association Table (PAT) is used to find all the data elements within it. The PAT holds a list, or table, of all the PIDs and what they are for in the TS. When the viewer selects minor Channel 3, which is listed as “sports” (all this data comes from the TVCT), the PAT directs the decoder to PID 80, which is where the Program Map Table (PMT) is located, and lists the PIDs for the PES — in this case, they are PID 81 for MPEG-2 video, PID 84 for AC-3 audio (English) and PID 90 for AC-3 audio (Spanish).
These packets are then converted (this is where the PCR comes in) into a Program Stream (PS), and from there into their original Elementary Streams (ES) with the help of the system clock reference (i.e. individual serial data for the MPEG-2 video and the AC-3 audio). They are decompressed then supplied to the outputs for display and monitoring.
Source: Broadcast Engineering