17
17
@section Filtergraph syntax
19
19
A filtergraph can be represented using a textual representation, which
20
is recognized by the @code{-vf} and @code{-af} options of the ff*
21
tools, and by the @code{av_parse_graph()} function defined in
20
is recognized by the @code{-vf} and @code{-af} options in @command{avconv}
21
and @command{avplay}, and by the @code{av_parse_graph()} function defined in
22
22
@file{libavfilter/avfiltergraph}.
24
24
A filterchain consists of a sequence of connected filters, each one
183
183
@var{threshold} is the threshold below which a pixel value is
184
184
considered black, and defaults to 32.
188
Apply boxblur algorithm to the input video.
190
This filter accepts the parameters:
191
@var{luma_power}:@var{luma_radius}:@var{chroma_radius}:@var{chroma_power}:@var{alpha_radius}:@var{alpha_power}
193
Chroma and alpha parameters are optional, if not specified they default
194
to the corresponding values set for @var{luma_radius} and
197
@var{luma_radius}, @var{chroma_radius}, and @var{alpha_radius} represent
198
the radius in pixels of the box used for blurring the corresponding
199
input plane. They are expressions, and can contain the following
203
the input width and height in pixels
206
the input chroma image width and height in pixels
209
horizontal and vertical chroma subsample values. For example for the
210
pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
213
The radius must be a non-negative number, and must not be greater than
214
the value of the expression @code{min(w,h)/2} for the luma and alpha planes,
215
and of @code{min(cw,ch)/2} for the chroma planes.
217
@var{luma_power}, @var{chroma_power}, and @var{alpha_power} represent
218
how many times the boxblur filter is applied to the corresponding
221
Some examples follow:
226
Apply a boxblur filter with luma, chroma, and alpha radius
233
Set luma radius to 2, alpha and chroma radius to 0
239
Set luma and chroma radius to a fraction of the video dimension
241
boxblur=min(h\,w)/10:1:min(cw\,ch)/10:1
188
248
Copy the input source unchanged to the output. Mainly useful for
386
Suppress a TV station logo by a simple interpolation of the surrounding
387
pixels. Just set a rectangle covering the logo and watch it disappear
388
(and sometimes something even uglier appear - your mileage may vary).
390
The filter accepts parameters as a string of the form
391
"@var{x}:@var{y}:@var{w}:@var{h}:@var{band}", or as a list of
392
@var{key}=@var{value} pairs, separated by ":".
394
The description of the accepted parameters follows.
399
Specify the top left corner coordinates of the logo. They must be
403
Specify the width and height of the logo to clear. They must be
407
Specify the thickness of the fuzzy edge of the rectangle (added to
408
@var{w} and @var{h}). The default value is 4.
411
When set to 1, a green rectangle is drawn on the screen to simplify
412
finding the right @var{x}, @var{y}, @var{w}, @var{h} parameters, and
413
@var{band} is set to 4. The default value is 0.
417
Some examples follow.
422
Set a rectangle covering the area with top left corner coordinates 0,0
423
and size 100x77, setting a band of size 10:
429
As the previous example, but use named options:
431
delogo=x=0:y=0:w=100:h=77:band=10
326
438
Draw a colored box on the input image.
394
506
The offsets where text will be drawn within the video frame.
395
507
Relative to the top/left border of the output image.
508
They accept expressions similar to the @ref{overlay} filter:
512
the computed values for @var{x} and @var{y}. They are evaluated for
516
main input width and height
519
same as @var{main_w} and @var{main_h}
522
rendered text width and height
525
same as @var{text_w} and @var{text_h}
528
the number of frames processed, starting from 0
531
timestamp expressed in seconds, NAN if the input timestamp is unknown
397
535
The default value of @var{x} and @var{y} is 0.
701
838
@var{luma_tmp}*@var{chroma_spatial}/@var{luma_spatial}
841
@section lut, lutrgb, lutyuv
843
Compute a look-up table for binding each pixel component input value
844
to an output value, and apply it to input video.
846
@var{lutyuv} applies a lookup table to a YUV input video, @var{lutrgb}
847
to an RGB input video.
849
These filters accept in input a ":"-separated list of options, which
850
specify the expressions used for computing the lookup table for the
851
corresponding pixel component values.
853
The @var{lut} filter requires either YUV or RGB pixel formats in
854
input, and accepts the options:
856
@var{c0} (first pixel component)
857
@var{c1} (second pixel component)
858
@var{c2} (third pixel component)
859
@var{c3} (fourth pixel component, corresponds to the alpha component)
862
The exact component associated to each option depends on the format in
865
The @var{lutrgb} filter requires RGB pixel formats in input, and
868
@var{r} (red component)
869
@var{g} (green component)
870
@var{b} (blue component)
871
@var{a} (alpha component)
874
The @var{lutyuv} filter requires YUV pixel formats in input, and
877
@var{y} (Y/luminance component)
878
@var{u} (U/Cb component)
879
@var{v} (V/Cr component)
880
@var{a} (alpha component)
883
The expressions can contain the following constants and functions:
887
the corresponding mathematical approximated values for e
888
(euler number), pi (greek PI), PHI (golden ratio)
891
the input width and height
894
input value for the pixel component
897
the input value clipped in the @var{minval}-@var{maxval} range
900
maximum value for the pixel component
903
minimum value for the pixel component
906
the negated value for the pixel component value clipped in the
907
@var{minval}-@var{maxval} range , it corresponds to the expression
908
"maxval-clipval+minval"
911
the computed value in @var{val} clipped in the
912
@var{minval}-@var{maxval} range
914
@item gammaval(gamma)
915
the computed gamma correction value of the pixel component value
916
clipped in the @var{minval}-@var{maxval} range, corresponds to the
918
"pow((clipval-minval)/(maxval-minval)\,@var{gamma})*(maxval-minval)+minval"
922
All expressions default to "val".
924
Some examples follow:
927
lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
928
lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
930
# the above is the same as
931
lutrgb="r=negval:g=negval:b=negval"
932
lutyuv="y=negval:u=negval:v=negval"
937
# remove chroma components, turns the video into a graytone image
940
# apply a luma burning effect
943
# remove green and blue components
946
# set a constant alpha channel value on input
947
format=rgba,lutrgb=a="maxval-minval/2"
949
# correct luminance gamma by a 0.5 factor
950
lutyuv=y=gammaval(0.5)
957
This filter accepts an integer in input, if non-zero it negates the
958
alpha component (if available). The default value in input is 0.
706
960
Force libavfilter not to use any of the specified pixel formats for the
707
961
input to the next filter.
754
1008
@var{struct_el} represents a structuring element, and has the syntax:
755
1009
@var{cols}x@var{rows}+@var{anchor_x}x@var{anchor_y}/@var{shape}
757
@var{cols} and @var{rows} represent the number of colums and rows of
1011
@var{cols} and @var{rows} represent the number of columns and rows of
758
1012
the structuring element, @var{anchor_x} and @var{anchor_y} the anchor
759
1013
point, and @var{shape} the shape for the structuring element, and
760
1014
can be one of the values "rect", "cross", "ellipse", "custom".
896
1150
(euler number), pi (greek PI), phi (golden ratio)
898
1152
@item in_w, in_h
899
the input video width and heigth
1153
the input video width and height
902
1156
same as @var{in_w} and @var{in_h}
904
1158
@item out_w, out_h
905
the output width and heigth, that is the size of the padded area as
1159
the output width and height, that is the size of the padded area as
906
1160
specified by the @var{width} and @var{height} expressions
1003
1257
(euler number), pi (greek PI), phi (golden ratio)
1005
1259
@item in_w, in_h
1006
the input width and heigth
1260
the input width and height
1009
1263
same as @var{in_w} and @var{in_h}
1011
1265
@item out_w, out_h
1012
the output (cropped) width and heigth
1266
the output (cropped) width and height
1015
1269
same as @var{out_w} and @var{out_h}
1018
1272
input display aspect ratio, same as @var{iw} / @var{ih}
1275
input sample aspect ratio
1020
1277
@item hsub, vsub
1021
1278
horizontal and vertical chroma subsample values. For example for the
1022
1279
pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
1065
1322
scale='min(500\, iw*3/2):-1'
1326
Select frames to pass in output.
1328
It accepts in input an expression, which is evaluated for each input
1329
frame. If the expression is evaluated to a non-zero value, the frame
1330
is selected and passed to the output, otherwise it is discarded.
1332
The expression can contain the following constants:
1345
the sequential number of the filtered frame, starting from 0
1348
the sequential number of the selected frame, starting from 0
1350
@item prev_selected_n
1351
the sequential number of the last selected frame, NAN if undefined
1354
timebase of the input timestamps
1357
the PTS (Presentation TimeStamp) of the filtered video frame,
1358
expressed in @var{TB} units, NAN if undefined
1361
the PTS (Presentation TimeStamp) of the filtered video frame,
1362
expressed in seconds, NAN if undefined
1365
the PTS of the previously filtered video frame, NAN if undefined
1367
@item prev_selected_pts
1368
the PTS of the last previously filtered video frame, NAN if undefined
1370
@item prev_selected_t
1371
the PTS of the last previously selected video frame, NAN if undefined
1374
the PTS of the first video frame in the video, NAN if undefined
1377
the time of the first video frame in the video, NAN if undefined
1380
the type of the filtered frame, can assume one of the following
1392
@item interlace_type
1393
the frame interlace type, can assume one of the following values:
1396
the frame is progressive (not interlaced)
1398
the frame is top-field-first
1400
the frame is bottom-field-first
1404
1 if the filtered frame is a key-frame, 0 otherwise
1407
the position in the file of the filtered frame, -1 if the information
1408
is not available (e.g. for synthetic video)
1411
The default value of the select expression is "1".
1413
Some examples follow:
1416
# select all frames in input
1419
# the above is the same as:
1425
# select only I-frames
1426
select='eq(pict_type\,I)'
1428
# select one frame every 100
1429
select='not(mod(n\,100))'
1431
# select only frames contained in the 10-20 time interval
1432
select='gte(t\,10)*lte(t\,20)'
1434
# select only I frames contained in the 10-20 time interval
1435
select='gte(t\,10)*lte(t\,20)*eq(pict_type\,I)'
1437
# select frames with a minimum distance of 10 seconds
1438
select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
1068
1441
@anchor{setdar}
1069
1442
@section setdar
1589
Show a line containing various information for each input video frame.
1590
The input video is not modified.
1592
The shown line contains a sequence of key/value pairs of the form
1593
@var{key}:@var{value}.
1595
A description of each shown parameter follows:
1599
sequential number of the input frame, starting from 0
1602
Presentation TimeStamp of the input frame, expressed as a number of
1603
time base units. The time base unit depends on the filter input pad.
1606
Presentation TimeStamp of the input frame, expressed as a number of
1610
position of the frame in the input stream, -1 if this information in
1611
unavailable and/or meaningless (for example in case of synthetic video)
1617
sample aspect ratio of the input frame, expressed in the form
1621
size of the input frame, expressed in the form
1622
@var{width}x@var{height}
1625
interlaced mode ("P" for "progressive", "T" for top field first, "B"
1626
for bottom field first)
1629
1 if the frame is a key frame, 0 otherwise
1632
picture type of the input frame ("I" for an I-frame, "P" for a
1633
P-frame, "B" for a B-frame, "?" for unknown type).
1634
Check also the documentation of the @code{AVPictureType} enum and of
1635
the @code{av_get_picture_type_char} function defined in
1636
@file{libavutil/avutil.h}.
1639
Adler-32 checksum of all the planes of the input frame
1641
@item plane_checksum
1642
Adler-32 checksum of each plane of the input frame, expressed in the form
1643
"[@var{c0} @var{c1} @var{c2} @var{c3}]"
1214
1646
@section slicify
1216
1648
Pass the images of input video on to next video filter as multiple
1220
./ffmpeg -i in.avi -vf "slicify=32" out.avi
1652
./avconv -i in.avi -vf "slicify=32" out.avi
1223
1655
The filter accepts the slice height as parameter. If the parameter is
1557
2000
frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay
2003
@section rgbtestsrc, testsrc
2005
The @code{rgbtestsrc} source generates an RGB test pattern useful for
2006
detecting RGB vs BGR issues. You should see a red, green and blue
2007
stripe from top to bottom.
2009
The @code{testsrc} source generates a test video pattern, showing a
2010
color pattern, a scrolling gradient and a timestamp. This is mainly
2011
intended for testing purposes.
2013
Both sources accept an optional sequence of @var{key}=@var{value} pairs,
2014
separated by ":". The description of the accepted options follows.
2019
Specify the size of the sourced video, it may be a string of the form
2020
@var{width}x@var{height}, or the name of a size abbreviation. The
2021
default value is "320x240".
2024
Specify the frame rate of the sourced video, as the number of frames
2025
generated per second. It has to be a string in the format
2026
@var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
2027
number or a valid video frame rate abbreviation. The default value is
2031
Set the sample aspect ratio of the sourced video.
2034
Set the video duration of the sourced video. The accepted syntax is:
2036
[-]HH[:MM[:SS[.m...]]]
2039
See also the function @code{av_parse_time()}.
2041
If not specified, or the expressed duration is negative, the video is
2042
supposed to be generated forever.
2045
For example the following:
2047
testsrc=duration=5.3:size=qcif:rate=10
2050
will generate a video with a duration of 5.3 seconds, with size
2051
176x144 and a framerate of 10 frames per second.
1560
2053
@c man end VIDEO SOURCES
1562
2055
@chapter Video Sinks