Thursday, September 16, 2010

video transmission (mpeg2)

(excerpted from http://www.abdn.ac.uk/erg/research/future-net/digital-video/mpeg2-trans.html)
The MPEG-2 standards define how to format the various component parts of a multimedia programme (which may consist of: MPEG-2 compressed video, compressed audio, control data and/or user data). It also defines how these components are combined into a single synchronous transmission bit stream. The process of combining the steams is known as multiplexing.

The multiplexed stream may be transmitted over a variety of links, standards / products are (or will soon be) available for :
  • Radio Frequency Links (UHF/VHF)
  • Digital Broadcast Satellite Links
  • Cable TV Networks
  • Standard Terrestrial Communication Links (PDH, SDH)
  • Microwave Line of Sight (LoS) Links (wireless)
  • Digital Subscriber Links (ADSL family)
  • Packet / Cell Links (ATM, IP, IPv6, Ethernet)


Building the MPEG Bit Stream

To understand how the component parts of the bit stream are multiplexed, we need to first look at each component part. The most basic component is known as an Elementary Stream (ES) in MPEG. A programme (perhaps most easily thought of as a television programme, or a DVD track) contains a combination of elementary streams (typically one for video, one or more for audio, control data, subtitles, etc).

Each Elementary Stream (ES) output by an MPEG audio, video and (some) data encoders contain a single type of (usually compressed) signal. There are various forms of ES, including:
  • Digital Control Data
  • Digital Audio (sampled and compressed)
  • Digital Video (sampled and compressed)
  • Digital Data (synchronous, or asynchronous)

For video and audio, the data is organised into access units, each representing a fundamental unit of encoding. For example, in video, an access unit will usually be a complete encoded video frame.

Each ES is input to an MPEG-2 processor (e.g. a video compressor or data formatted) which accumulates the data into a stream of Packetised Elementary Stream (PES) packets. A PES packet may be a fixed (or variable) sized block, with up to 65536 bytes per block and includes a 6 byte protocol header. A PES is usually organised to contain an integral number of ES access units.

The PES header starts with a 3 byte start code, followed by a one byte stream ID and a 2 byte length field.

PES Indicators provide additional information about the stream to assist the decoder at the receiver. The following indicators are defined:
  • PES_Scrambling_Control - Defines whether scrambling is used, and the chosen scrambling method.
  • PES_Priority - Indicates priority of the current PES packet.
  • data_alignment_indicator - Indicates if the payload starts with a video or audio start code.
  • copyright information - Indicates if the payload is copyright protected.
  • original_or_copy - Indicates if this is the original ES.A one byte flags field completes the PES header. This defines the following optional fields, which if present, are inserted before the start of the PES payload.
  • Presentation Time Stamp (PTS) and possibly a Decode Time Stamp (DTS) - For audio / video streams these time stamps which may be used to synchronise a set of elementary streams and control the rate at which they are replayed by the receiver.
  • Elementary Stream Clock Reference (ESCR)
  • Elementary Stream rate - Rate at which the ES was encoded.
  • Trick Mode - indicates the video/audio is not the normal ES, e.g. after DSM-CC has signalled a replay.
  • Copyright Information - set to 1 to indicated a copyright ES.
  • CRC - this may be used to monitor errors in the previous PES packet
  • PES Extension Information - may be used to support MPEG-1 streams.

The PES packet payload includes the ES data. The information in the PES header is, in general, independent of the transmission method used.

MPEG-2 Multiplexing

The MPEG-2 standard allows two forms of multiplexing:
MPEG Program Stream
A group of tightly coupled PES packets referenced to the same time base. Such streams are suited for transmission in a relatively error-free environment and enable easy software processing of the received data. This form of multiplexing is used for video playback and for some network applications.
MPEG Transport Stream Each PES packet is broken into fixed-sized transport packets forming a general purpose way of combining one or more streams, possibly with independent time bases. This is suited for transmission in which there may be potential packet loss or corruption by noise, or / and where there is a need to send more than one programme at a time.

MPEG Transport Streams

A transport stream consists of a sequence of fixed sized transport packet of 188 B. Each packet comprises 184 B of payload and a 4 B header. One of the items in this 4 B header is the 13 bit Packet Identifier (PID) which plays a key role in the operation of the Transport Stream.

The format of the transport stream is described with an example: two elementary streams sent in the same MPEG-2 transport multiplex. Each packet is associated with a PES through the setting of the PID value in the packet header (the values of 64 and 51 respectively). The audio packets have been assigned PID 64, and the video packets PID 51 (these are arbitrary, but different values). As is usual, there are more video than audio packets, but you may also note that the two types of packets are not evenly spaced in time. The MPEG-TS is not a time division multiplex, packets with any PID may be inserted into the TS at any time by the TS multiplexor. If no packets are available at the multiplexor, it inserts null packets (denoted by a PID value of 0x1FFF) to retain the specified TS bit rate. The multiplexor also does not synchronise the two PESs, indeed the encoding and decoding delay for each PES may (and usually is different). A separate process is therefore require to synchronise the two streams.


Single and Multiple Program Transport Streams

A TS may correspond to a single TV programme, or multimedia stream (e.g. with two a video PES and an audio PES). This type of TS is normally called a Single Programme Transport Stream (SPTS).

An SPTS contains all the information requires to reproduce the encoded TV channel or multimedia stream. It may contain only an audio and video PESs, but in practice there will be other types of PES as well. Each PES shares a common timebase. Although some equipments output and use SPTS, this is not the normal form transmitted over a DVB link.

In most cases one or more SPTS streams are combined to form a Multiple Programme Transport Stream (MPTS). This larger aggregate also contains all the control information (Program Specific Information (PSI)) required to co-ordinate the DVB system, and any other data which is to be sent.

Signalling Tables

For a user to receive a particular transport stream, the user must first determine the PID being used, and then filter packets which have a matching PID value. To help the user identify which PID corresponds to which programme, a special set of streams, known as Signalling Tables, are transmitted with a description of each program carried within the MPEG-2 Transport Stream. Signalling tables are sent separately to PES, and are not synchronised with the elementary streams (i.e they are an independent control channel).


The tables (called Program Specific Information (PSI) in MPEG-2) consist of a description of the elementary streams which need to be combined to build programmes, and a description of the programmes. Each PSI table is carried in a sequence of PSI Sections, which may be of variable length (but are usually small, c.f. PES packets). Each section is protected by a CRC (checksum) to verify the integrity of the table being carried. The length of a section allows a decoder to identify the next section in a packet. A PSI section may also be used for down-loading data to a remote site. Tables are sent periodically by including them in the transmitted transport multiplex.

No comments: