Non IDR Picture NAL Units - 0x21 and 0x61 meaning

落花浮王杯 提交于 2020-01-13 05:38:30

问题


Does anyone know what does 0x21 and 0x61 means in h.264 encoded video stream?

I know that 0x01 means it's a b-frame and 0x41 means it's a p-frame. My encoded video gives me two 0x21 frame followed by one b-frame.

I 21 21 B 21 21 B...... 

What is this 0x21?


回答1:


From H.264 spec:

7.3.1 NAL unit syntax

  • forbidden_zero_bit - 1 bit - shall be equal to 0.
  • nal_ref_idc - 2 bits - not equal to 0 specifies that the content of the NAL unit contains a sequence parameter set [...]
  • nal_unit_type - 5 bits - specifies the type of RBSP data structure contained in the NAL unit [...]

0x21 and 0x61 make it NAL unit type 1 (Coded slice of a non-IDR picture) with different values for nal_ref_idc.

UPD. There is no one to one mapping of specific bit, esp. at fixed position from the beginning of the "frame" that says it's I/P/B frame. You will need to parse out the bitstream to read values per 7.4.3 Slice header semantics of H.264 spec (it is still doable in most cases since the value is real close to the beginning of the bitstream - check H.264 spec for details):




回答2:


First point, a NALu is not the same than as a frame. A frame can contain more that 1 NALu (but not less). A frame can also be made up of more than one slice type. A single frame can have I, B and P slices. If it is an IDR frame, then EVERY slice of that frame must be IDR.

0x01 is NOT a B slice. it is a "Coded slice of a non-IDR picture". exactly like 0x21 and 0x61. It could be a I/B/P or p slice. you need to parse the slice_type to know more.



来源:https://stackoverflow.com/questions/22551325/non-idr-picture-nal-units-0x21-and-0x61-meaning

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!