[FFmpeg-devel] [PATCH] flac encoding, issue 526
Thu Jul 17 22:41:39 CEST 2008
Michael Niedermayer wrote:
> On Thu, Jul 17, 2008 at 09:51:53PM +0200, Mathieu Velten wrote:
>> of course I forgot the patch...
> I think this patch breaks flac encoding in all cases except when the output is
> a raw flac file.
Michael beat me to it. :)
The general idea will work, but the streaminfo header needs to be in the
codec extradata for muxers other than raw flac to work properly.
I can think of a couple options. I don't know which, if any, is more
correct though. And sometimes I tend to overlook simple solutions... so
maybe someone else will have other suggestions.
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.
2) Do the same thing you suggested, but still use the codec extradata to
hold the steaminfo header as is done currently. If updating the
extradata at the end of encoding is not acceptable, then you can still
do the same thing you suggest and allocate new space to write the
updated header. The only downside would be that other muxers would not
get the updated info unless they all did the same thing. But at least
they wouldn't break.
More information about the ffmpeg-devel