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

萝らか妹 提交于 2020-01-02 07:04:36

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/8915435/can-you-find-key-frame-i-frame-in-h264-video-without-decoding-i-e-is-it-in-p

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!