[FFmpeg-devel] [PATCH] avformat/concatdec: port to the new bitstream filter API

James Almer jamrial at gmail.com
Sat Apr 29 03:16:55 EEST 2017

On 4/27/2017 10:59 PM, Michael Niedermayer wrote:
> On Wed, Apr 26, 2017 at 04:40:55PM -0300, James Almer wrote:
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>  libavformat/concatdec.c | 86 +++++++++++++++----------------------------------
>>  1 file changed, 26 insertions(+), 60 deletions(-)
> breaks
> ./ffmpeg -f concat -i ~/tickets/3108/concatfile.txt -codec copy test.avi
> (output produces many warnings/errors on playback)
> https://trac.ffmpeg.org/raw-attachment/ticket/3108/examplefiles.zip

Huh, this was more broken than i thought. Apparently, concatdec was
never really filtering anything before this patch.

detect_stream_specific() frees up the stream's extradata before the code
ever has the chance to call the bsf init function because, despite the
name, the compat code in av_bitstream_filter_init() does not call it.
That only happens in the first av_bitstream_filter_filter() call. The
h264_mp4toannexb bsf looks at extradata during init to figure out if it
needs to filter anything or just do a packet passthrough.
That aside, concatdec was also copying the input file's stream extradata
to the matched output stream extradata *before* it called
detect_stream_specific(), so any filtered extradata would have been
ignored anyway.

I don't know if this started happening after the new bsf API was
introduced and the old converted into a wrapper for the new, or if it
was always like this, but after this conversion it will not matter.

Will send an updated patch in a moment.

More information about the ffmpeg-devel mailing list