Sunteți pe pagina 1din 105

MPEG 101

Transport Stream Demystification


by Leon Urban, Sr. Sales Engineer
August 17, 2011 San Juan, PR for CCTA members
In collaboration with our Caribbean Value Added Reseller:

Mario Sebastiani & Bernard How


An LG Electronics Company

Basic MPEG Building Blocks

An LG Electronics Company

Typical DTV Transport Stream

Special case of MPEG-2 transport stream


May contain multiple virtual channels

Video channels

A video stream
One or more audio streams
Possibly one or more data streams

Audio channels

One or more audio streams


Possibly one or more data streams

Data only channels


Data-only

One or more data streams

An LG Electronics Company

Copyright 2009 Triveni Digital, Inc.

Page 3

MPEG--2 Transport Stream


MPEG

Made up of 188-byte transport packets, each with 4


byte header & 184 byte payload

Each
E
h packet
k t contains
t i any ONE ki
kind
d off iinformation
f
ti
audio, video, data, PSI,

One
Transport
(MPEG)
Packet

An LG Electronics Company

Copyright 2009 Triveni Digital, Inc.

Page 4

MPEG--2 Transport Stream (Contd.)


MPEG

We say transport packets have multiple interleaved


elementary streams -- audio, video, data, PSI, ...

Packets
P
k t b
belonging
l
i to
t th
the same elementary
l
t
stream
t
are
identified by packet id (PID) in packet header (same
color in our illustrations).
)

MPEG-2 Transport Stream

These three packets are the same color.


They have the same PID and belong to
the same Elementary stream
stream.
An LG Electronics Company

Copyright 2009 Triveni Digital, Inc.

Page 5

MPEG--2 Transport Stream Header Fields


MPEG
Noteworthy fields:
1) Sync Byte Find packet boundary
2) PID Used while demultiplexing stream
3) Continuity Counter Identify packet loss
4) PCR stamp in adaptation field Clock sync

MPEG-2 Transport Stream


Header (4 Bytes)

Sync
Byte

PID

188 Bytes
Continuity
Counter

Adaptation
Adaptation
Field
Field
(Optional)

An LG Electronics Company

PES 1
x

Or other Payload (Pat, PMT, PSIP,


etc)...

Copyright 2009 Triveni Digital, Inc.

Page 6

MPEG Header Fields: Sync Byte

When a decoder first tunes, all it sees are a stream of


0s and 1s

The d
Th
decoder
d mustt fi
firstt id
identify
tif the
th beginning
b i i off
packets before it can interpret the stream

The decoder uses the Sync Byte field to do this

01010001111010010101101010001100011110010111000
MPEG Data Prior to
Packet Sync

An LG Electronics Company

Copyright 2009 Triveni Digital, Inc.

Page 7

MPEG Header Fields: Sync Byte (Contd.)

The Sync Byte of a packet is always 0x47


(Hexadecimal) or 01000111 binary

The decoder looks for strings of zeros and ones which


match the pattern of the sync byte (see red below)

01010001111010010101101010000100011111000111

An LG Electronics Company

Copyright 2009 Triveni Digital, Inc.

Page 8

MPEG Header Fields: Sync Byte (Contd.)

Once the decoder finds a 0x47 in the stream, it looks 187 bytes
down the stream, and looks for another 0x47

If it finds three Sync


y Bytes
y
in a row,, then the Decoder has Found
Sync and assumes packet boundaries from then on

Each packet is tested for 0x47 as soon as it arrives. If a packet


arrives with an incorrect sync byte
byte, the decoder starts over
over. This
is called SYNC LOSS
Found Sync

0x47

187 bytes

0x47

187 bytes

0x47

187 bytes

Packet 188 bytes

Sync Not Found


Packet 188 bytes

Packet 188 bytes

An LG Electronics Company

0x32

11010101010111011010101010001

Copyright 2009 Triveni Digital, Inc.

Page 9

MPEG Header Fields: Sync Byte (Contd.)

If you dont have Packet Sync, the decoder cannot find


packet boundaries. You will not be able to decode at
all

Packet Sync problems typically occur in hardware at


packet boundaries during
g format converters, edge
g
devices, demodulators etc:

ASI to Gig-E
ASI to Microwave or QAM
Satellite to ASI

An LG Electronics Company

Copyright 2009 Triveni Digital, Inc.

Page 10

PIDs Defined - ATSC Bitstream


PSIP Tables

PSIP Generator

Video
PAT
Audio
PMT

Data channel
Dataenhanced
Audio/Video
channel
Audio/Video
channel

Data Server

Data
Null
PSIP

Data Server
Audio Encoder

MultiM
lti
plexer

Video Encoder
Audio Encoder
Video Encoder
MPEG-2 Transport Stream

An LG Electronics Company

Copyright 2009 Triveni Digital, Inc.

Page 11

PIDs Defined - Digital Cable Bitstream


Video/Audio
channel

Video/Audio
channel
Video/Audio
channel
Video/Audio
channel

A di Encoder
E
d
Audio

PAT

Video Encoder

PMT

Audio Encoder

CAT

Video Encoder
Audio Encoder

Null

Video
Audio
Video
Audio
Vid
Video
Audio

Video
Audio

MultiM
lti
plexer

Video Encoder
Audio Encoder
Video Encoder
MPEG-2 Transport Stream

An LG Electronics Company

Copyright 2009 Triveni Digital, Inc.

Page 12

MPEG--2 PSI Tables (Contd.)


MPEG
Decoder: Receiver or
Set top Box

WXXX Channel Video


PID 0x31 Program 1

WXXX Channel Audio


PID 0x34 Program 1

PSI via PID assignments and descriptors tells the decoder that these PIDS go

together
g
to make up
pap
program
g
An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 13

Transport Stream Demultiplexing

When a set top box first receives a Transport Stream, it


demultiplexes that stream based on PID

Decoder: Receiver or
set top box

Program
01 Video
Vid

Program
02 Video

Program
03 Video

PAT/PMT
/MPEG
Tables
T bl

An LG Electronics Company

PSIP
Tables

Program
02
Audio Program
Program
03 Audio
01 Audio
A di

Copyright 2011 Triveni Digital, Inc.

Page 14

Metadata

Data about included data is metadata


Metadata tells the decoder which kinds of information
are contained in each PID, and which PIDs go
together.

There are two kinds of Metadata


Program Specific Information (PSI) - Tables in the
stream defined in the MPEG standards
Program and System Information Protocol (PSIP) Tables defined in ATSC A/65

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 15

MPEG 101 Knowledge Check #1

Q: How manyy of what must the decoder


Q
see before it can begin decoding a digital
video stream ?

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 16

PSI Data In the Stream

An LG Electronics Company

PSI Tables (MPEG


(MPEG--2 Tables)

PAT - Program Association Table

Appears
pp
in PID 0x0000

The PAT iis on PID 0


Th
0x00.
00 Thi
This iis the
th first
fi t PID or Base
B
PID a
MPEG decoder looks for

Identifies MPEG-2 programs in transport stream and gives


PIDs for their PMTs

PMT - Program Map Table


bl

Identifies elementary streams in program (virtual


channel),
), and gives
g
their PIDs.

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 18

MPEG--2 PSI Tables (Contd.)


MPEG

PMT 1
Video PID 0x31
Audio PID 0x34
Audio PID 0x35
PCR_PID 0x31

PAT (always on PID 0x0)


Station TSID

PMT 2
PID 0x40

PMT 1 -> On PID 0x30


PMT 2 ->
> On PID 0x40
PMT 3 -> On PID 0x50

Video PID 0x41


Audio PID 0x44
Audio PID 0x45
PCR PID 0x41
PCR_PID

PMT 3
Video PID 0x51
Audio PID 0x54
Audio PID 0x55
PCR_PID 0x51

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 19

Graphical View of PAT/PMT

Elementary streams
found in this PMT

Descriptor
Defines
Additional
Stream
Characteristics

Elementary streams
found in this PMT

(PID 0x0000)
Program 2
PID for
PMT

Program 3
PID for
PMT
An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 20

MPEG--2 PSI Tables (Contd.)


MPEG
Decoder: Receiver or
Set top Box

WXXX Channel Video


PID 0x31

WXXX Channel Audio


PID 0x34

PSI
PID assignments
Th
These
PIDS go ttogether
th
An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 21

PSIP Data In the Stream

An LG Electronics Company

PSIP Background

Program and System Information Protocol


Metadata inserted into broadcast stream
Enables:

Tuning to virtual channels


Displaying channel name (on channel changes)
Interactive electronic program guides (EPGs)
Automatic language selection for audio track
Caption decoding
V-Chip
p function (parental
(p
content blocking)
g)
Accurate receiver time-of-day clock setting
Redistribution Control
An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 23

Basic functions of PSIP Tables

Brandingg Station call letters and channel number


Signaling V-Chip
V Chip data
data, information about audio and
Video PIDs, Virtual Channel Table

Announcement Electronic Program Guide (EPG)

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 24

Signaling vs Announcement

Signaling

Information about what is "on now"


Used to assemble program elements into whole

Provides linkages
Ex: PMT and/or VCT used to link different components of television
program (i.e. video and audio)

Used to define characteristics of current program (descriptors0

Captioning, ratings, redistribution

Announcement

Information about what will be available in the future


Program Guide information (name, description schedule)
Characteristics of future programs (captioning, ratings,
redistribution)
Typically does not provide linkages between program elements

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 25

PSIP Generation Architecture


Traffic/Program
System

Encoder(s)

Time
PSIP
Generator

Remote
e ote
GUI(s)
Automation
System

Listing
g
Service

Staging
Server

M
U
X

F
I
R
E
W
A
L
L

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 26

PSIP metadata found in the Payload


Noteworthy fields:
Payload contains PSIP, PAT, PMT metadata
PSIP
metadata
found in the
packet
Payload
Payload

MPEG-2 Transport Stream


H d (4 B
Header
Bytes)
t )

