h.264transport-stream

H.264 payload with no '0x00 0x00 0x00 0x01 0x65'


I'm trying to detect I-frames in TS by searching for the:

0x00 0x00 0x00 0x01 0x65

But, it doesn't work on some streams. In some streams this sequence occurs very rare. Is there any other way of detecting I-frames?

Edit: I also tried saving TS to a file and then extracting H.264 payload. The extracted payload contains only a few 0x00 0x00 0x00 0x01 0x65 byte sequences.


Solution

  • What you are trying to do looks like a blind guess. H.264 specification is freely available. 00 00 00 01 is described in Annex B "Byte stream format" section. Then your 65 is what maps to section 7.3.1 "NAL unit syntax":

    enter image description here

    So you can split your byte stream into NAL units correctly and identify why your heuristic is not detecting I-Frames. Specifically, you are assuming two bit value to be equal to three exactly.

    Also, slice types are defined as this:

    enter image description here

    See also: