简体   繁体   English

x264 / avcodec:从NAL单元中减去帧序列号

[英]x264/avcodec: Deduce frame sequence number from NAL unit

I'm using avcodec H264 decoder in my project. 我在我的项目中使用avcodec H264解码器。 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. 我从网络接收NAL单元,将来自相同帧的NAL(在网络层上添加额外的标头)粘在一起,然后传递给解码器。 I was wondering if frame sequence number is encoded into NAL unit - it would be logical, as we need the reference to IDR frames. 我想知道帧序列号是否被编码成NAL单元 - 它是合乎逻辑的,因为我们需要对IDR帧的引用。

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. 现在我正在研究ITU-T H.264规范,这是我能承认的非常复杂的规范。 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). 编号frame_num是不够的(因为它对于不同的帧可能相等而不是由于MaxFrameNum帧溢出)。 For example, subsequent B-frames can have equal frame_num but different pic_order_cnt_lsb. 例如,后续B帧可以具有相等的frame_num但是具有不同的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. 正如我所说,您需要从H.264规范中读取“7.4.1.2.4检测主要编码图像的第一个VCL NAL单元”,以找出来自不同主要编码图像的NAL。 And to find out the order of NALs inside one picture you can analyse the value of first_mb_in_slice. 要找出一张图片中NAL的顺序,您可以分析first_mb_in_slice的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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