1 @chapter Filtering Introduction
2 @c man begin FILTERING INTRODUCTION
4 Filtering in FFmpeg is enabled through the libavfilter library.
6 In libavfilter, a filter can have multiple inputs and multiple
8 To illustrate the sorts of things that are possible, we consider the
13 input --> split ---------------------> overlay --> output
16 +-----> crop --> vflip -------+
19 This filtergraph splits the input stream in two streams, then sends one
20 stream through the crop filter and the vflip filter, before merging it
21 back with the other stream by overlaying it on top. You can use the
22 following command to achieve this:
25 ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
28 The result will be that the top half of the video is mirrored
29 onto the bottom half of the output video.
31 Filters in the same linear chain are separated by commas, and distinct
32 linear chains of filters are separated by semicolons. In our example,
33 @var{crop,vflip} are in one linear chain, @var{split} and
34 @var{overlay} are separately in another. The points where the linear
35 chains join are labelled by names enclosed in square brackets. In the
36 example, the split filter generates two outputs that are associated to
37 the labels @var{[main]} and @var{[tmp]}.
39 The stream sent to the second output of @var{split}, labelled as
40 @var{[tmp]}, is processed through the @var{crop} filter, which crops
41 away the lower half part of the video, and then vertically flipped. The
42 @var{overlay} filter takes in input the first unchanged output of the
43 split filter (which was labelled as @var{[main]}), and overlay on its
44 lower half the output generated by the @var{crop,vflip} filterchain.
46 Some filters take in input a list of parameters: they are specified
47 after the filter name and an equal sign, and are separated from each other
50 There exist so-called @var{source filters} that do not have an
51 audio/video input, and @var{sink filters} that will not have audio/video
54 @c man end FILTERING INTRODUCTION
57 @c man begin GRAPH2DOT
59 The @file{graph2dot} program included in the FFmpeg @file{tools}
60 directory can be used to parse a filtergraph description and issue a
61 corresponding textual representation in the dot language.
68 to see how to use @file{graph2dot}.
70 You can then pass the dot description to the @file{dot} program (from
71 the graphviz suite of programs) and obtain a graphical representation
74 For example the sequence of commands:
76 echo @var{GRAPH_DESCRIPTION} | \
77 tools/graph2dot -o graph.tmp && \
78 dot -Tpng graph.tmp -o graph.png && \
82 can be used to create and display an image representing the graph
83 described by the @var{GRAPH_DESCRIPTION} string. Note that this string must be
84 a complete self-contained graph, with its inputs and outputs explicitly defined.
85 For example if your command line is of the form:
87 ffmpeg -i infile -vf scale=640:360 outfile
89 your @var{GRAPH_DESCRIPTION} string will need to be of the form:
91 nullsrc,scale=640:360,nullsink
93 you may also need to set the @var{nullsrc} parameters and add a @var{format}
94 filter in order to simulate a specific input file.
98 @chapter Filtergraph description
99 @c man begin FILTERGRAPH DESCRIPTION
101 A filtergraph is a directed graph of connected filters. It can contain
102 cycles, and there can be multiple links between a pair of
103 filters. Each link has one input pad on one side connecting it to one
104 filter from which it takes its input, and one output pad on the other
105 side connecting it to one filter accepting its output.
107 Each filter in a filtergraph is an instance of a filter class
108 registered in the application, which defines the features and the
109 number of input and output pads of the filter.
111 A filter with no input pads is called a "source", and a filter with no
112 output pads is called a "sink".
114 @anchor{Filtergraph syntax}
115 @section Filtergraph syntax
117 A filtergraph has a textual representation, which is
118 recognized by the @option{-filter}/@option{-vf} and @option{-filter_complex}
119 options in @command{ffmpeg} and @option{-vf} in @command{ffplay}, and by the
120 @code{avfilter_graph_parse()}/@code{avfilter_graph_parse2()} functions defined in
121 @file{libavfilter/avfilter.h}.
123 A filterchain consists of a sequence of connected filters, each one
124 connected to the previous one in the sequence. A filterchain is
125 represented by a list of ","-separated filter descriptions.
127 A filtergraph consists of a sequence of filterchains. A sequence of
128 filterchains is represented by a list of ";"-separated filterchain
131 A filter is represented by a string of the form:
132 [@var{in_link_1}]...[@var{in_link_N}]@var{filter_name}=@var{arguments}[@var{out_link_1}]...[@var{out_link_M}]
134 @var{filter_name} is the name of the filter class of which the
135 described filter is an instance of, and has to be the name of one of
136 the filter classes registered in the program.
137 The name of the filter class is optionally followed by a string
140 @var{arguments} is a string which contains the parameters used to
141 initialize the filter instance. It may have one of two forms:
145 A ':'-separated list of @var{key=value} pairs.
148 A ':'-separated list of @var{value}. In this case, the keys are assumed to be
149 the option names in the order they are declared. E.g. the @code{fade} filter
150 declares three options in this order -- @option{type}, @option{start_frame} and
151 @option{nb_frames}. Then the parameter list @var{in:0:30} means that the value
152 @var{in} is assigned to the option @option{type}, @var{0} to
153 @option{start_frame} and @var{30} to @option{nb_frames}.
156 A ':'-separated list of mixed direct @var{value} and long @var{key=value}
157 pairs. The direct @var{value} must precede the @var{key=value} pairs, and
158 follow the same constraints order of the previous point. The following
159 @var{key=value} pairs can be set in any preferred order.
163 If the option value itself is a list of items (e.g. the @code{format} filter
164 takes a list of pixel formats), the items in the list are usually separated by
167 The list of arguments can be quoted using the character "'" as initial
168 and ending mark, and the character '\' for escaping the characters
169 within the quoted text; otherwise the argument string is considered
170 terminated when the next special character (belonging to the set
171 "[]=;,") is encountered.
173 The name and arguments of the filter are optionally preceded and
174 followed by a list of link labels.
175 A link label allows one to name a link and associate it to a filter output
176 or input pad. The preceding labels @var{in_link_1}
177 ... @var{in_link_N}, are associated to the filter input pads,
178 the following labels @var{out_link_1} ... @var{out_link_M}, are
179 associated to the output pads.
181 When two link labels with the same name are found in the
182 filtergraph, a link between the corresponding input and output pad is
185 If an output pad is not labelled, it is linked by default to the first
186 unlabelled input pad of the next filter in the filterchain.
187 For example in the filterchain
189 nullsrc, split[L1], [L2]overlay, nullsink
191 the split filter instance has two output pads, and the overlay filter
192 instance two input pads. The first output pad of split is labelled
193 "L1", the first input pad of overlay is labelled "L2", and the second
194 output pad of split is linked to the second input pad of overlay,
195 which are both unlabelled.
197 In a complete filterchain all the unlabelled filter input and output
198 pads must be connected. A filtergraph is considered valid if all the
199 filter input and output pads of all the filterchains are connected.
201 Libavfilter will automatically insert @ref{scale} filters where format
202 conversion is required. It is possible to specify swscale flags
203 for those automatically inserted scalers by prepending
204 @code{sws_flags=@var{flags};}
205 to the filtergraph description.
207 Here is a BNF description of the filtergraph syntax:
209 @var{NAME} ::= sequence of alphanumeric characters and '_'
210 @var{LINKLABEL} ::= "[" @var{NAME} "]"
211 @var{LINKLABELS} ::= @var{LINKLABEL} [@var{LINKLABELS}]
212 @var{FILTER_ARGUMENTS} ::= sequence of chars (possibly quoted)
213 @var{FILTER} ::= [@var{LINKLABELS}] @var{NAME} ["=" @var{FILTER_ARGUMENTS}] [@var{LINKLABELS}]
214 @var{FILTERCHAIN} ::= @var{FILTER} [,@var{FILTERCHAIN}]
215 @var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
218 @section Notes on filtergraph escaping
220 Filtergraph description composition entails several levels of
221 escaping. See @ref{quoting_and_escaping,,the "Quoting and escaping"
222 section in the ffmpeg-utils(1) manual,ffmpeg-utils} for more
223 information about the employed escaping procedure.
225 A first level escaping affects the content of each filter option
226 value, which may contain the special character @code{:} used to
227 separate values, or one of the escaping characters @code{\'}.
229 A second level escaping affects the whole filter description, which
230 may contain the escaping characters @code{\'} or the special
231 characters @code{[],;} used by the filtergraph description.
233 Finally, when you specify a filtergraph on a shell commandline, you
234 need to perform a third level escaping for the shell special
235 characters contained within it.
237 For example, consider the following string to be embedded in
238 the @ref{drawtext} filter description @option{text} value:
240 this is a 'string': may contain one, or more, special characters
243 This string contains the @code{'} special escaping character, and the
244 @code{:} special character, so it needs to be escaped in this way:
246 text=this is a \'string\'\: may contain one, or more, special characters
249 A second level of escaping is required when embedding the filter
250 description in a filtergraph description, in order to escape all the
251 filtergraph special characters. Thus the example above becomes:
253 drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
255 (note that in addition to the @code{\'} escaping special characters,
256 also @code{,} needs to be escaped).
258 Finally an additional level of escaping is needed when writing the
259 filtergraph description in a shell command, which depends on the
260 escaping rules of the adopted shell. For example, assuming that
261 @code{\} is special and needs to be escaped with another @code{\}, the
262 previous string will finally result in:
264 -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
267 @chapter Timeline editing
269 Some filters support a generic @option{enable} option. For the filters
270 supporting timeline editing, this option can be set to an expression which is
271 evaluated before sending a frame to the filter. If the evaluation is non-zero,
272 the filter will be enabled, otherwise the frame will be sent unchanged to the
273 next filter in the filtergraph.
275 The expression accepts the following values:
278 timestamp expressed in seconds, NAN if the input timestamp is unknown
281 sequential number of the input frame, starting from 0
284 the position in the file of the input frame, NAN if unknown
287 Additionally, these filters support an @option{enable} command that can be used
288 to re-define the expression.
290 Like any other filtering option, the @option{enable} option follows the same
293 For example, to enable a blur filter (@ref{smartblur}) from 10 seconds to 3
294 minutes, and a @ref{curves} filter starting at 3 seconds:
296 smartblur = enable='between(t,10,3*60)',
297 curves = enable='gte(t,3)' : preset=cross_process
300 @c man end FILTERGRAPH DESCRIPTION
302 @chapter Audio Filters
303 @c man begin AUDIO FILTERS
305 When you configure your FFmpeg build, you can disable any of the
306 existing filters using @code{--disable-filters}.
307 The configure output will show the audio filters included in your
310 Below is a description of the currently available audio filters.
314 Convert the input audio format to the specified formats.
316 @emph{This filter is deprecated. Use @ref{aformat} instead.}
318 The filter accepts a string of the form:
319 "@var{sample_format}:@var{channel_layout}".
321 @var{sample_format} specifies the sample format, and can be a string or the
322 corresponding numeric value defined in @file{libavutil/samplefmt.h}. Use 'p'
323 suffix for a planar sample format.
325 @var{channel_layout} specifies the channel layout, and can be a string
326 or the corresponding number value defined in @file{libavutil/channel_layout.h}.
328 The special parameter "auto", signifies that the filter will
329 automatically select the output format depending on the output filter.
335 Convert input to float, planar, stereo:
341 Convert input to unsigned 8-bit, automatically select out channel layout:
349 Delay one or more audio channels.
351 Samples in delayed channel are filled with silence.
353 The filter accepts the following option:
357 Set list of delays in milliseconds for each channel separated by '|'.
358 At least one delay greater than 0 should be provided.
359 Unused delays will be silently ignored. If number of given delays is
360 smaller than number of channels all remaining channels will not be delayed.
367 Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
368 the second channel (and any other channels that may be present) unchanged.
376 Apply echoing to the input audio.
378 Echoes are reflected sound and can occur naturally amongst mountains
379 (and sometimes large buildings) when talking or shouting; digital echo
380 effects emulate this behaviour and are often used to help fill out the
381 sound of a single instrument or vocal. The time difference between the
382 original signal and the reflection is the @code{delay}, and the
383 loudness of the reflected signal is the @code{decay}.
384 Multiple echoes can have different delays and decays.
386 A description of the accepted parameters follows.
390 Set input gain of reflected signal. Default is @code{0.6}.
393 Set output gain of reflected signal. Default is @code{0.3}.
396 Set list of time intervals in milliseconds between original signal and reflections
397 separated by '|'. Allowed range for each @code{delay} is @code{(0 - 90000.0]}.
398 Default is @code{1000}.
401 Set list of loudnesses of reflected signals separated by '|'.
402 Allowed range for each @code{decay} is @code{(0 - 1.0]}.
403 Default is @code{0.5}.
410 Make it sound as if there are twice as many instruments as are actually playing:
412 aecho=0.8:0.88:60:0.4
416 If delay is very short, then it sound like a (metallic) robot playing music:
422 A longer delay will sound like an open air concert in the mountains:
424 aecho=0.8:0.9:1000:0.3
428 Same as above but with one more mountain:
430 aecho=0.8:0.9:1000|1800:0.3|0.25
436 Modify an audio signal according to the specified expressions.
438 This filter accepts one or more expressions (one for each channel),
439 which are evaluated and used to modify a corresponding audio signal.
441 It accepts the following parameters:
445 Set the '|'-separated expressions list for each separate channel. If
446 the number of input channels is greater than the number of
447 expressions, the last specified expression is used for the remaining
450 @item channel_layout, c
451 Set output channel layout. If not specified, the channel layout is
452 specified by the number of expressions. If set to @samp{same}, it will
453 use by default the same input channel layout.
456 Each expression in @var{exprs} can contain the following constants and functions:
460 channel number of the current expression
463 number of the evaluated sample, starting from 0
469 time of the evaluated sample expressed in seconds
472 @item nb_out_channels
473 input and output number of channels
476 the value of input channel with number @var{CH}
479 Note: this filter is slow. For faster processing you should use a
488 aeval=val(ch)/2:c=same
492 Invert phase of the second channel:
500 Apply fade-in/out effect to input audio.
502 A description of the accepted parameters follows.
506 Specify the effect type, can be either @code{in} for fade-in, or
507 @code{out} for a fade-out effect. Default is @code{in}.
509 @item start_sample, ss
510 Specify the number of the start sample for starting to apply the fade
511 effect. Default is 0.
514 Specify the number of samples for which the fade effect has to last. At
515 the end of the fade-in effect the output audio will have the same
516 volume as the input audio, at the end of the fade-out transition
517 the output audio will be silence. Default is 44100.
520 Specify time for starting to apply the fade effect. Default is 0.
521 The accepted syntax is:
523 [-]HH[:MM[:SS[.m...]]]
526 See also the function @code{av_parse_time()}.
527 If set this option is used instead of @var{start_sample} one.
530 Specify the duration for which the fade effect has to last. Default is 0.
531 The accepted syntax is:
533 [-]HH[:MM[:SS[.m...]]]
536 See also the function @code{av_parse_time()}.
537 At the end of the fade-in effect the output audio will have the same
538 volume as the input audio, at the end of the fade-out transition
539 the output audio will be silence.
540 If set this option is used instead of @var{nb_samples} one.
543 Set curve for fade transition.
545 It accepts the following values:
548 select triangular, linear slope (default)
550 select quarter of sine wave
552 select half of sine wave
554 select exponential sine wave
558 select inverted parabola
574 Fade in first 15 seconds of audio:
580 Fade out last 25 seconds of a 900 seconds audio:
582 afade=t=out:st=875:d=25
589 Set output format constraints for the input audio. The framework will
590 negotiate the most appropriate format to minimize conversions.
592 It accepts the following parameters:
596 A '|'-separated list of requested sample formats.
599 A '|'-separated list of requested sample rates.
601 @item channel_layouts
602 A '|'-separated list of requested channel layouts.
604 See @ref{channel layout syntax,,the Channel Layout section in the ffmpeg-utils(1) manual,ffmpeg-utils}
605 for the required syntax.
608 If a parameter is omitted, all values are allowed.
610 Force the output to either unsigned 8-bit or signed 16-bit stereo
612 aformat=sample_fmts=u8|s16:channel_layouts=stereo
617 Apply a two-pole all-pass filter with central frequency (in Hz)
618 @var{frequency}, and filter-width @var{width}.
619 An all-pass filter changes the audio's frequency to phase relationship
620 without changing its frequency to amplitude relationship.
622 The filter accepts the following options:
629 Set method to specify band-width of filter.
642 Specify the band-width of a filter in width_type units.
647 Merge two or more audio streams into a single multi-channel stream.
649 The filter accepts the following options:
654 Set the number of inputs. Default is 2.
658 If the channel layouts of the inputs are disjoint, and therefore compatible,
659 the channel layout of the output will be set accordingly and the channels
660 will be reordered as necessary. If the channel layouts of the inputs are not
661 disjoint, the output will have all the channels of the first input then all
662 the channels of the second input, in that order, and the channel layout of
663 the output will be the default value corresponding to the total number of
666 For example, if the first input is in 2.1 (FL+FR+LF) and the second input
667 is FC+BL+BR, then the output will be in 5.1, with the channels in the
668 following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
669 first input, b1 is the first channel of the second input).
671 On the other hand, if both input are in stereo, the output channels will be
672 in the default order: a1, a2, b1, b2, and the channel layout will be
673 arbitrarily set to 4.0, which may or may not be the expected value.
675 All inputs must have the same sample rate, and format.
677 If inputs do not have the same duration, the output will stop with the
684 Merge two mono files into a stereo stream:
686 amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
690 Multiple merges assuming 1 video stream and 6 audio streams in @file{input.mkv}:
692 ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
698 Mixes multiple audio inputs into a single output.
700 Note that this filter only supports float samples (the @var{amerge}
701 and @var{pan} audio filters support many formats). If the @var{amix}
702 input has integer samples then @ref{aresample} will be automatically
703 inserted to perform the conversion to float samples.
707 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
709 will mix 3 input audio streams to a single output with the same duration as the
710 first input and a dropout transition time of 3 seconds.
712 It accepts the following parameters:
716 The number of inputs. If unspecified, it defaults to 2.
719 How to determine the end-of-stream.
723 The duration of the longest input. (default)
726 The duration of the shortest input.
729 The duration of the first input.
733 @item dropout_transition
734 The transition time, in seconds, for volume renormalization when an input
735 stream ends. The default value is 2 seconds.
741 Pass the audio source unchanged to the output.
745 Pad the end of a audio stream with silence, this can be used together with
746 -shortest to extend audio streams to the same length as the video stream.
749 Add a phasing effect to the input audio.
751 A phaser filter creates series of peaks and troughs in the frequency spectrum.
752 The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
754 A description of the accepted parameters follows.
758 Set input gain. Default is 0.4.
761 Set output gain. Default is 0.74
764 Set delay in milliseconds. Default is 3.0.
767 Set decay. Default is 0.4.
770 Set modulation speed in Hz. Default is 0.5.
773 Set modulation type. Default is triangular.
775 It accepts the following values:
785 Resample the input audio to the specified parameters, using the
786 libswresample library. If none are specified then the filter will
787 automatically convert between its input and output.
789 This filter is also able to stretch/squeeze the audio data to make it match
790 the timestamps or to inject silence / cut out audio to make it match the
791 timestamps, do a combination of both or do neither.
793 The filter accepts the syntax
794 [@var{sample_rate}:]@var{resampler_options}, where @var{sample_rate}
795 expresses a sample rate and @var{resampler_options} is a list of
796 @var{key}=@var{value} pairs, separated by ":". See the
797 ffmpeg-resampler manual for the complete list of supported options.
803 Resample the input audio to 44100Hz:
809 Stretch/squeeze samples to the given timestamps, with a maximum of 1000
810 samples per second compensation:
816 @section asetnsamples
818 Set the number of samples per each output audio frame.
820 The last output packet may contain a different number of samples, as
821 the filter will flush all the remaining samples when the input audio
824 The filter accepts the following options:
828 @item nb_out_samples, n
829 Set the number of frames per each output audio frame. The number is
830 intended as the number of samples @emph{per each channel}.
831 Default value is 1024.
834 If set to 1, the filter will pad the last audio frame with zeroes, so
835 that the last frame will contain the same number of samples as the
836 previous ones. Default value is 1.
839 For example, to set the number of per-frame samples to 1234 and
840 disable padding for the last frame, use:
842 asetnsamples=n=1234:p=0
847 Set the sample rate without altering the PCM data.
848 This will result in a change of speed and pitch.
850 The filter accepts the following options:
854 Set the output sample rate. Default is 44100 Hz.
859 Show a line containing various information for each input audio frame.
860 The input audio is not modified.
862 The shown line contains a sequence of key/value pairs of the form
863 @var{key}:@var{value}.
865 It accepts the following parameters:
869 The (sequential) number of the input frame, starting from 0.
872 The presentation timestamp of the input frame, in time base units; the time base
873 depends on the filter input pad, and is usually 1/@var{sample_rate}.
876 The presentation timestamp of the input frame in seconds.
879 position of the frame in the input stream, -1 if this information in
880 unavailable and/or meaningless (for example in case of synthetic audio)
889 The sample rate for the audio frame.
892 The number of samples (per channel) in the frame.
895 The Adler-32 checksum (printed in hexadecimal) of the audio data. For planar
896 audio, the data is treated as if all the planes were concatenated.
898 @item plane_checksums
899 A list of Adler-32 checksums for each data plane.
904 Display time domain statistical information about the audio channels.
905 Statistics are calculated and displayed for each audio channel and,
906 where applicable, an overall figure is also given.
908 It accepts the following option:
911 Short window length in seconds, used for peak and trough RMS measurement.
912 Default is @code{0.05} (50 miliseconds). Allowed range is @code{[0.1 - 10]}.
915 A description of each shown parameter follows:
919 Mean amplitude displacement from zero.
922 Minimal sample level.
925 Maximal sample level.
929 Standard peak and RMS level measured in dBFS.
933 Peak and trough values for RMS level measured over a short window.
936 Standard ratio of peak to RMS level (note: not in dB).
939 Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
940 (i.e. either @var{Min level} or @var{Max level}).
943 Number of occasions (not the number of samples) that the signal attained either
944 @var{Min level} or @var{Max level}.
949 Forward two audio streams and control the order the buffers are forwarded.
951 The filter accepts the following options:
955 Set the expression deciding which stream should be
956 forwarded next: if the result is negative, the first stream is forwarded; if
957 the result is positive or zero, the second stream is forwarded. It can use
958 the following variables:
962 number of buffers forwarded so far on each stream
964 number of samples forwarded so far on each stream
966 current timestamp of each stream
969 The default value is @code{t1-t2}, which means to always forward the stream
970 that has a smaller timestamp.
975 Stress-test @code{amerge} by randomly sending buffers on the wrong
976 input, while avoiding too much of a desynchronization:
978 amovie=file.ogg [a] ; amovie=file.mp3 [b] ;
979 [a] [b] astreamsync=(2*random(1))-1+tanh(5*(t1-t2)) [a2] [b2] ;
985 Synchronize audio data with timestamps by squeezing/stretching it and/or
986 dropping samples/adding silence when needed.
988 This filter is not built by default, please use @ref{aresample} to do squeezing/stretching.
990 It accepts the following parameters:
994 Enable stretching/squeezing the data to make it match the timestamps. Disabled
995 by default. When disabled, time gaps are covered with silence.
998 The minimum difference between timestamps and audio data (in seconds) to trigger
999 adding/dropping samples. The default value is 0.1. If you get an imperfect
1000 sync with this filter, try setting this parameter to 0.
1003 The maximum compensation in samples per second. Only relevant with compensate=1.
1004 The default value is 500.
1007 Assume that the first PTS should be this value. The time base is 1 / sample
1008 rate. This allows for padding/trimming at the start of the stream. By default,
1009 no assumption is made about the first frame's expected PTS, so no padding or
1010 trimming is done. For example, this could be set to 0 to pad the beginning with
1011 silence if an audio stream starts after the video stream or to trim any samples
1012 with a negative PTS due to encoder delay.
1020 The filter accepts exactly one parameter, the audio tempo. If not
1021 specified then the filter will assume nominal 1.0 tempo. Tempo must
1022 be in the [0.5, 2.0] range.
1024 @subsection Examples
1028 Slow down audio to 80% tempo:
1034 To speed up audio to 125% tempo:
1042 Trim the input so that the output contains one continuous subpart of the input.
1044 It accepts the following parameters:
1047 Timestamp (in seconds) of the start of the section to keep. I.e. the audio
1048 sample with the timestamp @var{start} will be the first sample in the output.
1051 Specify time of the first audio sample that will be dropped, i.e. the
1052 audio sample immediately preceding the one with the timestamp @var{end} will be
1053 the last sample in the output.
1056 Same as @var{start}, except this option sets the start timestamp in samples
1060 Same as @var{end}, except this option sets the end timestamp in samples instead
1064 The maximum duration of the output in seconds.
1067 The number of the first sample that should be output.
1070 The number of the first sample that should be dropped.
1073 @option{start}, @option{end}, @option{duration} are expressed as time
1074 duration specifications, check the "Time duration" section in the
1075 ffmpeg-utils manual.
1077 Note that the first two sets of the start/end options and the @option{duration}
1078 option look at the frame timestamp, while the _sample options simply count the
1079 samples that pass through the filter. So start/end_pts and start/end_sample will
1080 give different results when the timestamps are wrong, inexact or do not start at
1081 zero. Also note that this filter does not modify the timestamps. If you wish
1082 to have the output timestamps start at zero, insert the asetpts filter after the
1085 If multiple start or end options are set, this filter tries to be greedy and
1086 keep all samples that match at least one of the specified constraints. To keep
1087 only the part that matches all the constraints at once, chain multiple atrim
1090 The defaults are such that all the input is kept. So it is possible to set e.g.
1091 just the end values to keep everything before the specified time.
1096 Drop everything except the second minute of input:
1098 ffmpeg -i INPUT -af atrim=60:120
1102 Keep only the first 1000 samples:
1104 ffmpeg -i INPUT -af atrim=end_sample=1000
1111 Apply a two-pole Butterworth band-pass filter with central
1112 frequency @var{frequency}, and (3dB-point) band-width width.
1113 The @var{csg} option selects a constant skirt gain (peak gain = Q)
1114 instead of the default: constant 0dB peak gain.
1115 The filter roll off at 6dB per octave (20dB per decade).
1117 The filter accepts the following options:
1121 Set the filter's central frequency. Default is @code{3000}.
1124 Constant skirt gain if set to 1. Defaults to 0.
1127 Set method to specify band-width of filter.
1140 Specify the band-width of a filter in width_type units.
1145 Apply a two-pole Butterworth band-reject filter with central
1146 frequency @var{frequency}, and (3dB-point) band-width @var{width}.
1147 The filter roll off at 6dB per octave (20dB per decade).
1149 The filter accepts the following options:
1153 Set the filter's central frequency. Default is @code{3000}.
1156 Set method to specify band-width of filter.
1169 Specify the band-width of a filter in width_type units.
1174 Boost or cut the bass (lower) frequencies of the audio using a two-pole
1175 shelving filter with a response similar to that of a standard
1176 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
1178 The filter accepts the following options:
1182 Give the gain at 0 Hz. Its useful range is about -20
1183 (for a large cut) to +20 (for a large boost).
1184 Beware of clipping when using a positive gain.
1187 Set the filter's central frequency and so can be used
1188 to extend or reduce the frequency range to be boosted or cut.
1189 The default value is @code{100} Hz.
1192 Set method to specify band-width of filter.
1205 Determine how steep is the filter's shelf transition.
1210 Apply a biquad IIR filter with the given coefficients.
1211 Where @var{b0}, @var{b1}, @var{b2} and @var{a0}, @var{a1}, @var{a2}
1212 are the numerator and denominator coefficients respectively.
1215 Bauer stereo to binaural transformation, which improves headphone listening of
1216 stereo audio records.
1218 It accepts the following parameters:
1222 Pre-defined crossfeed level.
1226 Default level (fcut=700, feed=50).
1229 Chu Moy circuit (fcut=700, feed=60).
1232 Jan Meier circuit (fcut=650, feed=95).
1237 Cut frequency (in Hz).
1246 Remap input channels to new locations.
1248 It accepts the following parameters:
1250 @item channel_layout
1251 The channel layout of the output stream.
1254 Map channels from input to output. The argument is a '|'-separated list of
1255 mappings, each in the @code{@var{in_channel}-@var{out_channel}} or
1256 @var{in_channel} form. @var{in_channel} can be either the name of the input
1257 channel (e.g. FL for front left) or its index in the input channel layout.
1258 @var{out_channel} is the name of the output channel or its index in the output
1259 channel layout. If @var{out_channel} is not given then it is implicitly an
1260 index, starting with zero and increasing by one for each mapping.
1263 If no mapping is present, the filter will implicitly map input channels to
1264 output channels, preserving indices.
1266 For example, assuming a 5.1+downmix input MOV file,
1268 ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
1270 will create an output WAV file tagged as stereo from the downmix channels of
1273 To fix a 5.1 WAV improperly encoded in AAC's native channel order
1275 ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:channel_layout=5.1' out.wav
1278 @section channelsplit
1280 Split each channel from an input audio stream into a separate output stream.
1282 It accepts the following parameters:
1284 @item channel_layout
1285 The channel layout of the input stream. The default is "stereo".
1288 For example, assuming a stereo input MP3 file,
1290 ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
1292 will create an output Matroska file with two audio streams, one containing only
1293 the left channel and the other the right channel.
1295 Split a 5.1 WAV file into per-channel files:
1297 ffmpeg -i in.wav -filter_complex
1298 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
1299 -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
1300 front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
1305 Compress or expand the audio's dynamic range.
1307 It accepts the following parameters:
1313 A list of times in seconds for each channel over which the instantaneous level
1314 of the input signal is averaged to determine its volume. @var{attacks} refers to
1315 increase of volume and @var{decays} refers to decrease of volume. For most
1316 situations, the attack time (response to the audio getting louder) should be
1317 shorter than the decay time, because the human ear is more sensitive to sudden
1318 loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
1319 a typical value for decay is 0.8 seconds.
1322 A list of points for the transfer function, specified in dB relative to the
1323 maximum possible signal amplitude. Each key points list must be defined using
1324 the following syntax: @code{x0/y0|x1/y1|x2/y2|....} or
1325 @code{x0/y0 x1/y1 x2/y2 ....}
1327 The input values must be in strictly increasing order but the transfer function
1328 does not have to be monotonically rising. The point @code{0/0} is assumed but
1329 may be overridden (by @code{0/out-dBn}). Typical values for the transfer
1330 function are @code{-70/-70|-60/-20}.
1333 Set the curve radius in dB for all joints. It defaults to 0.01.
1336 Set the additional gain in dB to be applied at all points on the transfer
1337 function. This allows for easy adjustment of the overall gain.
1341 Set an initial volume, in dB, to be assumed for each channel when filtering
1342 starts. This permits the user to supply a nominal level initially, so that, for
1343 example, a very large gain is not applied to initial signal levels before the
1344 companding has begun to operate. A typical value for audio which is initially
1345 quiet is -90 dB. It defaults to 0.
1348 Set a delay, in seconds. The input audio is analyzed immediately, but audio is
1349 delayed before being fed to the volume adjuster. Specifying a delay
1350 approximately equal to the attack/decay times allows the filter to effectively
1351 operate in predictive rather than reactive mode. It defaults to 0.
1355 @subsection Examples
1359 Make music with both quiet and loud passages suitable for listening to in a
1362 compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
1366 A noise gate for when the noise is at a lower level than the signal:
1368 compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
1372 Here is another noise gate, this time for when the noise is at a higher level
1373 than the signal (making it, in some ways, similar to squelch):
1375 compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
1381 Make audio easier to listen to on headphones.
1383 This filter adds `cues' to 44.1kHz stereo (i.e. audio CD format) audio
1384 so that when listened to on headphones the stereo image is moved from
1385 inside your head (standard for headphones) to outside and in front of
1386 the listener (standard for speakers).
1392 Apply a two-pole peaking equalisation (EQ) filter. With this
1393 filter, the signal-level at and around a selected frequency can
1394 be increased or decreased, whilst (unlike bandpass and bandreject
1395 filters) that at all other frequencies is unchanged.
1397 In order to produce complex equalisation curves, this filter can
1398 be given several times, each with a different central frequency.
1400 The filter accepts the following options:
1404 Set the filter's central frequency in Hz.
1407 Set method to specify band-width of filter.
1420 Specify the band-width of a filter in width_type units.
1423 Set the required gain or attenuation in dB.
1424 Beware of clipping when using a positive gain.
1427 @subsection Examples
1430 Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
1432 equalizer=f=1000:width_type=h:width=200:g=-10
1436 Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
1438 equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
1443 Apply a flanging effect to the audio.
1445 The filter accepts the following options:
1449 Set base delay in milliseconds. Range from 0 to 30. Default value is 0.
1452 Set added swep delay in milliseconds. Range from 0 to 10. Default value is 2.
1455 Set percentage regeneneration (delayed signal feedback). Range from -95 to 95.
1459 Set percentage of delayed signal mixed with original. Range from 0 to 100.
1463 Set sweeps per second (Hz). Range from 0.1 to 10. Default value is 0.5.
1466 Set swept wave shape, can be @var{triangular} or @var{sinusoidal}.
1467 Default value is @var{sinusoidal}.
1470 Set swept wave percentage-shift for multi channel. Range from 0 to 100.
1471 Default value is 25.
1474 Set delay-line interpolation, @var{linear} or @var{quadratic}.
1475 Default is @var{linear}.
1480 Apply a high-pass filter with 3dB point frequency.
1481 The filter can be either single-pole, or double-pole (the default).
1482 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
1484 The filter accepts the following options:
1488 Set frequency in Hz. Default is 3000.
1491 Set number of poles. Default is 2.
1494 Set method to specify band-width of filter.
1507 Specify the band-width of a filter in width_type units.
1508 Applies only to double-pole filter.
1509 The default is 0.707q and gives a Butterworth response.
1514 Join multiple input streams into one multi-channel stream.
1516 It accepts the following parameters:
1520 The number of input streams. It defaults to 2.
1522 @item channel_layout
1523 The desired output channel layout. It defaults to stereo.
1526 Map channels from inputs to output. The argument is a '|'-separated list of
1527 mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
1528 form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
1529 can be either the name of the input channel (e.g. FL for front left) or its
1530 index in the specified input stream. @var{out_channel} is the name of the output
1534 The filter will attempt to guess the mappings when they are not specified
1535 explicitly. It does so by first trying to find an unused matching input channel
1536 and if that fails it picks the first unused input channel.
1538 Join 3 inputs (with properly set channel layouts):
1540 ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
1543 Build a 5.1 output from 6 single-channel streams:
1545 ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
1546 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
1552 Load a LADSPA (Linux Audio Developer's Simple Plugin API) plugin.
1554 To enable compilation of this filter you need to configure FFmpeg with
1555 @code{--enable-ladspa}.
1559 Specifies the name of LADSPA plugin library to load. If the environment
1560 variable @env{LADSPA_PATH} is defined, the LADSPA plugin is searched in
1561 each one of the directories specified by the colon separated list in
1562 @env{LADSPA_PATH}, otherwise in the standard LADSPA paths, which are in
1563 this order: @file{HOME/.ladspa/lib/}, @file{/usr/local/lib/ladspa/},
1564 @file{/usr/lib/ladspa/}.
1567 Specifies the plugin within the library. Some libraries contain only
1568 one plugin, but others contain many of them. If this is not set filter
1569 will list all available plugins within the specified library.
1572 Set the '|' separated list of controls which are zero or more floating point
1573 values that determine the behavior of the loaded plugin (for example delay,
1575 Controls need to be defined using the following syntax:
1576 c0=@var{value0}|c1=@var{value1}|c2=@var{value2}|..., where
1577 @var{valuei} is the value set on the @var{i}-th control.
1578 If @option{controls} is set to @code{help}, all available controls and
1579 their valid ranges are printed.
1581 @item sample_rate, s
1582 Specify the sample rate, default to 44100. Only used if plugin have
1586 Set the number of samples per channel per each output frame, default
1587 is 1024. Only used if plugin have zero inputs.
1590 Set the minimum duration of the sourced audio. See the function
1591 @code{av_parse_time()} for the accepted format, also check the "Time duration"
1592 section in the ffmpeg-utils manual.
1593 Note that the resulting duration may be greater than the specified duration,
1594 as the generated audio is always cut at the end of a complete frame.
1595 If not specified, or the expressed duration is negative, the audio is
1596 supposed to be generated forever.
1597 Only used if plugin have zero inputs.
1601 @subsection Examples
1605 List all available plugins within amp (LADSPA example plugin) library:
1611 List all available controls and their valid ranges for @code{vcf_notch}
1612 plugin from @code{VCF} library:
1614 ladspa=f=vcf:p=vcf_notch:c=help
1618 Simulate low quality audio equipment using @code{Computer Music Toolkit} (CMT)
1621 ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
1625 Add reverberation to the audio using TAP-plugins
1626 (Tom's Audio Processing plugins):
1628 ladspa=file=tap_reverb:tap_reverb
1632 Generate white noise, with 0.2 amplitude:
1634 ladspa=file=cmt:noise_source_white:c=c0=.2
1638 Generate 20 bpm clicks using plugin @code{C* Click - Metronome} from the
1639 @code{C* Audio Plugin Suite} (CAPS) library:
1641 ladspa=file=caps:Click:c=c1=20'
1645 Apply @code{C* Eq10X2 - Stereo 10-band equaliser} effect:
1647 ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
1651 @subsection Commands
1653 This filter supports the following commands:
1656 Modify the @var{N}-th control value.
1658 If the specified value is not valid, it is ignored and prior one is kept.
1663 Apply a low-pass filter with 3dB point frequency.
1664 The filter can be either single-pole or double-pole (the default).
1665 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
1667 The filter accepts the following options:
1671 Set frequency in Hz. Default is 500.
1674 Set number of poles. Default is 2.
1677 Set method to specify band-width of filter.
1690 Specify the band-width of a filter in width_type units.
1691 Applies only to double-pole filter.
1692 The default is 0.707q and gives a Butterworth response.
1697 Mix channels with specific gain levels. The filter accepts the output
1698 channel layout followed by a set of channels definitions.
1700 This filter is also designed to remap efficiently the channels of an audio
1703 The filter accepts parameters of the form:
1704 "@var{l}:@var{outdef}:@var{outdef}:..."
1708 output channel layout or number of channels
1711 output channel specification, of the form:
1712 "@var{out_name}=[@var{gain}*]@var{in_name}[+[@var{gain}*]@var{in_name}...]"
1715 output channel to define, either a channel name (FL, FR, etc.) or a channel
1716 number (c0, c1, etc.)
1719 multiplicative coefficient for the channel, 1 leaving the volume unchanged
1722 input channel to use, see out_name for details; it is not possible to mix
1723 named and numbered input channels
1726 If the `=' in a channel specification is replaced by `<', then the gains for
1727 that specification will be renormalized so that the total is 1, thus
1728 avoiding clipping noise.
1730 @subsection Mixing examples
1732 For example, if you want to down-mix from stereo to mono, but with a bigger
1733 factor for the left channel:
1735 pan=1:c0=0.9*c0+0.1*c1
1738 A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
1739 7-channels surround:
1741 pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
1744 Note that @command{ffmpeg} integrates a default down-mix (and up-mix) system
1745 that should be preferred (see "-ac" option) unless you have very specific
1748 @subsection Remapping examples
1750 The channel remapping will be effective if, and only if:
1753 @item gain coefficients are zeroes or ones,
1754 @item only one input per channel output,
1757 If all these conditions are satisfied, the filter will notify the user ("Pure
1758 channel mapping detected"), and use an optimized and lossless method to do the
1761 For example, if you have a 5.1 source and want a stereo audio stream by
1762 dropping the extra channels:
1764 pan="stereo: c0=FL : c1=FR"
1767 Given the same source, you can also switch front left and front right channels
1768 and keep the input channel layout:
1770 pan="5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5"
1773 If the input is a stereo audio stream, you can mute the front left channel (and
1774 still keep the stereo channel layout) with:
1779 Still with a stereo audio stream input, you can copy the right channel in both
1780 front left and right:
1782 pan="stereo: c0=FR : c1=FR"
1787 ReplayGain scanner filter. This filter takes an audio stream as an input and
1788 outputs it unchanged.
1789 At end of filtering it displays @code{track_gain} and @code{track_peak}.
1793 Convert the audio sample format, sample rate and channel layout. It is
1794 not meant to be used directly.
1796 @section silencedetect
1798 Detect silence in an audio stream.
1800 This filter logs a message when it detects that the input audio volume is less
1801 or equal to a noise tolerance value for a duration greater or equal to the
1802 minimum detected noise duration.
1804 The printed times and duration are expressed in seconds.
1806 The filter accepts the following options:
1810 Set silence duration until notification (default is 2 seconds).
1813 Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
1814 specified value) or amplitude ratio. Default is -60dB, or 0.001.
1817 @subsection Examples
1821 Detect 5 seconds of silence with -50dB noise tolerance:
1823 silencedetect=n=-50dB:d=5
1827 Complete example with @command{ffmpeg} to detect silence with 0.0001 noise
1828 tolerance in @file{silence.mp3}:
1830 ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
1836 Boost or cut treble (upper) frequencies of the audio using a two-pole
1837 shelving filter with a response similar to that of a standard
1838 hi-fi's tone-controls. This is also known as shelving equalisation (EQ).
1840 The filter accepts the following options:
1844 Give the gain at whichever is the lower of ~22 kHz and the
1845 Nyquist frequency. Its useful range is about -20 (for a large cut)
1846 to +20 (for a large boost). Beware of clipping when using a positive gain.
1849 Set the filter's central frequency and so can be used
1850 to extend or reduce the frequency range to be boosted or cut.
1851 The default value is @code{3000} Hz.
1854 Set method to specify band-width of filter.
1867 Determine how steep is the filter's shelf transition.
1872 Adjust the input audio volume.
1874 It accepts the following parameters:
1878 Set audio volume expression.
1880 Output values are clipped to the maximum value.
1882 The output audio volume is given by the relation:
1884 @var{output_volume} = @var{volume} * @var{input_volume}
1887 The default value for @var{volume} is "1.0".
1890 This parameter represents the mathematical precision.
1892 It determines which input sample formats will be allowed, which affects the
1893 precision of the volume scaling.
1897 8-bit fixed-point; this limits input sample format to U8, S16, and S32.
1899 32-bit floating-point; this limits input sample format to FLT. (default)
1901 64-bit floating-point; this limits input sample format to DBL.
1905 Choose the behaviour on encountering ReplayGain side data in input frames.
1909 Remove ReplayGain side data, ignoring its contents (the default).
1912 Ignore ReplayGain side data, but leave it in the frame.
1915 Prefer the track gain, if present.
1918 Prefer the album gain, if present.
1921 @item replaygain_preamp
1922 Pre-amplification gain in dB to apply to the selected replaygain gain.
1924 Default value for @var{replaygain_preamp} is 0.0.
1927 Set when the volume expression is evaluated.
1929 It accepts the following values:
1932 only evaluate expression once during the filter initialization, or
1933 when the @samp{volume} command is sent
1936 evaluate expression for each incoming frame
1939 Default value is @samp{once}.
1942 The volume expression can contain the following parameters.
1946 frame number (starting at zero)
1949 @item nb_consumed_samples
1950 number of samples consumed by the filter
1952 number of samples in the current frame
1954 original frame position in the file
1960 PTS at start of stream
1962 time at start of stream
1968 last set volume value
1971 Note that when @option{eval} is set to @samp{once} only the
1972 @var{sample_rate} and @var{tb} variables are available, all other
1973 variables will evaluate to NAN.
1975 @subsection Commands
1977 This filter supports the following commands:
1980 Modify the volume expression.
1981 The command accepts the same syntax of the corresponding option.
1983 If the specified expression is not valid, it is kept at its current
1985 @item replaygain_noclip
1986 Prevent clipping by limiting the gain applied.
1988 Default value for @var{replaygain_noclip} is 1.
1992 @subsection Examples
1996 Halve the input audio volume:
2000 volume=volume=-6.0206dB
2003 In all the above example the named key for @option{volume} can be
2004 omitted, for example like in:
2010 Increase input audio power by 6 decibels using fixed-point precision:
2012 volume=volume=6dB:precision=fixed
2016 Fade volume after time 10 with an annihilation period of 5 seconds:
2018 volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
2022 @section volumedetect
2024 Detect the volume of the input video.
2026 The filter has no parameters. The input is not modified. Statistics about
2027 the volume will be printed in the log when the input stream end is reached.
2029 In particular it will show the mean volume (root mean square), maximum
2030 volume (on a per-sample basis), and the beginning of a histogram of the
2031 registered volume values (from the maximum value to a cumulated 1/1000 of
2034 All volumes are in decibels relative to the maximum PCM value.
2036 @subsection Examples
2038 Here is an excerpt of the output:
2040 [Parsed_volumedetect_0 @ 0xa23120] mean_volume: -27 dB
2041 [Parsed_volumedetect_0 @ 0xa23120] max_volume: -4 dB
2042 [Parsed_volumedetect_0 @ 0xa23120] histogram_4db: 6
2043 [Parsed_volumedetect_0 @ 0xa23120] histogram_5db: 62
2044 [Parsed_volumedetect_0 @ 0xa23120] histogram_6db: 286
2045 [Parsed_volumedetect_0 @ 0xa23120] histogram_7db: 1042
2046 [Parsed_volumedetect_0 @ 0xa23120] histogram_8db: 2551
2047 [Parsed_volumedetect_0 @ 0xa23120] histogram_9db: 4609
2048 [Parsed_volumedetect_0 @ 0xa23120] histogram_10db: 8409
2054 The mean square energy is approximately -27 dB, or 10^-2.7.
2056 The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
2058 There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
2061 In other words, raising the volume by +4 dB does not cause any clipping,
2062 raising it by +5 dB causes clipping for 6 samples, etc.
2064 @c man end AUDIO FILTERS
2066 @chapter Audio Sources
2067 @c man begin AUDIO SOURCES
2069 Below is a description of the currently available audio sources.
2073 Buffer audio frames, and make them available to the filter chain.
2075 This source is mainly intended for a programmatic use, in particular
2076 through the interface defined in @file{libavfilter/asrc_abuffer.h}.
2078 It accepts the following parameters:
2082 The timebase which will be used for timestamps of submitted frames. It must be
2083 either a floating-point number or in @var{numerator}/@var{denominator} form.
2086 The sample rate of the incoming audio buffers.
2089 The sample format of the incoming audio buffers.
2090 Either a sample format name or its corresponging integer representation from
2091 the enum AVSampleFormat in @file{libavutil/samplefmt.h}
2093 @item channel_layout
2094 The channel layout of the incoming audio buffers.
2095 Either a channel layout name from channel_layout_map in
2096 @file{libavutil/channel_layout.c} or its corresponding integer representation
2097 from the AV_CH_LAYOUT_* macros in @file{libavutil/channel_layout.h}
2100 The number of channels of the incoming audio buffers.
2101 If both @var{channels} and @var{channel_layout} are specified, then they
2106 @subsection Examples
2109 abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
2112 will instruct the source to accept planar 16bit signed stereo at 44100Hz.
2113 Since the sample format with name "s16p" corresponds to the number
2114 6 and the "stereo" channel layout corresponds to the value 0x3, this is
2117 abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
2122 Generate an audio signal specified by an expression.
2124 This source accepts in input one or more expressions (one for each
2125 channel), which are evaluated and used to generate a corresponding
2128 This source accepts the following options:
2132 Set the '|'-separated expressions list for each separate channel. In case the
2133 @option{channel_layout} option is not specified, the selected channel layout
2134 depends on the number of provided expressions. Otherwise the last
2135 specified expression is applied to the remaining output channels.
2137 @item channel_layout, c
2138 Set the channel layout. The number of channels in the specified layout
2139 must be equal to the number of specified expressions.
2142 Set the minimum duration of the sourced audio. See the function
2143 @code{av_parse_time()} for the accepted format.
2144 Note that the resulting duration may be greater than the specified
2145 duration, as the generated audio is always cut at the end of a
2148 If not specified, or the expressed duration is negative, the audio is
2149 supposed to be generated forever.
2152 Set the number of samples per channel per each output frame,
2155 @item sample_rate, s
2156 Specify the sample rate, default to 44100.
2159 Each expression in @var{exprs} can contain the following constants:
2163 number of the evaluated sample, starting from 0
2166 time of the evaluated sample expressed in seconds, starting from 0
2173 @subsection Examples
2183 Generate a sin signal with frequency of 440 Hz, set sample rate to
2186 aevalsrc="sin(440*2*PI*t):s=8000"
2190 Generate a two channels signal, specify the channel layout (Front
2191 Center + Back Center) explicitly:
2193 aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
2197 Generate white noise:
2199 aevalsrc="-2+random(0)"
2203 Generate an amplitude modulated signal:
2205 aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
2209 Generate 2.5 Hz binaural beats on a 360 Hz carrier:
2211 aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
2218 The null audio source, return unprocessed audio frames. It is mainly useful
2219 as a template and to be employed in analysis / debugging tools, or as
2220 the source for filters which ignore the input data (for example the sox
2223 This source accepts the following options:
2227 @item channel_layout, cl
2229 Specifies the channel layout, and can be either an integer or a string
2230 representing a channel layout. The default value of @var{channel_layout}
2233 Check the channel_layout_map definition in
2234 @file{libavutil/channel_layout.c} for the mapping between strings and
2235 channel layout values.
2237 @item sample_rate, r
2238 Specifies the sample rate, and defaults to 44100.
2241 Set the number of samples per requested frames.
2245 @subsection Examples
2249 Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
2251 anullsrc=r=48000:cl=4
2255 Do the same operation with a more obvious syntax:
2257 anullsrc=r=48000:cl=mono
2261 All the parameters need to be explicitly defined.
2265 Synthesize a voice utterance using the libflite library.
2267 To enable compilation of this filter you need to configure FFmpeg with
2268 @code{--enable-libflite}.
2270 Note that the flite library is not thread-safe.
2272 The filter accepts the following options:
2277 If set to 1, list the names of the available voices and exit
2278 immediately. Default value is 0.
2281 Set the maximum number of samples per frame. Default value is 512.
2284 Set the filename containing the text to speak.
2287 Set the text to speak.
2290 Set the voice to use for the speech synthesis. Default value is
2291 @code{kal}. See also the @var{list_voices} option.
2294 @subsection Examples
2298 Read from file @file{speech.txt}, and synthetize the text using the
2299 standard flite voice:
2301 flite=textfile=speech.txt
2305 Read the specified text selecting the @code{slt} voice:
2307 flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
2311 Input text to ffmpeg:
2313 ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
2317 Make @file{ffplay} speak the specified text, using @code{flite} and
2318 the @code{lavfi} device:
2320 ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
2324 For more information about libflite, check:
2325 @url{http://www.speech.cs.cmu.edu/flite/}
2329 Generate an audio signal made of a sine wave with amplitude 1/8.
2331 The audio signal is bit-exact.
2333 The filter accepts the following options:
2338 Set the carrier frequency. Default is 440 Hz.
2340 @item beep_factor, b
2341 Enable a periodic beep every second with frequency @var{beep_factor} times
2342 the carrier frequency. Default is 0, meaning the beep is disabled.
2344 @item sample_rate, r
2345 Specify the sample rate, default is 44100.
2348 Specify the duration of the generated audio stream.
2350 @item samples_per_frame
2351 Set the number of samples per output frame, default is 1024.
2354 @subsection Examples
2359 Generate a simple 440 Hz sine wave:
2365 Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
2369 sine=frequency=220:beep_factor=4:duration=5
2374 @c man end AUDIO SOURCES
2376 @chapter Audio Sinks
2377 @c man begin AUDIO SINKS
2379 Below is a description of the currently available audio sinks.
2381 @section abuffersink
2383 Buffer audio frames, and make them available to the end of filter chain.
2385 This sink is mainly intended for programmatic use, in particular
2386 through the interface defined in @file{libavfilter/buffersink.h}
2387 or the options system.
2389 It accepts a pointer to an AVABufferSinkContext structure, which
2390 defines the incoming buffers' formats, to be passed as the opaque
2391 parameter to @code{avfilter_init_filter} for initialization.
2394 Null audio sink; do absolutely nothing with the input audio. It is
2395 mainly useful as a template and for use in analysis / debugging
2398 @c man end AUDIO SINKS
2400 @chapter Video Filters
2401 @c man begin VIDEO FILTERS
2403 When you configure your FFmpeg build, you can disable any of the
2404 existing filters using @code{--disable-filters}.
2405 The configure output will show the video filters included in your
2408 Below is a description of the currently available video filters.
2410 @section alphaextract
2412 Extract the alpha component from the input as a grayscale video. This
2413 is especially useful with the @var{alphamerge} filter.
2417 Add or replace the alpha component of the primary input with the
2418 grayscale value of a second input. This is intended for use with
2419 @var{alphaextract} to allow the transmission or storage of frame
2420 sequences that have alpha in a format that doesn't support an alpha
2423 For example, to reconstruct full frames from a normal YUV-encoded video
2424 and a separate video created with @var{alphaextract}, you might use:
2426 movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
2429 Since this filter is designed for reconstruction, it operates on frame
2430 sequences without considering timestamps, and terminates when either
2431 input reaches end of stream. This will cause problems if your encoding
2432 pipeline drops frames. If you're trying to apply an image as an
2433 overlay to a video stream, consider the @var{overlay} filter instead.
2437 Same as the @ref{subtitles} filter, except that it doesn't require libavcodec
2438 and libavformat to work. On the other hand, it is limited to ASS (Advanced
2439 Substation Alpha) subtitles files.
2443 Compute the bounding box for the non-black pixels in the input frame
2446 This filter computes the bounding box containing all the pixels with a
2447 luminance value greater than the minimum allowed value.
2448 The parameters describing the bounding box are printed on the filter
2451 The filter accepts the following option:
2455 Set the minimal luminance value. Default is @code{16}.
2458 @section blackdetect
2460 Detect video intervals that are (almost) completely black. Can be
2461 useful to detect chapter transitions, commercials, or invalid
2462 recordings. Output lines contains the time for the start, end and
2463 duration of the detected black interval expressed in seconds.
2465 In order to display the output lines, you need to set the loglevel at
2466 least to the AV_LOG_INFO value.
2468 The filter accepts the following options:
2471 @item black_min_duration, d
2472 Set the minimum detected black duration expressed in seconds. It must
2473 be a non-negative floating point number.
2475 Default value is 2.0.
2477 @item picture_black_ratio_th, pic_th
2478 Set the threshold for considering a picture "black".
2479 Express the minimum value for the ratio:
2481 @var{nb_black_pixels} / @var{nb_pixels}
2484 for which a picture is considered black.
2485 Default value is 0.98.
2487 @item pixel_black_th, pix_th
2488 Set the threshold for considering a pixel "black".
2490 The threshold expresses the maximum pixel luminance value for which a
2491 pixel is considered "black". The provided value is scaled according to
2492 the following equation:
2494 @var{absolute_threshold} = @var{luminance_minimum_value} + @var{pixel_black_th} * @var{luminance_range_size}
2497 @var{luminance_range_size} and @var{luminance_minimum_value} depend on
2498 the input video format, the range is [0-255] for YUV full-range
2499 formats and [16-235] for YUV non full-range formats.
2501 Default value is 0.10.
2504 The following example sets the maximum pixel threshold to the minimum
2505 value, and detects only black intervals of 2 or more seconds:
2507 blackdetect=d=2:pix_th=0.00
2512 Detect frames that are (almost) completely black. Can be useful to
2513 detect chapter transitions or commercials. Output lines consist of
2514 the frame number of the detected frame, the percentage of blackness,
2515 the position in the file if known or -1 and the timestamp in seconds.
2517 In order to display the output lines, you need to set the loglevel at
2518 least to the AV_LOG_INFO value.
2520 It accepts the following parameters:
2525 The percentage of the pixels that have to be below the threshold; it defaults to
2528 @item threshold, thresh
2529 The threshold below which a pixel value is considered black; it defaults to
2536 Blend two video frames into each other.
2538 It takes two input streams and outputs one stream, the first input is the
2539 "top" layer and second input is "bottom" layer.
2540 Output terminates when shortest input terminates.
2542 A description of the accepted options follows.
2550 Set blend mode for specific pixel component or all pixel components in case
2551 of @var{all_mode}. Default value is @code{normal}.
2553 Available values for component modes are:
2586 Set blend opacity for specific pixel component or all pixel components in case
2587 of @var{all_opacity}. Only used in combination with pixel component blend modes.
2594 Set blend expression for specific pixel component or all pixel components in case
2595 of @var{all_expr}. Note that related mode options will be ignored if those are set.
2597 The expressions can use the following variables:
2601 The sequential number of the filtered frame, starting from @code{0}.
2605 the coordinates of the current sample
2609 the width and height of currently filtered plane
2613 Width and height scale depending on the currently filtered plane. It is the
2614 ratio between the corresponding luma plane number of pixels and the current
2615 plane ones. E.g. for YUV4:2:0 the values are @code{1,1} for the luma plane, and
2616 @code{0.5,0.5} for chroma planes.
2619 Time of the current frame, expressed in seconds.
2622 Value of pixel component at current location for first video frame (top layer).
2625 Value of pixel component at current location for second video frame (bottom layer).
2629 Force termination when the shortest input terminates. Default is @code{0}.
2631 Continue applying the last bottom frame after the end of the stream. A value of
2632 @code{0} disable the filter after the last frame of the bottom layer is reached.
2633 Default is @code{1}.
2636 @subsection Examples
2640 Apply transition from bottom layer to top layer in first 10 seconds:
2642 blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
2646 Apply 1x1 checkerboard effect:
2648 blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
2652 Apply uncover left effect:
2654 blend=all_expr='if(gte(N*SW+X,W),A,B)'
2658 Apply uncover down effect:
2660 blend=all_expr='if(gte(Y-N*SH,0),A,B)'
2664 Apply uncover up-left effect:
2666 blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
2672 Apply a boxblur algorithm to the input video.
2674 It accepts the following parameters:
2678 @item luma_radius, lr
2679 @item luma_power, lp
2680 @item chroma_radius, cr
2681 @item chroma_power, cp
2682 @item alpha_radius, ar
2683 @item alpha_power, ap
2687 A description of the accepted options follows.
2690 @item luma_radius, lr
2691 @item chroma_radius, cr
2692 @item alpha_radius, ar
2693 Set an expression for the box radius in pixels used for blurring the
2694 corresponding input plane.
2696 The radius value must be a non-negative number, and must not be
2697 greater than the value of the expression @code{min(w,h)/2} for the
2698 luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
2701 Default value for @option{luma_radius} is "2". If not specified,
2702 @option{chroma_radius} and @option{alpha_radius} default to the
2703 corresponding value set for @option{luma_radius}.
2705 The expressions can contain the following constants:
2709 The input width and height in pixels.
2713 The input chroma image width and height in pixels.
2717 The horizontal and vertical chroma subsample values. For example, for the
2718 pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
2721 @item luma_power, lp
2722 @item chroma_power, cp
2723 @item alpha_power, ap
2724 Specify how many times the boxblur filter is applied to the
2725 corresponding plane.
2727 Default value for @option{luma_power} is 2. If not specified,
2728 @option{chroma_power} and @option{alpha_power} default to the
2729 corresponding value set for @option{luma_power}.
2731 A value of 0 will disable the effect.
2734 @subsection Examples
2738 Apply a boxblur filter with the luma, chroma, and alpha radii
2741 boxblur=luma_radius=2:luma_power=1
2746 Set the luma radius to 2, and alpha and chroma radius to 0:
2748 boxblur=2:1:cr=0:ar=0
2752 Set the luma and chroma radii to a fraction of the video dimension:
2754 boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
2758 @section colorbalance
2759 Modify intensity of primary colors (red, green and blue) of input frames.
2761 The filter allows an input frame to be adjusted in the shadows, midtones or highlights
2762 regions for the red-cyan, green-magenta or blue-yellow balance.
2764 A positive adjustment value shifts the balance towards the primary color, a negative
2765 value towards the complementary color.
2767 The filter accepts the following options:
2773 Adjust red, green and blue shadows (darkest pixels).
2778 Adjust red, green and blue midtones (medium pixels).
2783 Adjust red, green and blue highlights (brightest pixels).
2785 Allowed ranges for options are @code{[-1.0, 1.0]}. Defaults are @code{0}.
2788 @subsection Examples
2792 Add red color cast to shadows:
2798 @section colorchannelmixer
2800 Adjust video input frames by re-mixing color channels.
2802 This filter modifies a color channel by adding the values associated to
2803 the other channels of the same pixels. For example if the value to
2804 modify is red, the output value will be:
2806 @var{red}=@var{red}*@var{rr} + @var{blue}*@var{rb} + @var{green}*@var{rg} + @var{alpha}*@var{ra}
2809 The filter accepts the following options:
2816 Adjust contribution of input red, green, blue and alpha channels for output red channel.
2817 Default is @code{1} for @var{rr}, and @code{0} for @var{rg}, @var{rb} and @var{ra}.
2823 Adjust contribution of input red, green, blue and alpha channels for output green channel.
2824 Default is @code{1} for @var{gg}, and @code{0} for @var{gr}, @var{gb} and @var{ga}.
2830 Adjust contribution of input red, green, blue and alpha channels for output blue channel.
2831 Default is @code{1} for @var{bb}, and @code{0} for @var{br}, @var{bg} and @var{ba}.
2837 Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
2838 Default is @code{1} for @var{aa}, and @code{0} for @var{ar}, @var{ag} and @var{ab}.
2840 Allowed ranges for options are @code{[-2.0, 2.0]}.
2843 @subsection Examples
2847 Convert source to grayscale:
2849 colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
2852 Simulate sepia tones:
2854 colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
2858 @section colormatrix
2860 Convert color matrix.
2862 The filter accepts the following options:
2867 Specify the source and destination color matrix. Both values must be
2870 The accepted values are:
2886 For example to convert from BT.601 to SMPTE-240M, use the command:
2888 colormatrix=bt601:smpte240m
2893 Copy the input source unchanged to the output. This is mainly useful for
2898 Crop the input video to given dimensions.
2900 It accepts the following parameters:
2904 The width of the output video. It defaults to @code{iw}.
2905 This expression is evaluated only once during the filter
2909 The height of the output video. It defaults to @code{ih}.
2910 This expression is evaluated only once during the filter
2914 The horizontal position, in the input video, of the left edge of the output
2915 video. It defaults to @code{(in_w-out_w)/2}.
2916 This expression is evaluated per-frame.
2919 The vertical position, in the input video, of the top edge of the output video.
2920 It defaults to @code{(in_h-out_h)/2}.
2921 This expression is evaluated per-frame.
2924 If set to 1 will force the output display aspect ratio
2925 to be the same of the input, by changing the output sample aspect
2926 ratio. It defaults to 0.
2929 The @var{out_w}, @var{out_h}, @var{x}, @var{y} parameters are
2930 expressions containing the following constants:
2935 The computed values for @var{x} and @var{y}. They are evaluated for
2940 The input width and height.
2944 These are the same as @var{in_w} and @var{in_h}.
2948 The output (cropped) width and height.
2952 These are the same as @var{out_w} and @var{out_h}.
2955 same as @var{iw} / @var{ih}
2958 input sample aspect ratio
2961 input display aspect ratio, it is the same as (@var{iw} / @var{ih}) * @var{sar}
2965 horizontal and vertical chroma subsample values. For example for the
2966 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
2969 The number of the input frame, starting from 0.
2972 the position in the file of the input frame, NAN if unknown
2975 The timestamp expressed in seconds. It's NAN if the input timestamp is unknown.
2979 The expression for @var{out_w} may depend on the value of @var{out_h},
2980 and the expression for @var{out_h} may depend on @var{out_w}, but they
2981 cannot depend on @var{x} and @var{y}, as @var{x} and @var{y} are
2982 evaluated after @var{out_w} and @var{out_h}.
2984 The @var{x} and @var{y} parameters specify the expressions for the
2985 position of the top-left corner of the output (non-cropped) area. They
2986 are evaluated for each frame. If the evaluated value is not valid, it
2987 is approximated to the nearest valid value.
2989 The expression for @var{x} may depend on @var{y}, and the expression
2990 for @var{y} may depend on @var{x}.
2992 @subsection Examples
2996 Crop area with size 100x100 at position (12,34).
3001 Using named options, the example above becomes:
3003 crop=w=100:h=100:x=12:y=34
3007 Crop the central input area with size 100x100:
3013 Crop the central input area with size 2/3 of the input video:
3015 crop=2/3*in_w:2/3*in_h
3019 Crop the input video central square:
3026 Delimit the rectangle with the top-left corner placed at position
3027 100:100 and the right-bottom corner corresponding to the right-bottom
3028 corner of the input image.
3030 crop=in_w-100:in_h-100:100:100
3034 Crop 10 pixels from the left and right borders, and 20 pixels from
3035 the top and bottom borders
3037 crop=in_w-2*10:in_h-2*20
3041 Keep only the bottom right quarter of the input image:
3043 crop=in_w/2:in_h/2:in_w/2:in_h/2
3047 Crop height for getting Greek harmony:
3049 crop=in_w:1/PHI*in_w
3053 Appply trembling effect:
3055 crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)
3059 Apply erratic camera effect depending on timestamp:
3061 crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)"
3065 Set x depending on the value of y:
3067 crop=in_w/2:in_h/2:y:10+10*sin(n/10)
3073 Auto-detect the crop size.
3075 It calculates the necessary cropping parameters and prints the
3076 recommended parameters via the logging system. The detected dimensions
3077 correspond to the non-black area of the input video.
3079 It accepts the following parameters:
3084 Set higher black value threshold, which can be optionally specified
3085 from nothing (0) to everything (255). An intensity value greater
3086 to the set value is considered non-black. It defaults to 24.
3089 The value which the width/height should be divisible by. It defaults to
3090 16. The offset is automatically adjusted to center the video. Use 2 to
3091 get only even dimensions (needed for 4:2:2 video). 16 is best when
3092 encoding to most video codecs.
3094 @item reset_count, reset
3095 Set the counter that determines after how many frames cropdetect will
3096 reset the previously detected largest video area and start over to
3097 detect the current optimal crop area. Default value is 0.
3099 This can be useful when channel logos distort the video area. 0
3100 indicates 'never reset', and returns the largest area encountered during
3107 Apply color adjustments using curves.
3109 This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
3110 component (red, green and blue) has its values defined by @var{N} key points
3111 tied from each other using a smooth curve. The x-axis represents the pixel
3112 values from the input frame, and the y-axis the new pixel values to be set for
3115 By default, a component curve is defined by the two points @var{(0;0)} and
3116 @var{(1;1)}. This creates a straight line where each original pixel value is
3117 "adjusted" to its own value, which means no change to the image.
3119 The filter allows you to redefine these two points and add some more. A new
3120 curve (using a natural cubic spline interpolation) will be define to pass
3121 smoothly through all these new coordinates. The new defined points needs to be
3122 strictly increasing over the x-axis, and their @var{x} and @var{y} values must
3123 be in the @var{[0;1]} interval. If the computed curves happened to go outside
3124 the vector spaces, the values will be clipped accordingly.
3126 If there is no key point defined in @code{x=0}, the filter will automatically
3127 insert a @var{(0;0)} point. In the same way, if there is no key point defined
3128 in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
3130 The filter accepts the following options:
3134 Select one of the available color presets. This option can be used in addition
3135 to the @option{r}, @option{g}, @option{b} parameters; in this case, the later
3136 options takes priority on the preset values.
3137 Available presets are:
3140 @item color_negative
3143 @item increase_contrast
3145 @item linear_contrast
3146 @item medium_contrast
3148 @item strong_contrast
3151 Default is @code{none}.
3153 Set the master key points. These points will define a second pass mapping. It
3154 is sometimes called a "luminance" or "value" mapping. It can be used with
3155 @option{r}, @option{g}, @option{b} or @option{all} since it acts like a
3156 post-processing LUT.
3158 Set the key points for the red component.
3160 Set the key points for the green component.
3162 Set the key points for the blue component.
3164 Set the key points for all components (not including master).
3165 Can be used in addition to the other key points component
3166 options. In this case, the unset component(s) will fallback on this
3167 @option{all} setting.
3169 Specify a Photoshop curves file (@code{.asv}) to import the settings from.
3172 To avoid some filtergraph syntax conflicts, each key points list need to be
3173 defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
3175 @subsection Examples
3179 Increase slightly the middle level of blue:
3181 curves=blue='0.5/0.58'
3187 curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
3189 Here we obtain the following coordinates for each components:
3192 @code{(0;0.11) (0.42;0.51) (1;0.95)}
3194 @code{(0;0) (0.50;0.48) (1;1)}
3196 @code{(0;0.22) (0.49;0.44) (1;0.80)}
3200 The previous example can also be achieved with the associated built-in preset:
3202 curves=preset=vintage
3212 Use a Photoshop preset and redefine the points of the green component:
3214 curves=psfile='MyCurvesPresets/purple.asv':green='0.45/0.53'
3220 Denoise frames using 2D DCT (frequency domain filtering).
3222 This filter is not designed for real time and can be extremely slow.
3224 The filter accepts the following options:
3228 Set the noise sigma constant.
3230 This @var{sigma} defines a hard threshold of @code{3 * sigma}; every DCT
3231 coefficient (absolute value) below this threshold with be dropped.
3233 If you need a more advanced filtering, see @option{expr}.
3235 Default is @code{0}.
3238 Set number overlapping pixels for each block. Each block is of size
3239 @code{16x16}. Since the filter can be slow, you may want to reduce this value,
3240 at the cost of a less effective filter and the risk of various artefacts.
3242 If the overlapping value doesn't allow to process the whole input width or
3243 height, a warning will be displayed and according borders won't be denoised.
3245 Default value is @code{15}.
3248 Set the coefficient factor expression.
3250 For each coefficient of a DCT block, this expression will be evaluated as a
3251 multiplier value for the coefficient.
3253 If this is option is set, the @option{sigma} option will be ignored.
3255 The absolute value of the coefficient can be accessed through the @var{c}
3259 @subsection Examples
3261 Apply a denoise with a @option{sigma} of @code{4.5}:
3266 The same operation can be achieved using the expression system:
3268 dctdnoiz=e='gte(c, 4.5*3)'
3274 Drop duplicated frames at regular intervals.
3276 The filter accepts the following options:
3280 Set the number of frames from which one will be dropped. Setting this to
3281 @var{N} means one frame in every batch of @var{N} frames will be dropped.
3282 Default is @code{5}.
3285 Set the threshold for duplicate detection. If the difference metric for a frame
3286 is less than or equal to this value, then it is declared as duplicate. Default
3290 Set scene change threshold. Default is @code{15}.
3294 Set the size of the x and y-axis blocks used during metric calculations.
3295 Larger blocks give better noise suppression, but also give worse detection of
3296 small movements. Must be a power of two. Default is @code{32}.
3299 Mark main input as a pre-processed input and activate clean source input
3300 stream. This allows the input to be pre-processed with various filters to help
3301 the metrics calculation while keeping the frame selection lossless. When set to
3302 @code{1}, the first stream is for the pre-processed input, and the second
3303 stream is the clean source from where the kept frames are chosen. Default is
3307 Set whether or not chroma is considered in the metric calculations. Default is
3313 Remove judder produced by partially interlaced telecined content.
3315 Judder can be introduced, for instance, by @ref{pullup} filter. If the original
3316 source was partially telecined content then the output of @code{pullup,dejudder}
3317 will have a variable frame rate. May change the recorded frame rate of the
3318 container. Aside from that change, this filter will not affect constant frame
3321 The option available in this filter is:
3325 Specify the length of the window over which the judder repeats.
3327 Accepts any integer greater than 1. Useful values are:
3331 If the original was telecined from 24 to 30 fps (Film to NTSC).
3334 If the original was telecined from 25 to 30 fps (PAL to NTSC).
3337 If a mixture of the two.
3340 The default is @samp{4}.
3345 Suppress a TV station logo by a simple interpolation of the surrounding
3346 pixels. Just set a rectangle covering the logo and watch it disappear
3347 (and sometimes something even uglier appear - your mileage may vary).
3349 It accepts the following parameters:
3354 Specify the top left corner coordinates of the logo. They must be
3359 Specify the width and height of the logo to clear. They must be
3363 Specify the thickness of the fuzzy edge of the rectangle (added to
3364 @var{w} and @var{h}). The default value is 4.
3367 When set to 1, a green rectangle is drawn on the screen to simplify
3368 finding the right @var{x}, @var{y}, @var{w}, and @var{h} parameters.
3369 The default value is 0.
3371 The rectangle is drawn on the outermost pixels which will be (partly)
3372 replaced with interpolated values. The values of the next pixels
3373 immediately outside this rectangle in each direction will be used to
3374 compute the interpolated pixel values inside the rectangle.
3378 @subsection Examples
3382 Set a rectangle covering the area with top left corner coordinates 0,0
3383 and size 100x77, and a band of size 10:
3385 delogo=x=0:y=0:w=100:h=77:band=10
3392 Attempt to fix small changes in horizontal and/or vertical shift. This
3393 filter helps remove camera shake from hand-holding a camera, bumping a
3394 tripod, moving on a vehicle, etc.
3396 The filter accepts the following options:
3404 Specify a rectangular area where to limit the search for motion
3406 If desired the search for motion vectors can be limited to a
3407 rectangular area of the frame defined by its top left corner, width
3408 and height. These parameters have the same meaning as the drawbox
3409 filter which can be used to visualise the position of the bounding
3412 This is useful when simultaneous movement of subjects within the frame
3413 might be confused for camera motion by the motion vector search.
3415 If any or all of @var{x}, @var{y}, @var{w} and @var{h} are set to -1
3416 then the full frame is used. This allows later options to be set
3417 without specifying the bounding box for the motion vector search.
3419 Default - search the whole frame.
3423 Specify the maximum extent of movement in x and y directions in the
3424 range 0-64 pixels. Default 16.
3427 Specify how to generate pixels to fill blanks at the edge of the
3428 frame. Available values are:
3431 Fill zeroes at blank locations
3433 Original image at blank locations
3435 Extruded edge value at blank locations
3437 Mirrored edge at blank locations
3439 Default value is @samp{mirror}.
3442 Specify the blocksize to use for motion search. Range 4-128 pixels,
3446 Specify the contrast threshold for blocks. Only blocks with more than
3447 the specified contrast (difference between darkest and lightest
3448 pixels) will be considered. Range 1-255, default 125.
3451 Specify the search strategy. Available values are:
3454 Set exhaustive search
3456 Set less exhaustive search.
3458 Default value is @samp{exhaustive}.
3461 If set then a detailed log of the motion search is written to the
3465 If set to 1, specify using OpenCL capabilities, only available if
3466 FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
3472 Draw a colored box on the input image.
3474 It accepts the following parameters:
3479 The expressions which specify the top left corner coordinates of the box. It defaults to 0.
3483 The expressions which specify the width and height of the box; if 0 they are interpreted as
3484 the input width and height. It defaults to 0.
3487 Specify the color of the box to write. For the general syntax of this option,
3488 check the "Color" section in the ffmpeg-utils manual. If the special
3489 value @code{invert} is used, the box edge color is the same as the
3490 video with inverted luma.
3493 The expression which sets the thickness of the box edge. Default value is @code{3}.
3495 See below for the list of accepted constants.
3498 The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
3499 following constants:
3503 The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
3507 horizontal and vertical chroma subsample values. For example for the
3508 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
3512 The input width and height.
3515 The input sample aspect ratio.
3519 The x and y offset coordinates where the box is drawn.
3523 The width and height of the drawn box.
3526 The thickness of the drawn box.
3528 These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
3529 each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
3533 @subsection Examples
3537 Draw a black box around the edge of the input image:
3543 Draw a box with color red and an opacity of 50%:
3545 drawbox=10:20:200:60:red@@0.5
3548 The previous example can be specified as:
3550 drawbox=x=10:y=20:w=200:h=60:color=red@@0.5
3554 Fill the box with pink color:
3556 drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
3560 Draw a 2-pixel red 2.40:1 mask:
3562 drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
3568 Draw a grid on the input image.
3570 It accepts the following parameters:
3575 The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
3579 The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
3580 input width and height, respectively, minus @code{thickness}, so image gets
3581 framed. Default to 0.
3584 Specify the color of the grid. For the general syntax of this option,
3585 check the "Color" section in the ffmpeg-utils manual. If the special
3586 value @code{invert} is used, the grid color is the same as the
3587 video with inverted luma.
3590 The expression which sets the thickness of the grid line. Default value is @code{1}.
3592 See below for the list of accepted constants.
3595 The parameters for @var{x}, @var{y}, @var{w} and @var{h} and @var{t} are expressions containing the
3596 following constants:
3600 The input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}.
3604 horizontal and vertical chroma subsample values. For example for the
3605 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
3609 The input grid cell width and height.
3612 The input sample aspect ratio.
3616 The x and y coordinates of some point of grid intersection (meant to configure offset).
3620 The width and height of the drawn cell.
3623 The thickness of the drawn cell.
3625 These constants allow the @var{x}, @var{y}, @var{w}, @var{h} and @var{t} expressions to refer to
3626 each other, so you may for example specify @code{y=x/dar} or @code{h=w/dar}.
3630 @subsection Examples
3634 Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
3636 drawgrid=width=100:height=100:thickness=2:color=red@@0.5
3640 Draw a white 3x3 grid with an opacity of 50%:
3642 drawgrid=w=iw/3:h=ih/3:t=2:c=white@@0.5
3649 Draw a text string or text from a specified file on top of a video, using the
3650 libfreetype library.
3652 To enable compilation of this filter, you need to configure FFmpeg with
3653 @code{--enable-libfreetype}.
3654 To enable default font fallback and the @var{font} option you need to
3655 configure FFmpeg with @code{--enable-libfontconfig}.
3659 It accepts the following parameters:
3664 Used to draw a box around text using the background color.
3665 The value must be either 1 (enable) or 0 (disable).
3666 The default value of @var{box} is 0.
3669 The color to be used for drawing box around text. For the syntax of this
3670 option, check the "Color" section in the ffmpeg-utils manual.
3672 The default value of @var{boxcolor} is "white".
3675 Set the width of the border to be drawn around the text using @var{bordercolor}.
3676 The default value of @var{borderw} is 0.
3679 Set the color to be used for drawing border around text. For the syntax of this
3680 option, check the "Color" section in the ffmpeg-utils manual.
3682 The default value of @var{bordercolor} is "black".
3685 Select how the @var{text} is expanded. Can be either @code{none},
3686 @code{strftime} (deprecated) or
3687 @code{normal} (default). See the @ref{drawtext_expansion, Text expansion} section
3691 If true, check and fix text coords to avoid clipping.
3694 The color to be used for drawing fonts. For the syntax of this option, check
3695 the "Color" section in the ffmpeg-utils manual.
3697 The default value of @var{fontcolor} is "black".
3700 The font family to be used for drawing text. By default Sans.
3703 The font file to be used for drawing text. The path must be included.
3704 This parameter is mandatory if the fontconfig support is disabled.
3707 The font size to be used for drawing text.
3708 The default value of @var{fontsize} is 16.
3711 The flags to be used for loading the fonts.
3713 The flags map the corresponding flags supported by libfreetype, and are
3714 a combination of the following values:
3721 @item vertical_layout
3722 @item force_autohint
3725 @item ignore_global_advance_width
3727 @item ignore_transform
3733 Default value is "default".
3735 For more information consult the documentation for the FT_LOAD_*
3739 The color to be used for drawing a shadow behind the drawn text. For the
3740 syntax of this option, check the "Color" section in the ffmpeg-utils manual.
3742 The default value of @var{shadowcolor} is "black".
3746 The x and y offsets for the text shadow position with respect to the
3747 position of the text. They can be either positive or negative
3748 values. The default value for both is "0".
3751 The starting frame number for the n/frame_num variable. The default value
3755 The size in number of spaces to use for rendering the tab.
3759 Set the initial timecode representation in "hh:mm:ss[:;.]ff"
3760 format. It can be used with or without text parameter. @var{timecode_rate}
3761 option must be specified.
3763 @item timecode_rate, rate, r
3764 Set the timecode frame rate (timecode only).
3767 The text string to be drawn. The text must be a sequence of UTF-8
3769 This parameter is mandatory if no file is specified with the parameter
3773 A text file containing text to be drawn. The text must be a sequence
3774 of UTF-8 encoded characters.
3776 This parameter is mandatory if no text string is specified with the
3777 parameter @var{text}.
3779 If both @var{text} and @var{textfile} are specified, an error is thrown.
3782 If set to 1, the @var{textfile} will be reloaded before each frame.
3783 Be sure to update it atomically, or it may be read partially, or even fail.
3787 The expressions which specify the offsets where text will be drawn
3788 within the video frame. They are relative to the top/left border of the
3791 The default value of @var{x} and @var{y} is "0".
3793 See below for the list of accepted constants and functions.
3796 The parameters for @var{x} and @var{y} are expressions containing the
3797 following constants and functions:
3801 input display aspect ratio, it is the same as (@var{w} / @var{h}) * @var{sar}
3805 horizontal and vertical chroma subsample values. For example for the
3806 pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
3809 the height of each text line
3817 @item max_glyph_a, ascent
3818 the maximum distance from the baseline to the highest/upper grid
3819 coordinate used to place a glyph outline point, for all the rendered
3821 It is a positive value, due to the grid's orientation with the Y axis
3824 @item max_glyph_d, descent
3825 the maximum distance from the baseline to the lowest grid coordinate
3826 used to place a glyph outline point, for all the rendered glyphs.
3827 This is a negative value, due to the grid's orientation, with the Y axis
3831 maximum glyph height, that is the maximum height for all the glyphs
3832 contained in the rendered text, it is equivalent to @var{ascent} -
3836 maximum glyph width, that is the maximum width for all the glyphs
3837 contained in the rendered text
3840 the number of input frame, starting from 0
3842 @item rand(min, max)
3843 return a random number included between @var{min} and @var{max}
3846 The input sample aspect ratio.
3849 timestamp expressed in seconds, NAN if the input timestamp is unknown
3852 the height of the rendered text
3855 the width of the rendered text
3859 the x and y offset coordinates where the text is drawn.
3861 These parameters allow the @var{x} and @var{y} expressions to refer
3862 each other, so you can for example specify @code{y=x/dar}.
3865 @anchor{drawtext_expansion}
3866 @subsection Text expansion
3868 If @option{expansion} is set to @code{strftime},
3869 the filter recognizes strftime() sequences in the provided text and
3870 expands them accordingly. Check the documentation of strftime(). This
3871 feature is deprecated.
3873 If @option{expansion} is set to @code{none}, the text is printed verbatim.
3875 If @option{expansion} is set to @code{normal} (which is the default),
3876 the following expansion mechanism is used.
3878 The backslash character '\', followed by any character, always expands to
3879 the second character.
3881 Sequence of the form @code{%@{...@}} are expanded. The text between the
3882 braces is a function name, possibly followed by arguments separated by ':'.
3883 If the arguments contain special characters or delimiters (':' or '@}'),
3884 they should be escaped.
3886 Note that they probably must also be escaped as the value for the
3887 @option{text} option in the filter argument string and as the filter
3888 argument in the filtergraph description, and possibly also for the shell,
3889 that makes up to four levels of escaping; using a text file avoids these
3892 The following functions are available:
3897 The expression evaluation result.
3899 It must take one argument specifying the expression to be evaluated,
3900 which accepts the same constants and functions as the @var{x} and
3901 @var{y} values. Note that not all constants should be used, for
3902 example the text size is not known when evaluating the expression, so
3903 the constants @var{text_w} and @var{text_h} will have an undefined
3907 The time at which the filter is running, expressed in UTC.
3908 It can accept an argument: a strftime() format string.
3911 The time at which the filter is running, expressed in the local time zone.
3912 It can accept an argument: a strftime() format string.
3915 Frame metadata. It must take one argument specifying metadata key.
3918 The frame number, starting from 0.
3921 A 1 character description of the current picture type.
3924 The timestamp of the current frame.
3925 It can take up to two arguments.
3927 The first argument is the format of the timestamp; it defaults to @code{flt}
3928 for seconds as a decimal number with microsecond accuracy; @code{hms} stands
3929 for a formatted @var{[-]HH:MM:SS.mmm} timestamp with millisecond accuracy.
3931 The second argument is an offset added to the timestamp.
3935 @subsection Examples
3939 Draw "Test Text" with font FreeSerif, using the default values for the
3940 optional parameters.
3943 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
3947 Draw 'Test Text' with font FreeSerif of size 24 at position x=100
3948 and y=50 (counting from the top-left corner of the screen), text is
3949 yellow with a red box around it. Both the text and the box have an
3953 drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
3954 x=100: y=50: fontsize=24: fontcolor=yellow@@0.2: box=1: boxcolor=red@@0.2"
3957 Note that the double quotes are not necessary if spaces are not used
3958 within the parameter list.
3961 Show the text at the center of the video frame:
3963 drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
3967 Show a text line sliding from right to left in the last row of the video
3968 frame. The file @file{LONG_LINE} is assumed to contain a single line
3971 drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
3975 Show the content of file @file{CREDITS} off the bottom of the frame and scroll up.
3977 drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
3981 Draw a single green letter "g", at the center of the input video.
3982 The glyph baseline is placed at half screen height.
3984 drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
3988 Show text for 1 second every 3 seconds:
3990 drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
3994 Use fontconfig to set the font. Note that the colons need to be escaped.
3996 drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
4000 Print the date of a real-time encoding (see strftime(3)):
4002 drawtext='fontfile=FreeSans.ttf:text=%@{localtime:%a %b %d %Y@}'
4007 For more information about libfreetype, check:
4008 @url{http://www.freetype.org/}.
4010 For more information about fontconfig, check:
4011 @url{http://freedesktop.org/software/fontconfig/fontconfig-user.html}.
4015 Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
4017 The filter accepts the following options:
4022 Set low and high threshold values used by the Canny thresholding
4025 The high threshold selects the "strong" edge pixels, which are then
4026 connected through 8-connectivity with the "weak" edge pixels selected
4027 by the low threshold.
4029 @var{low} and @var{high} threshold values must be chosen in the range
4030 [0,1], and @var{low} should be lesser or equal to @var{high}.
4032 Default value for @var{low} is @code{20/255}, and default value for @var{high}
4036 Define the drawing mode.
4040 Draw white/gray wires on black background.
4043 Mix the colors to create a paint/cartoon effect.
4046 Default value is @var{wires}.
4049 @subsection Examples
4053 Standard edge detection with custom values for the hysteresis thresholding:
4055 edgedetect=low=0.1:high=0.4
4059 Painting effect without thresholding:
4061 edgedetect=mode=colormix:high=0
4065 @section extractplanes
4067 Extract color channel components from input video stream into
4068 separate grayscale video streams.
4070 The filter accepts the following option:
4074 Set plane(s) to extract.
4076 Available values for planes are:
4087 Choosing planes not available in the input will result in an error.
4088 That means you cannot select @code{r}, @code{g}, @code{b} planes
4089 with @code{y}, @code{u}, @code{v} planes at same time.
4092 @subsection Examples
4096 Extract luma, u and v color channel component from input video frame
4097 into 3 grayscale outputs:
4099 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
4105 Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
4107 For each input image, the filter will compute the optimal mapping from
4108 the input to the output given the codebook length, that is the number
4109 of distinct output colors.
4111 This filter accepts the following options.
4114 @item codebook_length, l
4115 Set codebook length. The value must be a positive integer, and
4116 represents the number of distinct output colors. Default value is 256.
4119 Set the maximum number of iterations to apply for computing the optimal
4120 mapping. The higher the value the better the result and the higher the
4121 computation time. Default value is 1.
4124 Set a random seed, must be an integer included between 0 and
4125 UINT32_MAX. If not specified, or if explicitly set to -1, the filter
4126 will try to use a good random seed on a best effort basis.
4131 Apply a fade-in/out effect to the input video.
4133 It accepts the following parameters:
4137 The effect type can be either "in" for a fade-in, or "out" for a fade-out
4139 Default is @code{in}.
4141 @item start_frame, s
4142 Specify the number of the frame to start applying the fade
4143 effect at. Default is 0.
4146 The number of frames that the fade effect lasts. At the end of the
4147 fade-in effect, the output video will have the same intensity as the input video.
4148 At the end of the fade-out transition, the output video will be filled with the
4149 selected @option{color}.
4153 If set to 1, fade only alpha channel, if one exists on the input.
4156 @item start_time, st
4157 Specify the timestamp (in seconds) of the frame to start to apply the fade
4158 effect. If both start_frame and start_time are specified, the fade will start at
4159 whichever comes last. Default is 0.
4162 The number of seconds for which the fade effect has to last. At the end of the
4163 fade-in effect the output video will have the same intensity as the input video,
4164 at the end of the fade-out transition the output video will be filled with the
4165 selected @option{color}.
4166 If both duration and nb_frames are specified, duration is used. Default is 0.
4169 Specify the color of the fade. Default is "black".
4172 @subsection Examples
4176 Fade in the first 30 frames of video:
4181 The command above is equivalent to:
4187 Fade out the last 45 frames of a 200-frame video:
4190 fade=type=out:start_frame=155:nb_frames=45
4194 Fade in the first 25 frames and fade out the last 25 frames of a 1000-frame video:
4196 fade=in:0:25, fade=out:975:25
4200 Make the first 5 frames yellow, then fade in from frame 5-24:
4202 fade=in:5:20:color=yellow
4206 Fade in alpha over first 25 frames of video:
4208 fade=in:0:25:alpha=1
4212 Make the first 5.5 seconds black, then fade in for 0.5 seconds:
4214 fade=t=in:st=5.5:d=0.5
4221 Extract a single field from an interlaced image using stride
4222 arithmetic to avoid wasting CPU time. The output frames are marked as
4225 The filter accepts the following options:
4229 Specify whether to extract the top (if the value is @code{0} or
4230 @code{top}) or the bottom field (if the value is @code{1} or
4236 Field matching filter for inverse telecine. It is meant to reconstruct the
4237 progressive frames from a telecined stream. The filter