usage of start code for H264 video

你说的曾经没有我的故事 提交于 2019-12-03 00:48:07
Markus Schumann

There are two H.264 stream formats and they are sometimes called

  1. Annex B (as found in raw H.264 stream)
  2. AVCC (as found in containers like MP4)

An H.264 stream is made of NALs (a unit of packaging)

(1) Annex B : has 4-byte start code before each NAL unit's bytes [x00][x00][x00][x01].

[start code]--[NAL]--[start code]--[NAL] etc


(2) AVCC : is size prefixed (meaning each NALU begins with byte size of this 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.

  • The Annex B format you'll find in MPEG-2 TS, RTP and some encoders default output.

  • The AVCC format you'll find in MP4, FLV, MKV, AVI and such A/V container formats.

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 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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!