逐字节详解H.264 AVCC header
AVCC header sequence header or extradata
按位读取流程:
8 version(版本是1,也是就0x01 )
8 avc profile(值来自 sps[0][1] )
8 avc compatibility(值来自 sps[0][2] )
8 avc level(值来自 sps[0][3] )
6 reserved(保留位,且所有位置1 )
2 NALULengthSizeMinusOne ( 每个表示NALU数据长度所占的Byte -1。如果结果为0,则表示头为1个Byte)
3 reserved ( all bits on )
5 number of SPS NALUs (usually 1)
repeated once per SPS:
16 SPS size
variable SPS NALU data
8 number of PPS NALUs (usually 1)
repeated once per PPS
16 PPS size
variable PPS NALU data
原始数据:
逐字节解析:
01: version
64: avc profile
00: avc compatibility
0A: avc level
FF: reserved + NALULengthSizeMinusOne, NALULengthSizeMinusOne= (0xFF&0x3)+1 = 0x3 + 1 = 4,表示每个NALU需要4 bytes
E1: reserved(3 bits)+ number of SPS NALUs(5 bits),当前头SPS个数=0xE1&0x1F = 0x1 = 1,说明后续只有1个SPS
00 19: 0x0019,当前SPS的长度为25 bytes
67 64 00 0A AC 72 84 44 26 84 00 00 03 00 04 00 00 03 00 CA 3C 48 96 11 80 (SPS到此结束)
01: 含有一个 PPS
00 07:PPS的长度为7 bytes
68 E8 43 8F 13 21 30 (PPS到此结束)
00 00 02 41 :根据前面计算得到的NALULengthSizeMinusOne可以知道需要读取的数据长度为4 bytes, 0x0241=577 bytes
65 88 81 00 05 4E 7F 87 DF 61 A5 8B ...:577 bytes数据