[FFmpeg-devel] [PATCH] lavfi: mv vf_select.c -> f_select.c

Stefano Sabatini stefasab at gmail.com
Tue Dec 11 23:27:24 CET 2012


The file now contains also an audio select implementation. Also move the
aselect/select documentation from video filters to the multimedia filters
section.
---
 doc/filters.texi                        |  268 +++++++++++++++----------------
 libavfilter/Makefile                    |    4 +-
 libavfilter/{vf_select.c => f_select.c} |    0
 3 files changed, 136 insertions(+), 136 deletions(-)
 rename libavfilter/{vf_select.c => f_select.c} (100%)

diff --git a/doc/filters.texi b/doc/filters.texi
index fefc2af..5969ef5 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -3506,140 +3506,6 @@ scale='min(500\, iw*3/2):-1'
 @end example
 @end itemize
 
- at section aselect, select
-Select frames to pass in output.
-
-It accepts in input an expression, which is evaluated for each input
-frame. If the expression is evaluated to a non-zero value, the frame
-is selected and passed to the output, otherwise it is discarded.
-
-The expression can contain the following constants:
-
- at table @option
- at item n
-the sequential number of the filtered frame, starting from 0
-
- at item selected_n
-the sequential number of the selected frame, starting from 0
-
- at item prev_selected_n
-the sequential number of the last selected frame, NAN if undefined
-
- at item TB
-timebase of the input timestamps
-
- at item pts
-the PTS (Presentation TimeStamp) of the filtered video frame,
-expressed in @var{TB} units, NAN if undefined
-
- at item t
-the PTS (Presentation TimeStamp) of the filtered video frame,
-expressed in seconds, NAN if undefined
-
- at item prev_pts
-the PTS of the previously filtered video frame, NAN if undefined
-
- at item prev_selected_pts
-the PTS of the last previously filtered video frame, NAN if undefined
-
- at item prev_selected_t
-the PTS of the last previously selected video frame, NAN if undefined
-
- at item start_pts
-the PTS of the first video frame in the video, NAN if undefined
-
- at item start_t
-the time of the first video frame in the video, NAN if undefined
-
- at item pict_type @emph{(only video)}
-the type of the filtered frame, can assume one of the following
-values:
- at table @option
- at item I
- at item P
- at item B
- at item S
- at item SI
- at item SP
- at item BI
- at end table
-
- at item interlace_type @emph{(only video)}
-the frame interlace type, can assume one of the following values:
- at table @option
- at item PROGRESSIVE
-the frame is progressive (not interlaced)
- at item TOPFIRST
-the frame is top-field-first
- at item BOTTOMFIRST
-the frame is bottom-field-first
- at end table
-
- at item consumed_sample_n @emph{(only audio)}
-the number of selected samples before the current frame
-
- at item samples_n @emph{(only audio)}
-the number of samples in the current frame
-
- at item sample_rate @emph{(only audio)}
-the input sample rate
-
- at item key
-1 if the filtered frame is a key-frame, 0 otherwise
-
- at item pos
-the position in the file of the filtered frame, -1 if the information
-is not available (e.g. for synthetic video)
-
- at item scene @emph{(only video)}
-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 end table
-
-The default value of the select expression is "1".
-
-Some examples follow:
-
- at example
-# select all frames in input
-select
-
-# the above is the same as:
-select=1
-
-# skip all frames:
-select=0
-
-# select only I-frames
-select='eq(pict_type\,I)'
-
-# select one frame every 100
-select='not(mod(n\,100))'
-
-# select only frames contained in the 10-20 time interval
-select='gte(t\,10)*lte(t\,20)'
-
-# select only I frames contained in the 10-20 time interval
-select='gte(t\,10)*lte(t\,20)*eq(pict_type\,I)'
-
-# select frames with a minimum distance of 10 seconds
-select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
-
-# use aselect to select only audio frames with samples number > 100
-aselect='gt(samples_n, 100)'
- at end example
-
-Complete example to create a mosaic of the first scenes:
-
- at example
-ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
- at end example
-
-Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
-choice.
-
 @section setdar, setsar
 
 The @code{setdar} filter sets the Display Aspect Ratio for the filter
@@ -4768,6 +4634,140 @@ tools.
 
 Below is a description of the currently available multimedia filters.
 
