Can you find key frame (I-frame) in h264 video without decoding? i.e. is it in packet?

StackOverflow https://stackoverflow.com/questions/8961982

  •  18-04-2021
  •  | 
  •  

문제

I need to know if I can find a I-frame without having to decode it first. I would like there to be some flag in AVPacket, but I can't see that there is one.

Thanks.

도움이 되었습니까?

해결책

You can certainly find location of I frame by looking up appropriate header code. If you parse the sequence you can find it from the start code.

The H.264 bitstream is broken into sections called NAL units. These units have the 24 bit code 0x000001 preceding them for synchronization. After this there will be a unique start code that corresponds to start of a picture, and type of picture based on which you can decide which frame is this.

다른 팁

Yes you can get key frame from AVPacket, there is a member in the this structure 'flags'. you can get the value by pkt.flags, for Key-frame the value will be 1, 0 otherwise.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top