Log in

View Full Version : How can I parse slice header of H.264 bitstream


phdzwei
24th June 2011, 10:11
Hi friends:

I want to parse the length of each VCL NALU for H.264 bitstream, but don't decode it.

Is there source code or function?

Thank you

Shevach
4th July 2011, 15:29
This is a simple realization. Each NAL unit starts with start-code 0x000001 followed by a byte containing [forbidden_zero_bit, nal_ref_idc - 2 bits, nal_unit_type - 5 bits].
You need read the above byte and mask it by 0x1f to extract nal_unit_type.
Then if nal_unit_type is between 1 to 5 (inclusively) you deduce that a given NAL unit is VLC NAL unit. From this point look for next start code. The number bytes elapsed from the start position and the next start code is actually NAL unit size.