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.

Answers


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.


Need Your Help

How to model Go bindings to C structs that use unions?

c go unions api-design cgo

I'm currently writing a Go wrapper for the libfreefare. The API of the libfreefare contains the following function:

How to get users who belong to a WordPress Multisite blog (site) with SQL?

sql wordpress multisite

I need to get all the users who have joined (are members) of a site (blog) in WordPress multisite.