h264语法(P帧语法详细信息)
我正在解析 h264 NAL 单元。在我的序列中 - 有带有图片参数集、序列参数集、I 帧(它们也是 IDR)和 P 帧(I 和 P 帧由单个切片组成)的 NAL 单元。 (根本没有 B 帧)
所以我的 NAL 单元流看起来像:
[SPS] [PPS] [I(IDR)] [P] [P] [P] ... [P] [P] [SPS] [PPS] [I(IDR)] [P] [P] [P] ....
我的流中的每个 I 帧也是 IDR 帧,因此它的frame_num 是 0(根据 h.264 标准)。
此外,每个 P 帧的每单位 frame_num
都大于前一帧。
但是,我对 pic_order_cnt_lsb
感到困惑。
pic_order_cnt_lsb
代表什么?
在我的序列中:
- 如果 P 帧有
frame_num==2
其pic_order_cnt_lsb==4
- 如果 P 帧有
frame_num==3
其pic_order_cnt_lsb==6
- 如果 P 帧有
frame_num==4
其pic_order_cnt_lsb==8
- 等...(在我的情况下
pic_order_cnt_lsb == 2*frame_num
)
以及为什么 frame_num
和 <代码>pic_order_cnt_lsb?
谢谢,
I'm parsing h264 NAL Units. In my sequence - there are NAL Units with picture parameters set, sequence parameters set, I frames (they are also IDR) and P frames (I and P frames consits of single slice). (No B frames at all)
So I have the stream of NAL Units looks like:
[SPS] [PPS] [I(IDR)] [P] [P] [P] ... [P] [P] [SPS] [PPS] [I(IDR)] [P] [P] [P] ....
Each I frame in my stream is also IDR frame, so its frame_num is 0 (acording to h.264 standart).
Also each P frame has frame_num
per unit greater than the previous frame.
But, I'm confused about pic_order_cnt_lsb
.
What does pic_order_cnt_lsb
represents?
In my sequence:
- if P frame has
frame_num==2
itspic_order_cnt_lsb==4
- if P frame has
frame_num==3
itspic_order_cnt_lsb==6
- if P frame has
frame_num==4
itspic_order_cnt_lsb==8
- etc... (in my situation
pic_order_cnt_lsb == 2*frame_num
)
And why there is such correlation between frame_num
and pic_order_cnt_lsb
?
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您有交错数据。对于隔行数据,一帧由两个场组成。每帧的其他字段将具有
pic_order_cnt_lsb
的奇数值。pic_order_cnt_lsb
只是跟踪图片顺序的计数器的最低有效位。如果(如典型的隔行扫描数据)每帧有两张图片,则每次更改frame_num 时它都会增加 2。如果您的流是渐进式的而不是隔行式的,则两者将一起递增。It looks like you have interlaced data. With interlaced data, one frame is composed of two fields. The other field of each frame will have the odd values for
pic_order_cnt_lsb
.pic_order_cnt_lsb
is just the least significant bits of a counter tracking the order of the pictures. If (as in typical interlaced data) you have two pictures per frame, then it'll increment by two for every change in the frame_num. If your stream was progressive instead of interlaced, the two would increment together.