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

Stefano Sabatini stefasab at gmail.com
Mon Nov 16 12:46:29 CET 2015


On date Tuesday 2015-11-10 00:25:30 +0100, Marton Balint encoded:
> This option can be used to select useful frames from an ffconcat file which is
> using inpoints and outpoints but where the source files are not intra frame
> only.
> 
> Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  doc/filters.texi       | 17 +++++++++++++++++
>  libavfilter/f_select.c | 27 +++++++++++++++++++++++++++
>  2 files changed, 44 insertions(+)
> 
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 471ec3f..ade571d 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -13196,6 +13196,16 @@ value between 0 and 1 to indicate a new scene; a low value reflects a low
>  probability for the current frame to introduce a new scene, while a higher
>  value means the current frame is more likely to be one (see the example below)
>  
> + 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.

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

> +
>  @end table
>  
>  The default value of the select expression is "1".
> @@ -13270,6 +13280,13 @@ Send even and odd frames to separate outputs, and compose them:
>  @example
>  select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
>  @end example
> +
> + 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?

>  @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)

[...]

Looks good otherwise.
-- 
FFmpeg = Fiendish and Friendly Mortal Portable Erroneous Gospel


More information about the ffmpeg-devel mailing list