MPEG-2 transport stream
Broadcasting digital television signals involves multiplexing and formatting the coded audio and video elementary bitstreams, into packetised elemen- tary streams (PESs) and multiplexing them together with relevant service PESs as well as PESs of other programmes. The multiplexed PESs are then formatted into 188-byte packets to form a transport stream as illustrated in Figure 7.1. This is followed by the channel encoder in which the transport stream is used to modulate a suitable carrier. The transport stream is fully defined by MPEG-2. MPEG-4 on the other hand is designed to be transport agnostic. This means that MPEG-4 coded data can be carried over differ- ent transport layers and could move from one transport layer to another. In the case of HDTV, an amendment to MPEG-2’s transport stream has been defined to carry MPEG-4 data. This involves introducing additional identification and other flags specifically for MPEG-4 packets. Transport of MPEG-4 over IP has also been defined.
Transport stream multiplexing
Video and audio coders deliver their outputs in the form of an elementary stream (ES). Raw uncompressed pieces of video or audio, known as pre- sentation units are fed into their respective coders to produce video and audio access units. A video access unit could be an I, P or B coded picture. The audio access units contain coded information for a few milliseconds of sound window: 24 ms (layer II) and 24 or 8 ms in the case of window switching (layer III). The sequence of the video and audio access units forms the video and audio elementary streams respectively. Each ES is then broken up into packets to form the video or audio PES. Service data and other data are similarly grouped into their own PESs. The PES packets are then sliced into smaller 188-byte transport packets.
The transport stream is intended for broadcasting applications in which the communication medium is error prone, be it satellite or terrestrial. An error-prone transmission medium is one that has a potential bit error rate (BER) greater than 10-14. To ensure that errors caused by the transmission medium can be corrected at the receiving end, and to facilitate the multi- plexing of several programmes, the transport stream packet is set to a standard, relatively short length of 188 bytes. For applications on DVD, where the communication medium has a lower potential BER, a packet length in kilobytes can be used to form what is known as a programme stream.
MPEG-2 PES packet
Like any data packet, the PES packet starts with a header followed by the payload (Figure 7.2). The PES packet may vary in length up to a maximum of 64 KB. A typical length however is 2 KB. The payload consists of access units taken sequentially from the original ES. There is no requirement to align the start of access units and the start of the payload (Figure 7.3). Thus a new access unit may start at any point on the payload of a PES packet, and it is also possible for several small access units to be contained in a single PES packet.
The essential components of the header are the start code prefix (3 bytes), the start code stream_id (1 byte), programme time stamp, PTS (33 bits) and the decoding time stamp, DTS (33 bits). PTS and DTS need not be included in every PES packet as long as they are included at least once every 100 ms in transport stream applications (DTV) or 700 ms in programme stream applications (DVD). The header includes other fields containing important parameters such as the length of the PES packet, the length of the header itself and whether PTS and DTS fields are pres- ent in the packet. Besides these, there are several other optional fields, 25 in total, which may be used to convey additional information about the
PES such as whether scrambled or not, relative priority and copyright information.
The contents of the PES header are outlined in Figure 7.4. The first four fields comprise the PES packet start code. It consists of a 24-bit prefix and 8-bit stream identification (stream_id). This combination of 32 bits is guar- anteed not to arise in the PES other than at the start of a PES packet. The prefix is set to 00 00 01 in hex. The stream_id byte distinguishes packets belonging to one ES from those of another within the same programme. MPEG specifies the permitted values for this field, which include 32 differ- ent values for audio and 16 different values for video elementary streams. The next field, packet length field, is another mandatory field indicating the length of the packet in bytes after the end of this field. This is followed by two flag fields, flags 1 and flags 2, containing bits which show the presence or absence of various optional fields. The two most significant bits of flags 1, marked SS, indicate the type of scrambling if any, and the two most significant bits of flags 2, marked P and D, indicate the presence or absence of PTS and DTS fields respectively. The last mandatory field, PES_header_length, gives the number of bytes of optional data present in the header before the first byte of the payload is reached. The remaining fields are optional including the PTS and the DTS fields.