IDR 参考帧
PPS 属于 [RTP header] + 单一NAL单元模式 ,所以RTP包结构如下
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|V=2|P|X| CC |M| PT | sequence number |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| timestamp |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| synchronization source (SSRC) identifier |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
| contributing source (CSRC) identifiers |
| .... |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|F|NRI| type | |
+-+-+-+-+-+-+-+-+ |
| |
| Bytes 2..n of a Single NAL unit |
| |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :...OPTIONAL RTP padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
先看 抓到的 dump
0000 80 e0 e2 20 ff 6d 85 0f c6 0a 3f ef 65 88 82 00 .àâ ÿm..Æ.?ïe...
0010 04 73 9f fe f7 81 bf 32 cb 64 3f aa c9 71 f9 e7 .s.þ÷.¿2Ëd?ªÉqùç
0020 7d 2c ac cf 3c e4 3c 72 5d 89 ae b8 d0 00 00 03 },¬Ï<ä<r].®¸Ð...
0030 00 00 03 00 00 03 00 00 03 03 2c 9f cb 69 5a 9d ..........,.ËiZ.
0040 0f dd ff 88 00 00 03 00 00 10 90 00 0d 18 00 14 .Ýÿ.............
0050 60 00 2d e0 00 7d 00 01 92 00 07 10 00 1f c0 00 `.-à.}........À.
0060 99 00 04 34 00 1f 60 00 c5 00 07 58 00 00 03 00 ...4..`.Å..X....
0070 00 03 00 00 03 00 00 03 00 00 03 00 00 03 00 00 ................
0080 03 00 00 03 00 00 03 00 00 03 00 00 03 00 00 03 ................
0090 00 00 03 00 00 03 00 00 03 00 00 03 00 00 03 00 ................
00a0 00 03 00 00 03 00 00 03 00 00 03 00 00 03 00 00 ................
00b0 03 00 00 03 00 00 03 00 00 03 00 00 03 00 00 03 ................
00c0 00 00 03 00 00 03 00 00 03 00 00 03 00 00 03 00 ................
00d0 00 03 00 00 03 00 00 03 00 00 03 00 00 03 00 1b ................
00e0 31 1
在上面12个byte是 [RTP Header] 对应的码流 和SPS 一样的RTP Header
80 e0 e2 20
ff 6d 85 0f
c6 0a 3f ef
====>转化 二进制
1000 0000 0110 0000 1110 0010 0010 0000 v=2 p=0 x=0 CC=0 M=0 PT=96 SN=57888
1111 1111 0110 1101 1000 0101 0000 1111 timestamp
1100 0110 0000 1010 0011 1111 1110 1111 ssrc
对应wireshark 解析
Real-Time Transport Protocol
10.. .... = Version: RFC 1889 Version (2)
..0. .... = Padding: False
...0 .... = Extension: False
.... 0000 = Contributing source identifiers count: 0
1... .... = Marker: True
Payload type: DynamicRTP-Type-96 (96)
Sequence number: 57888
Timestamp: 4285367567
Synchronization Source identifier: 0xc60a3fef (3322560495)
NALU 码流 .根据单一NAL单元模式 判断 前1byte 是[NALU Header]
0000 65 88 82 00 04 73 9f fe f7 81 bf 32 cb 64 3f aa e....s.þ÷.¿2Ëd?ª
0010 c9 71 f9 e7 7d 2c ac cf 3c e4 3c 72 5d 89 ae b8 Éqùç},¬Ï<ä<r].®¸
0020 d0 00 00 03 00 00 03 00 00 03 00 00 03 03 2c 9f Ð.............,.
0030 cb 69 5a 9d 0f dd ff 88 00 00 03 00 00 10 90 00 ËiZ..Ýÿ.........
0040 0d 18 00 14 60 00 2d e0 00 7d 00 01 92 00 07 10 ....`.-à.}......
0050 00 1f c0 00 99 00 04 34 00 1f 60 00 c5 00 07 58 ..À....4..`.Å..X
0060 00 00 03 00 00 03 00 00 03 00 00 03 00 00 03 00 ................
0070 00 03 00 00 03 00 00 03 00 00 03 00 00 03 00 00 ................
0080 03 00 00 03 00 00 03 00 00 03 00 00 03 00 00 03 ................
0090 00 00 03 00 00 03 00 00 03 00 00 03 00 00 03 00 ................
00a0 00 03 00 00 03 00 00 03 00 00 03 00 00 03 00 00 ................
00b0 03 00 00 03 00 00 03 00 00 03 00 00 03 00 00 03 ................
00c0 00 00 03 00 00 03 00 00 03 00 00 03 00 00 03 00 ................
00d0 00 03 00 1b 31 ....1
===> 转化 第一个字节 65
0110 0101 F=0 NRI=11 特别重要 type=5 说明是IDR
wireshark 解析
NAL unit header or first byte of the payload
0... .... = F bit: No bit errors or other syntax violations
.11. .... = Nal_ref_idc (NRI): 3
...0 0101 = Type: NAL unit - Coded slice of an IDR picture (5)
剩下的就看下H264 NAL Unit Payload NALU的负载
NALU payload
0000 88 82 00 04 73 9f fe f7 81 bf 32 cb 64 3f aa c9 ....s.þ÷.¿2Ëd?ªÉ
0010 71 f9 e7 7d 2c ac cf 3c e4 3c 72 5d 89 ae b8 d0 qùç},¬Ï<ä<r].®¸Ð
0020 00 00 03 00 00 03 00 00 03 00 00 03 03 2c 9f cb .............,.Ë
0030 69 5a 9d 0f dd ff 88 00 00 03 00 00 10 90 00 0d iZ..Ýÿ..........
0040 18 00 14 60 00 2d e0 00 7d 00 01 92 00 07 10 00 ...`.-à.}.......
0050 1f c0 00 99 00 04 34 00 1f 60 00 c5 00 07 58 00 .À....4..`.Å..X.
0060 00 03 00 00 03 00 00 03 00 00 03 00 00 03 00 00 ................
0070 03 00 00 03 00 00 03 00 00 03 00 00 03 00 00 03 ................
0080 00 00 03 00 00 03 00 00 03 00 00 03 00 00 03 00 ................
0090 00 03 00 00 03 00 00 03 00 00 03 00 00 03 00 00 ................
00a0 03 00 00 03 00 00 03 00 00 03 00 00 03 00 00 03 ................
00b0 00 00 03 00 00 03 00 00 03 00 00 03 00 00 03 00 ................
00c0 00 03 00 00 03 00 00 03 00 00 03 00 00 03 00 00 ................
00d0 03 00 1b 31 ...1
能理解多少,记多少,为后面学习编码和解码打基础