Skip to main content

πŸ“ PES Length Validation

PES_packet_length should match the observed number of bytes in the PES packet after the length field.

What it checks​

The checker compares the declared PES_packet_length value with the observed PES byte span collected from transport packets on the same PID.

βœ… Pass condition​

The test passes when all parsed non-zero PES_packet_length values match the observed PES size.

❌ Fail condition​

The test fails when one or more PES packets declare a length that does not match the observed packet size.

note

Important note

Many video PES packets use PES_packet_length = 0, which means the PES continues until the next PES start on the same PID.

For this validation to fail, the injected value must remain parseable as a real PES length. Very small replacements such as 1, 2, 3, or 4 may be ignored by the PES parser because they are smaller than the minimum header size implied by the optional PES fields. In that case, the analyzer still sees PacketLength = 0, so the packet is skipped by this validation.

Example​

The chart below shows PES length validation errors detected in the test asset.

PES length validation chart

Test file​

  • mpegts-pes-length.ts

Injected packets in the current test asset:

  • Packet 238: PID=0x0100 stream_id=0xE0 PES_packet_length 0 -> 9
  • Packet 489: PID=0x0100 stream_id=0xE0 PES_packet_length 0 -> 10
  • Packet 752: PID=0x0100 stream_id=0xE0 PES_packet_length 0 -> 11
  • Packet 1026: PID=0x0100 stream_id=0xE0 PES_packet_length 0 -> 12