Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPEG Transport Stream Continuity Counters [closed]

I am troubleshooting an IPTV Layer 3 multicast VPN across a 10GB MPLS network.

Only certain HD channels are experiencing severe freezing and tiling; all other SD and HD channels work fine. Our IPTV video monitoring equipment is detecting and reporting packet loss by monitoring a continuity counter. I have asked every equipment vendor we have and read every .pdf I can find and no one seems to know exactly:

  1. How/when/where an MPEG transport stream continuity counter fits into a transport stream ?
  2. What packets/frames in the transport stream are being counted?
  3. Why does the reported packet loss seem to occur in increments of 16 (0, 16, 32) ?
  4. How can there be an error condition with 0 packet loss ?
  5. How/when/where does the PCR value fit into the transport stream ?
like image 725
user2689780 Avatar asked Jun 19 '14 15:06

user2689780


People also ask

What causes continuity counter errors?

Continuity count error: This error occurs when any of the following faults happen — incorrect packet order, a packet occurs more than twice or a packet is lost.

What is continuity counter?

Simply put 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. When a PID “skips” one value of the continuity Counter, we call it a 'Continuity Error. ' This means one or more packets were lost.

How does MPEG TS work?

Mpeg2 TS is a container. Containers hold one or more audio/video streams and also contain the metadata describing how this data (the mutltimedia streams) are stored in the file. Containers greatly simplify the display application by way of interleaving, synchronisation, inter alia.

What is PCR MPEG?

PCR= Program Clock Reference, it is a master clock running at the encoder and used by decoder to sync with the encoder while decoding. Every Program Stream in the MPEG may have its own master clock called STC.


1 Answers

That's a lot of questions ! Let's clarify a bit:

  1. Continuity Counter (CC) is carried in the header of every Transport Packet (TP) of the Transport Stream (TS).
  2. Every TP also has a packet identifier (PID) in the header. Every PID has its own CC. The CC for any given PID is incremented every time the TP has a payload according wikipedia but I think it is actually incremented on every new TP... [EDIT]: CC is only incremented when the payload flag is true (cf Mike Reedel comment below)
  3. Actually since the CC is on 4 bits the value should go from 0x0 to 0xF then start over at 0x0.
  4. Some people are careless about the standards, it can happen that during the multiplexing of the TS that the CC is not correctly incremented: in this case you didn't lose any packet but because the CC is broken, your tool is reporting an error. However the error can happen anywhere during the transmission of the TS, including the monitoring tool that might not sample at the correct rate.
  5. Program Clock Reference (PCR) is a timestamp that is regularly inserted in the TS to provide an accurate 27 Mhz clock to the decoder. It should be repeated every 40ms according to the standards. There is no obligation about the PID carrying the PCR but most of the time it is the Video PID: you need to look at the PMT to find out on which PID the PCR is.

Some references:

  • Wikipedia
  • ETSI TR 101 290
  • Tektronix CC FAQ
  • ISO 13818-1
like image 194
n0p Avatar answered Oct 08 '22 05:10

n0p