π 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.
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.

Test fileβ
mpegts-pes-length.ts
Injected packets in the current test asset:
- Packet 238:
PID=0x0100stream_id=0xE0PES_packet_length 0 -> 9 - Packet 489:
PID=0x0100stream_id=0xE0PES_packet_length 0 -> 10 - Packet 752:
PID=0x0100stream_id=0xE0PES_packet_length 0 -> 11 - Packet 1026:
PID=0x0100stream_id=0xE0PES_packet_length 0 -> 12