In annexb, [start code] may be 0x000001 or 0x00000001.
In avcc, the bytes of [length] depends on NALULengthSizeMinusOne in avcc extradata, the value of [length] depends on the size of following NALU and in both annexb and avcc format, the NALUs are no different.
H264 Format
AnnexB format:
AVCC format:
In annexb, [start code] may be 0x000001 or 0x00000001.
In avcc, the bytes of [length] depends on NALULengthSizeMinusOne in avcc extradata, the value of [length] depends on the size of following NALU and in both annexb and avcc format, the NALUs are no different.
Ref: StackOverflow
这里的Annex B中,Annex是附件的意思,类似附件二,所以Annex B具体来说是指T-REC-H.264-201610-S这个文档中328页附件B,附件B就是描述了Byte stream format, 整个附件B一共就2页
parse code
dump frames 如下:
整理后的总体输出如下:
RTMP
当从flv改到发送h264的时候就需要根据sps/pps构造出两个packet
@setMetaFrame
Wireshark dump内容如下:
然后观察obs (flv-mux.c)
如果仅video,我们需要提供的内容包括:
注:
AVCDecoderConfigurationRecord
FLV中存放sps/pps的tag如下, 以下字节去掉了Tag Header, 从VIDEODATA为0x17开始,1表示keyframe (for AVC, a seeable fame), 7表示AVC
这里需要填写的内容比较简单, 参考AVC File Format (ISO 14496-15)
obs对应的代码:
obs-avc.c
sps/pps
我们先从sps/pps分析开始,
指数哥伦布编码
[Golomb及指数哥伦布编码原理介绍及实现 - Brook_icv - 博客园]https://www.cnblogs.com/wangguchangqing/p/6297792.html)
以之前的flv为例,
27 4d 00 15 ab 61 a3 7c b2 cd 40 40 40 40 80
Timestamp
传输过程中涉及2个时间,
注:
写了一个解析flv的timestamp和composition time,
参考阅读