MPEG TS Error Detection in StanagProcessor
StanagProcessor includes functionality to monitor and diagnose MPEG Transport Stream (MPEG TS) data by detecting various types of stream errors. This manual explains the specific errors that StanagProcessor can detect, along with the methods used for their detection.
StanagProcessor shows counters for the total number of errors as well as dynamic metrics for a predefined time period (30 seconds by default). This provides a more real-time view of stream health, allowing operators to quickly identify transient issues or patterns in errors that may not be evident from the total counters alone.
Stream bitrate chart
StanagProcessor includes a default chart that visualizes the stream bitrate as a stacked area chart, where each MPEG TS PID (Packet Identifier) is represented with its respective bitrate.
The chart also includes the total values for Continuity Errors, PCR Out of Order, PTS Out of Order, and Transport Stream Indicator Errors. These metrics are displayed alongside the bitrate data to give operators a holistic view of stream performance, combining bitrate visualization with error tracking.
This chart provides a comprehensive visualization of the bitrate distribution across different PIDs in the MPEG TS stream. Each area in the chart corresponds to the bitrate associated with a particular PID, allowing operators to easily identify the bitrate distribution of each stream component over time, as well as the presence or absence of elementary stream packets.
Continuity Errors
Description: Continuity errors occur when there is a break in the sequence of packets in an MPEG TS stream. Each TS packet contains a 4-bit continuity error indicates a packet drop, reordering, or repetition. It can also occur if the stream is restarted. Continuity counter increments with each subsequent packet having the same PID (Packet Identifier).
Detection Method: StanagProcessor checks the continuity counter of every incoming TS packet for each PID. The continuity counter is expected to increase sequentially for consecutive packets (modulus 16). If the counter does not increment as expected, a continuity error is recorded. These errors usually indicate packet loss, reordering or duplication, and they can disrupt the decoding of video, audio or data streams.
PCR Out of Order
Description: The Program Clock Reference (PCR) is used to synchronize the decoding and presentation of MPEG TS streams. PCR values should always be increasing over time. If PCR values regress (i.e., a newer packet has a lower PCR value than a preceding one), it is considered an out-of-order PCR.
A PCR Out of Order error indicates packet reordering, duplication, or a stream switch/restart.
Detection Method: StanagProcessor examines the PCR values extracted from the adaptation fields of TS packets. For each PID carrying PCR, the processor ensures that the PCR values are monotonically increasing. If a lower PCR value is detected after a higher one, an "out-of-order" condition is flagged.
PCR Discontinuity Error
Happens when sequential PCR values differ by more than 100 milliseconds without the discontinuity_indicator flag being set.
PTS Out of Order
Description: The Presentation Time Stamp (PTS) determines when a particular frame should be presented during playback. PTS values should generally increase (in streams without B-frames). A regression in PTS values can lead to frames being dropped.
Detection Method: StanagProcessor monitors PTS values from the PES (Packetized Elementary Stream) headers of the TS packets. For streams without B-frames, PTS values should always increase sequentially. If a PTS value is lower than a previously detected value, an out-of-order PTS error is logged. This error typically results in frames being dropped, shown out of sequence, which may cause playback glitches.
Note: If the stream contains B-frames, PTS values will appear out of order due to frame reordering. This behavior is perfectly normal and does not indicate an error.
Transport Error Indicator (TEI)
Description: Transport Stream errors are indicators of issues during transmission. These errors are flagged in the TS packet header by the Transport Error Indicator bit. If this bit is set, it indicates that the packet contains an error and may not be reliable for decoding.
For example, it is set when a demodulator cannot correct errors from Forward Error Correction (FEC) data, signaling that the packet is corrupt.
Detection Method: StanagProcessor checks the Transport Error Indicator bit in the header of every TS packet. If the bit is set, it increments the Total Transport Stream Errors counter. These errors often arise from issues like signal degradation or data corruption during transmission, potentially impacting the quality of the received stream.
Summary
The MPEG TS stream errors detected by StanagProcessor are crucial for ensuring the reliability of video, audio and data transmission. By monitoring continuity counters, PCR values, PTS values, and transport stream error indicators, StanagProcessor provides a comprehensive view of stream health, helping to identify and troubleshoot issues that could affect playback quality.
- Total Continuity Errors: Detects sequence breaks in packet continuity.
- Total PCR Out of Order: Detects regressions in Program Clock Reference values.
- Total PTS Out of Order: Detects regressions in Presentation Time Stamp values (if no B-frames are present).
- Total Transport Error Indicator: Detects packets marked as containing errors.
These metrics help maintain stream integrity and ensure smooth playback, which is particularly important for applications like live broadcasts and mission-critical video feeds.