Sync
Byte

PID

188 Bytes
Continuity
Counter

Adaptation
Adaptation
Field
Field
(Optional)

An LG Electronics Company

PES 1
x

Or other Payload (Pat, PMT, PSIP,


etc)...

Copyright 2011 Triveni Digital, Inc.

Page 27

ATSC PSIP Tables

MGT - Master Guide Table


Interval: 150ms
- Appears in PID 0x1FFB.
- Gives PIDs, sizes, and version numbers of other PSIP
tables (except STT). A directory of all PSIP tables.

STT - System
S t
Ti
Time Table
T bl
- Appears in PID 0x1FFB
- Gives current UTC time.

VCT - Virtual Channel Table Interval: 400ms


- Identifies and describes virtual channels
channels.

An LG Electronics Company

I t
Interval:
l 1
1,000ms
000
(1 sec))

Copyright 2011 Triveni Digital, Inc.

Page 28

ATSC PSIP Tables (Contd.)

RRT- Rating Region Table

Interval: 60,000ms (1 min)


- Describes content advisory system(s) being used to rate
events.

EIT - Event Information Table

EIT has variable intervals:


EITEIT-0: 500ms
EITEIT-1: 3,000ms
EIT
EIT--2 & up:
p 60,000ms
,

- Gives titles, start times, durations, content advisory


ratings of events (TV programs).

ETT - Extended Text Table

Interval: Follows its EIT


- Gives extended textual descriptions of virtual channels
and events.

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 29

PIDs in the Stream

PAT
PAT
points
points
to to
PMT
PMT

PSIP
metadata
tables: VCT,
MGT, STT,
EITs & ETTs

An LG Electronics Company

Page 30

Details of FCC R&O PSIP related

"fully implement PSIP to the extent that ATSC A/65B


requires."

Required transmission of all mandatory tables and descriptors

MGT, TVCT, EIT-03, STT, RRT (except region 1)

Required tables and descriptors must be populated


with
ith proper and
d correctt information
i f
ti

At least 12 hours of populated EITs

(EIT-0 thru 3)

EITs must contain correct schedule information


Each EIT contains 3 hours worth of event information

Major
j channel rules from PSIP ((A/65B)
/
) adopted
p
Correct Major Channel number must be used
Correct TSIDs (Transport Stream ID) must be used
An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 31

VCT -- Virtual Channel Concept

Breaks the link between RF channel number and users


notion of channel number

Analog broadcast channel number was the same as the


RF carrier designation

Digital broadcast channel


channel number
number is defined by Virtual
Channel Table (VCT)

One digital TS can include multiple channels of


programming
i

8-VSB carrier freq. may have (probably) shifted during


transition (June 2009)

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 32

VCT: Two Part Channel Numbers

1st part: major channel (Original analog channel)


2nd part: minor channel
Broadcasters retain their brand identity

Digital services groupable with analog


KZZZ has been associated with Channel 7 for years; KZZZ-DT
can be found on Channel 7-1

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 33

Virtual Channel Table (VCT)

Has same info as PAT & PMTs, plus more.


Allows tuning by virtual major-minor channel number,
rather
th th
than physical
h i l channel
h
l number
b and
d MPEG-2
MPEG 2
program number.

Allows language track selection.


selection
Allows channel name to be displayed on channel
changes
g and in EPG.

ATSC receivers are designed to use VCT; may have


trouble with PAT and PMTs alone.

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 34

Comparing PAT vs. VCT


PAT (Program
(P
Association
A
i ti Table)
T bl )
Table ID
Section Syntax Indicator
Section Length
Transport
p
Stream ID (TSID)
(
)
Version Number
Current Next Indicator
Section Number
Last Section Number
Program Number
Program Map PID

An LG Electronics Company

VCT (Virtual
(Vi t al Channel Table)
Table ID
Section Syntax Indicator
Section Length
Transport
p
Stream ID (TSID)
(
)
Version Number
Current Next Indicator
Section Number
Last Section Number
ATSC protocol version
Number of Channels in Section
Short Name
Major Channel Number
Minor Channel Number
Modulation Mode
Channel TSID
Program Number
Extended Text Message Location
Descriptor Length
Descriptor ( )
Source ID
Service Type
Access Controlled
Hidd / Hide
Hidden
Hid Guide
G id
Copyright 2011 Triveni Digital, Inc.

Page 35

Virtual Channel Table (VCT)

(PID 0x1FFB)

Virtual Channel
Short
Sh t Channel
Ch
lN
Name
Major Channel Number
Minor Channel Number
Modulation Mode
Frequency
F
TS ID (of Virtual Channel)
Program Number (in Stream)
Extended Text Location
Access
A
Controlled
C t ll d ?
Hidden ? Hide from Guide?
Service Type (A/V/D)
Source ID
Service
S i L
Location
ti Descr
D
other descriptors

An LG Electronics Company

Video Stream
Eng Audio Stream
Fre Audio Stream

Copyright 2011 Triveni Digital, Inc.

Page 36

PSIP and PSI Link


Table Information for a
Television Broadcast Stream
PAT
(On PID 0x0)

PMT 1
(On PID 0x30)

Station TSID

Video PID 0x31


Audio PID 0x34
PCR_PID 0x31

PMT 1 -> On PID 0x30

PAT and PMT Tables

An LG Electronics Company

VCT
On Pid 0x1FFB
4-1
WXXX
Video PID 0x31
Audio PID 0x34

PSIP table

Copyright 2011 Triveni Digital, Inc.

Page 37

Continuity Counter

An LG Electronics Company

MPEG 101 Knowledge Check #2

Q: Name two tables found in PSI


metadata

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 39

MPEG Header: Continuity Counter

The continuity counter is a 4 bit field in the header


which increments by 1 each time a packet comes out
on a specific PID:
All Packets PID 0x52
0

14

15

When a PID skips one value of the continuity Counter,


we call it a Continuity Error. This means one or more
packets were lost.
Continuity
Error Here

All Packets PID 0x54


0

10

An LG Electronics Company

11

Copyright 2011 Triveni Digital, Inc.

Page 40

MPEG Header: Continuity Counter (Contd.)

Identifies WHEN we lose


Packets, but not HOW MANY!

Packet loss causes many other kinds of analysis to reset or give


bogus results.

Any analysis based on an average over many packets will


automatically reset when it encounters continuity problems.

Since a continuity error mean some


some packets
packets have been lost,
frequent continuity errors should be one of the FIRST things you
look for when debugging.

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 41

Three Things to Remember

Three main monitoring and troubleshooting lessons:

Fix Continuity Problems first

C ti it errors create
Continuity
t b
bogus alarms
l
iin other
th areas.
Until you resolve the continuity problems, it will be very hard to
determine if you have other problems in your stream

To Be Discussed
To Be Discussed

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 42

MPEG 101 Knowledge Check #3

Q: If the continuity counter on a


given PID changes from 3 to 7, how
many packets have been lost?

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 43

Elementary
y streams:
Encoding Video & Audio
Data

An LG Electronics Company

MPEG--2 / MPEGMPEG
MPEG-4 Video Compression

Digital Compression starts at the MPEG encoder

MPEG2 or MPEG4 CODECS can be carried in an MPEG2 Transport Stream

The encoder filters noise in the input signal and:


compresses baseband video & audio OR
uncompressed digitized video/audio/data (SDI)

Video and Audio elements are encoded into a sequence of frames

A frame is a single image from a video or audio sequence

In most countries,, one frame occurs everyy 33 milliseconds

Each frame is encoded in one of three ways:

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 45

MPEG--2 Video/Audio Encoding


MPEG

I Frames
I-picture: intra-picture encoding, similar to jpeg encoding
(exploiting spatial redundancy).

Compressed solely on information found in the frame


Highest amount of data of all other frame types
Group
Group Of Pictures
Pictures always start with an I frame
B & P frames are calculated from the I frame
I stands for Intra coded

An LG Electronics Company

Copyright 2011Triveni Digital, Inc.

Page 46

MPEG--2 Video/Audio Encoding


MPEG

B Frames
B-picture: bi-directional encoding, using motion adjusted

deltas from a previous and a future frame (exploiting temporal


redundancy).
redundancy)

Uses Data from preceding and following I & P frames


Depends
p d on
o data
da a before
b o and/or
a d/o after
a
in video
d o sequence
qu
Cannot calculate from another B frame

An LG Electronics Company

Copyright 2009 Triveni Digital, Inc.

Page 47

MPEG--2 Video/Audio Encoding


MPEG