+ at section aselect, select
+Select frames to pass in output.
+
+It accepts in input an expression, which is evaluated for each input
+frame. If the expression is evaluated to a non-zero value, the frame
+is selected and passed to the output, otherwise it is discarded.
+
+The expression can contain the following constants:
+
+ at table @option
+ at item n
+the sequential number of the filtered frame, starting from 0
+
+ at item selected_n
+the sequential number of the selected frame, starting from 0
+
+ at item prev_selected_n
+the sequential number of the last selected frame, NAN if undefined
+
+ at item TB
+timebase of the input timestamps
+
+ at item pts
+the PTS (Presentation TimeStamp) of the filtered video frame,
+expressed in @var{TB} units, NAN if undefined
+
+ at item t
+the PTS (Presentation TimeStamp) of the filtered video frame,
+expressed in seconds, NAN if undefined
+
+ at item prev_pts
+the PTS of the previously filtered video frame, NAN if undefined
+
+ at item prev_selected_pts
+the PTS of the last previously filtered video frame, NAN if undefined
+
+ at item prev_selected_t
+the PTS of the last previously selected video frame, NAN if undefined
+
+ at item start_pts
+the PTS of the first video frame in the video, NAN if undefined
+
+ at item start_t
+the time of the first video frame in the video, NAN if undefined
+
+ at item pict_type @emph{(only video)}
+the type of the filtered frame, can assume one of the following
+values:
+ at table @option
+ at item I
+ at item P
+ at item B
+ at item S
+ at item SI
+ at item SP
+ at item BI
+ at end table
+
+ at item interlace_type @emph{(only video)}
+the frame interlace type, can assume one of the following values:
+ at table @option
+ at item PROGRESSIVE
+the frame is progressive (not interlaced)
+ at item TOPFIRST
+the frame is top-field-first
+ at item BOTTOMFIRST
+the frame is bottom-field-first
+ at end table
+
+ at item consumed_sample_n @emph{(only audio)}
+the number of selected samples before the current frame
+
+ at item samples_n @emph{(only audio)}
+the number of samples in the current frame
+
+ at item sample_rate @emph{(only audio)}
+the input sample rate
+
+ at item key
+1 if the filtered frame is a key-frame, 0 otherwise
+
+ at item pos
+the position in the file of the filtered frame, -1 if the information
+is not available (e.g. for synthetic video)
+
+ at item scene @emph{(only video)}
+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 end table
+
+The default value of the select expression is "1".
+
+Some examples follow:
+
+ at example
+# select all frames in input
+select
+
+# the above is the same as:
+select=1
+
+# skip all frames:
+select=0
+
+# select only I-frames
+select='eq(pict_type\,I)'
+
+# select one frame every 100
+select='not(mod(n\,100))'
+
+# select only frames contained in the 10-20 time interval
+select='gte(t\,10)*lte(t\,20)'
+
+# select only I frames contained in the 10-20 time interval
+select='gte(t\,10)*lte(t\,20)*eq(pict_type\,I)'
+
+# select frames with a minimum distance of 10 seconds
+select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
+
+# use aselect to select only audio frames with samples number > 100
+aselect='gt(samples_n, 100)'
+ at end example
+
+Complete example to create a mosaic of the first scenes:
+
+ at example
+ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
+ at end example
+
+Comparing @var{scene} against a value between 0.3 and 0.5 is generally a sane
+choice.
+
 @section asendcmd, sendcmd
 
 Send commands to filters in the filtergraph.
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 3480b42..58f8954 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -54,7 +54,7 @@ OBJS-$(CONFIG_AMERGE_FILTER)                 += af_amerge.o
 OBJS-$(CONFIG_AMIX_FILTER)                   += af_amix.o
 OBJS-$(CONFIG_ANULL_FILTER)                  += af_anull.o
 OBJS-$(CONFIG_ARESAMPLE_FILTER)              += af_aresample.o
-OBJS-$(CONFIG_ASELECT_FILTER)                += vf_select.o
+OBJS-$(CONFIG_ASELECT_FILTER)                += f_select.o
 OBJS-$(CONFIG_ASENDCMD_FILTER)               += f_sendcmd.o
 OBJS-$(CONFIG_ASETNSAMPLES_FILTER)           += af_asetnsamples.o
 OBJS-$(CONFIG_ASETPTS_FILTER)                += f_setpts.o
@@ -125,7 +125,7 @@ OBJS-$(CONFIG_PAD_FILTER)                    += vf_pad.o
 OBJS-$(CONFIG_PIXDESCTEST_FILTER)            += vf_pixdesctest.o
 OBJS-$(CONFIG_REMOVELOGO_FILTER)             += bbox.o lswsutils.o lavfutils.o vf_removelogo.o
 OBJS-$(CONFIG_SCALE_FILTER)                  += vf_scale.o
-OBJS-$(CONFIG_SELECT_FILTER)                 += vf_select.o
+OBJS-$(CONFIG_SELECT_FILTER)                 += f_select.o
 OBJS-$(CONFIG_SENDCMD_FILTER)                += f_sendcmd.o
 OBJS-$(CONFIG_SETDAR_FILTER)                 += vf_aspect.o
 OBJS-$(CONFIG_SETFIELD_FILTER)               += vf_setfield.o
diff --git a/libavfilter/vf_select.c b/libavfilter/f_select.c
similarity index 100%
rename from libavfilter/vf_select.c
rename to libavfilter/f_select.c
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list