I have general question about the usage of start code (0x00 0x00 0x00 0x01) for the H264 video. I am not clear about the usage of this start code as there is no reference in the RTP RFCs that are related to H264 video. But I do see lot of reference in the net and particularly in the *.
对于H264视频的启动代码(0x00 0x00 0x00 0x01)的用法,我有一个一般性的问题。我不清楚这个开始代码的用法,因为RTP RFCs中没有与H264视频相关的引用。但我确实在网上看到了很多参考尤其是在*上。
I am confused as I see one client doesn't have this start code and another client is using this start code. So, I am looking for a specific answer where this start code should be used and where I shouldn't.
我很困惑,因为我看到一个客户端没有这个开始代码,而另一个客户端正在使用这个开始代码。因此,我正在寻找一个特定的答案,在哪里应该使用这个起始代码,在哪里不应该使用。
KMurali
KMurali
1 个解决方案
#1
8
There are two H.264 stream formats and they are sometimes called
H.264流格式有两种,它们有时被称为
- Annex B (as found in raw H.264 stream)
- 附件B(如原始H.264格式)
- AVCC (as found in containers like MP4)
- AVCC(如MP4这样的容器)
An H.264 stream is made of NALs (a unit of packaging)
H.264流是由NALs(包装单位)构成的
(1) Annex B : has 4-byte start code before each NAL unit's bytes [x00][x00][x00][x01]
.
(1)附件B:在每个NAL单元的字节[x00][x00][x00][x00][x01]之前有4字节的起始码。
[start code]--[NAL]--[start code]--[NAL] etc
(2) AVCC : is size prefixed (meaning each NALU begins with byte size of this NALU)
(2)AVCC:大小前缀(意思是每个NALU以NALU的字节大小开始)
[SIZE (4 bytes)]--[NAL]--[SIZE (4 bytes)]--[NAL] etc
Some notes :
一些注意事项:
-
The AVCC (MP4) stream format doesn't contain any NALs of type SPS, PPS or AU delimter. Since that specific information is now placed within MP4 metadata.
AVCC (MP4)流格式不包含任何类型的SPS、PPS或AU delimter。因为特定的信息现在放在MP4元数据中。
-
The Annex B format you'll find in MPEG-2 TS, RTP and some encoders default output.
在MPEG-2 TS、RTP和一些编码器默认输出中可以找到附件B格式。
-
The AVCC format you'll find in MP4, FLV, MKV, AVI and such A/V container formats.
在MP4、FLV、MKV、AVI和这样的A/V容器格式中可以找到AVCC格式。
Both formats can be converted into each other.
两种格式都可以转换成对方格式。
Annex B to MP4 : Remove start codes, insert length of NAL, filter out SPS, PPS and AU delimiter.
MP4附件B:删除启动码,插入NAL长度,过滤SPS、PPS和AU分隔符。
MP4 to Annex B : Remove length, insert start code, insert SPS for each I-frame, insert PPS for each frame, insert AU delimiter for each GOP.
附件B的MP4:删除长度,插入开始代码,为每个i帧插入SPS,为每个帧插入PPS,为每个GOP插入AU分隔符。
#1
8
There are two H.264 stream formats and they are sometimes called
H.264流格式有两种,它们有时被称为
- Annex B (as found in raw H.264 stream)
- 附件B(如原始H.264格式)
- AVCC (as found in containers like MP4)
- AVCC(如MP4这样的容器)
An H.264 stream is made of NALs (a unit of packaging)
H.264流是由NALs(包装单位)构成的
(1) Annex B : has 4-byte start code before each NAL unit's bytes [x00][x00][x00][x01]
.
(1)附件B:在每个NAL单元的字节[x00][x00][x00][x00][x01]之前有4字节的起始码。
[start code]--[NAL]--[start code]--[NAL] etc
(2) AVCC : is size prefixed (meaning each NALU begins with byte size of this NALU)
(2)AVCC:大小前缀(意思是每个NALU以NALU的字节大小开始)
[SIZE (4 bytes)]--[NAL]--[SIZE (4 bytes)]--[NAL] etc
Some notes :
一些注意事项:
-
The AVCC (MP4) stream format doesn't contain any NALs of type SPS, PPS or AU delimter. Since that specific information is now placed within MP4 metadata.
AVCC (MP4)流格式不包含任何类型的SPS、PPS或AU delimter。因为特定的信息现在放在MP4元数据中。
-
The Annex B format you'll find in MPEG-2 TS, RTP and some encoders default output.
在MPEG-2 TS、RTP和一些编码器默认输出中可以找到附件B格式。
-
The AVCC format you'll find in MP4, FLV, MKV, AVI and such A/V container formats.
在MP4、FLV、MKV、AVI和这样的A/V容器格式中可以找到AVCC格式。
Both formats can be converted into each other.
两种格式都可以转换成对方格式。
Annex B to MP4 : Remove start codes, insert length of NAL, filter out SPS, PPS and AU delimiter.
MP4附件B:删除启动码,插入NAL长度,过滤SPS、PPS和AU分隔符。
MP4 to Annex B : Remove length, insert start code, insert SPS for each I-frame, insert PPS for each frame, insert AU delimiter for each GOP.
附件B的MP4:删除长度,插入开始代码,为每个i帧插入SPS,为每个帧插入PPS,为每个GOP插入AU分隔符。