轉(zhuǎn)自:https://my.oschina.net/u/2326611/blog/854463
https://blog.csdn.net/zero_sama/article/details/69802783
第一個 rtmp body: avc sequence header
首先看看包 video data
Message Type id: 0x09 表示視頻
rtmp body 每個字節(jié)表示的含義
字節(jié) 1:高四位表示 key frame屠凶,1表示關鍵幀,2表示中間幀肆资,低四位表示視頻類型如7表示H264編碼格式矗愧;上圖中的17就表示H264編碼格式的關鍵幀
字節(jié) 2:AVC packet type : 1字節(jié)
0x00: AVC Sequence Header
0x01: AVC NALU
字節(jié) 3,4郑原,5:0 表示 composition time 3字節(jié)唉韭, AVC時無意義,全為0
當AVC packet type為AVC Sequence Header時犯犁,接下來就是AVCDecoderConfigurationRecord的內(nèi)容:
字節(jié) 6:1 表示 version
字節(jié) 7:0x64 表示 profile
字節(jié) 8:0 表示 profile compat
字節(jié) 9:0x1f 表示 level
字節(jié) 10:0xff纽哥,6 bits reserved (111111) + 2 bits nal size length - 1 (11)
字節(jié) 11:0xe1,3 bits reserved (111) + 5 bits number of sps (00001)
字節(jié) 12,13:0x1e栖秕,nal size
字節(jié) 14:0x67春塌,nal type,其中 7 表示 sps
字節(jié) 44:1 表示 number of pps。其中字節(jié) 44 為 0x1e+nal type 的地址
字節(jié) 45只壳,46:5 表示 pps size
第二個 rtmp body: AVC NALU
首先看看包 video data
當AVC packet type為AVC NALU(0x01)時:
audio / video 信息:1字節(jié)
AVC packet type:AVC NALU
后跟1個或多個NALU
composition time:3字節(jié)俏拱,AVC時無意義,全為0
NALU length:(lengthSizeMinusOne & 3) + 1字節(jié) NALU長度
NALU Data:
NALU length:
NALU Data:
上面截圖中的body size 為 870吼句,包括兩個 NAL锅必。
另外封裝的時候去掉了 H264 的 start code prefix 00 00 01,或者 00 00 00 01惕艳,該 body 包括兩個 NAL搞隐,第一個 nal 的大小為 0x02af,nal type 值為 6 表示 SEI远搪,第二個 nal 的大小為 0xaa劣纲,nal type 值為 5, 表示 IDR