[x264-devel] Start codes and Annex B

Jason Garrett-Glaser jason at x264.com
Thu Aug 9 21:56:05 CEST 2012


On Thu, Aug 9, 2012 at 10:14 AM, Tim Pitman <tapitman11 at gmail.com> wrote:
> I'm trying to understand H.264 start codes and the way x264 implements
> them. When looking at a raw encoded stream in a hex editor, most of my
> NALUs start with the 24 bit 0x000001 code, but some of them start with
> the full 32 bit 0x00000001. My understanding of the spec is that
> either start code is valid. x264.h, concerning b_annexb, states:
>
> "if set, place start codes (4 bytes) before NAL units, otherwise place
> size (4 bytes) before NAL units."
>
> So I would expect to always see the 32 bit codes or sizes. Does
> x264cli always use 3 byte start codes instead of size? Why not 4
> bytes? Is there any way to control b_annexb from the command line?

x264 uses 3 byte start codes where the spec says those start codes can
be used.  4 byte start codes must be used at the start of SPS, PPS,
and in the first NAL of a frame.

Jason


More information about the x264-devel mailing list