NAL H264 Block Prefixes

I need to clarify the H264 NAL block separator prefixes ( 00 00 00 01and 00 00 01). I use the Intel Media SDK to generate H264 and package in RTP. The problem is that so far I have only looked 00 00 00 01at the unit separator and basically could only find the units AUD, SPS, PPS and SEI in the bit stream. Looking at the memory, I saw that after SEI there was a sequence of bytes 00 00 01 25that could be the beginning of an IDR block, but my search algorithm did not find it due to the absence of a zero byte. Can anyone clarify the difference between 00 00 00 01and prefixes 00 00 01? Looking at the Chromium code , it seems that the first block, as well as AUD, SPS, PPS and SEI, have an extra zero:

if (first_nal_in_this_access_unit ||
    IsAccessUnitBoundaryNal(nal_unit_type)) {
    output_size += 1;  // Extra zero_byte for these nal units
    first_nal_in_this_access_unit = false;
}

...

static bool IsAccessUnitBoundaryNal(int nal_unit_type) {
    // Check if this packet marks access unit boundary by checking the
    // packet type.
    if (nal_unit_type == 6 ||  // Supplemental enhancement information
        nal_unit_type == 7 ||  // Picture parameter set
        nal_unit_type == 8 ||  // Sequence parameter set
        nal_unit_type == 9 ||  // Access unit delimiter
        (nal_unit_type >= 14 && nal_unit_type <= 18)) {  // Reserved types
            return true;
        }
    return false;
}

1) , , , NAL, ( , 3 4 , NAL ).

2) PPS, SPS SEI? , .

, -, , .

+4
1

H.264, B.1.2 NAL :

enter image description here

zero_byte - , 0x00.

zero_byte.

  • nal_unit_type nal_unit() 7 ( ) 8 ( )
  • NAL NAL , 7.4.1.2.3.
+6

Source: https://habr.com/ru/post/1539564/


All Articles