FFmpeg 0.7.17
Since* 0.7
#

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:

PI

Greek PI

PHI

golden ratio

E

Euler number

n

the sequential number of the filtered frame, starting from 0

selected_n

the sequential number of the selected frame, starting from 0

prev_selected_n

the sequential number of the last selected frame, NAN if undefined

TB

timebase of the input timestamps

pts

the PTS (Presentation TimeStamp) of the filtered video frame, expressed in TB units, NAN if undefined

t

the PTS (Presentation TimeStamp) of the filtered video frame, expressed in seconds, NAN if undefined

prev_pts

the PTS of the previously filtered video frame, NAN if undefined

prev_selected_pts

the PTS of the last previously filtered video frame, NAN if undefined

prev_selected_t

the PTS of the last previously selected video frame, NAN if undefined

start_pts

the PTS of the first video frame in the video, NAN if undefined

start_t

the time of the first video frame in the video, NAN if undefined

pict_type

the picture type of the filtered frame, can assume one of the following values:

  • PICT_TYPE_I
  • PICT_TYPE_P
  • PICT_TYPE_B
  • PICT_TYPE_S
  • PICT_TYPE_SI
  • PICT_TYPE_SP
  • PICT_TYPE_BI
interlace_type

the frame interlace type, can assume one of the following values:

INTERLACE_TYPE_P

the frame is progressive (not interlaced)

INTERLACE_TYPE_T

the frame is top-field-first

INTERLACE_TYPE_B

the frame is bottom-field-first

key

1 if the filtered frame is a key-frame, 0 otherwise

pos

the position in the file of the filtered frame, -1 if the information is not available (e.g. for synthetic video)

The default value of the select expression is "1".

Some examples follow:

# 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\,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\,PICT_TYPE_I)'

# select frames with a minimum distance of 10 seconds
select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'