[Ffmpeg-devel] I'm giving up

Måns Rullgård mru
Wed Dec 6 17:21:44 CET 2006

Luca Abeni said:
> Hi Michael,
> On Wed, 2006-12-06 at 16:49 +0100, Michael Niedermayer wrote:
> [...]
>> > I know that I can ask the codec to encode PPS and SPS inline, and then
>> > parse the stream to remove them... But why generating some NALs and then
>> > removing them? I was under the impression that the
>> > CODEC_FLAG_GLOBAL_HEADER flag was designed to help in this case, no? If
>> > not, what's its purpose?
>> CODEC_FLAG_GLOBAL_HEADER should cause the encoder to put the global header(s)
>> in extradata, of course it should use the same format as is used in the
>> bytestream if possible, any container specific reformating belongs to some
>> other layer IMHO
> Of course this it what I meant since the beginning (this is why I got
> confused by this "NAL form / raw form / bytestream form" discussion :).

The spec is quite clear that NAL units always are encoded the same way.  The
bytestream format is defined as one possible way of separating NAL units.
The raw data (RBSP) should be extracted from the NAL unit by the decoder.
One could of course argue that the escaping is not needed when format with
separate framing is used.  Our resident codec expert is out at the moment so
I can't ask him why this is always required.  I'll try to catch him when he
gets back.

> And, unless I misremember something this is what libavcodec/x264.c is
> doing.

Quite so.

> I was just proposing to implement the same behaviour in the new
> h264 encoder

That seems reasonable to me too.

M?ns Rullg?rd
mru at inprovide.com

More information about the ffmpeg-devel mailing list