Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top