[FFmpeg-devel] [PATCH] flac encoding, issue 526

Justin Ruggles justinruggles
Sat Jul 19 15:35:51 CEST 2008

Mathieu Velten wrote:
> Justin Ruggles wrotes
>> 1) The FLAC encoder can know when it has encoded the last frame because
>> of CODEC_CAP_SMALL_LAST_FRAME.  It will either be shorter than all the
>> previous frames or the input samples array will be NULL.  The encoder
>> could update the extradata at that point in case any muxer wants to go
>> back and reuse the new data to update the header.  I'm not sure if this
>> is ok to do though.
> I don't really understand how to detect the last frame (sorry I am not
> familiar with the code).
> Does the length of a frame is constant except for the last one ?
> Otherwise I don't see how to detect efficiently the last frame...

Yes, AVCodecContext.frame_size will be constant except that the last
frame can be smaller.  If it is the same size, then there will be
another call to encode() with data (input samples) being NULL.

See lines 1399-1415 of ffmpeg.c for more info.


More information about the ffmpeg-devel mailing list