RTP Over UDP
这是rtmp-rtsp-stream-client-java发出的包
1 | 80600396000cf6ae0ce9d37f|我是分隔符|7c85b8141ff1c6921a6ba385c00040056dd92a7ccbeb7e38000837470001067fff1fc3177b46c9c731d84f1e6b6f6ff6fc763b09e21dfe9df6dbc8b84f176dbfe9db4d3b68efff8f1c444b8fca76b5da32e13cda7476ffff477fc47e3c53ebad78fc20f47edf6fe3ffa3fffff3ff043afe1edee6b04a600b730c899d05e4d4dffba8ba5f3adab44c59e08ded760e63763eda138901d3c527ffedff09e0854eb3b7ffe3bef09fd013dfb7ffe9be1d7a32430a449f19848276060df0f31fe941ff8a8976a7039b22b8d910300043c1c004254905641cf077c3c9ed77812f89043040be9a437b35b520bf448436f46f48c000401817b8f391571dc96f9f8515c3225034d14963b27feab77e6a3e8e7722e93bf6bda10b439fbee0f8afa2887e21c776f75fb8c50fff9f50caa27ddf2f17de9e690f29a9780eef43e6b031805184fce2e27feb480fb577381cace9e2bbaf378354bd524c3a3c45812dc55528ee47b8a78ab2f228bddf5372c7964bd0781f5cb673f2dbd45cfe8fc00e8675e64aaca76d34cdbaa6993c69c69c5df77bb0cf48a7ba41457cb8f6d42728128ecd69f2d1b7fdbffc89e3ebe78cbbe90bb557dc8fa006e3e8593fb7f5d3b65a8347e7ffd757e21558f4b17ac009c887912807061fdc1d87e56cfffcd951823d6e8d28060f7038a1605115c154bc0bcec0e77cfbc17ae34e6cf9b2b7641dd1f4e3e5dfff0f060a7bf595121372efffdbd2de14a9c908826749655109894930c25b0cb20fc30327a7ffc2b8973fff6e54b221f641354a50ffffe8e7485551a7fffca8c832481117a78fffdb6d05fd3edf171153a44cb24d580c9862259a3152f54e1565d4694eda2a32519e5ffbbfa88afe7cd956bd2f516f74fffa21042c4e12421c2112488a2a11b4da4055a564a7b022561f103175bd441f8f73fc3d4474f8e62d71bc4c1dc6c6cd295df1690870f73aa0efad48c09f7ec5203c0954554ba7f0a312006e3bd03fbacf6ff9518c1ed5bccb3c49106c150b6bc14c5216e9ab42bfb48cb8d958eb59641482a2946928541f04f49fd74e3b4ea8e67b78147940b2d3813f275f5744028cad6a0d27369bd6b8e6ddf4ae5ea34ac977795b69afa9888a2dc7c657b8428e7f510f971c3d035d0ee31ee67a6185555ceb6610c896d16c32cd8c857bedf56aaf58a49a1e68f28875bedf4bd083601f0ada56fffffe7d61d07fd650b7e045246963c6aa9d28ed1ccf9e37c584401664a2f8e92c711f055b7b52d9d89dc02f7e48280553ca1c2d52cf20159a824cb6fb7eb60971384a9ff7b954807714fcb880952c102ed4fd32af30ce6032668ad447dfae2425f10c04dfcfea34116c1565385b99728679581c8d23dbb18bdf90abeae6fbfa94ca18f486feb34d660bec5c5d76b54db986731a0857db65250c82d293b16060802c1c1037464d9b3709ecf5b770ca586800821738c93c4588a64b80d33292b3ec07c461c7e840bda57c18f4403615df6de9012a2b60b7e066105e60f30aee1506dbc2c4f2b8c89201b293a8fa61dd3d3804498c8c48643c80724573fb77238f65116824d336be409c8ec6a290344368394a6bd00a5872d4107ff54b09eb398c061f5e0c81283da0afdbf06686a383fab987254b835d095f2cabcbe0eaae9c4c03d7286ada203e607156d0d3a9b6f9f9a0034211effb7c0392a47214afbef9ffda37102e821292af133105d4c33b5ddbf0b1ba4e609422f878e94831e6f6909391292a41daafd076146581226a148afcfa1395062fa8 |
分隔符前面是 rtp header
后面是 rtp payload
也就是H264的NAL,这部分可能有三种情况:单NAL,聚合NAL,分包NAL
FU-A
1 | 0 1 2 3 |
FU-A分包NAL,payload的前面两个字节携带信息 FU indicator
和 FU header
,如示例中的包:
** FU indicator = 7c (01111100) **
1 | +---------------+ |
F|NRI 和 NAL的F|NRI相同,Type规定为28(11100)
F 占1bit,是禁止位,规定为0
NRI 占2bit,它的取值范围在0~3,值越大,表示这个Nal越重要
** FU header = 85(10000101) **
1 | +---------------+ |
- S: 1 bit
当值等于1,开始位指示分片NAL单元的第一个包。非第一个包为0。 - E: 1 bit
当值等于1, 最后一个包,是否为0。 - R: 1 bit
保留位必须设置为0,接收者必须忽略该位。 - Type: 5 bits
NAL的Type,示例中00101
= 5, 即是I帧。
非I帧 FU header常见值:
81 -> 1 0 0 00001 第一个包
01 -> 0 0 0 00001 中间包
41 -> 0 1 0 00001 最后一个包
I帧 FU header常见值:
85 -> 1 0 0 00101 第一个包
05 -> 0 0 0 00101 中间包
45 -> 0 1 0 00101 最后一个包