P Frames
P-picture: predictive encoding, using motion adjusted deltas
from a p
previous reference frame (exploiting
( p
g temporal
p
redundancy).

Compressed using data from closest preceding I or P frame


GOP with
ith b
back-to-back
k t b k P frames
f
usually
ll indicate
i di t fast
f t motion
ti

An LG Electronics Company

Copyright 2009 Triveni Digital, Inc.

Page 48

MPEG--2 Video/Audio Encoding


MPEG

Encoder emits sequence of encoded frames


Sizes of encoded frames varyy
Encoded frames are packed into packetized
elementary stream (PES) packets.

PES packets are packed into MPEG-2 transport packets


(All packets for single video stream have same PID
value)

Overall compression ratio is 50:1 or more


Closed
Cl
d captioning
ti i associated
i t d with
ith video
id frame
f
is
i
encoded here

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 49

MPEG-2 Elementary Stream


PTS DTS

PES
Header

PES Packet
Payload

PES
Header

Only PTS on Audio PES


packet

PES Packet
Payload

PES
Header

PES Packet
Payload

MPEG-2 Elementary Stream

Header (4 Bytes)

Sync
Byte

PID

188 Bytes
Continuity
Counter

Adaptation Field on Video Length


PIDs Only

Adaptation
Adaptation
Field
Field
(Optional)

Flags

PES 1
x

Optional
Fields

Or other Payload (Pat, PMT, PSIP,


etc)...

Stuffing
Bytes

PCR

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 50

MPEG--2 Video/Audio Encoding


MPEG

Group of Pictures = GOP

Series of frames consisting of a single I frame with P & B frames

All frames within the GOP depend directly or indirectly on data from
the I frame

Relationships between GOPs: Either OPEN or CLOSED

A GOP begins
g
with an I frame and ends with last frame before the
next I frame

Closed GOP is self-contained. No dependance on data outside GOP


Open GOP can use data from I frame of following GOP

An LG Electronics Company

Copyright 2009 Triveni Digital, Inc.

Page 51

MPEG--2 Video/Audio Encoding (Contd.)


MPEG
Example 1. Panning Camera
I-picture

B-picture

I-picture

B-picture

I-picture

Example 2. Moving Object


I-picture

An LG Electronics Company

Copyright 2009 Triveni Digital, Inc.

Page 52

MPEG--2 Video/Audio Encoding


MPEG

T i l GOP Structures
Typical
S
I Frame
216.6 Kb

B Frame
49 9 Kb
49.9

B B

P B

B P B B P B

P Frame
83.45 Kb

B P B B P B

B P B B

Typical low motion GOP sequence


I Frame
183.2 Kb

P Frame
59.9 Kb

P P

P P

P P

P P P

P P

P Frame
44.5 Kb

P P P P

P P

P P

P P

Typical high motion GOP sequence


An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 53

ATSC/SCTE Audio Formats

ATSC uses AC-3 audio encoding, with up to 6 audio


channels: left, right, center, left surround, right
surround, low frequency enhancement.

The full set is often called 5.1 audio.


The sampling rate is always 48 kHz.
kHz
The encoded bit rate may be up to 384 kbps.

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 54

AC
AC--3 Audio Encoding

Audio frames, each 32 milliseconds in length, are


encoded.

Encoded
E
d d frame
f
size
i depends
d
d only
l on bitrate.
bit t
Encoded frames are packed into packetized
elementary stream (PES) packets.
packets

PES packets are packed into MPEG-2 transport packets.


( packets
(All
p
for single
g audio stream have same PID
value.)

An LG Electronics Company

Copyright 2009 Triveni Digital, Inc.

Page 55

MPEG 101 Knowledge Check #4

Q: In MPEG
MPEG--2 video encoding, what
are the three video frame types
called?

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 56

Video
deo and
a d Audio
ud o
Syncronization using
PCR

An LG Electronics Company

Audio--Video Synchronization
Audio

Audio,, video are encoded independently,


p
y, must be
synchronized during play

MPEG has to allow for great distances AND network

processing between the Encoder and Decoder and still


allow for Correct Decode of the transport stream

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 58

How to Assure Audio/Video Sync?

In order for the audio and video Elementary Streams to


remain in Sync,
Sync the Encoder Clock and the Decoder
Clock must remain in sync

The next few slides will demonstrate how this happens


and what components to check when it fails

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 59

Encoder Inserts PCR

When the encoder streams creates packets, it embeds


the current value of its 27 MHz clock into the stream

This
Thi time
ti
reference
f
is
i called
ll d the
th PCR:
PCR Program
P
Cl
Clock
k
Reference

MPEG demands that one PCR packet appear in the


stream every 100ms

Encoder
27Mhz Clock

MPEG Packets

MPEG
Packet with
PCR Stamp

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 60

The Encoder and Decoder Clock

The MPEG encoder and MPEG decoder use a 27Mhz


clock to encode/decode incoming audio and video

The clock
Th
l k iis actually
t ll a counter

t which
hi h advances
d
every
1/27000000 seconds
Encoder

Decoder

27Mhz Clock

27Mhz Clock

1,2,3,4..

1234
1,2,3,4..

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 61

The Encoder and Decoder Clock

The MPEG encoder and MPEG decoder use a 27Mhz


clock to encode/decode incoming audio and video

The
Th clock
l k iis actually
t ll a counter

t which
hi h advances
d
every
1/27000000 seconds
Encoder

Decoder

27Mhz Clock

27Mhz Clock

1,2,3,4..

1234
1,2,3,4..

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 62

The Encoder and Decoder Clock

The MPEG encoder and MPEG decoder use a 27Mhz


clock to encode/decode incoming audio and video

The
Th clock
l k iis actually
t ll a counter

t which
hi h advances
d
every
1/27000000 seconds

Decoder

Encoder
27Mhz Clock

Massive
Network
Processing

1,2,3,4..

An LG Electronics Company

27Mhz Clock

1234
1,2,3,4..

Copyright 2011 Triveni Digital, Inc.

Page 63

PCR Timestamp Issue

What could conceptually cause PCR timestamp issues?

E
Encoder
d possibly
ibl time
i
stamped
d incorrectly
i
l

Decoder possibly failed to consume time stamps

PCR packet was accidentally lost in transmission

When PCR time stamps


p go
g awry,
y, we have PCR jjitter

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 64

PCR Jitter Defined


PCR Jitter is:

Difference between
the Actual Value of the PCR time stamped by
encoder
and
the Expected
th
E
t d Value
V l off the
th PCR as calculated
l l t d by
b
decoder based on the clock rate and the time
at which the PCR value is received.
received

PCR Jitter spec:

500ns

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 65

PCR Rate (Frequency) Offset


PCR Frequency Offset is:

Difference between
the clock frequency calculated at decoder
based on actual PCR values received
and
an ideal
id l 27 MHz
MH clock,
l k which
hi h is
i the
th clock
l k rate
t
dictated by the MPEG-2 standard

PCR Frequency Offset Spec:


An LG Electronics Company

+/- 810 Hz
Copyright 2011 Triveni Digital, Inc.

Page 66

PCR Intervals, Jitter and Rate


PCR spec summary:

Transmit interval: 100 ms


Jitter: no more than 500 ns
Rate: 27 MHz +/- 810 Hz
Most
o streams
a
seen in the field
d are
a compliant,
o p a , but
bu everyy
now and then extreme jitter shows up.

Heres Why
An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 67

PCR Packet Spacing Before Muxing

Note the Number of Packets between each PCR packet


in each Input Stream
Video 0x31

PID
Video 0x41

Video 0x51

Packet
Spacing

0x31

2 Packets

0x41

1 Packet

0x51

0 Packets

An LG Electronics Company

Transport
Stream
MUX

Copyright 2011 Triveni Digital, Inc.

Page 68

PCR Packet Spacing After Muxing

Note that the PCR packet spacing has changed!


Video 0x31

Video 0x41

Video 0x51

Transport
Stream
MUX

PID

Old Spacing

New Spacing

0x31

2 Packets

8 Packets

0x41

1 Packet

5 Packets

0x51

0 Packets

2 Packets

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 69

Muxing Causes PCR Jitter

When we MUX multiple streams together, the


spacing between the PCR packets in each
stream CHANGES

The physical shift results in a TEMPORAL shift


as well, throwing the time stamps off

The TEMPORAL shift in PCR values is referred


to as PCR jitter

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 70

Muxing Causes PCR Jitter (Contd.)

The MUX has to RESTAMP all the PCR values


to correct for the change in the packet
spacing THIS IS VERY HARD TO DO

The more services on the output, the harder it is to


restamp

The fewer null


null packets at the output
output, the harder it
is to restamp

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 71

PCR Timestamp Issue (Contd.)

What in your network facility could cause PCR


timestamp issues?

Three
Th
off the
th mostt common are:

It can happen any time you MUX streams

It can happen on any IP link due to network lag

It can happen
pp
at the source encoding
g

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 72

PCR Jitter From Incorrect Encoding

If the MPEG encoders parameters are set up

incorrectly, you can introduce jitter at the source

This
Thi is
i relatively
l ti l rare, however
h

If a national programmer sent its stream up to the bird with


jjitter in it,, the result would effect all receive sites !

Re-encoded streams at the headend may also create PCR jitter


Local broadcast streams could create PCR jitter at the encoder

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 73

PCR Timestamp Issue (Contd.)

What in your network facility could cause PCR


timestamp issues?

Three
Th
off the
th mostt common are:

It can happen any time you MUX streams

It can happen
pp at the source encoding
g

lag

It can happen on any IP link due to network

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 74

PCR Jitter Due to IP Carriage

Network lag can conceal MPEG jitter problems on an IP


link. The network jitter is usually so much larger than
the PCR jitter that the PCR jitter is lost
lost in the noise.
noise.

Hopefully, the IP-ASI or IP-QAM edge device will

provide
id buffering
b ff i and
d use high
hi h level
l
l math
th to
t smooth
th
out the network lag.

MT-40 provides a way to separate the Network Lag


from PCR Jitter.

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 75

MPEG 101 Knowledge Check #5

Q: What is the key element for


keeping the Encoder and Decoder in
time sync?

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 76

Video and Audio Buffers


& Presentation Time
Stamp (PTS)

An LG Electronics Company

Presentation Time Stamp - PTS

Each Frame is marked with a PTS Presentation Time


Stamp a positive number

Th
l off th
l off th
d
The value
the PTS iis sett tto th
the value
the E
Encoder
Clock when the frame is encoded
Encoder
27Mhz Clock

MPEG Packets

1,2,3,4..
F1
PTS
500

F2
PTS
950

Packetizer

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 78

Packets Assigned to Decode Buffer

As packets flow into the Decoder, a space in memory is


set aside for them, one buffer for each PID.
Decoder
27Mhz Clock
MPEG Packets

1,2,3,4..
Buffer 1 Pid 0x31 Video

Buffer 2 Pid 0x34 Audio

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 79

Reconstruction of Frames From Buffer

Packets form Video and Audio Frames in the buffer


Decoder
27Mhz Clock
MPEG Packets

1,2,3,4..
Buffer 1 Pid 0x31 Video
F1
PTS
500

F2
PTS
675

F3
PTS
950

Buffer 2 Pid 0x34 Audio


F1
PTS
200

An LG Electronics Company

F2
PTS
990

Copyright 2011 Triveni Digital, Inc.

Page 80

The Magic of Decode

When the value of the Decode clock MATCHES the PTS


on the frame, that frame is sent to the decode
hardware
Decoder

Decode
Hardware

27Mhz Clock
MPEG Packets

F1
PTS
200

= 200
Buffer 1 Pid 0x31 Video
F1
PTS
500

F2
PTS
675

F3
PTS
950

Buffer 2 Pid 0x34 Audio


F2
PTS
990

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 81

Another Frame Goes to Decode Hardware

Next Frame
Decoder

Decode
Hardware

27Mhz Clock
MPEG Packets

F1
PTS
500

= 500
Buffer 1 Pid 0x31 Video
F2
PTS
675

F3
PTS
950

Buffer 2 Pid 0x34 Audio


F2
PTS
990

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 82

One More Frame Heads to Decode

And the next frame


Decoder

Decode
Hardware

27Mhz Clock
MPEG Packets

F2
PTS
675

= 675
Buffer 1 Pid 0x31 Video
F3
PTS
950
Buffer 2 Pid 0x34 Audio
F2
PTS
990

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 83

Audio and Video Buffers

Receiver must buffer audio and video frame data until


presentation time.

If data
d t appears too
t llate
t iin th
the ttransportt stream,
t
b ff
buffer
underflow results.

If data appears too early in the transport stream


stream,
buffer overflow results.

Either condition results in ggarbled play


p y or incorrect
synchronization.

Different set top boxes may respond differently to the


same underlying buffer violations

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 84

Summary: Audio/Video Sync

PCR values help the Encoder Clock and the Decoder


Clock to remain in sync

PCR jitter
jitt can cause synchronization
h i ti problems
bl
for
f
elementary streams

Ensure

PCR jitter and frequency offsets are within standard limits


Elementaryy stream buffers limits are NOT violated

Large PCR jitter values can cause Lip sync error


Buffer overover or underflow problems may cause tiling,
tiling ,
pixelization/macroblocking errors

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 85

MPEG 101 Knowledge Check #6

Q: What is one potential result of


video buffer underflow ?

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 86

Three Things to Remember

Three main monitoring and troubleshooting lessons:

Fix Continuity Problems first

C ti it errors create
Continuity
t b
bogus alarms
l
iin other
th areas
Until you resolve the continuity problems, it will be very hard to
determine if you have other problems in your stream

Check for PCR jitter

PCR jitter can cause packet over- or underflow problems


Lip synch errors may also be result of PCR jitter

To Be Discussed

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 87

MPEG Troubleshooting
T
bl h ti
using
g the MTMT-40

An LG Electronics Company

Why Transport Stream Analyzer?

With analog transmission, if audio/video did not have


any anomalies on a TV set up in the studio, it would
show up intact on the end user
userss TV

For digital transmission, this assumption is NOT valid


as digital
di it l signals
i
l rely
l on the
th decoders
d
d

Firmware implementation
Buffer sizes
Software decoding capability

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 89

Why Transport Stream Analyzer? (Contd.)

The transition to digital has introduced some specific


challenges for broadcast engineers

Not all Set top boxes will respond the same way to the same
underlying problem
Standards violations in digital Transport Streams may show up on a
receiver
i
only
l iintermittently
t
itt tl

The only streams which will consistently decode are


those which are compliant
p

The best way to assure compliance is with a Transport


stream Analyzer/Monitor

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 90

Troubleshooting Example Audio Outage

Customer calls into station or NOC audio dropping out on their set
In station video monitors & set top boxes do not have any problems
How serious is this problem?

Are other Customers seeing it?

Encoders
Encoders
Encoders
Encoders

QPSK

Satellite
Dish

Satellite
Receivers
R
S i lli
Satellite
Satellite
Receivers
Receivers

MUX

Network
Processing

QAM
Modulator
Digital to
Analog Mod

PSIP Gen
Data Gen

Cable TV Scenario

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 91

Troubleshooting Example (Contd.)

Start at the end..Off-air or combined RF output.


Encoders
Encoders
Encoders
Encoders

QPSK

Satellite
Dish

Satellite
Receivers
R
S i t llit
Satellite
Satellite
Receivers
Receivers

ASI

ASI

MUX

ASI

Network
Processing

Gigabit-IP

QAM
Modulator

ASI

PSIP Gen
Data Gen

Digital to
Analog Mod

Cable TV Scenario

Transport Stream
Analyzer

An LG Electronics Company

RF Input (8VSB or QAM)

Copyright 2011 Triveni Digital, Inc.

Page 92

Troubleshooting Example (Contd.)

Check of the MPEG analyzer shows Standards violation has occurred

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 93

Troubleshooting Example (Contd.)

Move back in the network toward the beginning....


Input to the QAM modulator
Encoders
Encoders
Encoders
Encoders

QPSK

Satellite
Dish

Satellite
R Satellite
Receivers
S i t llit
Satellite
Receivers
Receivers

ASI
Gigabit-IP
ASI

MUX

ASI

Network
Processing

QAM
Modulator
Digital to
Analog Mod

ASI

PSIP Gen

Gigabit
Ethernet
Input

Data Gen

Transport Stream
Analyzer

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 94

Troubleshooting Example (Contd.)

Standards violation is still present

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 95

Troubleshooting Example (Contd.)


Move further back..
Encoders
Encoders
Encoders
Encoders

QPSK

Satellite
Dish

Satellite
Receivers
R
S i t llit
Satellite
Satellite
Receivers
Receivers

ASI

ASI

MUX

ASI

Network
Processing

Gigabit-IP

QAM
Modulator

ASI

PSIP Gen

Digital to
Analog Mod

ASI
Input

Data Gen

Transport Stream
Analyzer

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 96

Troubleshooting Example (Contd.)

Standards violation is still present

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 97

Troubleshooting Example (Contd.)


And further back..
Encoders
Encoders
Encoders
Encoders

QPSK

Satellite
Dish

Satellite
Receivers
R
S i t llit
Satellite
Satellite
Receivers
Receivers

ASI

ASI

MUX

ASI

Network
Processing

Gigabit-IP

ASI

PSIP Gen

ASI
Input

Data Gen

QAM
Modulator
Digital to
Analog Mod

Cable TV Scenario

Transport Stream
Analyzer

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 98

Troubleshooting Example (Contd.)


Using record capability to collect data..
Encoders
Encoders
Encoders
Encoders

QPSK

Satellite
Dish

Satellite
Receivers
R
S i t llit
Satellite
Satellite
Receivers
Receivers

ASI

ASI

MUX

ASI

Network
Processing

Gigabit-IP

Digital to
Analog Mod

ASI

PSIP Gen

QAM
Modulator

Data Gen
Record at
this point

Record at
this point

Cable TV Scenario

Transport Stream
Analyzer

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 99

Summary: MPEG Monitoring Over the Long Term


Complete and continous monitoring..
Encoders
Encoders
Encoders
Encoders

QPSK

Satellite
Dish

Satellite
Receivers
R
S i t llit
Satellite
Satellite
Receivers
Receivers

Analyze, Monitor or
Record Streams at any Broadcast Scenario
of these points
Gigabit-IP,
ASI or
SMPTE 310

ASI

ASI

MUX

ASI

Network
Processing
Gigabit-IP

ASI

PSIP Gen

Television
Transmitter

QAM
Modulator

Data Gen

Digital to
Analog Mod

Cable TV Scenario
Error Alerts:
SNMP,
SMS,
E-Mail,
Triggered Recording or
Contact Closure

Error
Notification

Transport Stream
Analyzer or
Remote Monitor

An LG Electronics Company

RF Input (8VSB or QAM)

Copyright 2011 Triveni Digital, Inc.

Page 100

Three Things to Remember

Three main monitoring and troubleshooting lessons:

Fix Continuity Problems first

C ti it errors create
Continuity
t b
bogus alarms
l
iin other
th areas
Until you resolve the continuity problems, it will be very hard to
determine if you have other problems in your stream

Check for PCR jitter

PCR jitter can cause packet over- or underflow problems


Lip synch errors may also be result of PCR jitter

Move Backward through your network as you debug

Isolate the offending device first, then go for detailed problem


solving
l i steps
t
(recording
(
di a file,
fil etc.)
t )

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 101

Summary: MPEGs 7 Basic Parameters


Per ATSC standards:

PAT
PMT
PCR

Interval:

100ms

Interval:

400ms

Interval:

100ms

Max

Jitter:

500ns

Max Freq. Offset: +/- 810 Hz


Also check:
Video Buffer
Audio Buffer

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 102

References

Information Technology -- Generic Coding of Moving Pictures and


Associated Audio Information: Systems (MPEG-2 Systems
), ISO/IEC
/
13818-1.
standard),

ATSC Digital Television Standard, ATSC Doc. A/53.

ATSC Data Broadcast Standard, ATSC Doc. A/90.

Program and System Information Protocol for Terrestrial


Broadcast
d
and
d Cable
bl , ATSC Doc. A/65
/ ((with
h amendments).
d
)
ATSC A/78 Recommended Practice on Bitstream Verification.
Verification
Video Over IP by Wes Simpson available SCTE bookstore.

An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 103

In the Caribbean:

Mario Sebastiani
msebastiani@incospec.com
@
p
Bernard How
bhow@incospec.com

IIs our Value


V l Add
Added
dR
Re-seller
ll iin th
the
Caribbean for Triveni Digital products
Stream Scope:
p
MT-40 MPEG analyzer
RM-40 MPEG monitor
GuideBuilder PSIP metadata generator
GuideBuilder SI -- metadata generator
GuideBuilder-SI
An LG Electronics Company

Copyright 2011 Triveni Digital, Inc.

Page 104

Thank you-Gracias-Merci-Danki

Caribbean Cable Television Association


San Juan, Puerto Rico
August 17, 2011

MPEG 101
Transport Stream Demystification

An LG Electronics Company

S-ar putea să vă placă și