简体   繁体   中英

x264/avcodec: Deduce frame sequence number from NAL unit

I'm using avcodec H264 decoder in my project. I receive NAL units from network, stick together NALs from same frame (additional header is added on network layer) and than pass to the decoder. I was wondering if frame sequence number is encoded into NAL unit - it would be logical, as we need the reference to IDR frames.

If this information is present - how can I extract it?

Right now I looking into ITU-T H.264 specification, which is quite complex I can admit. So far I have not found the answer to my question.

No. frame_num is not enough (because it can be equal for different frames and not due MaxFrameNum frame overflow). For example, subsequent B-frames can have equal frame_num but different pic_order_cnt_lsb. As I said you need to read "7.4.1.2.4 Detection of the first VCL NAL unit of a primary coded picture" from H.264 spec to find out NALs from different primary coded pictures. And to find out the order of NALs inside one picture you can analyse the value of first_mb_in_slice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM