MPEG Transport Stream Continuity Counters

user2689780 picture user2689780 · Jun 19, 2014 · Viewed 15.2k times · Source

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 ?

Answer

n0p picture n0p · Jul 16, 2014

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: