5
votes

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 its pic_order_cnt_lsb==4
  • if P frame has frame_num==3 its pic_order_cnt_lsb==6
  • if P frame has frame_num==4 its pic_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,

1

1 Answers

1
votes

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.