.
For more information about libfribidi, check: .
edgedetect
Detect and draw edges. The filter uses the Canny Edge Detection
algorithm.
The filter accepts the following options:
low
high
Set low and high threshold values used by the Canny thresholding
algorithm.
The high threshold selects the "strong" edge pixels, which are then
connected through 8-connectivity with the "weak" edge pixels
selected by the low threshold.
low and high threshold values must be chosen in the range [0,1],
and low should be lesser or equal to high.
Default value for low is "20/255", and default value for high is
"50/255".
mode
Define the drawing mode.
wires
Draw white/gray wires on black background.
colormix
Mix the colors to create a paint/cartoon effect.
canny
Apply Canny edge detector on all selected planes.
Default value is wires.
planes
Select planes for filtering. By default all available planes are
filtered.
Examples
o Standard edge detection with custom values for the hysteresis
thresholding:
edgedetect=low=0.1:high=0.4
o Painting effect without thresholding:
edgedetect=mode=colormix:high=0
elbg
Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
For each input image, the filter will compute the optimal mapping from
the input to the output given the codebook length, that is the number
of distinct output colors.
This filter accepts the following options.
codebook_length, l
Set codebook length. The value must be a positive integer, and
represents the number of distinct output colors. Default value is
256.
nb_steps, n
Set the maximum number of iterations to apply for computing the
optimal mapping. The higher the value the better the result and the
higher the computation time. Default value is 1.
seed, s
Set a random seed, must be an integer included between 0 and
UINT32_MAX. If not specified, or if explicitly set to -1, the
filter will try to use a good random seed on a best effort basis.
pal8
Set pal8 output pixel format. This option does not work with
codebook length greater than 256.
entropy
Measure graylevel entropy in histogram of color channels of video
frames.
It accepts the following parameters:
mode
Can be either normal or diff. Default is normal.
diff mode measures entropy of histogram delta values, absolute
differences between neighbour histogram values.
eq
Set brightness, contrast, saturation and approximate gamma adjustment.
The filter accepts the following options:
contrast
Set the contrast expression. The value must be a float value in
range "-1000.0" to 1000.0. The default value is "1".
brightness
Set the brightness expression. The value must be a float value in
range "-1.0" to 1.0. The default value is "0".
saturation
Set the saturation expression. The value must be a float in range
0.0 to 3.0. The default value is "1".
gamma
Set the gamma expression. The value must be a float in range 0.1 to
10.0. The default value is "1".
gamma_r
Set the gamma expression for red. The value must be a float in
range 0.1 to 10.0. The default value is "1".
gamma_g
Set the gamma expression for green. The value must be a float in
range 0.1 to 10.0. The default value is "1".
gamma_b
Set the gamma expression for blue. The value must be a float in
range 0.1 to 10.0. The default value is "1".
gamma_weight
Set the gamma weight expression. It can be used to reduce the
effect of a high gamma value on bright image areas, e.g. keep them
from getting overamplified and just plain white. The value must be
a float in range 0.0 to 1.0. A value of 0.0 turns the gamma
correction all the way down while 1.0 leaves it at its full
strength. Default is "1".
eval
Set when the expressions for brightness, contrast, saturation and
gamma expressions are evaluated.
It accepts the following values:
init
only evaluate expressions once during the filter initialization
or when a command is processed
frame
evaluate expressions for each incoming frame
Default value is init.
The expressions accept the following parameters:
n frame count of the input frame starting from 0
pos byte position of the corresponding packet in the input file, NAN if
unspecified
r frame rate of the input video, NAN if the input frame rate is
unknown
t timestamp expressed in seconds, NAN if the input timestamp is
unknown
Commands
The filter supports the following commands:
contrast
Set the contrast expression.
brightness
Set the brightness expression.
saturation
Set the saturation expression.
gamma
Set the gamma expression.
gamma_r
Set the gamma_r expression.
gamma_g
Set gamma_g expression.
gamma_b
Set gamma_b expression.
gamma_weight
Set gamma_weight expression.
The command accepts the same syntax of the corresponding option.
If the specified expression is not valid, it is kept at its current
value.
erosion
Apply erosion effect to the video.
This filter replaces the pixel by the local(3x3) minimum.
It accepts the following options:
threshold0
threshold1
threshold2
threshold3
Limit the maximum change for each plane, default is 65535. If 0,
plane will remain unchanged.
coordinates
Flag which specifies the pixel to refer to. Default is 255 i.e. all
eight pixels are used.
Flags to local 3x3 coordinates maps like this:
1 2 3
4 5
6 7 8
Commands
This filter supports the all above options as commands.
extractplanes
Extract color channel components from input video stream into separate
grayscale video streams.
The filter accepts the following option:
planes
Set plane(s) to extract.
Available values for planes are:
y
u
v
a
r
g
b
Choosing planes not available in the input will result in an error.
That means you cannot select "r", "g", "b" planes with "y", "u",
"v" planes at same time.
Examples
o Extract luma, u and v color channel component from input video
frame into 3 grayscale outputs:
ffmpeg -i video.avi -filter_complex 'extractplanes=y+u+v[y][u][v]' -map '[y]' y.avi -map '[u]' u.avi -map '[v]' v.avi
fade
Apply a fade-in/out effect to the input video.
It accepts the following parameters:
type, t
The effect type can be either "in" for a fade-in, or "out" for a
fade-out effect. Default is "in".
start_frame, s
Specify the number of the frame to start applying the fade effect
at. Default is 0.
nb_frames, n
The number of frames that the fade effect lasts. At the end of the
fade-in effect, the output video will have the same intensity as
the input video. At the end of the fade-out transition, the output
video will be filled with the selected color. Default is 25.
alpha
If set to 1, fade only alpha channel, if one exists on the input.
Default value is 0.
start_time, st
Specify the timestamp (in seconds) of the frame to start to apply
the fade effect. If both start_frame and start_time are specified,
the fade will start at whichever comes last. Default is 0.
duration, d
The number of seconds for which the fade effect has to last. At the
end of the fade-in effect the output video will have the same
intensity as the input video, at the end of the fade-out transition
the output video will be filled with the selected color. If both
duration and nb_frames are specified, duration is used. Default is
0 (nb_frames is used by default).
color, c
Specify the color of the fade. Default is "black".
Examples
o Fade in the first 30 frames of video:
fade=in:0:30
The command above is equivalent to:
fade=t=in:s=0:n=30
o Fade out the last 45 frames of a 200-frame video:
fade=out:155:45
fade=type=out:start_frame=155:nb_frames=45
o Fade in the first 25 frames and fade out the last 25 frames of a
1000-frame video:
fade=in:0:25, fade=out:975:25
o Make the first 5 frames yellow, then fade in from frame 5-24:
fade=in:5:20:color=yellow
o Fade in alpha over first 25 frames of video:
fade=in:0:25:alpha=1
o Make the first 5.5 seconds black, then fade in for 0.5 seconds:
fade=t=in:st=5.5:d=0.5
fftdnoiz
Denoise frames using 3D FFT (frequency domain filtering).
The filter accepts the following options:
sigma
Set the noise sigma constant. This sets denoising strength.
Default value is 1. Allowed range is from 0 to 30. Using very high
sigma with low overlap may give blocking artifacts.
amount
Set amount of denoising. By default all detected noise is reduced.
Default value is 1. Allowed range is from 0 to 1.
block
Set size of block, Default is 4, can be 3, 4, 5 or 6. Actual size
of block in pixels is 2 to power of block, so by default block size
in pixels is 2^4 which is 16.
overlap
Set block overlap. Default is 0.5. Allowed range is from 0.2 to
0.8.
prev
Set number of previous frames to use for denoising. By default is
set to 0.
next
Set number of next frames to to use for denoising. By default is
set to 0.
planes
Set planes which will be filtered, by default are all available
filtered except alpha.
fftfilt
Apply arbitrary expressions to samples in frequency domain
dc_Y
Adjust the dc value (gain) of the luma plane of the image. The
filter accepts an integer value in range 0 to 1000. The default
value is set to 0.
dc_U
Adjust the dc value (gain) of the 1st chroma plane of the image.
The filter accepts an integer value in range 0 to 1000. The default
value is set to 0.
dc_V
Adjust the dc value (gain) of the 2nd chroma plane of the image.
The filter accepts an integer value in range 0 to 1000. The default
value is set to 0.
weight_Y
Set the frequency domain weight expression for the luma plane.
weight_U
Set the frequency domain weight expression for the 1st chroma
plane.
weight_V
Set the frequency domain weight expression for the 2nd chroma
plane.
eval
Set when the expressions are evaluated.
It accepts the following values:
init
Only evaluate expressions once during the filter
initialization.
frame
Evaluate expressions for each incoming frame.
Default value is init.
The filter accepts the following variables:
X
Y The coordinates of the current sample.
W
H The width and height of the image.
N The number of input frame, starting from 0.
Examples
o High-pass:
fftfilt=dc_Y=128:weight_Y='squish(1-(Y+X)/100)'
o Low-pass:
fftfilt=dc_Y=0:weight_Y='squish((Y+X)/100-1)'
o Sharpen:
fftfilt=dc_Y=0:weight_Y='1+squish(1-(Y+X)/100)'
o Blur:
fftfilt=dc_Y=0:weight_Y='exp(-4 * ((Y+X)/(W+H)))'
field
Extract a single field from an interlaced image using stride arithmetic
to avoid wasting CPU time. The output frames are marked as non-
interlaced.
The filter accepts the following options:
type
Specify whether to extract the top (if the value is 0 or "top") or
the bottom field (if the value is 1 or "bottom").
fieldhint
Create new frames by copying the top and bottom fields from surrounding
frames supplied as numbers by the hint file.
hint
Set file containing hints: absolute/relative frame numbers.
There must be one line for each frame in a clip. Each line must
contain two numbers separated by the comma, optionally followed by
"-" or "+". Numbers supplied on each line of file can not be out
of [N-1,N+1] where N is current frame number for "absolute" mode or
out of [-1, 1] range for "relative" mode. First number tells from
which frame to pick up top field and second number tells from which
frame to pick up bottom field.
If optionally followed by "+" output frame will be marked as
interlaced, else if followed by "-" output frame will be marked as
progressive, else it will be marked same as input frame. If
optionally followed by "t" output frame will use only top field, or
in case of "b" it will use only bottom field. If line starts with
"#" or ";" that line is skipped.
mode
Can be item "absolute" or "relative". Default is "absolute".
Example of first several lines of "hint" file for "relative" mode:
0,0 - # first frame
1,0 - # second frame, use third's frame top field and second's frame bottom field
1,0 - # third frame, use fourth's frame top field and third's frame bottom field
1,0 -
0,0 -
0,0 -
1,0 -
1,0 -
1,0 -
0,0 -
0,0 -
1,0 -
1,0 -
1,0 -
0,0 -
fieldmatch
Field matching filter for inverse telecine. It is meant to reconstruct
the progressive frames from a telecined stream. The filter does not
drop duplicated frames, so to achieve a complete inverse telecine
"fieldmatch" needs to be followed by a decimation filter such as
decimate in the filtergraph.
The separation of the field matching and the decimation is notably
motivated by the possibility of inserting a de-interlacing filter
fallback between the two. If the source has mixed telecined and real
interlaced content, "fieldmatch" will not be able to match fields for
the interlaced parts. But these remaining combed frames will be marked
as interlaced, and thus can be de-interlaced by a later filter such as
yadif before decimation.
In addition to the various configuration options, "fieldmatch" can take
an optional second stream, activated through the ppsrc option. If
enabled, the frames reconstruction will be based on the fields and
frames from this second stream. This allows the first input to be pre-
processed in order to help the various algorithms of the filter, while
keeping the output lossless (assuming the fields are matched properly).
Typically, a field-aware denoiser, or brightness/contrast adjustments
can help.
Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth
project) and VIVTC/VFM (VapourSynth project). The later is a light
clone of TFM from which "fieldmatch" is based on. While the semantic
and usage are very close, some behaviour and options names can differ.
The decimate filter currently only works for constant frame rate input.
If your input has mixed telecined (30fps) and progressive content with
a lower framerate like 24fps use the following filterchain to produce
the necessary cfr stream:
"dejudder,fps=30000/1001,fieldmatch,decimate".
The filter accepts the following options:
order
Specify the assumed field order of the input stream. Available
values are:
auto
Auto detect parity (use FFmpeg's internal parity value).
bff Assume bottom field first.
tff Assume top field first.
Note that it is sometimes recommended not to trust the parity
announced by the stream.
Default value is auto.
mode
Set the matching mode or strategy to use. pc mode is the safest in
the sense that it won't risk creating jerkiness due to duplicate
frames when possible, but if there are bad edits or blended fields
it will end up outputting combed frames when a good match might
actually exist. On the other hand, pcn_ub mode is the most risky in
terms of creating jerkiness, but will almost always find a good
frame if there is one. The other values are all somewhere in
between pc and pcn_ub in terms of risking jerkiness and creating
duplicate frames versus finding good matches in sections with bad
edits, orphaned fields, blended fields, etc.
More details about p/c/n/u/b are available in p/c/n/u/b meaning
section.
Available values are:
pc 2-way matching (p/c)
pc_n
2-way matching, and trying 3rd match if still combed (p/c + n)
pc_u
2-way matching, and trying 3rd match (same order) if still
combed (p/c + u)
pc_n_ub
2-way matching, trying 3rd match if still combed, and trying
4th/5th matches if still combed (p/c + n + u/b)
pcn 3-way matching (p/c/n)
pcn_ub
3-way matching, and trying 4th/5th matches if all 3 of the
original matches are detected as combed (p/c/n + u/b)
The parenthesis at the end indicate the matches that would be used
for that mode assuming order=tff (and field on auto or top).
In terms of speed pc mode is by far the fastest and pcn_ub is the
slowest.
Default value is pc_n.
ppsrc
Mark the main input stream as a pre-processed input, and enable the
secondary input stream as the clean source to pick the fields from.
See the filter introduction for more details. It is similar to the
clip2 feature from VFM/TFM.
Default value is 0 (disabled).
field
Set the field to match from. It is recommended to set this to the
same value as order unless you experience matching failures with
that setting. In certain circumstances changing the field that is
used to match from can have a large impact on matching performance.
Available values are:
auto
Automatic (same value as order).
bottom
Match from the bottom field.
top Match from the top field.
Default value is auto.
mchroma
Set whether or not chroma is included during the match comparisons.
In most cases it is recommended to leave this enabled. You should
set this to 0 only if your clip has bad chroma problems such as
heavy rainbowing or other artifacts. Setting this to 0 could also
be used to speed things up at the cost of some accuracy.
Default value is 1.
y0
y1 These define an exclusion band which excludes the lines between y0
and y1 from being included in the field matching decision. An
exclusion band can be used to ignore subtitles, a logo, or other
things that may interfere with the matching. y0 sets the starting
scan line and y1 sets the ending line; all lines in between y0 and
y1 (including y0 and y1) will be ignored. Setting y0 and y1 to the
same value will disable the feature. y0 and y1 defaults to 0.
scthresh
Set the scene change detection threshold as a percentage of maximum
change on the luma plane. Good values are in the "[8.0, 14.0]"
range. Scene change detection is only relevant in case
combmatch=sc. The range for scthresh is "[0.0, 100.0]".
Default value is 12.0.
combmatch
When combatch is not none, "fieldmatch" will take into account the
combed scores of matches when deciding what match to use as the
final match. Available values are:
none
No final matching based on combed scores.
sc Combed scores are only used when a scene change is detected.
full
Use combed scores all the time.
Default is sc.
combdbg
Force "fieldmatch" to calculate the combed metrics for certain
matches and print them. This setting is known as micout in TFM/VFM
vocabulary. Available values are:
none
No forced calculation.
pcn Force p/c/n calculations.
pcnub
Force p/c/n/u/b calculations.
Default value is none.
cthresh
This is the area combing threshold used for combed frame detection.
This essentially controls how "strong" or "visible" combing must be
to be detected. Larger values mean combing must be more visible
and smaller values mean combing can be less visible or strong and
still be detected. Valid settings are from "-1" (every pixel will
be detected as combed) to 255 (no pixel will be detected as
combed). This is basically a pixel difference value. A good range
is "[8, 12]".
Default value is 9.
chroma
Sets whether or not chroma is considered in the combed frame
decision. Only disable this if your source has chroma problems
(rainbowing, etc.) that are causing problems for the combed frame
detection with chroma enabled. Actually, using chroma=0 is usually
more reliable, except for the case where there is chroma only
combing in the source.
Default value is 0.
blockx
blocky
Respectively set the x-axis and y-axis size of the window used
during combed frame detection. This has to do with the size of the
area in which combpel pixels are required to be detected as combed
for a frame to be declared combed. See the combpel parameter
description for more info. Possible values are any number that is
a power of 2 starting at 4 and going up to 512.
Default value is 16.
combpel
The number of combed pixels inside any of the blocky by blockx size
blocks on the frame for the frame to be detected as combed. While
cthresh controls how "visible" the combing must be, this setting
controls "how much" combing there must be in any localized area (a
window defined by the blockx and blocky settings) on the frame.
Minimum value is 0 and maximum is "blocky x blockx" (at which point
no frames will ever be detected as combed). This setting is known
as MI in TFM/VFM vocabulary.
Default value is 80.
p/c/n/u/b meaning
p/c/n
We assume the following telecined stream:
Top fields: 1 2 2 3 4
Bottom fields: 1 2 3 4 4
The numbers correspond to the progressive frame the fields relate to.
Here, the first two frames are progressive, the 3rd and 4th are combed,
and so on.
When "fieldmatch" is configured to run a matching from bottom
(field=bottom) this is how this input stream get transformed:
Input stream:
T 1 2 2 3 4
B 1 2 3 4 4 <-- matching reference
Matches: c c n n c
Output stream:
T 1 2 3 4 4
B 1 2 3 4 4
As a result of the field matching, we can see that some frames get
duplicated. To perform a complete inverse telecine, you need to rely
on a decimation filter after this operation. See for instance the
decimate filter.
The same operation now matching from top fields (field=top) looks like
this:
Input stream:
T 1 2 2 3 4 <-- matching reference
B 1 2 3 4 4
Matches: c c p p c
Output stream:
T 1 2 2 3 4
B 1 2 2 3 4
In these examples, we can see what p, c and n mean; basically, they
refer to the frame and field of the opposite parity:
*
*
*
u/b
The u and b matching are a bit special in the sense that they match
from the opposite parity flag. In the following examples, we assume
that we are currently matching the 2nd frame (Top:2, bottom:2).
According to the match, a 'x' is placed above and below each matched
fields.
With bottom matching (field=bottom):
Match: c p n b u
x x x x x
Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
x x x x x
Output frames:
2 1 2 2 2
2 2 2 1 3
With top matching (field=top):
Match: c p n b u
x x x x x
Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2
Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
x x x x x
Output frames:
2 2 2 1 2
2 1 3 2 2
Examples
Simple IVTC of a top field first telecined stream:
fieldmatch=order=tff:combmatch=none, decimate
Advanced IVTC, with fallback on yadif for still combed frames:
fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
fieldorder
Transform the field order of the input video.
It accepts the following parameters:
order
The output field order. Valid values are tff for top field first or
bff for bottom field first.
The default value is tff.
The transformation is done by shifting the picture content up or down
by one line, and filling the remaining line with appropriate picture
content. This method is consistent with most broadcast field order
converters.
If the input video is not flagged as being interlaced, or it is already
flagged as being of the required output field order, then this filter
does not alter the incoming video.
It is very useful when converting to or from PAL DV material, which is
bottom field first.
For example:
ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
fifo, afifo
Buffer input images and send them when they are requested.
It is mainly useful when auto-inserted by the libavfilter framework.
It does not take parameters.
fillborders
Fill borders of the input video, without changing video stream
dimensions. Sometimes video can have garbage at the four edges and you
may not want to crop video input to keep size multiple of some number.
This filter accepts the following options:
left
Number of pixels to fill from left border.
right
Number of pixels to fill from right border.
top Number of pixels to fill from top border.
bottom
Number of pixels to fill from bottom border.
mode
Set fill mode.
It accepts the following values:
smear
fill pixels using outermost pixels
mirror
fill pixels using mirroring
fixed
fill pixels with constant value
Default is smear.
color
Set color for pixels in fixed mode. Default is black.
Commands
This filter supports same commands as options. The command accepts the
same syntax of the corresponding option.
If the specified expression is not valid, it is kept at its current
value.
find_rect
Find a rectangular object
It accepts the following options:
object
Filepath of the object image, needs to be in gray8.
threshold
Detection threshold, default is 0.5.
mipmaps
Number of mipmaps, default is 3.
xmin, ymin, xmax, ymax
Specifies the rectangle in which to search.
Examples
o Cover a rectangular object by the supplied image of a given video
using ffmpeg:
ffmpeg -i file.ts -vf find_rect=newref.pgm,cover_rect=cover.jpg:mode=cover new.mkv
floodfill
Flood area with values of same pixel components with another values.
It accepts the following options:
x Set pixel x coordinate.
y Set pixel y coordinate.
s0 Set source #0 component value.
s1 Set source #1 component value.
s2 Set source #2 component value.
s3 Set source #3 component value.
d0 Set destination #0 component value.
d1 Set destination #1 component value.
d2 Set destination #2 component value.
d3 Set destination #3 component value.
format
Convert the input video to one of the specified pixel formats.
Libavfilter will try to pick one that is suitable as input to the next
filter.
It accepts the following parameters:
pix_fmts
A '|'-separated list of pixel format names, such as
"pix_fmts=yuv420p|monow|rgb24".
Examples
o Convert the input video to the yuv420p format
format=pix_fmts=yuv420p
Convert the input video to any of the formats in the list
format=pix_fmts=yuv420p|yuv444p|yuv410p
fps
Convert the video to specified constant frame rate by duplicating or
dropping frames as necessary.
It accepts the following parameters:
fps The desired output frame rate. The default is 25.
start_time
Assume the first PTS should be the given value, in seconds. This
allows for padding/trimming at the start of stream. By default, no
assumption is made about the first frame's expected PTS, so no
padding or trimming is done. For example, this could be set to 0
to pad the beginning with duplicates of the first frame if a video
stream starts after the audio stream or to trim any frames with a
negative PTS.
round
Timestamp (PTS) rounding method.
Possible values are:
zero
round towards 0
inf round away from 0
down
round towards -infinity
up round towards +infinity
near
round to nearest
The default is "near".
eof_action
Action performed when reading the last frame.
Possible values are:
round
Use same timestamp rounding method as used for other frames.
pass
Pass through last frame if input duration has not been reached
yet.
The default is "round".
Alternatively, the options can be specified as a flat string:
fps[:start_time[:round]].
See also the setpts filter.
Examples
o A typical usage in order to set the fps to 25:
fps=fps=25
o Sets the fps to 24, using abbreviation and rounding method to round
to nearest:
fps=fps=film:round=near
framepack
Pack two different video streams into a stereoscopic video, setting
proper metadata on supported codecs. The two views should have the same
size and framerate and processing will stop when the shorter video
ends. Please note that you may conveniently adjust view properties with
the scale and fps filters.
It accepts the following parameters:
format
The desired packing format. Supported values are:
sbs The views are next to each other (default).
tab The views are on top of each other.
lines
The views are packed by line.
columns
The views are packed by column.
frameseq
The views are temporally interleaved.
Some examples:
# Convert left and right views into a frame-sequential video
ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
# Convert views into a side-by-side video with the same output resolution as the input
ffmpeg -i LEFT -i RIGHT -filter_complex [0:v]scale=w=iw/2[left],[1:v]scale=w=iw/2[right],[left][right]framepack=sbs OUTPUT
framerate
Change the frame rate by interpolating new video output frames from the
source frames.
This filter is not designed to function correctly with interlaced
media. If you wish to change the frame rate of interlaced media then
you are required to deinterlace before this filter and re-interlace
after this filter.
A description of the accepted options follows.
fps Specify the output frames per second. This option can also be
specified as a value alone. The default is 50.
interp_start
Specify the start of a range where the output frame will be created
as a linear interpolation of two frames. The range is [0-255], the
default is 15.
interp_end
Specify the end of a range where the output frame will be created
as a linear interpolation of two frames. The range is [0-255], the
default is 240.
scene
Specify the level at which a scene change is detected as a value
between 0 and 100 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. The default is 8.2.
flags
Specify flags influencing the filter process.
Available value for flags is:
scene_change_detect, scd
Enable scene change detection using the value of the option
scene. This flag is enabled by default.
framestep
Select one frame every N-th frame.
This filter accepts the following option:
step
Select frame after every "step" frames. Allowed values are
positive integers higher than 0. Default value is 1.
freezedetect
Detect frozen video.
This filter logs a message and sets frame metadata when it detects that
the input video has no significant change in content during a specified
duration. Video freeze detection calculates the mean average absolute
difference of all the components of video frames and compares it to a
noise floor.
The printed times and duration are expressed in seconds. The
"lavfi.freezedetect.freeze_start" metadata key is set on the first
frame whose timestamp equals or exceeds the detection duration and it
contains the timestamp of the first frame of the freeze. The
"lavfi.freezedetect.freeze_duration" and
"lavfi.freezedetect.freeze_end" metadata keys are set on the first
frame after the freeze.
The filter accepts the following options:
noise, n
Set noise tolerance. Can be specified in dB (in case "dB" is
appended to the specified value) or as a difference ratio between 0
and 1. Default is -60dB, or 0.001.
duration, d
Set freeze duration until notification (default is 2 seconds).
frei0r
Apply a frei0r effect to the input video.
To enable the compilation of this filter, you need to install the
frei0r header and configure FFmpeg with "--enable-frei0r".
It accepts the following parameters:
filter_name
The name of the frei0r effect to load. If the environment variable
FREI0R_PATH is defined, the frei0r effect is searched for in each
of the directories specified by the colon-separated list in
FREI0R_PATH. Otherwise, the standard frei0r paths are searched, in
this order: HOME/.frei0r-1/lib/, /usr/local/lib/frei0r-1/,
/usr/lib/frei0r-1/.
filter_params
A '|'-separated list of parameters to pass to the frei0r effect.
A frei0r effect parameter can be a boolean (its value is either "y" or
"n"), a double, a color (specified as R/G/B, where R, G, and B are
floating point numbers between 0.0 and 1.0, inclusive) or a color
description as specified in the "Color" section in the ffmpeg-utils
manual, a position (specified as X/Y, where X and Y are floating point
numbers) and/or a string.
The number and types of parameters depend on the loaded effect. If an
effect parameter is not specified, the default value is set.
Examples
o Apply the distort0r effect, setting the first two double
parameters:
frei0r=filter_name=distort0r:filter_params=0.5|0.01
o Apply the colordistance effect, taking a color as the first
parameter:
frei0r=colordistance:0.2/0.3/0.4
frei0r=colordistance:violet
frei0r=colordistance:0x112233
o Apply the perspective effect, specifying the top left and top right
image positions:
frei0r=perspective:0.2/0.2|0.8/0.2
For more information, see
fspp
Apply fast and simple postprocessing. It is a faster version of spp.
It splits (I)DCT into horizontal/vertical passes. Unlike the simple
post- processing filter, one of them is performed once per block, not
per pixel. This allows for much higher speed.
The filter accepts the following options:
quality
Set quality. This option defines the number of levels for
averaging. It accepts an integer in the range 4-5. Default value is
4.
qp Force a constant quantization parameter. It accepts an integer in
range 0-63. If not set, the filter will use the QP from the video
stream (if available).
strength
Set filter strength. It accepts an integer in range -15 to 32.
Lower values mean more details but also more artifacts, while
higher values make the image smoother but also blurrier. Default
value is 0 X PSNR optimal.
use_bframe_qp
Enable the use of the QP from the B-Frames if set to 1. Using this
option may cause flicker since the B-Frames have often larger QP.
Default is 0 (not enabled).
gblur
Apply Gaussian blur filter.
The filter accepts the following options:
sigma
Set horizontal sigma, standard deviation of Gaussian blur. Default
is 0.5.
steps
Set number of steps for Gaussian approximation. Default is 1.
planes
Set which planes to filter. By default all planes are filtered.
sigmaV
Set vertical sigma, if negative it will be same as "sigma".
Default is "-1".
Commands
This filter supports same commands as options. The command accepts the
same syntax of the corresponding option.
If the specified expression is not valid, it is kept at its current
value.
geq
Apply generic equation to each pixel.
The filter accepts the following options:
lum_expr, lum
Set the luminance expression.
cb_expr, cb
Set the chrominance blue expression.
cr_expr, cr
Set the chrominance red expression.
alpha_expr, a
Set the alpha expression.
red_expr, r
Set the red expression.
green_expr, g
Set the green expression.
blue_expr, b
Set the blue expression.
The colorspace is selected according to the specified options. If one
of the lum_expr, cb_expr, or cr_expr options is specified, the filter
will automatically select a YCbCr colorspace. If one of the red_expr,
green_expr, or blue_expr options is specified, it will select an RGB
colorspace.
If one of the chrominance expression is not defined, it falls back on
the other one. If no alpha expression is specified it will evaluate to
opaque value. If none of chrominance expressions are specified, they
will evaluate to the luminance expression.
The expressions can use the following variables and functions:
N The sequential number of the filtered frame, starting from 0.
X
Y The coordinates of the current sample.
W
H The width and height of the image.
SW
SH Width and height scale depending on the currently filtered plane.
It is the ratio between the corresponding luma plane number of
pixels and the current plane ones. E.g. for YUV4:2:0 the values are
"1,1" for the luma plane, and "0.5,0.5" for chroma planes.
T Time of the current frame, expressed in seconds.
p(x, y)
Return the value of the pixel at location (x,y) of the current
plane.
lum(x, y)
Return the value of the pixel at location (x,y) of the luminance
plane.
cb(x, y)
Return the value of the pixel at location (x,y) of the blue-
difference chroma plane. Return 0 if there is no such plane.
cr(x, y)
Return the value of the pixel at location (x,y) of the red-
difference chroma plane. Return 0 if there is no such plane.
r(x, y)
g(x, y)
b(x, y)
Return the value of the pixel at location (x,y) of the
red/green/blue component. Return 0 if there is no such component.
alpha(x, y)
Return the value of the pixel at location (x,y) of the alpha plane.
Return 0 if there is no such plane.
interpolation
Set one of interpolation methods:
nearest, n
bilinear, b
Default is bilinear.
For functions, if x and y are outside the area, the value will be
automatically clipped to the closer edge.
Examples
o Flip the image horizontally:
geq=p(W-X\,Y)
o Generate a bidimensional sine wave, with angle "PI/3" and a
wavelength of 100 pixels:
geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
o Generate a fancy enigmatic moving light:
nullsrc=s=256x256,geq=random(1)/hypot(X-cos(N*0.07)*W/2-W/2\,Y-sin(N*0.09)*H/2-H/2)^2*1000000*sin(N*0.02):128:128
o Generate a quick emboss effect:
format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
o Modify RGB components depending on pixel position:
geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
o Create a radial gradient that is the same size as the input (also
see the vignette filter):
geq=lum=255*gauss((X/W-0.5)*3)*gauss((Y/H-0.5)*3)/gauss(0)/gauss(0),format=gray
gradfun
Fix the banding artifacts that are sometimes introduced into nearly
flat regions by truncation to 8-bit color depth. Interpolate the
gradients that should go where the bands are, and dither them.
It is designed for playback only. Do not use it prior to lossy
compression, because compression tends to lose the dither and bring
back the bands.
It accepts the following parameters:
strength
The maximum amount by which the filter will change any one pixel.
This is also the threshold for detecting nearly flat regions.
Acceptable values range from .51 to 64; the default value is 1.2.
Out-of-range values will be clipped to the valid range.
radius
The neighborhood to fit the gradient to. A larger radius makes for
smoother gradients, but also prevents the filter from modifying the
pixels near detailed regions. Acceptable values are 8-32; the
default value is 16. Out-of-range values will be clipped to the
valid range.
Alternatively, the options can be specified as a flat string:
strength[:radius]
Examples
o Apply the filter with a 3.5 strength and radius of 8:
gradfun=3.5:8
o Specify radius, omitting the strength (which will fall-back to the
default value):
gradfun=radius=8
graphmonitor
Show various filtergraph stats.
With this filter one can debug complete filtergraph. Especially issues
with links filling with queued frames.
The filter accepts the following options:
size, s
Set video output size. Default is hd720.
opacity, o
Set video opacity. Default is 0.9. Allowed range is from 0 to 1.
mode, m
Set output mode, can be fulll or compact. In compact mode only
filters with some queued frames have displayed stats.
flags, f
Set flags which enable which stats are shown in video.
Available values for flags are:
queue
Display number of queued frames in each link.
frame_count_in
Display number of frames taken from filter.
frame_count_out
Display number of frames given out from filter.
pts Display current filtered frame pts.
time
Display current filtered frame time.
timebase
Display time base for filter link.
format
Display used format for filter link.
size
Display video size or number of audio channels in case of audio
used by filter link.
rate
Display video frame rate or sample rate in case of audio used
by filter link.
rate, r
Set upper limit for video rate of output stream, Default value is
25. This guarantee that output video frame rate will not be higher
than this value.
greyedge
A color constancy variation filter which estimates scene illumination
via grey edge algorithm and corrects the scene colors accordingly.
See:
The filter accepts the following options:
difford
The order of differentiation to be applied on the scene. Must be
chosen in the range [0,2] and default value is 1.
minknorm
The Minkowski parameter to be used for calculating the Minkowski
distance. Must be chosen in the range [0,20] and default value is
1. Set to 0 for getting max value instead of calculating Minkowski
distance.
sigma
The standard deviation of Gaussian blur to be applied on the scene.
Must be chosen in the range [0,1024.0] and default value = 1.
floor( sigma * break_off_sigma(3) ) can't be equal to 0 if difford
is greater than 0.
Examples
o Grey Edge:
greyedge=difford=1:minknorm=5:sigma=2
o Max Edge:
greyedge=difford=1:minknorm=0:sigma=2
haldclut
Apply a Hald CLUT to a video stream.
First input is the video stream to process, and second one is the Hald
CLUT. The Hald CLUT input can be a simple picture or a complete video
stream.
The filter accepts the following options:
shortest
Force termination when the shortest input terminates. Default is 0.
repeatlast
Continue applying the last CLUT after the end of the stream. A
value of 0 disable the filter after the last frame of the CLUT is
reached. Default is 1.
"haldclut" also has the same interpolation options as lut3d (both
filters share the same internals).
This filter also supports the framesync options.
More information about the Hald CLUT can be found on Eskil Steenberg's
website (Hald CLUT author) at
.
Workflow examples
Hald CLUT video stream
Generate an identity Hald CLUT stream altered with various effects:
ffmpeg -f lavfi -i B=8 -vf "hue=H=2*PI*t:s=sin(2*PI*t)+1, curves=cross_process" -t 10 -c:v ffv1 clut.nut
Note: make sure you use a lossless codec.
Then use it with "haldclut" to apply it on some random stream:
ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
The Hald CLUT will be applied to the 10 first seconds (duration of
clut.nut), then the latest picture of that CLUT stream will be applied
to the remaining frames of the "mandelbrot" stream.
Hald CLUT with preview
A Hald CLUT is supposed to be a squared image of "Level*Level*Level" by
"Level*Level*Level" pixels. For a given Hald CLUT, FFmpeg will select
the biggest possible square starting at the top left of the picture.
The remaining padding pixels (bottom or right) will be ignored. This
area can be used to add a preview of the Hald CLUT.
Typically, the following generated Hald CLUT will be supported by the
"haldclut" filter:
ffmpeg -f lavfi -i B