7/18/2008

MPEG-2 Transport Streams

Pro MPEG Forum CoP3 or SMPTE 2022


Introduction

Pro-MPEG Forum Code of Practice #3 release 2
(CoP3) or SMPTE 2022-2007, describe how MPEG-2 Transport Streams (MPEG-2 TS) should be encapsulated when sent over IP networks. It also describes a forward error correction (FEC) mechanism that can be used to correct errors than can occur during the transport. This article will explain how video content can be sent over IP networks and how errors can be corrected using CoP3 FEC.

ASI to IP

All MPEG-2 transport streams shall be encapsulated in RTP (Real-time Transport Protocol) according to RFC 1889 in conjunction with RFC 2250. Transport service is provided jointly by UDP (checksum and multiplexing) and RTP (sequencing and time stamping / jitter removing). RTP always uses an even UDP port number.

Mpeg-2 TS packets into RTP packets

For most streams, the RTP/UDP/IP overhead of 40 bytes per RTP packet is relatively low (for example 3% with a 1 316 byte payload).

.UDP and RTP headers

IP packets can carry from 1 to 7 TS packets, knowing that:
  • The overall size of RTP payload must not exceed the MTU (Maximum Transfer Unit) in order to prevent RTP packets fragmentation around the network
  • Short packets induce high overhead
There is no requirement for every RTP packet in a stream to contain the same number of transport stream packets. The receiver should use the length field in the UDP header to determine the number of transport stream packets contained in each RTP packet.

The time stamp field in the RTP header is based on the PCR values from MPEG-2 with a resolution of 90 Khz.

Streams must include:
  • Program Association Table (PAT)
  • Program Map Table (PMT)
Other tables are optional. SI (Service Information) is intended to be delivered via separate IP streams, e.g. in XML format.

RTCP (Real-time Transport Control Protocol) can be included to periodically inform the sending side about network quality (e.g. lost packets, delay, jitter, etc.).

At the output of the IP network, the delivered Transport Stream must be fully ISO/IEC 13818-1 compliant (40ms maximum jitter, 1 artifact every hour, etc.).

What about error protection ?

Code of Practice #3 describes a Forward Error Correction (FEC) method for protection against errors in delivering professional MPEG-2 TS data over IP networks. With that method implemented in IP video gateays, packet errors, out of order packets, network jitter and delay can be compensated.

FEC data insertion is done in real-time along with TS over IP encapsulation: Protection data is calculated and embedded in regular RTP packets with a specific payload type.
It relies on simple XOR arithmetics:
if F=A B C, then if only A,B,F are present, C can be recovered.

A FEC matrix is generated and transmitted on two separate UDP ports:
FEC columns on UDP port + 2
FEC rows on UDP port + 4

Forward Error Correction (FEC) packets for CoP3

FEC Matrix is computed as follows:

FEC matrix computation

FEC packets can be computed for both columns and lines. One FEC packet is able to recover one lost RTP packet in a column/row. If several packets are lost in the same column for instance, FEC packet for rows can be used to re-generate the packet.