[Ffmpeg-devel] Re: [PATCH] x264 avc encoding, movenc avcC, ctts

Stefan Gehrer stefan.gehrer
Mon Feb 20 12:32:27 CET 2006

Luca Abeni wrote:
> Hi Baptiste,
> On Mon, 2006-02-20 at 10:35 +0100, Baptiste COUDURIER wrote:
> [...]
>>>> The problem is that various containers define their own format for the
>>>> H.264 extradata.
>>> Yes, I agree. This is why I think that things (extradata, in this case)
>>> should be exported by libavcodec in a "format independent way".
>>> So, I think the current code in x264.c should not be changed (I might be
>>> misreading things, but it seems to me that x264.c is currently producing
>>> a stream as described in the "H.264 codec" standard... So, it looks
>>> correct).
>> What formats other than MOV/MP4 use those extradata ?
> I do not think this is the point; I think the point is that the H.264
> codec should output a raw H.264 stream, not something format dependent.
> (anyway, I use extradata for some H.264 streaming experiments I am
> doing.
> My current code can stream NALs without having to know if the
> CODEC_FLAG_GLOBAL_HEADER is set or not; with your patch I'd have to
> write different code for the CODEC_FLAG_GLOBAL_HEADER case).
>>  If libx264 chose
>> to export encoder_headers in AVC format, we would use that, right ?
> At the cost of showing all my ignorance, I have to admit that I do not
> see the "AVC format" defined in the MPEG4 Part 10 draft I have here...
> It seems to me that the format described there is the one produced by
> the current code.
> Where is the AVC format defined?
I might be mistaken here, but my impression was that in a mp4/mov file
one would put what in the H.264 spec is called "RBSP (raw bytestream 
If you put a start code (0x000001) and a byte containing
forbidden_zero_bit, nal_ref_idc and nal_unit_type in front of the RBSP
and escape all byte sequences 0x0000 as 0x000003, you get what is called a
NAL unit. This is what you need to create an ES and therefore you want
this in MPEG1/2 systems (ISO 13818-1) stuff.

However, I did not read this up but had that impression after looking at
.mov files in a hexeditor and not finding any startcodes. ;)

Stefan Gehrer

More information about the ffmpeg-devel mailing list