[FFmpeg-devel] [PATCH 5/5] lavfi/select: add support for concatdec_select option

Marton Balint cus at passwd.hu
Fri Nov 20 13:27:32 CET 2015

On Mon, 16 Nov 2015, Stefano Sabatini wrote:

>> + at item concatdec_select
>> +The concat demuxer can set the @var{lavf.concat.start_time} and the
>> + at var{lavf.concat.duration} packet metadata values which are also present in the
>> +decoded frames.
>> +
>> +The @var{concatdec_select} variable is -1 if the frame pts is at least
>> +start_time and either the duration metadata is missing or the frame pts is less
>> +than start_time + duration, 0 otherwise, and NaN if the start_time metadata is
>> +missing.
> Add also a single explanation, like this:
> That means that an input frame is selected if its pts is within the
> interval set by the concat demuxer.

Ok, will do.

> I wonder if it would make sense to export the input index
> (lavf.concat.index), and use it here in place of -1.

Maybe, but we should probably provide this as separate variable, because 
you cannot use 0 for the first segent, only -1 etc... And maybe there will 
be a time when the expression evaluation code will be able to access all 
fields and metadata of an AVFrame...

Anyway, can be added later.

>> + at item
>> +Select useful frames from an ffconcat file which is using inpoints and
>> +outpoints but where the source files are not intra frame only.
>> + at example
>> +ffmpeg -copyts -vsync 0 -segment_time_metadata 1 -i input.ffconcat -vf select=concatdec_select -af aselect=concatdec_select output.avi
>> + at end example
> I guess that the lavf.concat metadata is set so that start_time and
> duration corresponds to the inpoint and outpoint interval, right?

Yes, only inpoint and outpoint in the concat file are timestamps of the
source files referenced by the concat file,  start_time and 
duration metadata are timestamps of the "output" from the concat demuxer.

>>  @end itemize
>>  @section selectivecolor
>> diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
>> index 2b926e1..14a23d2 100644
>> --- a/libavfilter/f_select.c
>> +++ b/libavfilter/f_select.c
>> @@ -82,6 +82,8 @@ static const char *const var_names[] = {
>>      "scene",
>> +    "concatdec_select",  ///< frame usefulness based on pts and frame metadata originating from the concat demuxer
> probably you can give a more explicative description ("useful" is
> pretty generic)


Will send a new version soon.


More information about the ffmpeg-devel mailing list