Mercurial > hg > pmhd
view ffmpeg/doc/ffmpeg-filters.1 @ 13:844d341cf643 tip
Back up before ISMIR
author | Yading Song <yading.song@eecs.qmul.ac.uk> |
---|---|
date | Thu, 31 Oct 2013 13:17:06 +0000 |
parents | 6840f77b83aa |
children |
line wrap: on
line source
.\" Automatically generated by Pod::Man 2.23 (Pod::Simple 3.14) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .ie \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .el \{\ . de IX .. .\} .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "FFMPEG-FILTERS 1" .TH FFMPEG-FILTERS 1 "2013-04-21" " " " " .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" ffmpeg\-filters \- FFmpeg filters .SH "DESCRIPTION" .IX Header "DESCRIPTION" This document describes filters, sources, and sinks provided by the libavfilter library. .SH "FILTERING INTRODUCTION" .IX Header "FILTERING INTRODUCTION" Filtering in FFmpeg is enabled through the libavfilter library. .PP In libavfilter, a filter can have multiple inputs and multiple outputs. To illustrate the sorts of things that are possible, we consider the following filtergraph. .PP .Vb 4 \& input \-\-> split \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-> overlay \-\-> output \& | ^ \& | | \& +\-\-\-\-\-> crop \-\-> vflip \-\-\-\-\-\-\-+ .Ve .PP This filtergraph splits the input stream in two streams, sends one stream through the crop filter and the vflip filter before merging it back with the other stream by overlaying it on top. You can use the following command to achieve this: .PP .Vb 1 \& ffmpeg \-i INPUT \-vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT .Ve .PP The result will be that in output the top half of the video is mirrored onto the bottom half. .PP Filters in the same linear chain are separated by commas, and distinct linear chains of filters are separated by semicolons. In our example, \&\fIcrop,vflip\fR are in one linear chain, \fIsplit\fR and \&\fIoverlay\fR are separately in another. The points where the linear chains join are labelled by names enclosed in square brackets. In the example, the split filter generates two outputs that are associated to the labels \fI[main]\fR and \fI[tmp]\fR. .PP The stream sent to the second output of \fIsplit\fR, labelled as \&\fI[tmp]\fR, is processed through the \fIcrop\fR filter, which crops away the lower half part of the video, and then vertically flipped. The \&\fIoverlay\fR filter takes in input the first unchanged output of the split filter (which was labelled as \fI[main]\fR), and overlay on its lower half the output generated by the \fIcrop,vflip\fR filterchain. .PP Some filters take in input a list of parameters: they are specified after the filter name and an equal sign, and are separated from each other by a colon. .PP There exist so-called \fIsource filters\fR that do not have an audio/video input, and \fIsink filters\fR that will not have audio/video output. .SH "GRAPH" .IX Header "GRAPH" The \fIgraph2dot\fR program included in the FFmpeg \fItools\fR directory can be used to parse a filtergraph description and issue a corresponding textual representation in the dot language. .PP Invoke the command: .PP .Vb 1 \& graph2dot \-h .Ve .PP to see how to use \fIgraph2dot\fR. .PP You can then pass the dot description to the \fIdot\fR program (from the graphviz suite of programs) and obtain a graphical representation of the filtergraph. .PP For example the sequence of commands: .PP .Vb 4 \& echo <GRAPH_DESCRIPTION> | \e \& tools/graph2dot \-o graph.tmp && \e \& dot \-Tpng graph.tmp \-o graph.png && \e \& display graph.png .Ve .PP can be used to create and display an image representing the graph described by the \fI\s-1GRAPH_DESCRIPTION\s0\fR string. Note that this string must be a complete self-contained graph, with its inputs and outputs explicitly defined. For example if your command line is of the form: .PP .Vb 1 \& ffmpeg \-i infile \-vf scale=640:360 outfile .Ve .PP your \fI\s-1GRAPH_DESCRIPTION\s0\fR string will need to be of the form: .PP .Vb 1 \& nullsrc,scale=640:360,nullsink .Ve .PP you may also need to set the \fInullsrc\fR parameters and add a \fIformat\fR filter in order to simulate a specific input file. .SH "FILTERGRAPH DESCRIPTION" .IX Header "FILTERGRAPH DESCRIPTION" A filtergraph is a directed graph of connected filters. It can contain cycles, and there can be multiple links between a pair of filters. Each link has one input pad on one side connecting it to one filter from which it takes its input, and one output pad on the other side connecting it to the one filter accepting its output. .PP Each filter in a filtergraph is an instance of a filter class registered in the application, which defines the features and the number of input and output pads of the filter. .PP A filter with no input pads is called a \*(L"source\*(R", a filter with no output pads is called a \*(L"sink\*(R". .SS "Filtergraph syntax" .IX Subsection "Filtergraph syntax" A filtergraph can be represented using a textual representation, which is recognized by the \fB\-filter\fR/\fB\-vf\fR and \fB\-filter_complex\fR options in \fBffmpeg\fR and \fB\-vf\fR in \fBffplay\fR, and by the \&\f(CW\*(C`avfilter_graph_parse()\*(C'\fR/\f(CW\*(C`avfilter_graph_parse2()\*(C'\fR function defined in \&\fIlibavfilter/avfilter.h\fR. .PP A filterchain consists of a sequence of connected filters, each one connected to the previous one in the sequence. A filterchain is represented by a list of \*(L",\*(R"\-separated filter descriptions. .PP A filtergraph consists of a sequence of filterchains. A sequence of filterchains is represented by a list of \*(L";\*(R"\-separated filterchain descriptions. .PP A filter is represented by a string of the form: [\fIin_link_1\fR]...[\fIin_link_N\fR]\fIfilter_name\fR=\fIarguments\fR[\fIout_link_1\fR]...[\fIout_link_M\fR] .PP \&\fIfilter_name\fR is the name of the filter class of which the described filter is an instance of, and has to be the name of one of the filter classes registered in the program. The name of the filter class is optionally followed by a string "=\fIarguments\fR". .PP \&\fIarguments\fR is a string which contains the parameters used to initialize the filter instance. It may have one of the following forms: .IP "\(bu" 4 A ':'\-separated list of \fIkey=value\fR pairs. .IP "\(bu" 4 A ':'\-separated list of \fIvalue\fR. In this case, the keys are assumed to be the option names in the order they are declared. E.g. the \f(CW\*(C`fade\*(C'\fR filter declares three options in this order \*(-- \fBtype\fR, \fBstart_frame\fR and \&\fBnb_frames\fR. Then the parameter list \fIin:0:30\fR means that the value \&\fIin\fR is assigned to the option \fBtype\fR, \fI0\fR to \&\fBstart_frame\fR and \fI30\fR to \fBnb_frames\fR. .IP "\(bu" 4 A ':'\-separated list of mixed direct \fIvalue\fR and long \fIkey=value\fR pairs. The direct \fIvalue\fR must precede the \fIkey=value\fR pairs, and follow the same constraints order of the previous point. The following \&\fIkey=value\fR pairs can be set in any preferred order. .PP If the option value itself is a list of items (e.g. the \f(CW\*(C`format\*(C'\fR filter takes a list of pixel formats), the items in the list are usually separated by \&'|'. .PP The list of arguments can be quoted using the character \*(L"'\*(R" as initial and ending mark, and the character '\e' for escaping the characters within the quoted text; otherwise the argument string is considered terminated when the next special character (belonging to the set \&\*(L"[]=;,\*(R") is encountered. .PP The name and arguments of the filter are optionally preceded and followed by a list of link labels. A link label allows to name a link and associate it to a filter output or input pad. The preceding labels \fIin_link_1\fR \&... \fIin_link_N\fR, are associated to the filter input pads, the following labels \fIout_link_1\fR ... \fIout_link_M\fR, are associated to the output pads. .PP When two link labels with the same name are found in the filtergraph, a link between the corresponding input and output pad is created. .PP If an output pad is not labelled, it is linked by default to the first unlabelled input pad of the next filter in the filterchain. For example in the filterchain: .PP .Vb 1 \& nullsrc, split[L1], [L2]overlay, nullsink .Ve .PP the split filter instance has two output pads, and the overlay filter instance two input pads. The first output pad of split is labelled \&\*(L"L1\*(R", the first input pad of overlay is labelled \*(L"L2\*(R", and the second output pad of split is linked to the second input pad of overlay, which are both unlabelled. .PP In a complete filterchain all the unlabelled filter input and output pads must be connected. A filtergraph is considered valid if all the filter input and output pads of all the filterchains are connected. .PP Libavfilter will automatically insert scale filters where format conversion is required. It is possible to specify swscale flags for those automatically inserted scalers by prepending \&\f(CW\*(C`sws_flags=\f(CIflags\f(CW;\*(C'\fR to the filtergraph description. .PP Follows a \s-1BNF\s0 description for the filtergraph syntax: .PP .Vb 7 \& <NAME> ::= sequence of alphanumeric characters and \*(Aq_\*(Aq \& <LINKLABEL> ::= "[" <NAME> "]" \& <LINKLABELS> ::= <LINKLABEL> [<LINKLABELS>] \& <FILTER_ARGUMENTS> ::= sequence of chars (eventually quoted) \& <FILTER> ::= [<LINKLABELS>] <NAME> ["=" <FILTER_ARGUMENTS>] [<LINKLABELS>] \& <FILTERCHAIN> ::= <FILTER> [,<FILTERCHAIN>] \& <FILTERGRAPH> ::= [sws_flags=<flags>;] <FILTERCHAIN> [;<FILTERGRAPH>] .Ve .SS "Notes on filtergraph escaping" .IX Subsection "Notes on filtergraph escaping" Some filter arguments require the use of special characters, typically \&\f(CW\*(C`:\*(C'\fR to separate key=value pairs in a named options list. In this case the user should perform a first level escaping when specifying the filter arguments. For example, consider the following literal string to be embedded in the drawtext filter arguments: .PP .Vb 1 \& this is a \*(Aqstring\*(Aq: may contain one, or more, special characters .Ve .PP Since \f(CW\*(C`:\*(C'\fR is special for the filter arguments syntax, it needs to be escaped, so you get: .PP .Vb 1 \& text=this is a \e\*(Aqstring\e\*(Aq\e: may contain one, or more, special characters .Ve .PP A second level of escaping is required when embedding the filter arguments in a filtergraph description, in order to escape all the filtergraph special characters. Thus the example above becomes: .PP .Vb 1 \& drawtext=text=this is a \e\e\e\*(Aqstring\e\e\e\*(Aq\e\e: may contain one\e, or more\e, special characters .Ve .PP Finally an additional level of escaping may be needed when writing the filtergraph description in a shell command, which depends on the escaping rules of the adopted shell. For example, assuming that \&\f(CW\*(C`\e\*(C'\fR is special and needs to be escaped with another \f(CW\*(C`\e\*(C'\fR, the previous string will finally result in: .PP .Vb 1 \& \-vf "drawtext=text=this is a \e\e\e\e\e\e\*(Aqstring\e\e\e\e\e\e\*(Aq\e\e\e\e: may contain one\e\e, or more\e\e, special characters" .Ve .PP Sometimes, it might be more convenient to employ quoting in place of escaping. For example the string: .PP .Vb 1 \& Caesar: tu quoque, Brute, fili mi .Ve .PP Can be quoted in the filter arguments as: .PP .Vb 1 \& text=\*(AqCaesar: tu quoque, Brute, fili mi\*(Aq .Ve .PP And finally inserted in a filtergraph like: .PP .Vb 1 \& drawtext=text=\e\*(AqCaesar: tu quoque\e, Brute\e, fili mi\e\*(Aq .Ve .PP See the ``Quoting and escaping'' section in the ffmpeg-utils manual for more information about the escaping and quoting rules adopted by FFmpeg. .SH "AUDIO FILTERS" .IX Header "AUDIO FILTERS" When you configure your FFmpeg build, you can disable any of the existing filters using \f(CW\*(C`\-\-disable\-filters\*(C'\fR. The configure output will show the audio filters included in your build. .PP Below is a description of the currently available audio filters. .SS "aconvert" .IX Subsection "aconvert" Convert the input audio format to the specified formats. .PP \&\fIThis filter is deprecated. Use aformat\fR instead. .PP The filter accepts a string of the form: "\fIsample_format\fR:\fIchannel_layout\fR". .PP \&\fIsample_format\fR specifies the sample format, and can be a string or the corresponding numeric value defined in \fIlibavutil/samplefmt.h\fR. Use 'p' suffix for a planar sample format. .PP \&\fIchannel_layout\fR specifies the channel layout, and can be a string or the corresponding number value defined in \fIlibavutil/channel_layout.h\fR. .PP The special parameter \*(L"auto\*(R", signifies that the filter will automatically select the output format depending on the output filter. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Convert input to float, planar, stereo: .Sp .Vb 1 \& aconvert=fltp:stereo .Ve .IP "\(bu" 4 Convert input to unsigned 8\-bit, automatically select out channel layout: .Sp .Vb 1 \& aconvert=u8:auto .Ve .SS "allpass" .IX Subsection "allpass" Apply a two-pole all-pass filter with central frequency (in Hz) \&\fIfrequency\fR, and filter-width \fIwidth\fR. An all-pass filter changes the audio's frequency to phase relationship without changing its frequency to amplitude relationship. .PP The filter accepts the following options: .IP "\fBfrequency, f\fR" 4 .IX Item "frequency, f" Set frequency in Hz. .IP "\fBwidth_type\fR" 4 .IX Item "width_type" Set method to specify band-width of filter. .RS 4 .IP "\fBh\fR" 4 .IX Item "h" Hz .IP "\fBq\fR" 4 .IX Item "q" Q\-Factor .IP "\fBo\fR" 4 .IX Item "o" octave .IP "\fBs\fR" 4 .IX Item "s" slope .RE .RS 4 .RE .IP "\fBwidth, w\fR" 4 .IX Item "width, w" Specify the band-width of a filter in width_type units. .SS "highpass" .IX Subsection "highpass" Apply a high-pass filter with 3dB point frequency. The filter can be either single-pole, or double-pole (the default). The filter roll off at 6dB per pole per octave (20dB per pole per decade). .PP The filter accepts the following options: .IP "\fBfrequency, f\fR" 4 .IX Item "frequency, f" Set frequency in Hz. Default is 3000. .IP "\fBpoles, p\fR" 4 .IX Item "poles, p" Set number of poles. Default is 2. .IP "\fBwidth_type\fR" 4 .IX Item "width_type" Set method to specify band-width of filter. .RS 4 .IP "\fBh\fR" 4 .IX Item "h" Hz .IP "\fBq\fR" 4 .IX Item "q" Q\-Factor .IP "\fBo\fR" 4 .IX Item "o" octave .IP "\fBs\fR" 4 .IX Item "s" slope .RE .RS 4 .RE .IP "\fBwidth, w\fR" 4 .IX Item "width, w" Specify the band-width of a filter in width_type units. Applies only to double-pole filter. The default is 0.707q and gives a Butterworth response. .SS "lowpass" .IX Subsection "lowpass" Apply a low-pass filter with 3dB point frequency. The filter can be either single-pole or double-pole (the default). The filter roll off at 6dB per pole per octave (20dB per pole per decade). .PP The filter accepts the following options: .IP "\fBfrequency, f\fR" 4 .IX Item "frequency, f" Set frequency in Hz. Default is 500. .IP "\fBpoles, p\fR" 4 .IX Item "poles, p" Set number of poles. Default is 2. .IP "\fBwidth_type\fR" 4 .IX Item "width_type" Set method to specify band-width of filter. .RS 4 .IP "\fBh\fR" 4 .IX Item "h" Hz .IP "\fBq\fR" 4 .IX Item "q" Q\-Factor .IP "\fBo\fR" 4 .IX Item "o" octave .IP "\fBs\fR" 4 .IX Item "s" slope .RE .RS 4 .RE .IP "\fBwidth, w\fR" 4 .IX Item "width, w" Specify the band-width of a filter in width_type units. Applies only to double-pole filter. The default is 0.707q and gives a Butterworth response. .SS "bass" .IX Subsection "bass" Boost or cut the bass (lower) frequencies of the audio using a two-pole shelving filter with a response similar to that of a standard hi-fi's tone-controls. This is also known as shelving equalisation (\s-1EQ\s0). .PP The filter accepts the following options: .IP "\fBgain, g\fR" 4 .IX Item "gain, g" Give the gain at 0 Hz. Its useful range is about \-20 (for a large cut) to +20 (for a large boost). Beware of clipping when using a positive gain. .IP "\fBfrequency, f\fR" 4 .IX Item "frequency, f" Set the filter's central frequency and so can be used to extend or reduce the frequency range to be boosted or cut. The default value is \f(CW100\fR Hz. .IP "\fBwidth_type\fR" 4 .IX Item "width_type" Set method to specify band-width of filter. .RS 4 .IP "\fBh\fR" 4 .IX Item "h" Hz .IP "\fBq\fR" 4 .IX Item "q" Q\-Factor .IP "\fBo\fR" 4 .IX Item "o" octave .IP "\fBs\fR" 4 .IX Item "s" slope .RE .RS 4 .RE .IP "\fBwidth, w\fR" 4 .IX Item "width, w" Determine how steep is the filter's shelf transition. .SS "treble" .IX Subsection "treble" Boost or cut treble (upper) frequencies of the audio using a two-pole shelving filter with a response similar to that of a standard hi-fi's tone-controls. This is also known as shelving equalisation (\s-1EQ\s0). .PP The filter accepts the following options: .IP "\fBgain, g\fR" 4 .IX Item "gain, g" Give the gain at whichever is the lower of ~22 kHz and the Nyquist frequency. Its useful range is about \-20 (for a large cut) to +20 (for a large boost). Beware of clipping when using a positive gain. .IP "\fBfrequency, f\fR" 4 .IX Item "frequency, f" Set the filter's central frequency and so can be used to extend or reduce the frequency range to be boosted or cut. The default value is \f(CW3000\fR Hz. .IP "\fBwidth_type\fR" 4 .IX Item "width_type" Set method to specify band-width of filter. .RS 4 .IP "\fBh\fR" 4 .IX Item "h" Hz .IP "\fBq\fR" 4 .IX Item "q" Q\-Factor .IP "\fBo\fR" 4 .IX Item "o" octave .IP "\fBs\fR" 4 .IX Item "s" slope .RE .RS 4 .RE .IP "\fBwidth, w\fR" 4 .IX Item "width, w" Determine how steep is the filter's shelf transition. .SS "bandpass" .IX Subsection "bandpass" Apply a two-pole Butterworth band-pass filter with central frequency \fIfrequency\fR, and (3dB\-point) band-width width. The \fIcsg\fR option selects a constant skirt gain (peak gain = Q) instead of the default: constant 0dB peak gain. The filter roll off at 6dB per octave (20dB per decade). .PP The filter accepts the following options: .IP "\fBfrequency, f\fR" 4 .IX Item "frequency, f" Set the filter's central frequency. Default is \f(CW3000\fR. .IP "\fBcsg\fR" 4 .IX Item "csg" Constant skirt gain if set to 1. Defaults to 0. .IP "\fBwidth_type\fR" 4 .IX Item "width_type" Set method to specify band-width of filter. .RS 4 .IP "\fBh\fR" 4 .IX Item "h" Hz .IP "\fBq\fR" 4 .IX Item "q" Q\-Factor .IP "\fBo\fR" 4 .IX Item "o" octave .IP "\fBs\fR" 4 .IX Item "s" slope .RE .RS 4 .RE .IP "\fBwidth, w\fR" 4 .IX Item "width, w" Specify the band-width of a filter in width_type units. .SS "bandreject" .IX Subsection "bandreject" Apply a two-pole Butterworth band-reject filter with central frequency \fIfrequency\fR, and (3dB\-point) band-width \fIwidth\fR. The filter roll off at 6dB per octave (20dB per decade). .PP The filter accepts the following options: .IP "\fBfrequency, f\fR" 4 .IX Item "frequency, f" Set the filter's central frequency. Default is \f(CW3000\fR. .IP "\fBwidth_type\fR" 4 .IX Item "width_type" Set method to specify band-width of filter. .RS 4 .IP "\fBh\fR" 4 .IX Item "h" Hz .IP "\fBq\fR" 4 .IX Item "q" Q\-Factor .IP "\fBo\fR" 4 .IX Item "o" octave .IP "\fBs\fR" 4 .IX Item "s" slope .RE .RS 4 .RE .IP "\fBwidth, w\fR" 4 .IX Item "width, w" Specify the band-width of a filter in width_type units. .SS "biquad" .IX Subsection "biquad" Apply a biquad \s-1IIR\s0 filter with the given coefficients. Where \fIb0\fR, \fIb1\fR, \fIb2\fR and \fIa0\fR, \fIa1\fR, \fIa2\fR are the numerator and denominator coefficients respectively. .SS "equalizer" .IX Subsection "equalizer" Apply a two-pole peaking equalisation (\s-1EQ\s0) filter. With this filter, the signal-level at and around a selected frequency can be increased or decreased, whilst (unlike bandpass and bandreject filters) that at all other frequencies is unchanged. .PP In order to produce complex equalisation curves, this filter can be given several times, each with a different central frequency. .PP The filter accepts the following options: .IP "\fBfrequency, f\fR" 4 .IX Item "frequency, f" Set the filter's central frequency in Hz. .IP "\fBwidth_type\fR" 4 .IX Item "width_type" Set method to specify band-width of filter. .RS 4 .IP "\fBh\fR" 4 .IX Item "h" Hz .IP "\fBq\fR" 4 .IX Item "q" Q\-Factor .IP "\fBo\fR" 4 .IX Item "o" octave .IP "\fBs\fR" 4 .IX Item "s" slope .RE .RS 4 .RE .IP "\fBwidth, w\fR" 4 .IX Item "width, w" Specify the band-width of a filter in width_type units. .IP "\fBgain, g\fR" 4 .IX Item "gain, g" Set the required gain or attenuation in dB. Beware of clipping when using a positive gain. .SS "afade" .IX Subsection "afade" Apply fade\-in/out effect to input audio. .PP A description of the accepted parameters follows. .IP "\fBtype, t\fR" 4 .IX Item "type, t" Specify the effect type, can be either \f(CW\*(C`in\*(C'\fR for fade-in, or \&\f(CW\*(C`out\*(C'\fR for a fade-out effect. Default is \f(CW\*(C`in\*(C'\fR. .IP "\fBstart_sample, ss\fR" 4 .IX Item "start_sample, ss" Specify the number of the start sample for starting to apply the fade effect. Default is 0. .IP "\fBnb_samples, ns\fR" 4 .IX Item "nb_samples, ns" Specify the number of samples for which the fade effect has to last. At the end of the fade-in effect the output audio will have the same volume as the input audio, at the end of the fade-out transition the output audio will be silence. Default is 44100. .IP "\fBstart_time, st\fR" 4 .IX Item "start_time, st" Specify time for starting to apply the fade effect. Default is 0. The accepted syntax is: .Sp .Vb 2 \& [\-]HH[:MM[:SS[.m...]]] \& [\-]S+[.m...] .Ve .Sp See also the function \f(CW\*(C`av_parse_time()\*(C'\fR. If set this option is used instead of \fIstart_sample\fR one. .IP "\fBduration, d\fR" 4 .IX Item "duration, d" Specify the duration for which the fade effect has to last. Default is 0. The accepted syntax is: .Sp .Vb 2 \& [\-]HH[:MM[:SS[.m...]]] \& [\-]S+[.m...] .Ve .Sp See also the function \f(CW\*(C`av_parse_time()\*(C'\fR. At the end of the fade-in effect the output audio will have the same volume as the input audio, at the end of the fade-out transition the output audio will be silence. If set this option is used instead of \fInb_samples\fR one. .IP "\fBcurve\fR" 4 .IX Item "curve" Set curve for fade transition. .Sp It accepts the following values: .RS 4 .IP "\fBtri\fR" 4 .IX Item "tri" select triangular, linear slope (default) .IP "\fBqsin\fR" 4 .IX Item "qsin" select quarter of sine wave .IP "\fBhsin\fR" 4 .IX Item "hsin" select half of sine wave .IP "\fBesin\fR" 4 .IX Item "esin" select exponential sine wave .IP "\fBlog\fR" 4 .IX Item "log" select logarithmic .IP "\fBpar\fR" 4 .IX Item "par" select inverted parabola .IP "\fBqua\fR" 4 .IX Item "qua" select quadratic .IP "\fBcub\fR" 4 .IX Item "cub" select cubic .IP "\fBsqu\fR" 4 .IX Item "squ" select square root .IP "\fBcbr\fR" 4 .IX Item "cbr" select cubic root .RE .RS 4 .RE .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Fade in first 15 seconds of audio: .Sp .Vb 1 \& afade=t=in:ss=0:d=15 .Ve .IP "\(bu" 4 Fade out last 25 seconds of a 900 seconds audio: .Sp .Vb 1 \& afade=t=out:ss=875:d=25 .Ve .SS "aformat" .IX Subsection "aformat" Set output format constraints for the input audio. The framework will negotiate the most appropriate format to minimize conversions. .PP The filter accepts the following named parameters: .IP "\fBsample_fmts\fR" 4 .IX Item "sample_fmts" A '|'\-separated list of requested sample formats. .IP "\fBsample_rates\fR" 4 .IX Item "sample_rates" A '|'\-separated list of requested sample rates. .IP "\fBchannel_layouts\fR" 4 .IX Item "channel_layouts" A '|'\-separated list of requested channel layouts. .PP If a parameter is omitted, all values are allowed. .PP For example to force the output to either unsigned 8\-bit or signed 16\-bit stereo: .PP .Vb 1 \& aformat=sample_fmts=u8|s16:channel_layouts=stereo .Ve .SS "amerge" .IX Subsection "amerge" Merge two or more audio streams into a single multi-channel stream. .PP The filter accepts the following options: .IP "\fBinputs\fR" 4 .IX Item "inputs" Set the number of inputs. Default is 2. .PP If the channel layouts of the inputs are disjoint, and therefore compatible, the channel layout of the output will be set accordingly and the channels will be reordered as necessary. If the channel layouts of the inputs are not disjoint, the output will have all the channels of the first input then all the channels of the second input, in that order, and the channel layout of the output will be the default value corresponding to the total number of channels. .PP For example, if the first input is in 2.1 (\s-1FL+FR+LF\s0) and the second input is \s-1FC+BL+BR\s0, then the output will be in 5.1, with the channels in the following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the first input, b1 is the first channel of the second input). .PP On the other hand, if both input are in stereo, the output channels will be in the default order: a1, a2, b1, b2, and the channel layout will be arbitrarily set to 4.0, which may or may not be the expected value. .PP All inputs must have the same sample rate, and format. .PP If inputs do not have the same duration, the output will stop with the shortest. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Merge two mono files into a stereo stream: .Sp .Vb 1 \& amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge .Ve .IP "\(bu" 4 Multiple merges assuming 1 video stream and 6 audio streams in \fIinput.mkv\fR: .Sp .Vb 1 \& 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 .Ve .SS "amix" .IX Subsection "amix" Mixes multiple audio inputs into a single output. .PP For example .PP .Vb 1 \& ffmpeg \-i INPUT1 \-i INPUT2 \-i INPUT3 \-filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT .Ve .PP will mix 3 input audio streams to a single output with the same duration as the first input and a dropout transition time of 3 seconds. .PP The filter accepts the following named parameters: .IP "\fBinputs\fR" 4 .IX Item "inputs" Number of inputs. If unspecified, it defaults to 2. .IP "\fBduration\fR" 4 .IX Item "duration" How to determine the end-of-stream. .RS 4 .IP "\fBlongest\fR" 4 .IX Item "longest" Duration of longest input. (default) .IP "\fBshortest\fR" 4 .IX Item "shortest" Duration of shortest input. .IP "\fBfirst\fR" 4 .IX Item "first" Duration of first input. .RE .RS 4 .RE .IP "\fBdropout_transition\fR" 4 .IX Item "dropout_transition" Transition time, in seconds, for volume renormalization when an input stream ends. The default value is 2 seconds. .SS "anull" .IX Subsection "anull" Pass the audio source unchanged to the output. .SS "apad" .IX Subsection "apad" Pad the end of a audio stream with silence, this can be used together with \&\-shortest to extend audio streams to the same length as the video stream. .SS "aphaser" .IX Subsection "aphaser" Add a phasing effect to the input audio. .PP A phaser filter creates series of peaks and troughs in the frequency spectrum. The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect. .PP A description of the accepted parameters follows. .IP "\fBin_gain\fR" 4 .IX Item "in_gain" Set input gain. Default is 0.4. .IP "\fBout_gain\fR" 4 .IX Item "out_gain" Set output gain. Default is 0.74 .IP "\fBdelay\fR" 4 .IX Item "delay" Set delay in milliseconds. Default is 3.0. .IP "\fBdecay\fR" 4 .IX Item "decay" Set decay. Default is 0.4. .IP "\fBspeed\fR" 4 .IX Item "speed" Set modulation speed in Hz. Default is 0.5. .IP "\fBtype\fR" 4 .IX Item "type" Set modulation type. Default is triangular. .Sp It accepts the following values: .RS 4 .IP "\fBtriangular, t\fR" 4 .IX Item "triangular, t" .PD 0 .IP "\fBsinusoidal, s\fR" 4 .IX Item "sinusoidal, s" .RE .RS 4 .RE .PD .SS "aresample" .IX Subsection "aresample" Resample the input audio to the specified parameters, using the libswresample library. If none are specified then the filter will automatically convert between its input and output. .PP This filter is also able to stretch/squeeze the audio data to make it match the timestamps or to inject silence / cut out audio to make it match the timestamps, do a combination of both or do neither. .PP The filter accepts the syntax [\fIsample_rate\fR:]\fIresampler_options\fR, where \fIsample_rate\fR expresses a sample rate and \fIresampler_options\fR is a list of \&\fIkey\fR=\fIvalue\fR pairs, separated by \*(L":\*(R". See the ffmpeg-resampler manual for the complete list of supported options. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Resample the input audio to 44100Hz: .Sp .Vb 1 \& aresample=44100 .Ve .IP "\(bu" 4 Stretch/squeeze samples to the given timestamps, with a maximum of 1000 samples per second compensation: .Sp .Vb 1 \& aresample=async=1000 .Ve .SS "asetnsamples" .IX Subsection "asetnsamples" Set the number of samples per each output audio frame. .PP The last output packet may contain a different number of samples, as the filter will flush all the remaining samples when the input audio signal its end. .PP The filter accepts the following options: .IP "\fBnb_out_samples, n\fR" 4 .IX Item "nb_out_samples, n" Set the number of frames per each output audio frame. The number is intended as the number of samples \fIper each channel\fR. Default value is 1024. .IP "\fBpad, p\fR" 4 .IX Item "pad, p" If set to 1, the filter will pad the last audio frame with zeroes, so that the last frame will contain the same number of samples as the previous ones. Default value is 1. .PP For example, to set the number of per-frame samples to 1234 and disable padding for the last frame, use: .PP .Vb 1 \& asetnsamples=n=1234:p=0 .Ve .SS "ashowinfo" .IX Subsection "ashowinfo" Show a line containing various information for each input audio frame. The input audio is not modified. .PP The shown line contains a sequence of key/value pairs of the form \&\fIkey\fR:\fIvalue\fR. .PP A description of each shown parameter follows: .IP "\fBn\fR" 4 .IX Item "n" sequential number of the input frame, starting from 0 .IP "\fBpts\fR" 4 .IX Item "pts" Presentation timestamp of the input frame, in time base units; the time base depends on the filter input pad, and is usually 1/\fIsample_rate\fR. .IP "\fBpts_time\fR" 4 .IX Item "pts_time" presentation timestamp of the input frame in seconds .IP "\fBpos\fR" 4 .IX Item "pos" position of the frame in the input stream, \-1 if this information in unavailable and/or meaningless (for example in case of synthetic audio) .IP "\fBfmt\fR" 4 .IX Item "fmt" sample format .IP "\fBchlayout\fR" 4 .IX Item "chlayout" channel layout .IP "\fBrate\fR" 4 .IX Item "rate" sample rate for the audio frame .IP "\fBnb_samples\fR" 4 .IX Item "nb_samples" number of samples (per channel) in the frame .IP "\fBchecksum\fR" 4 .IX Item "checksum" Adler\-32 checksum (printed in hexadecimal) of the audio data. For planar audio the data is treated as if all the planes were concatenated. .IP "\fBplane_checksums\fR" 4 .IX Item "plane_checksums" A list of Adler\-32 checksums for each data plane. .SS "astreamsync" .IX Subsection "astreamsync" Forward two audio streams and control the order the buffers are forwarded. .PP The filter accepts the following options: .IP "\fBexpr, e\fR" 4 .IX Item "expr, e" Set the expression deciding which stream should be forwarded next: if the result is negative, the first stream is forwarded; if the result is positive or zero, the second stream is forwarded. It can use the following variables: .RS 4 .IP "\fIb1 b2\fR" 4 .IX Item "b1 b2" number of buffers forwarded so far on each stream .IP "\fIs1 s2\fR" 4 .IX Item "s1 s2" number of samples forwarded so far on each stream .IP "\fIt1 t2\fR" 4 .IX Item "t1 t2" current timestamp of each stream .RE .RS 4 .Sp The default value is \f(CW\*(C`t1\-t2\*(C'\fR, which means to always forward the stream that has a smaller timestamp. .RE .PP \fIExamples\fR .IX Subsection "Examples" .PP Stress-test \f(CW\*(C`amerge\*(C'\fR by randomly sending buffers on the wrong input, while avoiding too much of a desynchronization: .PP .Vb 3 \& amovie=file.ogg [a] ; amovie=file.mp3 [b] ; \& [a] [b] astreamsync=(2*random(1))\-1+tanh(5*(t1\-t2)) [a2] [b2] ; \& [a2] [b2] amerge .Ve .SS "atempo" .IX Subsection "atempo" Adjust audio tempo. .PP The filter accepts exactly one parameter, the audio tempo. If not specified then the filter will assume nominal 1.0 tempo. Tempo must be in the [0.5, 2.0] range. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Slow down audio to 80% tempo: .Sp .Vb 1 \& atempo=0.8 .Ve .IP "\(bu" 4 To speed up audio to 125% tempo: .Sp .Vb 1 \& atempo=1.25 .Ve .SS "earwax" .IX Subsection "earwax" Make audio easier to listen to on headphones. .PP This filter adds `cues' to 44.1kHz stereo (i.e. audio \s-1CD\s0 format) audio so that when listened to on headphones the stereo image is moved from inside your head (standard for headphones) to outside and in front of the listener (standard for speakers). .PP Ported from SoX. .SS "pan" .IX Subsection "pan" Mix channels with specific gain levels. The filter accepts the output channel layout followed by a set of channels definitions. .PP This filter is also designed to remap efficiently the channels of an audio stream. .PP The filter accepts parameters of the form: "\fIl\fR:\fIoutdef\fR:\fIoutdef\fR:..." .IP "\fBl\fR" 4 .IX Item "l" output channel layout or number of channels .IP "\fBoutdef\fR" 4 .IX Item "outdef" output channel specification, of the form: "\fIout_name\fR=[\fIgain\fR*]\fIin_name\fR[+[\fIgain\fR*]\fIin_name\fR...]" .IP "\fBout_name\fR" 4 .IX Item "out_name" output channel to define, either a channel name (\s-1FL\s0, \s-1FR\s0, etc.) or a channel number (c0, c1, etc.) .IP "\fBgain\fR" 4 .IX Item "gain" multiplicative coefficient for the channel, 1 leaving the volume unchanged .IP "\fBin_name\fR" 4 .IX Item "in_name" input channel to use, see out_name for details; it is not possible to mix named and numbered input channels .PP If the `=' in a channel specification is replaced by `<', then the gains for that specification will be renormalized so that the total is 1, thus avoiding clipping noise. .PP \fIMixing examples\fR .IX Subsection "Mixing examples" .PP For example, if you want to down-mix from stereo to mono, but with a bigger factor for the left channel: .PP .Vb 1 \& pan=1:c0=0.9*c0+0.1*c1 .Ve .PP A customized down-mix to stereo that works automatically for 3\-, 4\-, 5\- and 7\-channels surround: .PP .Vb 1 \& pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 0.6*SR .Ve .PP Note that \fBffmpeg\fR integrates a default down-mix (and up-mix) system that should be preferred (see \*(L"\-ac\*(R" option) unless you have very specific needs. .PP \fIRemapping examples\fR .IX Subsection "Remapping examples" .PP The channel remapping will be effective if, and only if: .IP "*<gain coefficients are zeroes or ones,>" 4 .IX Item "*<gain coefficients are zeroes or ones,>" .PD 0 .IP "*<only one input per channel output,>" 4 .IX Item "*<only one input per channel output,>" .PD .PP If all these conditions are satisfied, the filter will notify the user (\*(L"Pure channel mapping detected\*(R"), and use an optimized and lossless method to do the remapping. .PP For example, if you have a 5.1 source and want a stereo audio stream by dropping the extra channels: .PP .Vb 1 \& pan="stereo: c0=FL : c1=FR" .Ve .PP Given the same source, you can also switch front left and front right channels and keep the input channel layout: .PP .Vb 1 \& pan="5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5" .Ve .PP If the input is a stereo audio stream, you can mute the front left channel (and still keep the stereo channel layout) with: .PP .Vb 1 \& pan="stereo:c1=c1" .Ve .PP Still with a stereo audio stream input, you can copy the right channel in both front left and right: .PP .Vb 1 \& pan="stereo: c0=FR : c1=FR" .Ve .SS "silencedetect" .IX Subsection "silencedetect" Detect silence in an audio stream. .PP This filter logs a message when it detects that the input audio volume is less or equal to a noise tolerance value for a duration greater or equal to the minimum detected noise duration. .PP The printed times and duration are expressed in seconds. .PP The filter accepts the following options: .IP "\fBduration, d\fR" 4 .IX Item "duration, d" Set silence duration until notification (default is 2 seconds). .IP "\fBnoise, n\fR" 4 .IX Item "noise, n" Set noise tolerance. Can be specified in dB (in case \*(L"dB\*(R" is appended to the specified value) or amplitude ratio. Default is \-60dB, or 0.001. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Detect 5 seconds of silence with \-50dB noise tolerance: .Sp .Vb 1 \& silencedetect=n=\-50dB:d=5 .Ve .IP "\(bu" 4 Complete example with \fBffmpeg\fR to detect silence with 0.0001 noise tolerance in \fIsilence.mp3\fR: .Sp .Vb 1 \& ffmpeg \-i silence.mp3 \-af silencedetect=noise=0.0001 \-f null \- .Ve .SS "asyncts" .IX Subsection "asyncts" Synchronize audio data with timestamps by squeezing/stretching it and/or dropping samples/adding silence when needed. .PP This filter is not built by default, please use aresample to do squeezing/stretching. .PP The filter accepts the following named parameters: .IP "\fBcompensate\fR" 4 .IX Item "compensate" Enable stretching/squeezing the data to make it match the timestamps. Disabled by default. When disabled, time gaps are covered with silence. .IP "\fBmin_delta\fR" 4 .IX Item "min_delta" Minimum difference between timestamps and audio data (in seconds) to trigger adding/dropping samples. Default value is 0.1. If you get non-perfect sync with this filter, try setting this parameter to 0. .IP "\fBmax_comp\fR" 4 .IX Item "max_comp" Maximum compensation in samples per second. Relevant only with compensate=1. Default value 500. .IP "\fBfirst_pts\fR" 4 .IX Item "first_pts" Assume the first pts should be this value. The time base is 1 / sample rate. This allows for padding/trimming at the start of stream. By default, no assumption is made about the first frame's expected pts, so no padding or trimming is done. For example, this could be set to 0 to pad the beginning with silence if an audio stream starts after the video stream or to trim any samples with a negative pts due to encoder delay. .SS "channelsplit" .IX Subsection "channelsplit" Split each channel in input audio stream into a separate output stream. .PP This filter accepts the following named parameters: .IP "\fBchannel_layout\fR" 4 .IX Item "channel_layout" Channel layout of the input stream. Default is \*(L"stereo\*(R". .PP For example, assuming a stereo input \s-1MP3\s0 file .PP .Vb 1 \& ffmpeg \-i in.mp3 \-filter_complex channelsplit out.mkv .Ve .PP will create an output Matroska file with two audio streams, one containing only the left channel and the other the right channel. .PP To split a 5.1 \s-1WAV\s0 file into per-channel files .PP .Vb 5 \& ffmpeg \-i in.wav \-filter_complex \& \*(Aqchannelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]\*(Aq \& \-map \*(Aq[FL]\*(Aq front_left.wav \-map \*(Aq[FR]\*(Aq front_right.wav \-map \*(Aq[FC]\*(Aq \& front_center.wav \-map \*(Aq[LFE]\*(Aq lfe.wav \-map \*(Aq[SL]\*(Aq side_left.wav \-map \*(Aq[SR]\*(Aq \& side_right.wav .Ve .SS "channelmap" .IX Subsection "channelmap" Remap input channels to new locations. .PP This filter accepts the following named parameters: .IP "\fBchannel_layout\fR" 4 .IX Item "channel_layout" Channel layout of the output stream. .IP "\fBmap\fR" 4 .IX Item "map" Map channels from input to output. The argument is a '|'\-separated list of mappings, each in the \f(CW\*(C`\f(CIin_channel\f(CW\-\f(CIout_channel\f(CW\*(C'\fR or \&\fIin_channel\fR form. \fIin_channel\fR can be either the name of the input channel (e.g. \s-1FL\s0 for front left) or its index in the input channel layout. \&\fIout_channel\fR is the name of the output channel or its index in the output channel layout. If \fIout_channel\fR is not given then it is implicitly an index, starting with zero and increasing by one for each mapping. .PP If no mapping is present, the filter will implicitly map input channels to output channels preserving index. .PP For example, assuming a 5.1+downmix input \s-1MOV\s0 file .PP .Vb 1 \& ffmpeg \-i in.mov \-filter \*(Aqchannelmap=map=DL\-FL|DR\-FR\*(Aq out.wav .Ve .PP will create an output \s-1WAV\s0 file tagged as stereo from the downmix channels of the input. .PP To fix a 5.1 \s-1WAV\s0 improperly encoded in \s-1AAC\s0's native channel order .PP .Vb 1 \& ffmpeg \-i in.wav \-filter \*(Aqchannelmap=1|2|0|5|3|4:channel_layout=5.1\*(Aq out.wav .Ve .SS "join" .IX Subsection "join" Join multiple input streams into one multi-channel stream. .PP The filter accepts the following named parameters: .IP "\fBinputs\fR" 4 .IX Item "inputs" Number of input streams. Defaults to 2. .IP "\fBchannel_layout\fR" 4 .IX Item "channel_layout" Desired output channel layout. Defaults to stereo. .IP "\fBmap\fR" 4 .IX Item "map" Map channels from inputs to output. The argument is a '|'\-separated list of mappings, each in the \f(CW\*(C`\f(CIinput_idx\f(CW.\f(CIin_channel\f(CW\-\f(CIout_channel\f(CW\*(C'\fR form. \fIinput_idx\fR is the 0\-based index of the input stream. \fIin_channel\fR can be either the name of the input channel (e.g. \s-1FL\s0 for front left) or its index in the specified input stream. \fIout_channel\fR is the name of the output channel. .PP The filter will attempt to guess the mappings when those are not specified explicitly. It does so by first trying to find an unused matching input channel and if that fails it picks the first unused input channel. .PP E.g. to join 3 inputs (with properly set channel layouts) .PP .Vb 1 \& ffmpeg \-i INPUT1 \-i INPUT2 \-i INPUT3 \-filter_complex join=inputs=3 OUTPUT .Ve .PP To build a 5.1 output from 6 single-channel streams: .PP .Vb 3 \& ffmpeg \-i fl \-i fr \-i fc \-i sl \-i sr \-i lfe \-filter_complex \& \*(Aqjoin=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\*(Aq \& out .Ve .SS "resample" .IX Subsection "resample" Convert the audio sample format, sample rate and channel layout. This filter is not meant to be used directly. .SS "volume" .IX Subsection "volume" Adjust the input audio volume. .PP The filter accepts the following options: .IP "\fBvolume\fR" 4 .IX Item "volume" Expresses how the audio volume will be increased or decreased. .Sp Output values are clipped to the maximum value. .Sp The output audio volume is given by the relation: .Sp .Vb 1 \& <output_volume> = <volume> * <input_volume> .Ve .Sp Default value for \fIvolume\fR is 1.0. .IP "\fBprecision\fR" 4 .IX Item "precision" Set the mathematical precision. .Sp This determines which input sample formats will be allowed, which affects the precision of the volume scaling. .RS 4 .IP "\fBfixed\fR" 4 .IX Item "fixed" 8\-bit fixed-point; limits input sample format to U8, S16, and S32. .IP "\fBfloat\fR" 4 .IX Item "float" 32\-bit floating-point; limits input sample format to \s-1FLT\s0. (default) .IP "\fBdouble\fR" 4 .IX Item "double" 64\-bit floating-point; limits input sample format to \s-1DBL\s0. .RE .RS 4 .RE .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Halve the input audio volume: .Sp .Vb 3 \& volume=volume=0.5 \& volume=volume=1/2 \& volume=volume=\-6.0206dB .Ve .Sp In all the above example the named key for \fBvolume\fR can be omitted, for example like in: .Sp .Vb 1 \& volume=0.5 .Ve .IP "\(bu" 4 Increase input audio power by 6 decibels using fixed-point precision: .Sp .Vb 1 \& volume=volume=6dB:precision=fixed .Ve .SS "volumedetect" .IX Subsection "volumedetect" Detect the volume of the input video. .PP The filter has no parameters. The input is not modified. Statistics about the volume will be printed in the log when the input stream end is reached. .PP In particular it will show the mean volume (root mean square), maximum volume (on a per-sample basis), and the beginning of an histogram of the registered volume values (from the maximum value to a cumulated 1/1000 of the samples). .PP All volumes are in decibels relative to the maximum \s-1PCM\s0 value. .PP \fIExamples\fR .IX Subsection "Examples" .PP Here is an excerpt of the output: .PP .Vb 9 \& [Parsed_volumedetect_0 0xa23120] mean_volume: \-27 dB \& [Parsed_volumedetect_0 0xa23120] max_volume: \-4 dB \& [Parsed_volumedetect_0 0xa23120] histogram_4db: 6 \& [Parsed_volumedetect_0 0xa23120] histogram_5db: 62 \& [Parsed_volumedetect_0 0xa23120] histogram_6db: 286 \& [Parsed_volumedetect_0 0xa23120] histogram_7db: 1042 \& [Parsed_volumedetect_0 0xa23120] histogram_8db: 2551 \& [Parsed_volumedetect_0 0xa23120] histogram_9db: 4609 \& [Parsed_volumedetect_0 0xa23120] histogram_10db: 8409 .Ve .PP It means that: .IP "\(bu" 4 The mean square energy is approximately \-27 dB, or 10^\-2.7. .IP "\(bu" 4 The largest sample is at \-4 dB, or more precisely between \-4 dB and \-5 dB. .IP "\(bu" 4 There are 6 samples at \-4 dB, 62 at \-5 dB, 286 at \-6 dB, etc. .PP In other words, raising the volume by +4 dB does not cause any clipping, raising it by +5 dB causes clipping for 6 samples, etc. .SH "AUDIO SOURCES" .IX Header "AUDIO SOURCES" Below is a description of the currently available audio sources. .SS "abuffer" .IX Subsection "abuffer" Buffer audio frames, and make them available to the filter chain. .PP This source is mainly intended for a programmatic use, in particular through the interface defined in \fIlibavfilter/asrc_abuffer.h\fR. .PP It accepts the following named parameters: .IP "\fBtime_base\fR" 4 .IX Item "time_base" Timebase which will be used for timestamps of submitted frames. It must be either a floating-point number or in \fInumerator\fR/\fIdenominator\fR form. .IP "\fBsample_rate\fR" 4 .IX Item "sample_rate" The sample rate of the incoming audio buffers. .IP "\fBsample_fmt\fR" 4 .IX Item "sample_fmt" The sample format of the incoming audio buffers. Either a sample format name or its corresponging integer representation from the enum AVSampleFormat in \fIlibavutil/samplefmt.h\fR .IP "\fBchannel_layout\fR" 4 .IX Item "channel_layout" The channel layout of the incoming audio buffers. Either a channel layout name from channel_layout_map in \&\fIlibavutil/channel_layout.c\fR or its corresponding integer representation from the AV_CH_LAYOUT_* macros in \fIlibavutil/channel_layout.h\fR .IP "\fBchannels\fR" 4 .IX Item "channels" The number of channels of the incoming audio buffers. If both \fIchannels\fR and \fIchannel_layout\fR are specified, then they must be consistent. .PP \fIExamples\fR .IX Subsection "Examples" .PP .Vb 1 \& abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo .Ve .PP will instruct the source to accept planar 16bit signed stereo at 44100Hz. Since the sample format with name \*(L"s16p\*(R" corresponds to the number 6 and the \*(L"stereo\*(R" channel layout corresponds to the value 0x3, this is equivalent to: .PP .Vb 1 \& abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3 .Ve .SS "aevalsrc" .IX Subsection "aevalsrc" Generate an audio signal specified by an expression. .PP This source accepts in input one or more expressions (one for each channel), which are evaluated and used to generate a corresponding audio signal. .PP This source accepts the following options: .IP "\fBexprs\fR" 4 .IX Item "exprs" Set the '|'\-separated expressions list for each separate channel. In case the \&\fBchannel_layout\fR option is not specified, the selected channel layout depends on the number of provided expressions. .IP "\fBchannel_layout, c\fR" 4 .IX Item "channel_layout, c" Set the channel layout. The number of channels in the specified layout must be equal to the number of specified expressions. .IP "\fBduration, d\fR" 4 .IX Item "duration, d" Set the minimum duration of the sourced audio. See the function \&\f(CW\*(C`av_parse_time()\*(C'\fR for the accepted format. Note that the resulting duration may be greater than the specified duration, as the generated audio is always cut at the end of a complete frame. .Sp If not specified, or the expressed duration is negative, the audio is supposed to be generated forever. .IP "\fBnb_samples, n\fR" 4 .IX Item "nb_samples, n" Set the number of samples per channel per each output frame, default to 1024. .IP "\fBsample_rate, s\fR" 4 .IX Item "sample_rate, s" Specify the sample rate, default to 44100. .PP Each expression in \fIexprs\fR can contain the following constants: .IP "\fBn\fR" 4 .IX Item "n" number of the evaluated sample, starting from 0 .IP "\fBt\fR" 4 .IX Item "t" time of the evaluated sample expressed in seconds, starting from 0 .IP "\fBs\fR" 4 .IX Item "s" sample rate .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Generate silence: .Sp .Vb 1 \& aevalsrc=0 .Ve .IP "\(bu" 4 Generate a sin signal with frequency of 440 Hz, set sample rate to 8000 Hz: .Sp .Vb 1 \& aevalsrc="sin(440*2*PI*t):s=8000" .Ve .IP "\(bu" 4 Generate a two channels signal, specify the channel layout (Front Center + Back Center) explicitly: .Sp .Vb 1 \& aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC" .Ve .IP "\(bu" 4 Generate white noise: .Sp .Vb 1 \& aevalsrc="\-2+random(0)" .Ve .IP "\(bu" 4 Generate an amplitude modulated signal: .Sp .Vb 1 \& aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)" .Ve .IP "\(bu" 4 Generate 2.5 Hz binaural beats on a 360 Hz carrier: .Sp .Vb 1 \& aevalsrc="0.1*sin(2*PI*(360\-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)" .Ve .SS "anullsrc" .IX Subsection "anullsrc" Null audio source, return unprocessed audio frames. It is mainly useful as a template and to be employed in analysis / debugging tools, or as the source for filters which ignore the input data (for example the sox synth filter). .PP This source accepts the following options: .IP "\fBchannel_layout, cl\fR" 4 .IX Item "channel_layout, cl" Specify the channel layout, and can be either an integer or a string representing a channel layout. The default value of \fIchannel_layout\fR is \*(L"stereo\*(R". .Sp Check the channel_layout_map definition in \&\fIlibavutil/channel_layout.c\fR for the mapping between strings and channel layout values. .IP "\fBsample_rate, r\fR" 4 .IX Item "sample_rate, r" Specify the sample rate, and defaults to 44100. .IP "\fBnb_samples, n\fR" 4 .IX Item "nb_samples, n" Set the number of samples per requested frames. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Set the sample rate to 48000 Hz and the channel layout to \s-1AV_CH_LAYOUT_MONO\s0. .Sp .Vb 1 \& anullsrc=r=48000:cl=4 .Ve .IP "\(bu" 4 Do the same operation with a more obvious syntax: .Sp .Vb 1 \& anullsrc=r=48000:cl=mono .Ve .SS "abuffer" .IX Subsection "abuffer" Buffer audio frames, and make them available to the filter chain. .PP This source is not intended to be part of user-supplied graph descriptions but for insertion by calling programs through the interface defined in \&\fIlibavfilter/buffersrc.h\fR. .PP It accepts the following named parameters: .IP "\fBtime_base\fR" 4 .IX Item "time_base" Timebase which will be used for timestamps of submitted frames. It must be either a floating-point number or in \fInumerator\fR/\fIdenominator\fR form. .IP "\fBsample_rate\fR" 4 .IX Item "sample_rate" Audio sample rate. .IP "\fBsample_fmt\fR" 4 .IX Item "sample_fmt" Name of the sample format, as returned by \f(CW\*(C`av_get_sample_fmt_name()\*(C'\fR. .IP "\fBchannel_layout\fR" 4 .IX Item "channel_layout" Channel layout of the audio data, in the form that can be accepted by \&\f(CW\*(C`av_get_channel_layout()\*(C'\fR. .PP All the parameters need to be explicitly defined. .SS "flite" .IX Subsection "flite" Synthesize a voice utterance using the libflite library. .PP To enable compilation of this filter you need to configure FFmpeg with \&\f(CW\*(C`\-\-enable\-libflite\*(C'\fR. .PP Note that the flite library is not thread-safe. .PP The filter accepts the following options: .IP "\fBlist_voices\fR" 4 .IX Item "list_voices" If set to 1, list the names of the available voices and exit immediately. Default value is 0. .IP "\fBnb_samples, n\fR" 4 .IX Item "nb_samples, n" Set the maximum number of samples per frame. Default value is 512. .IP "\fBtextfile\fR" 4 .IX Item "textfile" Set the filename containing the text to speak. .IP "\fBtext\fR" 4 .IX Item "text" Set the text to speak. .IP "\fBvoice, v\fR" 4 .IX Item "voice, v" Set the voice to use for the speech synthesis. Default value is \&\f(CW\*(C`kal\*(C'\fR. See also the \fIlist_voices\fR option. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Read from file \fIspeech.txt\fR, and synthetize the text using the standard flite voice: .Sp .Vb 1 \& flite=textfile=speech.txt .Ve .IP "\(bu" 4 Read the specified text selecting the \f(CW\*(C`slt\*(C'\fR voice: .Sp .Vb 1 \& flite=text=\*(AqSo fare thee well, poor devil of a Sub\-Sub, whose commentator I am\*(Aq:voice=slt .Ve .IP "\(bu" 4 Input text to ffmpeg: .Sp .Vb 1 \& ffmpeg \-f lavfi \-i flite=text=\*(AqSo fare thee well, poor devil of a Sub\-Sub, whose commentator I am\*(Aq:voice=slt .Ve .IP "\(bu" 4 Make \fIffplay\fR speak the specified text, using \f(CW\*(C`flite\*(C'\fR and the \f(CW\*(C`lavfi\*(C'\fR device: .Sp .Vb 1 \& ffplay \-f lavfi flite=text=\*(AqNo more be grieved for which that thou hast done.\*(Aq .Ve .PP For more information about libflite, check: <\fBhttp://www.speech.cs.cmu.edu/flite/\fR> .SS "sine" .IX Subsection "sine" Generate an audio signal made of a sine wave with amplitude 1/8. .PP The audio signal is bit-exact. .PP The filter accepts the following options: .IP "\fBfrequency, f\fR" 4 .IX Item "frequency, f" Set the carrier frequency. Default is 440 Hz. .IP "\fBbeep_factor, b\fR" 4 .IX Item "beep_factor, b" Enable a periodic beep every second with frequency \fIbeep_factor\fR times the carrier frequency. Default is 0, meaning the beep is disabled. .IP "\fBsample_rate, s\fR" 4 .IX Item "sample_rate, s" Specify the sample rate, default is 44100. .IP "\fBduration, d\fR" 4 .IX Item "duration, d" Specify the duration of the generated audio stream. .IP "\fBsamples_per_frame\fR" 4 .IX Item "samples_per_frame" Set the number of samples per output frame, default is 1024. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Generate a simple 440 Hz sine wave: .Sp .Vb 1 \& sine .Ve .IP "\(bu" 4 Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds: .Sp .Vb 3 \& sine=220:4:d=5 \& sine=f=220:b=4:d=5 \& sine=frequency=220:beep_factor=4:duration=5 .Ve .SH "AUDIO SINKS" .IX Header "AUDIO SINKS" Below is a description of the currently available audio sinks. .SS "abuffersink" .IX Subsection "abuffersink" Buffer audio frames, and make them available to the end of filter chain. .PP This sink is mainly intended for programmatic use, in particular through the interface defined in \fIlibavfilter/buffersink.h\fR or the options system. .PP It accepts a pointer to an AVABufferSinkContext structure, which defines the incoming buffers' formats, to be passed as the opaque parameter to \f(CW\*(C`avfilter_init_filter\*(C'\fR for initialization. .SS "anullsink" .IX Subsection "anullsink" Null audio sink, do absolutely nothing with the input audio. It is mainly useful as a template and to be employed in analysis / debugging tools. .SH "VIDEO FILTERS" .IX Header "VIDEO FILTERS" When you configure your FFmpeg build, you can disable any of the existing filters using \f(CW\*(C`\-\-disable\-filters\*(C'\fR. The configure output will show the video filters included in your build. .PP Below is a description of the currently available video filters. .SS "alphaextract" .IX Subsection "alphaextract" Extract the alpha component from the input as a grayscale video. This is especially useful with the \fIalphamerge\fR filter. .SS "alphamerge" .IX Subsection "alphamerge" Add or replace the alpha component of the primary input with the grayscale value of a second input. This is intended for use with \&\fIalphaextract\fR to allow the transmission or storage of frame sequences that have alpha in a format that doesn't support an alpha channel. .PP For example, to reconstruct full frames from a normal YUV-encoded video and a separate video created with \fIalphaextract\fR, you might use: .PP .Vb 1 \& movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out] .Ve .PP Since this filter is designed for reconstruction, it operates on frame sequences without considering timestamps, and terminates when either input reaches end of stream. This will cause problems if your encoding pipeline drops frames. If you're trying to apply an image as an overlay to a video stream, consider the \fIoverlay\fR filter instead. .SS "ass" .IX Subsection "ass" Same as the subtitles filter, except that it doesn't require libavcodec and libavformat to work. On the other hand, it is limited to \s-1ASS\s0 (Advanced Substation Alpha) subtitles files. .SS "bbox" .IX Subsection "bbox" Compute the bounding box for the non-black pixels in the input frame luminance plane. .PP This filter computes the bounding box containing all the pixels with a luminance value greater than the minimum allowed value. The parameters describing the bounding box are printed on the filter log. .SS "blackdetect" .IX Subsection "blackdetect" Detect video intervals that are (almost) completely black. Can be useful to detect chapter transitions, commercials, or invalid recordings. Output lines contains the time for the start, end and duration of the detected black interval expressed in seconds. .PP In order to display the output lines, you need to set the loglevel at least to the \s-1AV_LOG_INFO\s0 value. .PP The filter accepts the following options: .IP "\fBblack_min_duration, d\fR" 4 .IX Item "black_min_duration, d" Set the minimum detected black duration expressed in seconds. It must be a non-negative floating point number. .Sp Default value is 2.0. .IP "\fBpicture_black_ratio_th, pic_th\fR" 4 .IX Item "picture_black_ratio_th, pic_th" Set the threshold for considering a picture \*(L"black\*(R". Express the minimum value for the ratio: .Sp .Vb 1 \& <nb_black_pixels> / <nb_pixels> .Ve .Sp for which a picture is considered black. Default value is 0.98. .IP "\fBpixel_black_th, pix_th\fR" 4 .IX Item "pixel_black_th, pix_th" Set the threshold for considering a pixel \*(L"black\*(R". .Sp The threshold expresses the maximum pixel luminance value for which a pixel is considered \*(L"black\*(R". The provided value is scaled according to the following equation: .Sp .Vb 1 \& <absolute_threshold> = <luminance_minimum_value> + <pixel_black_th> * <luminance_range_size> .Ve .Sp \&\fIluminance_range_size\fR and \fIluminance_minimum_value\fR depend on the input video format, the range is [0\-255] for \s-1YUV\s0 full-range formats and [16\-235] for \s-1YUV\s0 non full-range formats. .Sp Default value is 0.10. .PP The following example sets the maximum pixel threshold to the minimum value, and detects only black intervals of 2 or more seconds: .PP .Vb 1 \& blackdetect=d=2:pix_th=0.00 .Ve .SS "blackframe" .IX Subsection "blackframe" Detect frames that are (almost) completely black. Can be useful to detect chapter transitions or commercials. Output lines consist of the frame number of the detected frame, the percentage of blackness, the position in the file if known or \-1 and the timestamp in seconds. .PP In order to display the output lines, you need to set the loglevel at least to the \s-1AV_LOG_INFO\s0 value. .PP The filter accepts the following options: .IP "\fBamount\fR" 4 .IX Item "amount" Set the percentage of the pixels that have to be below the threshold, defaults to \f(CW98\fR. .IP "\fBthreshold, thresh\fR" 4 .IX Item "threshold, thresh" Set the threshold below which a pixel value is considered black, defaults to \&\f(CW32\fR. .SS "blend" .IX Subsection "blend" Blend two video frames into each other. .PP It takes two input streams and outputs one stream, the first input is the \&\*(L"top\*(R" layer and second input is \*(L"bottom\*(R" layer. Output terminates when shortest input terminates. .PP A description of the accepted options follows. .IP "\fBc0_mode\fR" 4 .IX Item "c0_mode" .PD 0 .IP "\fBc1_mode\fR" 4 .IX Item "c1_mode" .IP "\fBc2_mode\fR" 4 .IX Item "c2_mode" .IP "\fBc3_mode\fR" 4 .IX Item "c3_mode" .IP "\fBall_mode\fR" 4 .IX Item "all_mode" .PD Set blend mode for specific pixel component or all pixel components in case of \fIall_mode\fR. Default value is \f(CW\*(C`normal\*(C'\fR. .Sp Available values for component modes are: .RS 4 .IP "\fBaddition\fR" 4 .IX Item "addition" .PD 0 .IP "\fBand\fR" 4 .IX Item "and" .IP "\fBaverage\fR" 4 .IX Item "average" .IP "\fBburn\fR" 4 .IX Item "burn" .IP "\fBdarken\fR" 4 .IX Item "darken" .IP "\fBdifference\fR" 4 .IX Item "difference" .IP "\fBdivide\fR" 4 .IX Item "divide" .IP "\fBdodge\fR" 4 .IX Item "dodge" .IP "\fBexclusion\fR" 4 .IX Item "exclusion" .IP "\fBhardlight\fR" 4 .IX Item "hardlight" .IP "\fBlighten\fR" 4 .IX Item "lighten" .IP "\fBmultiply\fR" 4 .IX Item "multiply" .IP "\fBnegation\fR" 4 .IX Item "negation" .IP "\fBnormal\fR" 4 .IX Item "normal" .IP "\fBor\fR" 4 .IX Item "or" .IP "\fBoverlay\fR" 4 .IX Item "overlay" .IP "\fBphoenix\fR" 4 .IX Item "phoenix" .IP "\fBpinlight\fR" 4 .IX Item "pinlight" .IP "\fBreflect\fR" 4 .IX Item "reflect" .IP "\fBscreen\fR" 4 .IX Item "screen" .IP "\fBsoftlight\fR" 4 .IX Item "softlight" .IP "\fBsubtract\fR" 4 .IX Item "subtract" .IP "\fBvividlight\fR" 4 .IX Item "vividlight" .IP "\fBxor\fR" 4 .IX Item "xor" .RE .RS 4 .RE .IP "\fBc0_opacity\fR" 4 .IX Item "c0_opacity" .IP "\fBc1_opacity\fR" 4 .IX Item "c1_opacity" .IP "\fBc2_opacity\fR" 4 .IX Item "c2_opacity" .IP "\fBc3_opacity\fR" 4 .IX Item "c3_opacity" .IP "\fBall_opacity\fR" 4 .IX Item "all_opacity" .PD Set blend opacity for specific pixel component or all pixel components in case of \fIall_opacity\fR. Only used in combination with pixel component blend modes. .IP "\fBc0_expr\fR" 4 .IX Item "c0_expr" .PD 0 .IP "\fBc1_expr\fR" 4 .IX Item "c1_expr" .IP "\fBc2_expr\fR" 4 .IX Item "c2_expr" .IP "\fBc3_expr\fR" 4 .IX Item "c3_expr" .IP "\fBall_expr\fR" 4 .IX Item "all_expr" .PD Set blend expression for specific pixel component or all pixel components in case of \fIall_expr\fR. Note that related mode options will be ignored if those are set. .Sp The expressions can use the following variables: .RS 4 .IP "\fBN\fR" 4 .IX Item "N" The sequential number of the filtered frame, starting from \f(CW0\fR. .IP "\fBX\fR" 4 .IX Item "X" .PD 0 .IP "\fBY\fR" 4 .IX Item "Y" .PD the coordinates of the current sample .IP "\fBW\fR" 4 .IX Item "W" .PD 0 .IP "\fBH\fR" 4 .IX Item "H" .PD the width and height of currently filtered plane .IP "\fB\s-1SW\s0\fR" 4 .IX Item "SW" .PD 0 .IP "\fB\s-1SH\s0\fR" 4 .IX Item "SH" .PD Width and height scale depending on the currently filtered plane. It is the ratio between the corresponding luma plane number of pixels and the current plane ones. E.g. for \s-1YUV4:2:0\s0 the values are \f(CW\*(C`1,1\*(C'\fR for the luma plane, and \&\f(CW\*(C`0.5,0.5\*(C'\fR for chroma planes. .IP "\fBT\fR" 4 .IX Item "T" Time of the current frame, expressed in seconds. .IP "\fB\s-1TOP\s0, A\fR" 4 .IX Item "TOP, A" Value of pixel component at current location for first video frame (top layer). .IP "\fB\s-1BOTTOM\s0, B\fR" 4 .IX Item "BOTTOM, B" Value of pixel component at current location for second video frame (bottom layer). .RE .RS 4 .RE .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Apply transition from bottom layer to top layer in first 10 seconds: .Sp .Vb 1 \& blend=all_expr=\*(AqA*(if(gte(T,10),1,T/10))+B*(1\-(if(gte(T,10),1,T/10)))\*(Aq .Ve .IP "\(bu" 4 Apply 1x1 checkerboard effect: .Sp .Vb 1 \& blend=all_expr=\*(Aqif(eq(mod(X,2),mod(Y,2)),A,B)\*(Aq .Ve .SS "boxblur" .IX Subsection "boxblur" Apply boxblur algorithm to the input video. .PP The filter accepts the following options: .IP "\fBluma_radius, lr\fR" 4 .IX Item "luma_radius, lr" .PD 0 .IP "\fBluma_power, lp\fR" 4 .IX Item "luma_power, lp" .IP "\fBchroma_radius, cr\fR" 4 .IX Item "chroma_radius, cr" .IP "\fBchroma_power, cp\fR" 4 .IX Item "chroma_power, cp" .IP "\fBalpha_radius, ar\fR" 4 .IX Item "alpha_radius, ar" .IP "\fBalpha_power, ap\fR" 4 .IX Item "alpha_power, ap" .PD .PP A description of the accepted options follows. .IP "\fBluma_radius, lr\fR" 4 .IX Item "luma_radius, lr" .PD 0 .IP "\fBchroma_radius, cr\fR" 4 .IX Item "chroma_radius, cr" .IP "\fBalpha_radius, ar\fR" 4 .IX Item "alpha_radius, ar" .PD Set an expression for the box radius in pixels used for blurring the corresponding input plane. .Sp The radius value must be a non-negative number, and must not be greater than the value of the expression \f(CW\*(C`min(w,h)/2\*(C'\fR for the luma and alpha planes, and of \f(CW\*(C`min(cw,ch)/2\*(C'\fR for the chroma planes. .Sp Default value for \fBluma_radius\fR is \*(L"2\*(R". If not specified, \&\fBchroma_radius\fR and \fBalpha_radius\fR default to the corresponding value set for \fBluma_radius\fR. .Sp The expressions can contain the following constants: .RS 4 .IP "\fBw, h\fR" 4 .IX Item "w, h" the input width and height in pixels .IP "\fBcw, ch\fR" 4 .IX Item "cw, ch" the input chroma image width and height in pixels .IP "\fBhsub, vsub\fR" 4 .IX Item "hsub, vsub" horizontal and vertical chroma subsample values. For example for the pixel format \*(L"yuv422p\*(R" \fIhsub\fR is 2 and \fIvsub\fR is 1. .RE .RS 4 .RE .IP "\fBluma_power, lp\fR" 4 .IX Item "luma_power, lp" .PD 0 .IP "\fBchroma_power, cp\fR" 4 .IX Item "chroma_power, cp" .IP "\fBalpha_power, ap\fR" 4 .IX Item "alpha_power, ap" .PD Specify how many times the boxblur filter is applied to the corresponding plane. .Sp Default value for \fBluma_power\fR is 2. If not specified, \&\fBchroma_power\fR and \fBalpha_power\fR default to the corresponding value set for \fBluma_power\fR. .Sp A value of 0 will disable the effect. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Apply a boxblur filter with luma, chroma, and alpha radius set to 2: .Sp .Vb 2 \& boxblur=luma_radius=2:luma_power=1 \& boxblur=2:1 .Ve .IP "\(bu" 4 Set luma radius to 2, alpha and chroma radius to 0: .Sp .Vb 1 \& boxblur=2:1:cr=0:ar=0 .Ve .IP "\(bu" 4 Set luma and chroma radius to a fraction of the video dimension: .Sp .Vb 1 \& boxblur=luma_radius=min(h\e,w)/10:luma_power=1:chroma_radius=min(cw\e,ch)/10:chroma_power=1 .Ve .SS "colorbalance" .IX Subsection "colorbalance" Modify intensity of primary colors (red, green and blue) of input frames. .PP The filter allows an input frame to be adjusted in the shadows, midtones or highlights regions for the red-cyan, green-magenta or blue-yellow balance. .PP A positive adjustment value shifts the balance towards the primary color, a negative value towards the complementary color. .PP The filter accepts the following options: .IP "\fBrs\fR" 4 .IX Item "rs" .PD 0 .IP "\fBgs\fR" 4 .IX Item "gs" .IP "\fBbs\fR" 4 .IX Item "bs" .PD Adjust red, green and blue shadows (darkest pixels). .IP "\fBrm\fR" 4 .IX Item "rm" .PD 0 .IP "\fBgm\fR" 4 .IX Item "gm" .IP "\fBbm\fR" 4 .IX Item "bm" .PD Adjust red, green and blue midtones (medium pixels). .IP "\fBrh\fR" 4 .IX Item "rh" .PD 0 .IP "\fBgh\fR" 4 .IX Item "gh" .IP "\fBbh\fR" 4 .IX Item "bh" .PD Adjust red, green and blue highlights (brightest pixels). .Sp Allowed ranges for options are \f(CW\*(C`[\-1.0, 1.0]\*(C'\fR. Defaults are \f(CW0\fR. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Add red color cast to shadows: .Sp .Vb 1 \& colorbalance=rs=.3 .Ve .SS "colorchannelmixer" .IX Subsection "colorchannelmixer" Adjust video input frames by re-mixing color channels. .PP This filter modifies a color channel by adding the values associated to the other channels of the same pixels. For example if the value to modify is red, the output value will be: .PP .Vb 1 \& <red>=<red>*<rr> + <blue>*<rb> + <green>*<rg> + <alpha>*<ra> .Ve .PP The filter accepts the following options: .IP "\fBrr\fR" 4 .IX Item "rr" .PD 0 .IP "\fBrg\fR" 4 .IX Item "rg" .IP "\fBrb\fR" 4 .IX Item "rb" .IP "\fBra\fR" 4 .IX Item "ra" .PD Adjust contribution of input red, green, blue and alpha channels for output red channel. Default is \f(CW1\fR for \fIrr\fR, and \f(CW0\fR for \fIrg\fR, \fIrb\fR and \fIra\fR. .IP "\fBgr\fR" 4 .IX Item "gr" .PD 0 .IP "\fBgg\fR" 4 .IX Item "gg" .IP "\fBgb\fR" 4 .IX Item "gb" .IP "\fBga\fR" 4 .IX Item "ga" .PD Adjust contribution of input red, green, blue and alpha channels for output green channel. Default is \f(CW1\fR for \fIgg\fR, and \f(CW0\fR for \fIgr\fR, \fIgb\fR and \fIga\fR. .IP "\fBbr\fR" 4 .IX Item "br" .PD 0 .IP "\fBbg\fR" 4 .IX Item "bg" .IP "\fBbb\fR" 4 .IX Item "bb" .IP "\fBba\fR" 4 .IX Item "ba" .PD Adjust contribution of input red, green, blue and alpha channels for output blue channel. Default is \f(CW1\fR for \fIbb\fR, and \f(CW0\fR for \fIbr\fR, \fIbg\fR and \fIba\fR. .IP "\fBar\fR" 4 .IX Item "ar" .PD 0 .IP "\fBag\fR" 4 .IX Item "ag" .IP "\fBab\fR" 4 .IX Item "ab" .IP "\fBaa\fR" 4 .IX Item "aa" .PD Adjust contribution of input red, green, blue and alpha channels for output alpha channel. Default is \f(CW1\fR for \fIaa\fR, and \f(CW0\fR for \fIar\fR, \fIag\fR and \fIab\fR. .Sp Allowed ranges for options are \f(CW\*(C`[\-2.0, 2.0]\*(C'\fR. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Convert source to grayscale: .Sp .Vb 1 \& colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3 .Ve .SS "colormatrix" .IX Subsection "colormatrix" Convert color matrix. .PP The filter accepts the following options: .IP "\fBsrc\fR" 4 .IX Item "src" .PD 0 .IP "\fBdst\fR" 4 .IX Item "dst" .PD Specify the source and destination color matrix. Both values must be specified. .Sp The accepted values are: .RS 4 .IP "\fBbt709\fR" 4 .IX Item "bt709" \&\s-1BT\s0.709 .IP "\fBbt601\fR" 4 .IX Item "bt601" \&\s-1BT\s0.601 .IP "\fBsmpte240m\fR" 4 .IX Item "smpte240m" \&\s-1SMPTE\-240M\s0 .IP "\fBfcc\fR" 4 .IX Item "fcc" \&\s-1FCC\s0 .RE .RS 4 .RE .PP For example to convert from \s-1BT\s0.601 to \s-1SMPTE\-240M\s0, use the command: .PP .Vb 1 \& colormatrix=bt601:smpte240m .Ve .SS "copy" .IX Subsection "copy" Copy the input source unchanged to the output. Mainly useful for testing purposes. .SS "crop" .IX Subsection "crop" Crop the input video to given dimensions. .PP The filter accepts the following options: .IP "\fBw, out_w\fR" 4 .IX Item "w, out_w" Width of the output video. It defaults to \f(CW\*(C`iw\*(C'\fR. This expression is evaluated only once during the filter configuration. .IP "\fBh, out_h\fR" 4 .IX Item "h, out_h" Height of the output video. It defaults to \f(CW\*(C`ih\*(C'\fR. This expression is evaluated only once during the filter configuration. .IP "\fBx\fR" 4 .IX Item "x" Horizontal position, in the input video, of the left edge of the output video. It defaults to \f(CW\*(C`(in_w\-out_w)/2\*(C'\fR. This expression is evaluated per-frame. .IP "\fBy\fR" 4 .IX Item "y" Vertical position, in the input video, of the top edge of the output video. It defaults to \f(CW\*(C`(in_h\-out_h)/2\*(C'\fR. This expression is evaluated per-frame. .IP "\fBkeep_aspect\fR" 4 .IX Item "keep_aspect" If set to 1 will force the output display aspect ratio to be the same of the input, by changing the output sample aspect ratio. It defaults to 0. .PP The \fIout_w\fR, \fIout_h\fR, \fIx\fR, \fIy\fR parameters are expressions containing the following constants: .IP "\fBx, y\fR" 4 .IX Item "x, y" the computed values for \fIx\fR and \fIy\fR. They are evaluated for each new frame. .IP "\fBin_w, in_h\fR" 4 .IX Item "in_w, in_h" the input width and height .IP "\fBiw, ih\fR" 4 .IX Item "iw, ih" same as \fIin_w\fR and \fIin_h\fR .IP "\fBout_w, out_h\fR" 4 .IX Item "out_w, out_h" the output (cropped) width and height .IP "\fBow, oh\fR" 4 .IX Item "ow, oh" same as \fIout_w\fR and \fIout_h\fR .IP "\fBa\fR" 4 .IX Item "a" same as \fIiw\fR / \fIih\fR .IP "\fBsar\fR" 4 .IX Item "sar" input sample aspect ratio .IP "\fBdar\fR" 4 .IX Item "dar" input display aspect ratio, it is the same as (\fIiw\fR / \fIih\fR) * \fIsar\fR .IP "\fBhsub, vsub\fR" 4 .IX Item "hsub, vsub" horizontal and vertical chroma subsample values. For example for the pixel format \*(L"yuv422p\*(R" \fIhsub\fR is 2 and \fIvsub\fR is 1. .IP "\fBn\fR" 4 .IX Item "n" the number of input frame, starting from 0 .IP "\fBpos\fR" 4 .IX Item "pos" the position in the file of the input frame, \s-1NAN\s0 if unknown .IP "\fBt\fR" 4 .IX Item "t" timestamp expressed in seconds, \s-1NAN\s0 if the input timestamp is unknown .PP The expression for \fIout_w\fR may depend on the value of \fIout_h\fR, and the expression for \fIout_h\fR may depend on \fIout_w\fR, but they cannot depend on \fIx\fR and \fIy\fR, as \fIx\fR and \fIy\fR are evaluated after \fIout_w\fR and \fIout_h\fR. .PP The \fIx\fR and \fIy\fR parameters specify the expressions for the position of the top-left corner of the output (non-cropped) area. They are evaluated for each frame. If the evaluated value is not valid, it is approximated to the nearest valid value. .PP The expression for \fIx\fR may depend on \fIy\fR, and the expression for \fIy\fR may depend on \fIx\fR. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Crop area with size 100x100 at position (12,34). .Sp .Vb 1 \& crop=100:100:12:34 .Ve .Sp Using named options, the example above becomes: .Sp .Vb 1 \& crop=w=100:h=100:x=12:y=34 .Ve .IP "\(bu" 4 Crop the central input area with size 100x100: .Sp .Vb 1 \& crop=100:100 .Ve .IP "\(bu" 4 Crop the central input area with size 2/3 of the input video: .Sp .Vb 1 \& crop=2/3*in_w:2/3*in_h .Ve .IP "\(bu" 4 Crop the input video central square: .Sp .Vb 2 \& crop=out_w=in_h \& crop=in_h .Ve .IP "\(bu" 4 Delimit the rectangle with the top-left corner placed at position 100:100 and the right-bottom corner corresponding to the right-bottom corner of the input image: .Sp .Vb 1 \& crop=in_w\-100:in_h\-100:100:100 .Ve .IP "\(bu" 4 Crop 10 pixels from the left and right borders, and 20 pixels from the top and bottom borders .Sp .Vb 1 \& crop=in_w\-2*10:in_h\-2*20 .Ve .IP "\(bu" 4 Keep only the bottom right quarter of the input image: .Sp .Vb 1 \& crop=in_w/2:in_h/2:in_w/2:in_h/2 .Ve .IP "\(bu" 4 Crop height for getting Greek harmony: .Sp .Vb 1 \& crop=in_w:1/PHI*in_w .Ve .IP "\(bu" 4 Appply trembling effect: .Sp .Vb 1 \& 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) .Ve .IP "\(bu" 4 Apply erratic camera effect depending on timestamp: .Sp .Vb 1 \& 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)" .Ve .IP "\(bu" 4 Set x depending on the value of y: .Sp .Vb 1 \& crop=in_w/2:in_h/2:y:10+10*sin(n/10) .Ve .SS "cropdetect" .IX Subsection "cropdetect" Auto-detect crop size. .PP Calculate necessary cropping parameters and prints the recommended parameters through the logging system. The detected dimensions correspond to the non-black area of the input video. .PP The filter accepts the following options: .IP "\fBlimit\fR" 4 .IX Item "limit" Set higher black value threshold, which can be optionally specified from nothing (0) to everything (255). An intensity value greater to the set value is considered non-black. Default value is 24. .IP "\fBround\fR" 4 .IX Item "round" Set the value for which the width/height should be divisible by. The offset is automatically adjusted to center the video. Use 2 to get only even dimensions (needed for 4:2:2 video). 16 is best when encoding to most video codecs. Default value is 16. .IP "\fBreset_count, reset\fR" 4 .IX Item "reset_count, reset" Set the counter that determines after how many frames cropdetect will reset the previously detected largest video area and start over to detect the current optimal crop area. Default value is 0. .Sp This can be useful when channel logos distort the video area. 0 indicates never reset and return the largest area encountered during playback. .SS "curves" .IX Subsection "curves" Apply color adjustments using curves. .PP This filter is similar to the Adobe Photoshop and \s-1GIMP\s0 curves tools. Each component (red, green and blue) has its values defined by \fIN\fR key points tied from each other using a smooth curve. The x\-axis represents the pixel values from the input frame, and the y\-axis the new pixel values to be set for the output frame. .PP By default, a component curve is defined by the two points \fI(0;0)\fR and \&\fI(1;1)\fR. This creates a straight line where each original pixel value is \&\*(L"adjusted\*(R" to its own value, which means no change to the image. .PP The filter allows you to redefine these two points and add some more. A new curve (using a natural cubic spline interpolation) will be define to pass smoothly through all these new coordinates. The new defined points needs to be strictly increasing over the x\-axis, and their \fIx\fR and \fIy\fR values must be in the \fI[0;1]\fR interval. If the computed curves happened to go outside the vector spaces, the values will be clipped accordingly. .PP If there is no key point defined in \f(CW\*(C`x=0\*(C'\fR, the filter will automatically insert a \fI(0;0)\fR point. In the same way, if there is no key point defined in \f(CW\*(C`x=1\*(C'\fR, the filter will automatically insert a \fI(1;1)\fR point. .PP The filter accepts the following options: .IP "\fBpreset\fR" 4 .IX Item "preset" Select one of the available color presets. This option can be used in addition to the \fBr\fR, \fBg\fR, \fBb\fR parameters; in this case, the later options takes priority on the preset values. Available presets are: .RS 4 .IP "\fBnone\fR" 4 .IX Item "none" .PD 0 .IP "\fBcolor_negative\fR" 4 .IX Item "color_negative" .IP "\fBcross_process\fR" 4 .IX Item "cross_process" .IP "\fBdarker\fR" 4 .IX Item "darker" .IP "\fBincrease_contrast\fR" 4 .IX Item "increase_contrast" .IP "\fBlighter\fR" 4 .IX Item "lighter" .IP "\fBlinear_contrast\fR" 4 .IX Item "linear_contrast" .IP "\fBmedium_contrast\fR" 4 .IX Item "medium_contrast" .IP "\fBnegative\fR" 4 .IX Item "negative" .IP "\fBstrong_contrast\fR" 4 .IX Item "strong_contrast" .IP "\fBvintage\fR" 4 .IX Item "vintage" .RE .RS 4 .PD .Sp Default is \f(CW\*(C`none\*(C'\fR. .RE .IP "\fBmaster, m\fR" 4 .IX Item "master, m" Set the master key points. These points will define a second pass mapping. It is sometimes called a \*(L"luminance\*(R" or \*(L"value\*(R" mapping. It can be used with \&\fBr\fR, \fBg\fR, \fBb\fR or \fBall\fR since it acts like a post-processing \s-1LUT\s0. .IP "\fBred, r\fR" 4 .IX Item "red, r" Set the key points for the red component. .IP "\fBgreen, g\fR" 4 .IX Item "green, g" Set the key points for the green component. .IP "\fBblue, b\fR" 4 .IX Item "blue, b" Set the key points for the blue component. .IP "\fBall\fR" 4 .IX Item "all" Set the key points for all components (not including master). Can be used in addition to the other key points component options. In this case, the unset component(s) will fallback on this \&\fBall\fR setting. .IP "\fBpsfile\fR" 4 .IX Item "psfile" Specify a Photoshop curves file (\f(CW\*(C`.asv\*(C'\fR) to import the settings from. .PP To avoid some filtergraph syntax conflicts, each key points list need to be defined using the following syntax: \f(CW\*(C`x0/y0 x1/y1 x2/y2 ...\*(C'\fR. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Increase slightly the middle level of blue: .Sp .Vb 1 \& curves=blue=\*(Aq0.5/0.58\*(Aq .Ve .IP "\(bu" 4 Vintage effect: .Sp .Vb 1 \& curves=r=\*(Aq0/0.11 .42/.51 1/0.95\*(Aq:g=\*(Aq0.50/0.48\*(Aq:b=\*(Aq0/0.22 .49/.44 1/0.8\*(Aq .Ve .Sp Here we obtain the following coordinates for each components: .RS 4 .IP "\fIred\fR" 4 .IX Item "red" \&\f(CW\*(C`(0;0.11) (0.42;0.51) (1;0.95)\*(C'\fR .IP "\fIgreen\fR" 4 .IX Item "green" \&\f(CW\*(C`(0;0) (0.50;0.48) (1;1)\*(C'\fR .IP "\fIblue\fR" 4 .IX Item "blue" \&\f(CW\*(C`(0;0.22) (0.49;0.44) (1;0.80)\*(C'\fR .RE .RS 4 .RE .IP "\(bu" 4 The previous example can also be achieved with the associated built-in preset: .Sp .Vb 1 \& curves=preset=vintage .Ve .IP "\(bu" 4 Or simply: .Sp .Vb 1 \& curves=vintage .Ve .IP "\(bu" 4 Use a Photoshop preset and redefine the points of the green component: .Sp .Vb 1 \& curves=psfile=\*(AqMyCurvesPresets/purple.asv\*(Aq:green=\*(Aq0.45/0.53\*(Aq .Ve .SS "decimate" .IX Subsection "decimate" Drop duplicated frames at regular intervals. .PP The filter accepts the following options: .IP "\fBcycle\fR" 4 .IX Item "cycle" Set the number of frames from which one will be dropped. Setting this to \&\fIN\fR means one frame in every batch of \fIN\fR frames will be dropped. Default is \f(CW5\fR. .IP "\fBdupthresh\fR" 4 .IX Item "dupthresh" Set the threshold for duplicate detection. If the difference metric for a frame is less than or equal to this value, then it is declared as duplicate. Default is \f(CW1.1\fR .IP "\fBscthresh\fR" 4 .IX Item "scthresh" Set scene change threshold. Default is \f(CW15\fR. .IP "\fBblockx\fR" 4 .IX Item "blockx" .PD 0 .IP "\fBblocky\fR" 4 .IX Item "blocky" .PD Set the size of the x and y\-axis blocks used during metric calculations. Larger blocks give better noise suppression, but also give worse detection of small movements. Must be a power of two. Default is \f(CW32\fR. .IP "\fBppsrc\fR" 4 .IX Item "ppsrc" Mark main input as a pre-processed input and activate clean source input stream. This allows the input to be pre-processed with various filters to help the metrics calculation while keeping the frame selection lossless. When set to \&\f(CW1\fR, the first stream is for the pre-processed input, and the second stream is the clean source from where the kept frames are chosen. Default is \&\f(CW0\fR. .IP "\fBchroma\fR" 4 .IX Item "chroma" Set whether or not chroma is considered in the metric calculations. Default is \&\f(CW1\fR. .SS "delogo" .IX Subsection "delogo" Suppress a \s-1TV\s0 station logo by a simple interpolation of the surrounding pixels. Just set a rectangle covering the logo and watch it disappear (and sometimes something even uglier appear \- your mileage may vary). .PP This filter accepts the following options: .IP "\fBx, y\fR" 4 .IX Item "x, y" Specify the top left corner coordinates of the logo. They must be specified. .IP "\fBw, h\fR" 4 .IX Item "w, h" Specify the width and height of the logo to clear. They must be specified. .IP "\fBband, t\fR" 4 .IX Item "band, t" Specify the thickness of the fuzzy edge of the rectangle (added to \&\fIw\fR and \fIh\fR). The default value is 4. .IP "\fBshow\fR" 4 .IX Item "show" When set to 1, a green rectangle is drawn on the screen to simplify finding the right \fIx\fR, \fIy\fR, \fIw\fR, \fIh\fR parameters, and \&\fIband\fR is set to 4. The default value is 0. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Set a rectangle covering the area with top left corner coordinates 0,0 and size 100x77, setting a band of size 10: .Sp .Vb 1 \& delogo=x=0:y=0:w=100:h=77:band=10 .Ve .SS "deshake" .IX Subsection "deshake" Attempt to fix small changes in horizontal and/or vertical shift. This filter helps remove camera shake from hand-holding a camera, bumping a tripod, moving on a vehicle, etc. .PP The filter accepts the following options: .IP "\fBx\fR" 4 .IX Item "x" .PD 0 .IP "\fBy\fR" 4 .IX Item "y" .IP "\fBw\fR" 4 .IX Item "w" .IP "\fBh\fR" 4 .IX Item "h" .PD Specify a rectangular area where to limit the search for motion vectors. If desired the search for motion vectors can be limited to a rectangular area of the frame defined by its top left corner, width and height. These parameters have the same meaning as the drawbox filter which can be used to visualise the position of the bounding box. .Sp This is useful when simultaneous movement of subjects within the frame might be confused for camera motion by the motion vector search. .Sp If any or all of \fIx\fR, \fIy\fR, \fIw\fR and \fIh\fR are set to \-1 then the full frame is used. This allows later options to be set without specifying the bounding box for the motion vector search. .Sp Default \- search the whole frame. .IP "\fBrx\fR" 4 .IX Item "rx" .PD 0 .IP "\fBry\fR" 4 .IX Item "ry" .PD Specify the maximum extent of movement in x and y directions in the range 0\-64 pixels. Default 16. .IP "\fBedge\fR" 4 .IX Item "edge" Specify how to generate pixels to fill blanks at the edge of the frame. Available values are: .RS 4 .IP "\fBblank, 0\fR" 4 .IX Item "blank, 0" Fill zeroes at blank locations .IP "\fBoriginal, 1\fR" 4 .IX Item "original, 1" Original image at blank locations .IP "\fBclamp, 2\fR" 4 .IX Item "clamp, 2" Extruded edge value at blank locations .IP "\fBmirror, 3\fR" 4 .IX Item "mirror, 3" Mirrored edge at blank locations .RE .RS 4 .Sp Default value is \fBmirror\fR. .RE .IP "\fBblocksize\fR" 4 .IX Item "blocksize" Specify the blocksize to use for motion search. Range 4\-128 pixels, default 8. .IP "\fBcontrast\fR" 4 .IX Item "contrast" Specify the contrast threshold for blocks. Only blocks with more than the specified contrast (difference between darkest and lightest pixels) will be considered. Range 1\-255, default 125. .IP "\fBsearch\fR" 4 .IX Item "search" Specify the search strategy. Available values are: .RS 4 .IP "\fBexhaustive, 0\fR" 4 .IX Item "exhaustive, 0" Set exhaustive search .IP "\fBless, 1\fR" 4 .IX Item "less, 1" Set less exhaustive search. .RE .RS 4 .Sp Default value is \fBexhaustive\fR. .RE .IP "\fBfilename\fR" 4 .IX Item "filename" If set then a detailed log of the motion search is written to the specified file. .IP "\fBopencl\fR" 4 .IX Item "opencl" If set to 1, specify using OpenCL capabilities, only available if FFmpeg was configured with \f(CW\*(C`\-\-enable\-opencl\*(C'\fR. Default value is 0. .SS "drawbox" .IX Subsection "drawbox" Draw a colored box on the input image. .PP This filter accepts the following options: .IP "\fBx, y\fR" 4 .IX Item "x, y" Specify the top left corner coordinates of the box. Default to 0. .IP "\fBwidth, w\fR" 4 .IX Item "width, w" .PD 0 .IP "\fBheight, h\fR" 4 .IX Item "height, h" .PD Specify the width and height of the box, if 0 they are interpreted as the input width and height. Default to 0. .IP "\fBcolor, c\fR" 4 .IX Item "color, c" Specify the color of the box to write, it can be the name of a color (case insensitive match) or a 0xRRGGBB[\s-1AA\s0] sequence. If the special value \f(CW\*(C`invert\*(C'\fR is used, the box edge color is the same as the video with inverted luma. .IP "\fBthickness, t\fR" 4 .IX Item "thickness, t" Set the thickness of the box edge. Default value is \f(CW4\fR. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Draw a black box around the edge of the input image: .Sp .Vb 1 \& drawbox .Ve .IP "\(bu" 4 Draw a box with color red and an opacity of 50%: .Sp .Vb 1 \& drawbox=10:20:200:60:red@0.5 .Ve .Sp The previous example can be specified as: .Sp .Vb 1 \& drawbox=x=10:y=20:w=200:h=60:color=red@0.5 .Ve .IP "\(bu" 4 Fill the box with pink color: .Sp .Vb 1 \& drawbox=x=10:y=10:w=100:h=100:color=pink@0.5:t=max .Ve .SS "drawtext" .IX Subsection "drawtext" Draw text string or text from specified file on top of video using the libfreetype library. .PP To enable compilation of this filter you need to configure FFmpeg with \&\f(CW\*(C`\-\-enable\-libfreetype\*(C'\fR. .PP \fISyntax\fR .IX Subsection "Syntax" .PP The description of the accepted parameters follows. .IP "\fBbox\fR" 4 .IX Item "box" Used to draw a box around text using background color. Value should be either 1 (enable) or 0 (disable). The default value of \fIbox\fR is 0. .IP "\fBboxcolor\fR" 4 .IX Item "boxcolor" The color to be used for drawing box around text. Either a string (e.g. \*(L"yellow\*(R") or in 0xRRGGBB[\s-1AA\s0] format (e.g. \*(L"0xff00ff\*(R"), possibly followed by an alpha specifier. The default value of \fIboxcolor\fR is \*(L"white\*(R". .IP "\fBdraw\fR" 4 .IX Item "draw" Set an expression which specifies if the text should be drawn. If the expression evaluates to 0, the text is not drawn. This is useful for specifying that the text should be drawn only when specific conditions are met. .Sp Default value is \*(L"1\*(R". .Sp See below for the list of accepted constants and functions. .IP "\fBexpansion\fR" 4 .IX Item "expansion" Select how the \fItext\fR is expanded. Can be either \f(CW\*(C`none\*(C'\fR, \&\f(CW\*(C`strftime\*(C'\fR (deprecated) or \&\f(CW\*(C`normal\*(C'\fR (default). See the drawtext_expansion, Text expansion section below for details. .IP "\fBfix_bounds\fR" 4 .IX Item "fix_bounds" If true, check and fix text coords to avoid clipping. .IP "\fBfontcolor\fR" 4 .IX Item "fontcolor" The color to be used for drawing fonts. Either a string (e.g. \*(L"red\*(R") or in 0xRRGGBB[\s-1AA\s0] format (e.g. \*(L"0xff000033\*(R"), possibly followed by an alpha specifier. The default value of \fIfontcolor\fR is \*(L"black\*(R". .IP "\fBfontfile\fR" 4 .IX Item "fontfile" The font file to be used for drawing text. Path must be included. This parameter is mandatory. .IP "\fBfontsize\fR" 4 .IX Item "fontsize" The font size to be used for drawing text. The default value of \fIfontsize\fR is 16. .IP "\fBft_load_flags\fR" 4 .IX Item "ft_load_flags" Flags to be used for loading the fonts. .Sp The flags map the corresponding flags supported by libfreetype, and are a combination of the following values: .RS 4 .IP "\fIdefault\fR" 4 .IX Item "default" .PD 0 .IP "\fIno_scale\fR" 4 .IX Item "no_scale" .IP "\fIno_hinting\fR" 4 .IX Item "no_hinting" .IP "\fIrender\fR" 4 .IX Item "render" .IP "\fIno_bitmap\fR" 4 .IX Item "no_bitmap" .IP "\fIvertical_layout\fR" 4 .IX Item "vertical_layout" .IP "\fIforce_autohint\fR" 4 .IX Item "force_autohint" .IP "\fIcrop_bitmap\fR" 4 .IX Item "crop_bitmap" .IP "\fIpedantic\fR" 4 .IX Item "pedantic" .IP "\fIignore_global_advance_width\fR" 4 .IX Item "ignore_global_advance_width" .IP "\fIno_recurse\fR" 4 .IX Item "no_recurse" .IP "\fIignore_transform\fR" 4 .IX Item "ignore_transform" .IP "\fImonochrome\fR" 4 .IX Item "monochrome" .IP "\fIlinear_design\fR" 4 .IX Item "linear_design" .IP "\fIno_autohint\fR" 4 .IX Item "no_autohint" .IP "\fIend table\fR" 4 .IX Item "end table" .RE .RS 4 .PD .Sp Default value is \*(L"render\*(R". .Sp For more information consult the documentation for the FT_LOAD_* libfreetype flags. .RE .IP "\fBshadowcolor\fR" 4 .IX Item "shadowcolor" The color to be used for drawing a shadow behind the drawn text. It can be a color name (e.g. \*(L"yellow\*(R") or a string in the 0xRRGGBB[\s-1AA\s0] form (e.g. \*(L"0xff00ff\*(R"), possibly followed by an alpha specifier. The default value of \fIshadowcolor\fR is \*(L"black\*(R". .IP "\fBshadowx, shadowy\fR" 4 .IX Item "shadowx, shadowy" The x and y offsets for the text shadow position with respect to the position of the text. They can be either positive or negative values. Default value for both is \*(L"0\*(R". .IP "\fBtabsize\fR" 4 .IX Item "tabsize" The size in number of spaces to use for rendering the tab. Default value is 4. .IP "\fBtimecode\fR" 4 .IX Item "timecode" Set the initial timecode representation in \*(L"hh:mm:ss[:;.]ff\*(R" format. It can be used with or without text parameter. \fItimecode_rate\fR option must be specified. .IP "\fBtimecode_rate, rate, r\fR" 4 .IX Item "timecode_rate, rate, r" Set the timecode frame rate (timecode only). .IP "\fBtext\fR" 4 .IX Item "text" The text string to be drawn. The text must be a sequence of \s-1UTF\-8\s0 encoded characters. This parameter is mandatory if no file is specified with the parameter \&\fItextfile\fR. .IP "\fBtextfile\fR" 4 .IX Item "textfile" A text file containing text to be drawn. The text must be a sequence of \s-1UTF\-8\s0 encoded characters. .Sp This parameter is mandatory if no text string is specified with the parameter \fItext\fR. .Sp If both \fItext\fR and \fItextfile\fR are specified, an error is thrown. .IP "\fBreload\fR" 4 .IX Item "reload" If set to 1, the \fItextfile\fR will be reloaded before each frame. Be sure to update it atomically, or it may be read partially, or even fail. .IP "\fBx, y\fR" 4 .IX Item "x, y" The expressions which specify the offsets where text will be drawn within the video frame. They are relative to the top/left border of the output image. .Sp The default value of \fIx\fR and \fIy\fR is \*(L"0\*(R". .Sp See below for the list of accepted constants and functions. .PP The parameters for \fIx\fR and \fIy\fR are expressions containing the following constants and functions: .IP "\fBdar\fR" 4 .IX Item "dar" input display aspect ratio, it is the same as (\fIw\fR / \fIh\fR) * \fIsar\fR .IP "\fBhsub, vsub\fR" 4 .IX Item "hsub, vsub" horizontal and vertical chroma subsample values. For example for the pixel format \*(L"yuv422p\*(R" \fIhsub\fR is 2 and \fIvsub\fR is 1. .IP "\fBline_h, lh\fR" 4 .IX Item "line_h, lh" the height of each text line .IP "\fBmain_h, h, H\fR" 4 .IX Item "main_h, h, H" the input height .IP "\fBmain_w, w, W\fR" 4 .IX Item "main_w, w, W" the input width .IP "\fBmax_glyph_a, ascent\fR" 4 .IX Item "max_glyph_a, ascent" the maximum distance from the baseline to the highest/upper grid coordinate used to place a glyph outline point, for all the rendered glyphs. It is a positive value, due to the grid's orientation with the Y axis upwards. .IP "\fBmax_glyph_d, descent\fR" 4 .IX Item "max_glyph_d, descent" the maximum distance from the baseline to the lowest grid coordinate used to place a glyph outline point, for all the rendered glyphs. This is a negative value, due to the grid's orientation, with the Y axis upwards. .IP "\fBmax_glyph_h\fR" 4 .IX Item "max_glyph_h" maximum glyph height, that is the maximum height for all the glyphs contained in the rendered text, it is equivalent to \fIascent\fR \- \&\fIdescent\fR. .IP "\fBmax_glyph_w\fR" 4 .IX Item "max_glyph_w" maximum glyph width, that is the maximum width for all the glyphs contained in the rendered text .IP "\fBn\fR" 4 .IX Item "n" the number of input frame, starting from 0 .IP "\fBrand(min, max)\fR" 4 .IX Item "rand(min, max)" return a random number included between \fImin\fR and \fImax\fR .IP "\fBsar\fR" 4 .IX Item "sar" input sample aspect ratio .IP "\fBt\fR" 4 .IX Item "t" timestamp expressed in seconds, \s-1NAN\s0 if the input timestamp is unknown .IP "\fBtext_h, th\fR" 4 .IX Item "text_h, th" the height of the rendered text .IP "\fBtext_w, tw\fR" 4 .IX Item "text_w, tw" the width of the rendered text .IP "\fBx, y\fR" 4 .IX Item "x, y" the x and y offset coordinates where the text is drawn. .Sp These parameters allow the \fIx\fR and \fIy\fR expressions to refer each other, so you can for example specify \f(CW\*(C`y=x/dar\*(C'\fR. .PP If libavfilter was built with \f(CW\*(C`\-\-enable\-fontconfig\*(C'\fR, then \&\fBfontfile\fR can be a fontconfig pattern or omitted. .PP \fIText expansion\fR .IX Subsection "Text expansion" .PP If \fBexpansion\fR is set to \f(CW\*(C`strftime\*(C'\fR, the filter recognizes \fIstrftime()\fR sequences in the provided text and expands them accordingly. Check the documentation of \fIstrftime()\fR. This feature is deprecated. .PP If \fBexpansion\fR is set to \f(CW\*(C`none\*(C'\fR, the text is printed verbatim. .PP If \fBexpansion\fR is set to \f(CW\*(C`normal\*(C'\fR (which is the default), the following expansion mechanism is used. .PP The backslash character '\e', followed by any character, always expands to the second character. .PP Sequence of the form \f(CW\*(C`%{...}\*(C'\fR are expanded. The text between the braces is a function name, possibly followed by arguments separated by ':'. If the arguments contain special characters or delimiters (':' or '}'), they should be escaped. .PP Note that they probably must also be escaped as the value for the \&\fBtext\fR option in the filter argument string and as the filter argument in the filtergraph description, and possibly also for the shell, that makes up to four levels of escaping; using a text file avoids these problems. .PP The following functions are available: .IP "\fBexpr, e\fR" 4 .IX Item "expr, e" The expression evaluation result. .Sp It must take one argument specifying the expression to be evaluated, which accepts the same constants and functions as the \fIx\fR and \&\fIy\fR values. Note that not all constants should be used, for example the text size is not known when evaluating the expression, so the constants \fItext_w\fR and \fItext_h\fR will have an undefined value. .IP "\fBgmtime\fR" 4 .IX Item "gmtime" The time at which the filter is running, expressed in \s-1UTC\s0. It can accept an argument: a \fIstrftime()\fR format string. .IP "\fBlocaltime\fR" 4 .IX Item "localtime" The time at which the filter is running, expressed in the local time zone. It can accept an argument: a \fIstrftime()\fR format string. .IP "\fBn, frame_num\fR" 4 .IX Item "n, frame_num" The frame number, starting from 0. .IP "\fBpts\fR" 4 .IX Item "pts" The timestamp of the current frame, in seconds, with microsecond accuracy. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Draw \*(L"Test Text\*(R" with font FreeSerif, using the default values for the optional parameters. .Sp .Vb 1 \& drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text=\*(AqTest Text\*(Aq" .Ve .IP "\(bu" 4 Draw 'Test Text' with font FreeSerif of size 24 at position x=100 and y=50 (counting from the top-left corner of the screen), text is yellow with a red box around it. Both the text and the box have an opacity of 20%. .Sp .Vb 2 \& drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text=\*(AqTest Text\*(Aq:\e \& x=100: y=50: fontsize=24: fontcolor=yellow@0.2: box=1: boxcolor=red@0.2" .Ve .Sp Note that the double quotes are not necessary if spaces are not used within the parameter list. .IP "\(bu" 4 Show the text at the center of the video frame: .Sp .Vb 1 \& drawtext="fontsize=30:fontfile=FreeSerif.ttf:text=\*(Aqhello world\*(Aq:x=(w\-text_w)/2:y=(h\-text_h\-line_h)/2" .Ve .IP "\(bu" 4 Show a text line sliding from right to left in the last row of the video frame. The file \fI\s-1LONG_LINE\s0\fR is assumed to contain a single line with no newlines. .Sp .Vb 1 \& drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h\-line_h:x=\-50*t" .Ve .IP "\(bu" 4 Show the content of file \fI\s-1CREDITS\s0\fR off the bottom of the frame and scroll up. .Sp .Vb 1 \& drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h\-20*t" .Ve .IP "\(bu" 4 Draw a single green letter \*(L"g\*(R", at the center of the input video. The glyph baseline is placed at half screen height. .Sp .Vb 1 \& drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w\-max_glyph_w)/2:y=h/2\-ascent" .Ve .IP "\(bu" 4 Show text for 1 second every 3 seconds: .Sp .Vb 1 \& drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:draw=lt(mod(t\e,3)\e,1):text=\*(Aqblink\*(Aq" .Ve .IP "\(bu" 4 Use fontconfig to set the font. Note that the colons need to be escaped. .Sp .Vb 1 \& drawtext=\*(Aqfontfile=Linux Libertine O\-40\e:style=Semibold:text=FFmpeg\*(Aq .Ve .IP "\(bu" 4 Print the date of a real-time encoding (see \fIstrftime\fR\|(3)): .Sp .Vb 1 \& drawtext=\*(Aqfontfile=FreeSans.ttf:text=%{localtime:%a %b %d %Y}\*(Aq .Ve .PP For more information about libfreetype, check: <\fBhttp://www.freetype.org/\fR>. .PP For more information about fontconfig, check: <\fBhttp://freedesktop.org/software/fontconfig/fontconfig\-user.html\fR>. .SS "edgedetect" .IX Subsection "edgedetect" Detect and draw edges. The filter uses the Canny Edge Detection algorithm. .PP The filter accepts the following options: .IP "\fBlow, high\fR" 4 .IX Item "low, high" Set low and high threshold values used by the Canny thresholding algorithm. .Sp The high threshold selects the \*(L"strong\*(R" edge pixels, which are then connected through 8\-connectivity with the \*(L"weak\*(R" edge pixels selected by the low threshold. .Sp \&\fIlow\fR and \fIhigh\fR threshold values must be choosen in the range [0,1], and \fIlow\fR should be lesser or equal to \fIhigh\fR. .Sp Default value for \fIlow\fR is \f(CW\*(C`20/255\*(C'\fR, and default value for \fIhigh\fR is \f(CW\*(C`50/255\*(C'\fR. .PP Example: .PP .Vb 1 \& edgedetect=low=0.1:high=0.4 .Ve .SS "fade" .IX Subsection "fade" Apply fade\-in/out effect to input video. .PP This filter accepts the following options: .IP "\fBtype, t\fR" 4 .IX Item "type, t" The effect type \*(-- can be either \*(L"in\*(R" for fade-in, or \*(L"out\*(R" for a fade-out effect. Default is \f(CW\*(C`in\*(C'\fR. .IP "\fBstart_frame, s\fR" 4 .IX Item "start_frame, s" Specify the number of the start frame for starting to apply the fade effect. Default is 0. .IP "\fBnb_frames, n\fR" 4 .IX Item "nb_frames, n" The number of frames for which the fade effect has to last. At the end of the fade-in effect the output video will have the same intensity as the input video, at the end of the fade-out transition the output video will be completely black. Default is 25. .IP "\fBalpha\fR" 4 .IX Item "alpha" If set to 1, fade only alpha channel, if one exists on the input. Default value is 0. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Fade in first 30 frames of video: .Sp .Vb 1 \& fade=in:0:30 .Ve .Sp The command above is equivalent to: .Sp .Vb 1 \& fade=t=in:s=0:n=30 .Ve .IP "\(bu" 4 Fade out last 45 frames of a 200\-frame video: .Sp .Vb 2 \& fade=out:155:45 \& fade=type=out:start_frame=155:nb_frames=45 .Ve .IP "\(bu" 4 Fade in first 25 frames and fade out last 25 frames of a 1000\-frame video: .Sp .Vb 1 \& fade=in:0:25, fade=out:975:25 .Ve .IP "\(bu" 4 Make first 5 frames black, then fade in from frame 5\-24: .Sp .Vb 1 \& fade=in:5:20 .Ve .IP "\(bu" 4 Fade in alpha over first 25 frames of video: .Sp .Vb 1 \& fade=in:0:25:alpha=1 .Ve .SS "field" .IX Subsection "field" Extract a single field from an interlaced image using stride arithmetic to avoid wasting \s-1CPU\s0 time. The output frames are marked as non-interlaced. .PP The filter accepts the following options: .IP "\fBtype\fR" 4 .IX Item "type" Specify whether to extract the top (if the value is \f(CW0\fR or \&\f(CW\*(C`top\*(C'\fR) or the bottom field (if the value is \f(CW1\fR or \&\f(CW\*(C`bottom\*(C'\fR). .SS "fieldmatch" .IX Subsection "fieldmatch" Field matching filter for inverse telecine. It is meant to reconstruct the progressive frames from a telecined stream. The filter does not drop duplicated frames, so to achieve a complete inverse telecine \f(CW\*(C`fieldmatch\*(C'\fR needs to be followed by a decimation filter such as decimate in the filtergraph. .PP The separation of the field matching and the decimation is notably motivated by the possibility of inserting a de-interlacing filter fallback between the two. If the source has mixed telecined and real interlaced content, \&\f(CW\*(C`fieldmatch\*(C'\fR will not be able to match fields for the interlaced parts. But these remaining combed frames will be marked as interlaced, and thus can be de-interlaced by a later filter such as yadif before decimation. .PP In addition to the various configuration options, \f(CW\*(C`fieldmatch\*(C'\fR can take an optional second stream, activated through the \fBppsrc\fR option. If enabled, the frames reconstruction will be based on the fields and frames from this second stream. This allows the first input to be pre-processed in order to help the various algorithms of the filter, while keeping the output lossless (assuming the fields are matched properly). Typically, a field-aware denoiser, or brightness/contrast adjustments can help. .PP Note that this filter uses the same algorithms as \s-1TIVTC/TFM\s0 (AviSynth project) and \s-1VIVTC/VFM\s0 (VapourSynth project). The later is a light clone of \s-1TFM\s0 from which \f(CW\*(C`fieldmatch\*(C'\fR is based on. While the semantic and usage are very close, some behaviour and options names can differ. .PP The filter accepts the following options: .IP "\fBorder\fR" 4 .IX Item "order" Specify the assumed field order of the input stream. Available values are: .RS 4 .IP "\fBauto\fR" 4 .IX Item "auto" Auto detect parity (use FFmpeg's internal parity value). .IP "\fBbff\fR" 4 .IX Item "bff" Assume bottom field first. .IP "\fBtff\fR" 4 .IX Item "tff" Assume top field first. .RE .RS 4 .Sp Note that it is sometimes recommended not to trust the parity announced by the stream. .Sp Default value is \fIauto\fR. .RE .IP "\fBmode\fR" 4 .IX Item "mode" Set the matching mode or strategy to use. \fBpc\fR mode is the safest in the sense that it wont risk creating jerkiness due to duplicate frames when possible, but if there are bad edits or blended fields it will end up outputting combed frames when a good match might actually exist. On the other hand, \fBpcn_ub\fR mode is the most risky in terms of creating jerkiness, but will almost always find a good frame if there is one. The other values are all somewhere in between \fBpc\fR and \fBpcn_ub\fR in terms of risking jerkiness and creating duplicate frames versus finding good matches in sections with bad edits, orphaned fields, blended fields, etc. .Sp More details about p/c/n/u/b are available in p/c/n/u/b meaning section. .Sp Available values are: .RS 4 .IP "\fBpc\fR" 4 .IX Item "pc" 2\-way matching (p/c) .IP "\fBpc_n\fR" 4 .IX Item "pc_n" 2\-way matching, and trying 3rd match if still combed (p/c + n) .IP "\fBpc_u\fR" 4 .IX Item "pc_u" 2\-way matching, and trying 3rd match (same order) if still combed (p/c + u) .IP "\fBpc_n_ub\fR" 4 .IX Item "pc_n_ub" 2\-way matching, trying 3rd match if still combed, and trying 4th/5th matches if still combed (p/c + n + u/b) .IP "\fBpcn\fR" 4 .IX Item "pcn" 3\-way matching (p/c/n) .IP "\fBpcn_ub\fR" 4 .IX Item "pcn_ub" 3\-way matching, and trying 4th/5th matches if all 3 of the original matches are detected as combed (p/c/n + u/b) .RE .RS 4 .Sp The parenthesis at the end indicate the matches that would be used for that mode assuming \fBorder\fR=\fItff\fR (and \fBfield\fR on \fIauto\fR or \&\fItop\fR). .Sp In terms of speed \fBpc\fR mode is by far the fastest and \fBpcn_ub\fR is the slowest. .Sp Default value is \fIpc_n\fR. .RE .IP "\fBppsrc\fR" 4 .IX Item "ppsrc" Mark the main input stream as a pre-processed input, and enable the secondary input stream as the clean source to pick the fields from. See the filter introduction for more details. It is similar to the \fBclip2\fR feature from \&\s-1VFM/TFM\s0. .Sp Default value is \f(CW0\fR (disabled). .IP "\fBfield\fR" 4 .IX Item "field" Set the field to match from. It is recommended to set this to the same value as \&\fBorder\fR unless you experience matching failures with that setting. In certain circumstances changing the field that is used to match from can have a large impact on matching performance. Available values are: .RS 4 .IP "\fBauto\fR" 4 .IX Item "auto" Automatic (same value as \fBorder\fR). .IP "\fBbottom\fR" 4 .IX Item "bottom" Match from the bottom field. .IP "\fBtop\fR" 4 .IX Item "top" Match from the top field. .RE .RS 4 .Sp Default value is \fIauto\fR. .RE .IP "\fBmchroma\fR" 4 .IX Item "mchroma" Set whether or not chroma is included during the match comparisons. In most cases it is recommended to leave this enabled. You should set this to \f(CW0\fR only if your clip has bad chroma problems such as heavy rainbowing or other artifacts. Setting this to \f(CW0\fR could also be used to speed things up at the cost of some accuracy. .Sp Default value is \f(CW1\fR. .IP "\fBy0\fR" 4 .IX Item "y0" .PD 0 .IP "\fBy1\fR" 4 .IX Item "y1" .PD These define an exclusion band which excludes the lines between \fBy0\fR and \&\fBy1\fR from being included in the field matching decision. An exclusion band can be used to ignore subtitles, a logo, or other things that may interfere with the matching. \fBy0\fR sets the starting scan line and \&\fBy1\fR sets the ending line; all lines in between \fBy0\fR and \&\fBy1\fR (including \fBy0\fR and \fBy1\fR) will be ignored. Setting \&\fBy0\fR and \fBy1\fR to the same value will disable the feature. \&\fBy0\fR and \fBy1\fR defaults to \f(CW0\fR. .IP "\fBscthresh\fR" 4 .IX Item "scthresh" Set the scene change detection threshold as a percentage of maximum change on the luma plane. Good values are in the \f(CW\*(C`[8.0, 14.0]\*(C'\fR range. Scene change detection is only relevant in case \fBcombmatch\fR=\fIsc\fR. The range for \&\fBscthresh\fR is \f(CW\*(C`[0.0, 100.0]\*(C'\fR. .Sp Default value is \f(CW12.0\fR. .IP "\fBcombmatch\fR" 4 .IX Item "combmatch" When \fBcombatch\fR is not \fInone\fR, \f(CW\*(C`fieldmatch\*(C'\fR will take into account the combed scores of matches when deciding what match to use as the final match. Available values are: .RS 4 .IP "\fBnone\fR" 4 .IX Item "none" No final matching based on combed scores. .IP "\fBsc\fR" 4 .IX Item "sc" Combed scores are only used when a scene change is detected. .IP "\fBfull\fR" 4 .IX Item "full" Use combed scores all the time. .RE .RS 4 .Sp Default is \fIsc\fR. .RE .IP "\fBcombdbg\fR" 4 .IX Item "combdbg" Force \f(CW\*(C`fieldmatch\*(C'\fR to calculate the combed metrics for certain matches and print them. This setting is known as \fBmicout\fR in \s-1TFM/VFM\s0 vocabulary. Available values are: .RS 4 .IP "\fBnone\fR" 4 .IX Item "none" No forced calculation. .IP "\fBpcn\fR" 4 .IX Item "pcn" Force p/c/n calculations. .IP "\fBpcnub\fR" 4 .IX Item "pcnub" Force p/c/n/u/b calculations. .RE .RS 4 .Sp Default value is \fInone\fR. .RE .IP "\fBcthresh\fR" 4 .IX Item "cthresh" This is the area combing threshold used for combed frame detection. This essentially controls how \*(L"strong\*(R" or \*(L"visible\*(R" combing must be to be detected. Larger values mean combing must be more visible and smaller values mean combing can be less visible or strong and still be detected. Valid settings are from \&\f(CW\*(C`\-1\*(C'\fR (every pixel will be detected as combed) to \f(CW255\fR (no pixel will be detected as combed). This is basically a pixel difference value. A good range is \f(CW\*(C`[8, 12]\*(C'\fR. .Sp Default value is \f(CW9\fR. .IP "\fBchroma\fR" 4 .IX Item "chroma" Sets whether or not chroma is considered in the combed frame decision. Only disable this if your source has chroma problems (rainbowing, etc.) that are causing problems for the combed frame detection with chroma enabled. Actually, using \fBchroma\fR=\fI0\fR is usually more reliable, except for the case where there is chroma only combing in the source. .Sp Default value is \f(CW0\fR. .IP "\fBblockx\fR" 4 .IX Item "blockx" .PD 0 .IP "\fBblocky\fR" 4 .IX Item "blocky" .PD Respectively set the x\-axis and y\-axis size of the window used during combed frame detection. This has to do with the size of the area in which \&\fBcombpel\fR pixels are required to be detected as combed for a frame to be declared combed. See the \fBcombpel\fR parameter description for more info. Possible values are any number that is a power of 2 starting at 4 and going up to 512. .Sp Default value is \f(CW16\fR. .IP "\fBcombpel\fR" 4 .IX Item "combpel" The number of combed pixels inside any of the \fBblocky\fR by \&\fBblockx\fR size blocks on the frame for the frame to be detected as combed. While \fBcthresh\fR controls how \*(L"visible\*(R" the combing must be, this setting controls \*(L"how much\*(R" combing there must be in any localized area (a window defined by the \fBblockx\fR and \fBblocky\fR settings) on the frame. Minimum value is \f(CW0\fR and maximum is \f(CW\*(C`blocky x blockx\*(C'\fR (at which point no frames will ever be detected as combed). This setting is known as \fB\s-1MI\s0\fR in \s-1TFM/VFM\s0 vocabulary. .Sp Default value is \f(CW80\fR. .PP \fIp/c/n/u/b meaning\fR .IX Subsection "p/c/n/u/b meaning" .PP p/c/n .IX Subsection "p/c/n" .PP We assume the following telecined stream: .PP .Vb 2 \& Top fields: 1 2 2 3 4 \& Bottom fields: 1 2 3 4 4 .Ve .PP The numbers correspond to the progressive frame the fields relate to. Here, the first two frames are progressive, the 3rd and 4th are combed, and so on. .PP When \f(CW\*(C`fieldmatch\*(C'\fR is configured to run a matching from bottom (\fBfield\fR=\fIbottom\fR) this is how this input stream get transformed: .PP .Vb 3 \& Input stream: \& T 1 2 2 3 4 \& B 1 2 3 4 4 <\-\- matching reference \& \& Matches: c c n n c \& \& Output stream: \& T 1 2 3 4 4 \& B 1 2 3 4 4 .Ve .PP As a result of the field matching, we can see that some frames get duplicated. To perform a complete inverse telecine, you need to rely on a decimation filter after this operation. See for instance the decimate filter. .PP The same operation now matching from top fields (\fBfield\fR=\fItop\fR) looks like this: .PP .Vb 3 \& Input stream: \& T 1 2 2 3 4 <\-\- matching reference \& B 1 2 3 4 4 \& \& Matches: c c p p c \& \& Output stream: \& T 1 2 2 3 4 \& B 1 2 2 3 4 .Ve .PP In these examples, we can see what \fIp\fR, \fIc\fR and \fIn\fR mean; basically, they refer to the frame and field of the opposite parity: .IP "*<\fIp\fR matches the field of the opposite parity in the previous frame>" 4 .IX Item "*<p matches the field of the opposite parity in the previous frame>" .PD 0 .IP "*<\fIc\fR matches the field of the opposite parity in the current frame>" 4 .IX Item "*<c matches the field of the opposite parity in the current frame>" .IP "*<\fIn\fR matches the field of the opposite parity in the next frame>" 4 .IX Item "*<n matches the field of the opposite parity in the next frame>" .PD .PP u/b .IX Subsection "u/b" .PP The \fIu\fR and \fIb\fR matching are a bit special in the sense that they match from the opposite parity flag. In the following examples, we assume that we are currently matching the 2nd frame (Top:2, bottom:2). According to the match, a \&'x' is placed above and below each matched fields. .PP With bottom matching (\fBfield\fR=\fIbottom\fR): .PP .Vb 1 \& Match: c p n b u \& \& x x x x x \& Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2 \& Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 \& x x x x x \& \& Output frames: \& 2 1 2 2 2 \& 2 2 2 1 3 .Ve .PP With top matching (\fBfield\fR=\fItop\fR): .PP .Vb 1 \& Match: c p n b u \& \& x x x x x \& Top 1 2 2 1 2 2 1 2 2 1 2 2 1 2 2 \& Bottom 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 \& x x x x x \& \& Output frames: \& 2 2 2 1 2 \& 2 1 3 2 2 .Ve .PP \fIExamples\fR .IX Subsection "Examples" .PP Simple \s-1IVTC\s0 of a top field first telecined stream: .PP .Vb 1 \& fieldmatch=order=tff:combmatch=none, decimate .Ve .PP Advanced \s-1IVTC\s0, with fallback on yadif for still combed frames: .PP .Vb 1 \& fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate .Ve .SS "fieldorder" .IX Subsection "fieldorder" Transform the field order of the input video. .PP This filter accepts the following options: .IP "\fBorder\fR" 4 .IX Item "order" Output field order. Valid values are \fItff\fR for top field first or \fIbff\fR for bottom field first. .PP Default value is \fBtff\fR. .PP Transformation is achieved by shifting the picture content up or down by one line, and filling the remaining line with appropriate picture content. This method is consistent with most broadcast field order converters. .PP If the input video is not flagged as being interlaced, or it is already flagged as being of the required output field order then this filter does not alter the incoming video. .PP This filter is very useful when converting to or from \s-1PAL\s0 \s-1DV\s0 material, which is bottom field first. .PP For example: .PP .Vb 1 \& ffmpeg \-i in.vob \-vf "fieldorder=bff" out.dv .Ve .SS "fifo" .IX Subsection "fifo" Buffer input images and send them when they are requested. .PP This filter is mainly useful when auto-inserted by the libavfilter framework. .PP The filter does not take parameters. .SS "format" .IX Subsection "format" Convert the input video to one of the specified pixel formats. Libavfilter will try to pick one that is supported for the input to the next filter. .PP This filter accepts the following parameters: .IP "\fBpix_fmts\fR" 4 .IX Item "pix_fmts" A '|'\-separated list of pixel format names, for example \&\*(L"pix_fmts=yuv420p|monow|rgb24\*(R". .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Convert the input video to the format \fIyuv420p\fR .Sp .Vb 1 \& format=pix_fmts=yuv420p .Ve .Sp Convert the input video to any of the formats in the list .Sp .Vb 1 \& format=pix_fmts=yuv420p|yuv444p|yuv410p .Ve .SS "fps" .IX Subsection "fps" Convert the video to specified constant frame rate by duplicating or dropping frames as necessary. .PP This filter accepts the following named parameters: .IP "\fBfps\fR" 4 .IX Item "fps" Desired output frame rate. The default is \f(CW25\fR. .IP "\fBround\fR" 4 .IX Item "round" Rounding method. .Sp Possible values are: .RS 4 .IP "\fBzero\fR" 4 .IX Item "zero" zero round towards 0 .IP "\fBinf\fR" 4 .IX Item "inf" round away from 0 .IP "\fBdown\fR" 4 .IX Item "down" round towards \-infinity .IP "\fBup\fR" 4 .IX Item "up" round towards +infinity .IP "\fBnear\fR" 4 .IX Item "near" round to nearest .RE .RS 4 .Sp The default is \f(CW\*(C`near\*(C'\fR. .RE .PP Alternatively, the options can be specified as a flat string: \&\fIfps\fR[:\fIround\fR]. .PP See also the setpts filter. .SS "framestep" .IX Subsection "framestep" Select one frame every N\-th frame. .PP This filter accepts the following option: .IP "\fBstep\fR" 4 .IX Item "step" Select frame after every \f(CW\*(C`step\*(C'\fR frames. Allowed values are positive integers higher than 0. Default value is \f(CW1\fR. .SS "frei0r" .IX Subsection "frei0r" Apply a frei0r effect to the input video. .PP To enable compilation of this filter you need to install the frei0r header and configure FFmpeg with \f(CW\*(C`\-\-enable\-frei0r\*(C'\fR. .PP This filter accepts the following options: .IP "\fBfilter_name\fR" 4 .IX Item "filter_name" The name to the frei0r effect to load. If the environment variable \&\fB\s-1FREI0R_PATH\s0\fR is defined, the frei0r effect is searched in each one of the directories specified by the colon separated list in \fB\s-1FREIOR_PATH\s0\fR, otherwise in the standard frei0r paths, which are in this order: \&\fI\s-1HOME/\s0.frei0r\-1/lib/\fR, \fI/usr/local/lib/frei0r\-1/\fR, \&\fI/usr/lib/frei0r\-1/\fR. .IP "\fBfilter_params\fR" 4 .IX Item "filter_params" A '|'\-separated list of parameters to pass to the frei0r effect. .PP A frei0r effect parameter can be a boolean (whose values are specified with \*(L"y\*(R" and \*(L"n\*(R"), a double, a color (specified by the syntax \&\fIR\fR/\fIG\fR/\fIB\fR, \fIR\fR, \fIG\fR, and \fIB\fR being float numbers from 0.0 to 1.0) or by an \f(CW\*(C`av_parse_color()\*(C'\fR color description), a position (specified by the syntax \fIX\fR/\fIY\fR, \&\fIX\fR and \fIY\fR being float numbers) and a string. .PP The number and kind of parameters depend on the loaded effect. If an effect parameter is not specified the default value is set. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Apply the distort0r effect, set the first two double parameters: .Sp .Vb 1 \& frei0r=filter_name=distort0r:filter_params=0.5|0.01 .Ve .IP "\(bu" 4 Apply the colordistance effect, take a color as first parameter: .Sp .Vb 3 \& frei0r=colordistance:0.2/0.3/0.4 \& frei0r=colordistance:violet \& frei0r=colordistance:0x112233 .Ve .IP "\(bu" 4 Apply the perspective effect, specify the top left and top right image positions: .Sp .Vb 1 \& frei0r=perspective:0.2/0.2|0.8/0.2 .Ve .PP For more information see: <\fBhttp://frei0r.dyne.org\fR> .SS "geq" .IX Subsection "geq" The filter accepts the following options: .IP "\fBlum_expr\fR" 4 .IX Item "lum_expr" the luminance expression .IP "\fBcb_expr\fR" 4 .IX Item "cb_expr" the chrominance blue expression .IP "\fBcr_expr\fR" 4 .IX Item "cr_expr" the chrominance red expression .IP "\fBalpha_expr\fR" 4 .IX Item "alpha_expr" the alpha expression .PP If one of the chrominance expression is not defined, it falls back on the other one. If no alpha expression is specified it will evaluate to opaque value. If none of chrominance expressions are specified, they will evaluate the luminance expression. .PP The expressions can use the following variables and functions: .IP "\fBN\fR" 4 .IX Item "N" The sequential number of the filtered frame, starting from \f(CW0\fR. .IP "\fBX\fR" 4 .IX Item "X" .PD 0 .IP "\fBY\fR" 4 .IX Item "Y" .PD The coordinates of the current sample. .IP "\fBW\fR" 4 .IX Item "W" .PD 0 .IP "\fBH\fR" 4 .IX Item "H" .PD The width and height of the image. .IP "\fB\s-1SW\s0\fR" 4 .IX Item "SW" .PD 0 .IP "\fB\s-1SH\s0\fR" 4 .IX Item "SH" .PD Width and height scale depending on the currently filtered plane. It is the ratio between the corresponding luma plane number of pixels and the current plane ones. E.g. for \s-1YUV4:2:0\s0 the values are \f(CW\*(C`1,1\*(C'\fR for the luma plane, and \&\f(CW\*(C`0.5,0.5\*(C'\fR for chroma planes. .IP "\fBT\fR" 4 .IX Item "T" Time of the current frame, expressed in seconds. .IP "\fBp(x, y)\fR" 4 .IX Item "p(x, y)" Return the value of the pixel at location (\fIx\fR,\fIy\fR) of the current plane. .IP "\fBlum(x, y)\fR" 4 .IX Item "lum(x, y)" Return the value of the pixel at location (\fIx\fR,\fIy\fR) of the luminance plane. .IP "\fBcb(x, y)\fR" 4 .IX Item "cb(x, y)" Return the value of the pixel at location (\fIx\fR,\fIy\fR) of the blue-difference chroma plane. Returns 0 if there is no such plane. .IP "\fBcr(x, y)\fR" 4 .IX Item "cr(x, y)" Return the value of the pixel at location (\fIx\fR,\fIy\fR) of the red-difference chroma plane. Returns 0 if there is no such plane. .IP "\fBalpha(x, y)\fR" 4 .IX Item "alpha(x, y)" Return the value of the pixel at location (\fIx\fR,\fIy\fR) of the alpha plane. Returns 0 if there is no such plane. .PP For functions, if \fIx\fR and \fIy\fR are outside the area, the value will be automatically clipped to the closer edge. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Flip the image horizontally: .Sp .Vb 1 \& geq=p(W\-X\e,Y) .Ve .IP "\(bu" 4 Generate a bidimensional sine wave, with angle \f(CW\*(C`PI/3\*(C'\fR and a wavelength of 100 pixels: .Sp .Vb 1 \& geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X\-50*T) + sin(PI/3)*Y)):128:128 .Ve .IP "\(bu" 4 Generate a fancy enigmatic moving light: .Sp .Vb 1 \& nullsrc=s=256x256,geq=random(1)/hypot(X\-cos(N*0.07)*W/2\-W/2\e,Y\-sin(N*0.09)*H/2\-H/2)^2*1000000*sin(N*0.02):128:128 .Ve .IP "\(bu" 4 Generate a quick emboss effect: .Sp .Vb 1 \& format=gray,geq=lum_expr=\*(Aq(p(X,Y)+(256\-p(X\-4,Y\-4)))/2\*(Aq .Ve .SS "gradfun" .IX Subsection "gradfun" Fix the banding artifacts that are sometimes introduced into nearly flat regions by truncation to 8bit color depth. Interpolate the gradients that should go where the bands are, and dither them. .PP This filter is designed for playback only. Do not use it prior to lossy compression, because compression tends to lose the dither and bring back the bands. .PP This filter accepts the following options: .IP "\fBstrength\fR" 4 .IX Item "strength" The maximum amount by which the filter will change any one pixel. Also the threshold for detecting nearly flat regions. Acceptable values range from .51 to 64, default value is 1.2, out-of-range values will be clipped to the valid range. .IP "\fBradius\fR" 4 .IX Item "radius" The neighborhood to fit the gradient to. A larger radius makes for smoother gradients, but also prevents the filter from modifying the pixels near detailed regions. Acceptable values are 8\-32, default value is 16, out-of-range values will be clipped to the valid range. .PP Alternatively, the options can be specified as a flat string: \&\fIstrength\fR[:\fIradius\fR] .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Apply the filter with a \f(CW3.5\fR strength and radius of \f(CW8\fR: .Sp .Vb 1 \& gradfun=3.5:8 .Ve .IP "\(bu" 4 Specify radius, omitting the strength (which will fall-back to the default value): .Sp .Vb 1 \& gradfun=radius=8 .Ve .SS "hflip" .IX Subsection "hflip" Flip the input video horizontally. .PP For example to horizontally flip the input video with \fBffmpeg\fR: .PP .Vb 1 \& ffmpeg \-i in.avi \-vf "hflip" out.avi .Ve .SS "histeq" .IX Subsection "histeq" This filter applies a global color histogram equalization on a per-frame basis. .PP It can be used to correct video that has a compressed range of pixel intensities. The filter redistributes the pixel intensities to equalize their distribution across the intensity range. It may be viewed as an \*(L"automatically adjusting contrast filter\*(R". This filter is useful only for correcting degraded or poorly captured source video. .PP The filter accepts the following options: .IP "\fBstrength\fR" 4 .IX Item "strength" Determine the amount of equalization to be applied. As the strength is reduced, the distribution of pixel intensities more-and-more approaches that of the input frame. The value must be a float number in the range [0,1] and defaults to 0.200. .IP "\fBintensity\fR" 4 .IX Item "intensity" Set the maximum intensity that can generated and scale the output values appropriately. The strength should be set as desired and then the intensity can be limited if needed to avoid washing-out. The value must be a float number in the range [0,1] and defaults to 0.210. .IP "\fBantibanding\fR" 4 .IX Item "antibanding" Set the antibanding level. If enabled the filter will randomly vary the luminance of output pixels by a small amount to avoid banding of the histogram. Possible values are \f(CW\*(C`none\*(C'\fR, \f(CW\*(C`weak\*(C'\fR or \&\f(CW\*(C`strong\*(C'\fR. It defaults to \f(CW\*(C`none\*(C'\fR. .SS "histogram" .IX Subsection "histogram" Compute and draw a color distribution histogram for the input video. .PP The computed histogram is a representation of distribution of color components in an image. .PP The filter accepts the following options: .IP "\fBmode\fR" 4 .IX Item "mode" Set histogram mode. .Sp It accepts the following values: .RS 4 .IP "\fBlevels\fR" 4 .IX Item "levels" standard histogram that display color components distribution in an image. Displays color graph for each color component. Shows distribution of the Y, U, V, A or G, B, R components, depending on input format, in current frame. Bellow each graph is color component scale meter. .IP "\fBcolor\fR" 4 .IX Item "color" chroma values in vectorscope, if brighter more such chroma values are distributed in an image. Displays chroma values (U/V color placement) in two dimensional graph (which is called a vectorscope). It can be used to read of the hue and saturation of the current frame. At a same time it is a histogram. The whiter a pixel in the vectorscope, the more pixels of the input frame correspond to that pixel (that is the more pixels have this chroma value). The V component is displayed on the horizontal (X) axis, with the leftmost side being V = 0 and the rightmost side being V = 255. The U component is displayed on the vertical (Y) axis, with the top representing U = 0 and the bottom representing U = 255. .Sp The position of a white pixel in the graph corresponds to the chroma value of a pixel of the input clip. So the graph can be used to read of the hue (color flavor) and the saturation (the dominance of the hue in the color). As the hue of a color changes, it moves around the square. At the center of the square, the saturation is zero, which means that the corresponding pixel has no color. If you increase the amount of a specific color, while leaving the other colors unchanged, the saturation increases, and you move towards the edge of the square. .IP "\fBcolor2\fR" 4 .IX Item "color2" chroma values in vectorscope, similar as \f(CW\*(C`color\*(C'\fR but actual chroma values are displayed. .IP "\fBwaveform\fR" 4 .IX Item "waveform" per row/column color component graph. In row mode graph in the left side represents color component value 0 and right side represents value = 255. In column mode top side represents color component value = 0 and bottom side represents value = 255. .RE .RS 4 .Sp Default value is \f(CW\*(C`levels\*(C'\fR. .RE .IP "\fBlevel_height\fR" 4 .IX Item "level_height" Set height of level in \f(CW\*(C`levels\*(C'\fR. Default value is \f(CW200\fR. Allowed range is [50, 2048]. .IP "\fBscale_height\fR" 4 .IX Item "scale_height" Set height of color scale in \f(CW\*(C`levels\*(C'\fR. Default value is \f(CW12\fR. Allowed range is [0, 40]. .IP "\fBstep\fR" 4 .IX Item "step" Set step for \f(CW\*(C`waveform\*(C'\fR mode. Smaller values are useful to find out how much of same luminance values across input rows/columns are distributed. Default value is \f(CW10\fR. Allowed range is [1, 255]. .IP "\fBwaveform_mode\fR" 4 .IX Item "waveform_mode" Set mode for \f(CW\*(C`waveform\*(C'\fR. Can be either \f(CW\*(C`row\*(C'\fR, or \f(CW\*(C`column\*(C'\fR. Default is \f(CW\*(C`row\*(C'\fR. .IP "\fBdisplay_mode\fR" 4 .IX Item "display_mode" Set display mode for \f(CW\*(C`waveform\*(C'\fR and \f(CW\*(C`levels\*(C'\fR. It accepts the following values: .RS 4 .IP "\fBparade\fR" 4 .IX Item "parade" Display separate graph for the color components side by side in \&\f(CW\*(C`row\*(C'\fR waveform mode or one below other in \f(CW\*(C`column\*(C'\fR waveform mode for \f(CW\*(C`waveform\*(C'\fR histogram mode. For \f(CW\*(C`levels\*(C'\fR histogram mode per color component graphs are placed one bellow other. .Sp This display mode in \f(CW\*(C`waveform\*(C'\fR histogram mode makes it easy to spot color casts in the highlights and shadows of an image, by comparing the contours of the top and the bottom of each waveform. Since whites, grays, and blacks are characterized by exactly equal amounts of red, green, and blue, neutral areas of the picture should display three waveforms of roughly equal width/height. If not, the correction is easy to make by making adjustments to level the three waveforms. .IP "\fBoverlay\fR" 4 .IX Item "overlay" Presents information that's identical to that in the \f(CW\*(C`parade\*(C'\fR, except that the graphs representing color components are superimposed directly over one another. .Sp This display mode in \f(CW\*(C`waveform\*(C'\fR histogram mode can make it easier to spot the relative differences or similarities in overlapping areas of the color components that are supposed to be identical, such as neutral whites, grays, or blacks. .RE .RS 4 .Sp Default is \f(CW\*(C`parade\*(C'\fR. .RE .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Calculate and draw histogram: .Sp .Vb 1 \& ffplay \-i input \-vf histogram .Ve .SS "hqdn3d" .IX Subsection "hqdn3d" High precision/quality 3d denoise filter. This filter aims to reduce image noise producing smooth images and making still images really still. It should enhance compressibility. .PP It accepts the following optional parameters: .IP "\fBluma_spatial\fR" 4 .IX Item "luma_spatial" a non-negative float number which specifies spatial luma strength, defaults to 4.0 .IP "\fBchroma_spatial\fR" 4 .IX Item "chroma_spatial" a non-negative float number which specifies spatial chroma strength, defaults to 3.0*\fIluma_spatial\fR/4.0 .IP "\fBluma_tmp\fR" 4 .IX Item "luma_tmp" a float number which specifies luma temporal strength, defaults to 6.0*\fIluma_spatial\fR/4.0 .IP "\fBchroma_tmp\fR" 4 .IX Item "chroma_tmp" a float number which specifies chroma temporal strength, defaults to \&\fIluma_tmp\fR*\fIchroma_spatial\fR/\fIluma_spatial\fR .SS "hue" .IX Subsection "hue" Modify the hue and/or the saturation of the input. .PP This filter accepts the following options: .IP "\fBh\fR" 4 .IX Item "h" Specify the hue angle as a number of degrees. It accepts an expression, and defaults to \*(L"0\*(R". .IP "\fBs\fR" 4 .IX Item "s" Specify the saturation in the [\-10,10] range. It accepts a float number and defaults to \*(L"1\*(R". .IP "\fBH\fR" 4 .IX Item "H" Specify the hue angle as a number of radians. It accepts a float number or an expression, and defaults to \*(L"0\*(R". .PP \&\fBh\fR and \fBH\fR are mutually exclusive, and can't be specified at the same time. .PP The \fBh\fR, \fBH\fR and \fBs\fR option values are expressions containing the following constants: .IP "\fBn\fR" 4 .IX Item "n" frame count of the input frame starting from 0 .IP "\fBpts\fR" 4 .IX Item "pts" presentation timestamp of the input frame expressed in time base units .IP "\fBr\fR" 4 .IX Item "r" frame rate of the input video, \s-1NAN\s0 if the input frame rate is unknown .IP "\fBt\fR" 4 .IX Item "t" timestamp expressed in seconds, \s-1NAN\s0 if the input timestamp is unknown .IP "\fBtb\fR" 4 .IX Item "tb" time base of the input video .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Set the hue to 90 degrees and the saturation to 1.0: .Sp .Vb 1 \& hue=h=90:s=1 .Ve .IP "\(bu" 4 Same command but expressing the hue in radians: .Sp .Vb 1 \& hue=H=PI/2:s=1 .Ve .IP "\(bu" 4 Rotate hue and make the saturation swing between 0 and 2 over a period of 1 second: .Sp .Vb 1 \& hue="H=2*PI*t: s=sin(2*PI*t)+1" .Ve .IP "\(bu" 4 Apply a 3 seconds saturation fade-in effect starting at 0: .Sp .Vb 1 \& hue="s=min(t/3\e,1)" .Ve .Sp The general fade-in expression can be written as: .Sp .Vb 1 \& hue="s=min(0\e, max((t\-START)/DURATION\e, 1))" .Ve .IP "\(bu" 4 Apply a 3 seconds saturation fade-out effect starting at 5 seconds: .Sp .Vb 1 \& hue="s=max(0\e, min(1\e, (8\-t)/3))" .Ve .Sp The general fade-out expression can be written as: .Sp .Vb 1 \& hue="s=max(0\e, min(1\e, (START+DURATION\-t)/DURATION))" .Ve .PP \fICommands\fR .IX Subsection "Commands" .PP This filter supports the following commands: .IP "\fBs\fR" 4 .IX Item "s" .PD 0 .IP "\fBh\fR" 4 .IX Item "h" .IP "\fBH\fR" 4 .IX Item "H" .PD Modify the hue and/or the saturation of the input video. The command accepts the same syntax of the corresponding option. .Sp If the specified expression is not valid, it is kept at its current value. .SS "idet" .IX Subsection "idet" Detect video interlacing type. .PP This filter tries to detect if the input is interlaced or progressive, top or bottom field first. .PP The filter accepts the following options: .IP "\fBintl_thres\fR" 4 .IX Item "intl_thres" Set interlacing threshold. .IP "\fBprog_thres\fR" 4 .IX Item "prog_thres" Set progressive threshold. .SS "il" .IX Subsection "il" Deinterleave or interleave fields. .PP This filter allows to process interlaced images fields without deinterlacing them. Deinterleaving splits the input frame into 2 fields (so called half pictures). Odd lines are moved to the top half of the output image, even lines to the bottom half. You can process (filter) them independently and then re-interleave them. .PP The filter accepts the following options: .IP "\fBluma_mode, l\fR" 4 .IX Item "luma_mode, l" .PD 0 .IP "\fBchroma_mode, s\fR" 4 .IX Item "chroma_mode, s" .IP "\fBalpha_mode, a\fR" 4 .IX Item "alpha_mode, a" .PD Available values for \fIluma_mode\fR, \fIchroma_mode\fR and \&\fIalpha_mode\fR are: .RS 4 .IP "\fBnone\fR" 4 .IX Item "none" Do nothing. .IP "\fBdeinterleave, d\fR" 4 .IX Item "deinterleave, d" Deinterleave fields, placing one above the other. .IP "\fBinterleave, i\fR" 4 .IX Item "interleave, i" Interleave fields. Reverse the effect of deinterleaving. .RE .RS 4 .Sp Default value is \f(CW\*(C`none\*(C'\fR. .RE .IP "\fBluma_swap, ls\fR" 4 .IX Item "luma_swap, ls" .PD 0 .IP "\fBchroma_swap, cs\fR" 4 .IX Item "chroma_swap, cs" .IP "\fBalpha_swap, as\fR" 4 .IX Item "alpha_swap, as" .PD Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is \f(CW0\fR. .SS "interlace" .IX Subsection "interlace" Simple interlacing filter from progressive contents. This interleaves upper (or lower) lines from odd frames with lower (or upper) lines from even frames, halving the frame rate and preserving image height. .PP .Vb 9 \& Original Original New Frame \& Frame \*(Aqj\*(Aq Frame \*(Aqj+1\*(Aq (tff) \& ========== =========== ================== \& Line 0 \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-> Frame \*(Aqj\*(Aq Line 0 \& Line 1 Line 1 \-\-\-\-> Frame \*(Aqj+1\*(Aq Line 1 \& Line 2 \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-> Frame \*(Aqj\*(Aq Line 2 \& Line 3 Line 3 \-\-\-\-> Frame \*(Aqj+1\*(Aq Line 3 \& ... ... ... \& New Frame + 1 will be generated by Frame \*(Aqj+2\*(Aq and Frame \*(Aqj+3\*(Aq and so on .Ve .PP It accepts the following optional parameters: .IP "\fBscan\fR" 4 .IX Item "scan" determines whether the interlaced frame is taken from the even (tff \- default) or odd (bff) lines of the progressive frame. .IP "\fBlowpass\fR" 4 .IX Item "lowpass" Enable (default) or disable the vertical lowpass filter to avoid twitter interlacing and reduce moire patterns. .SS "kerndeint" .IX Subsection "kerndeint" Deinterlace input video by applying Donald Graft's adaptive kernel deinterling. Work on interlaced parts of a video to produce progressive frames. .PP The description of the accepted parameters follows. .IP "\fBthresh\fR" 4 .IX Item "thresh" Set the threshold which affects the filter's tolerance when determining if a pixel line must be processed. It must be an integer in the range [0,255] and defaults to 10. A value of 0 will result in applying the process on every pixels. .IP "\fBmap\fR" 4 .IX Item "map" Paint pixels exceeding the threshold value to white if set to 1. Default is 0. .IP "\fBorder\fR" 4 .IX Item "order" Set the fields order. Swap fields if set to 1, leave fields alone if 0. Default is 0. .IP "\fBsharp\fR" 4 .IX Item "sharp" Enable additional sharpening if set to 1. Default is 0. .IP "\fBtwoway\fR" 4 .IX Item "twoway" Enable twoway sharpening if set to 1. Default is 0. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Apply default values: .Sp .Vb 1 \& kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0 .Ve .IP "\(bu" 4 Enable additional sharpening: .Sp .Vb 1 \& kerndeint=sharp=1 .Ve .IP "\(bu" 4 Paint processed pixels in white: .Sp .Vb 1 \& kerndeint=map=1 .Ve .SS "lut, lutrgb, lutyuv" .IX Subsection "lut, lutrgb, lutyuv" Compute a look-up table for binding each pixel component input value to an output value, and apply it to input video. .PP \&\fIlutyuv\fR applies a lookup table to a \s-1YUV\s0 input video, \fIlutrgb\fR to an \s-1RGB\s0 input video. .PP These filters accept the following options: .IP "\fBc0\fR" 4 .IX Item "c0" set first pixel component expression .IP "\fBc1\fR" 4 .IX Item "c1" set second pixel component expression .IP "\fBc2\fR" 4 .IX Item "c2" set third pixel component expression .IP "\fBc3\fR" 4 .IX Item "c3" set fourth pixel component expression, corresponds to the alpha component .IP "\fBr\fR" 4 .IX Item "r" set red component expression .IP "\fBg\fR" 4 .IX Item "g" set green component expression .IP "\fBb\fR" 4 .IX Item "b" set blue component expression .IP "\fBa\fR" 4 .IX Item "a" alpha component expression .IP "\fBy\fR" 4 .IX Item "y" set Y/luminance component expression .IP "\fBu\fR" 4 .IX Item "u" set U/Cb component expression .IP "\fBv\fR" 4 .IX Item "v" set V/Cr component expression .PP Each of them specifies the expression to use for computing the lookup table for the corresponding pixel component values. .PP The exact component associated to each of the \fIc*\fR options depends on the format in input. .PP The \fIlut\fR filter requires either \s-1YUV\s0 or \s-1RGB\s0 pixel formats in input, \&\fIlutrgb\fR requires \s-1RGB\s0 pixel formats in input, and \fIlutyuv\fR requires \s-1YUV\s0. .PP The expressions can contain the following constants and functions: .IP "\fBw, h\fR" 4 .IX Item "w, h" the input width and height .IP "\fBval\fR" 4 .IX Item "val" input value for the pixel component .IP "\fBclipval\fR" 4 .IX Item "clipval" the input value clipped in the \fIminval\fR\-\fImaxval\fR range .IP "\fBmaxval\fR" 4 .IX Item "maxval" maximum value for the pixel component .IP "\fBminval\fR" 4 .IX Item "minval" minimum value for the pixel component .IP "\fBnegval\fR" 4 .IX Item "negval" the negated value for the pixel component value clipped in the \&\fIminval\fR\-\fImaxval\fR range , it corresponds to the expression \&\*(L"maxval\-clipval+minval\*(R" .IP "\fBclip(val)\fR" 4 .IX Item "clip(val)" the computed value in \fIval\fR clipped in the \&\fIminval\fR\-\fImaxval\fR range .IP "\fBgammaval(gamma)\fR" 4 .IX Item "gammaval(gamma)" the computed gamma correction value of the pixel component value clipped in the \fIminval\fR\-\fImaxval\fR range, corresponds to the expression "pow((clipval\-minval)/(maxval\-minval)\e,\fIgamma\fR)*(maxval\-minval)+minval" .PP All expressions default to \*(L"val\*(R". .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Negate input video: .Sp .Vb 2 \& lutrgb="r=maxval+minval\-val:g=maxval+minval\-val:b=maxval+minval\-val" \& lutyuv="y=maxval+minval\-val:u=maxval+minval\-val:v=maxval+minval\-val" .Ve .Sp The above is the same as: .Sp .Vb 2 \& lutrgb="r=negval:g=negval:b=negval" \& lutyuv="y=negval:u=negval:v=negval" .Ve .IP "\(bu" 4 Negate luminance: .Sp .Vb 1 \& lutyuv=y=negval .Ve .IP "\(bu" 4 Remove chroma components, turns the video into a graytone image: .Sp .Vb 1 \& lutyuv="u=128:v=128" .Ve .IP "\(bu" 4 Apply a luma burning effect: .Sp .Vb 1 \& lutyuv="y=2*val" .Ve .IP "\(bu" 4 Remove green and blue components: .Sp .Vb 1 \& lutrgb="g=0:b=0" .Ve .IP "\(bu" 4 Set a constant alpha channel value on input: .Sp .Vb 1 \& format=rgba,lutrgb=a="maxval\-minval/2" .Ve .IP "\(bu" 4 Correct luminance gamma by a 0.5 factor: .Sp .Vb 1 \& lutyuv=y=gammaval(0.5) .Ve .IP "\(bu" 4 Discard least significant bits of luma: .Sp .Vb 1 \& lutyuv=y=\*(Aqbitand(val, 128+64+32)\*(Aq .Ve .SS "mp" .IX Subsection "mp" Apply an MPlayer filter to the input video. .PP This filter provides a wrapper around most of the filters of MPlayer/MEncoder. .PP This wrapper is considered experimental. Some of the wrapped filters may not work properly and we may drop support for them, as they will be implemented natively into FFmpeg. Thus you should avoid depending on them when writing portable scripts. .PP The filters accepts the parameters: \&\fIfilter_name\fR[:=]\fIfilter_params\fR .PP \&\fIfilter_name\fR is the name of a supported MPlayer filter, \&\fIfilter_params\fR is a string containing the parameters accepted by the named filter. .PP The list of the currently supported filters follows: .IP "\fIdint\fR" 4 .IX Item "dint" .PD 0 .IP "\fIdown3dright\fR" 4 .IX Item "down3dright" .IP "\fIeq2\fR" 4 .IX Item "eq2" .IP "\fIeq\fR" 4 .IX Item "eq" .IP "\fIfil\fR" 4 .IX Item "fil" .IP "\fIfspp\fR" 4 .IX Item "fspp" .IP "\fIilpack\fR" 4 .IX Item "ilpack" .IP "\fImcdeint\fR" 4 .IX Item "mcdeint" .IP "\fIow\fR" 4 .IX Item "ow" .IP "\fIperspective\fR" 4 .IX Item "perspective" .IP "\fIphase\fR" 4 .IX Item "phase" .IP "\fIpp7\fR" 4 .IX Item "pp7" .IP "\fIpullup\fR" 4 .IX Item "pullup" .IP "\fIqp\fR" 4 .IX Item "qp" .IP "\fIsab\fR" 4 .IX Item "sab" .IP "\fIsoftpulldown\fR" 4 .IX Item "softpulldown" .IP "\fIspp\fR" 4 .IX Item "spp" .IP "\fItinterlace\fR" 4 .IX Item "tinterlace" .IP "\fIuspp\fR" 4 .IX Item "uspp" .PD .PP The parameter syntax and behavior for the listed filters are the same of the corresponding MPlayer filters. For detailed instructions check the \*(L"\s-1VIDEO\s0 \s-1FILTERS\s0\*(R" section in the MPlayer manual. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Adjust gamma, brightness, contrast: .Sp .Vb 1 \& mp=eq2=1.0:2:0.5 .Ve .PP See also \fImplayer\fR\|(1), <\fBhttp://www.mplayerhq.hu/\fR>. .SS "mpdecimate" .IX Subsection "mpdecimate" Drop frames that do not differ greatly from the previous frame in order to reduce frame rate. .PP The main use of this filter is for very-low-bitrate encoding (e.g. streaming over dialup modem), but it could in theory be used for fixing movies that were inverse-telecined incorrectly. .PP A description of the accepted options follows. .IP "\fBmax\fR" 4 .IX Item "max" Set the maximum number of consecutive frames which can be dropped (if positive), or the minimum interval between dropped frames (if negative). If the value is 0, the frame is dropped unregarding the number of previous sequentially dropped frames. .Sp Default value is 0. .IP "\fBhi\fR" 4 .IX Item "hi" .PD 0 .IP "\fBlo\fR" 4 .IX Item "lo" .IP "\fBfrac\fR" 4 .IX Item "frac" .PD Set the dropping threshold values. .Sp Values for \fBhi\fR and \fBlo\fR are for 8x8 pixel blocks and represent actual pixel value differences, so a threshold of 64 corresponds to 1 unit of difference for each pixel, or the same spread out differently over the block. .Sp A frame is a candidate for dropping if no 8x8 blocks differ by more than a threshold of \fBhi\fR, and if no more than \fBfrac\fR blocks (1 meaning the whole image) differ by more than a threshold of \fBlo\fR. .Sp Default value for \fBhi\fR is 64*12, default value for \fBlo\fR is 64*5, and default value for \fBfrac\fR is 0.33. .SS "negate" .IX Subsection "negate" Negate input video. .PP This filter accepts an integer in input, if non-zero it negates the alpha component (if available). The default value in input is 0. .SS "noformat" .IX Subsection "noformat" Force libavfilter not to use any of the specified pixel formats for the input to the next filter. .PP This filter accepts the following parameters: .IP "\fBpix_fmts\fR" 4 .IX Item "pix_fmts" A '|'\-separated list of pixel format names, for example \&\*(L"pix_fmts=yuv420p|monow|rgb24\*(R". .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Force libavfilter to use a format different from \fIyuv420p\fR for the input to the vflip filter: .Sp .Vb 1 \& noformat=pix_fmts=yuv420p,vflip .Ve .IP "\(bu" 4 Convert the input video to any of the formats not contained in the list: .Sp .Vb 1 \& noformat=yuv420p|yuv444p|yuv410p .Ve .SS "noise" .IX Subsection "noise" Add noise on video input frame. .PP The filter accepts the following options: .IP "\fBall_seed\fR" 4 .IX Item "all_seed" .PD 0 .IP "\fBc0_seed\fR" 4 .IX Item "c0_seed" .IP "\fBc1_seed\fR" 4 .IX Item "c1_seed" .IP "\fBc2_seed\fR" 4 .IX Item "c2_seed" .IP "\fBc3_seed\fR" 4 .IX Item "c3_seed" .PD Set noise seed for specific pixel component or all pixel components in case of \fIall_seed\fR. Default value is \f(CW123457\fR. .IP "\fBall_strength, alls\fR" 4 .IX Item "all_strength, alls" .PD 0 .IP "\fBc0_strength, c0s\fR" 4 .IX Item "c0_strength, c0s" .IP "\fBc1_strength, c1s\fR" 4 .IX Item "c1_strength, c1s" .IP "\fBc2_strength, c2s\fR" 4 .IX Item "c2_strength, c2s" .IP "\fBc3_strength, c3s\fR" 4 .IX Item "c3_strength, c3s" .PD Set noise strength for specific pixel component or all pixel components in case \&\fIall_strength\fR. Default value is \f(CW0\fR. Allowed range is [0, 100]. .IP "\fBall_flags, allf\fR" 4 .IX Item "all_flags, allf" .PD 0 .IP "\fBc0_flags, c0f\fR" 4 .IX Item "c0_flags, c0f" .IP "\fBc1_flags, c1f\fR" 4 .IX Item "c1_flags, c1f" .IP "\fBc2_flags, c2f\fR" 4 .IX Item "c2_flags, c2f" .IP "\fBc3_flags, c3f\fR" 4 .IX Item "c3_flags, c3f" .PD Set pixel component flags or set flags for all components if \fIall_flags\fR. Available values for component flags are: .RS 4 .IP "\fBa\fR" 4 .IX Item "a" averaged temporal noise (smoother) .IP "\fBp\fR" 4 .IX Item "p" mix random noise with a (semi)regular pattern .IP "\fBq\fR" 4 .IX Item "q" higher quality (slightly better looking, slightly slower) .IP "\fBt\fR" 4 .IX Item "t" temporal noise (noise pattern changes between frames) .IP "\fBu\fR" 4 .IX Item "u" uniform noise (gaussian otherwise) .RE .RS 4 .RE .PP \fIExamples\fR .IX Subsection "Examples" .PP Add temporal and uniform noise to input video: .PP .Vb 1 \& noise=alls=20:allf=t+u .Ve .SS "null" .IX Subsection "null" Pass the video source unchanged to the output. .SS "ocv" .IX Subsection "ocv" Apply video transform using libopencv. .PP To enable this filter install libopencv library and headers and configure FFmpeg with \f(CW\*(C`\-\-enable\-libopencv\*(C'\fR. .PP This filter accepts the following parameters: .IP "\fBfilter_name\fR" 4 .IX Item "filter_name" The name of the libopencv filter to apply. .IP "\fBfilter_params\fR" 4 .IX Item "filter_params" The parameters to pass to the libopencv filter. If not specified the default values are assumed. .PP Refer to the official libopencv documentation for more precise information: <\fBhttp://opencv.willowgarage.com/documentation/c/image_filtering.html\fR> .PP Follows the list of supported libopencv filters. .PP \fIdilate\fR .IX Subsection "dilate" .PP Dilate an image by using a specific structuring element. This filter corresponds to the libopencv function \f(CW\*(C`cvDilate\*(C'\fR. .PP It accepts the parameters: \fIstruct_el\fR|\fInb_iterations\fR. .PP \&\fIstruct_el\fR represents a structuring element, and has the syntax: \&\fIcols\fRx\fIrows\fR+\fIanchor_x\fRx\fIanchor_y\fR/\fIshape\fR .PP \&\fIcols\fR and \fIrows\fR represent the number of columns and rows of the structuring element, \fIanchor_x\fR and \fIanchor_y\fR the anchor point, and \fIshape\fR the shape for the structuring element, and can be one of the values \*(L"rect\*(R", \*(L"cross\*(R", \*(L"ellipse\*(R", \*(L"custom\*(R". .PP If the value for \fIshape\fR is \*(L"custom\*(R", it must be followed by a string of the form "=\fIfilename\fR". The file with name \&\fIfilename\fR is assumed to represent a binary image, with each printable character corresponding to a bright pixel. When a custom \&\fIshape\fR is used, \fIcols\fR and \fIrows\fR are ignored, the number or columns and rows of the read file are assumed instead. .PP The default value for \fIstruct_el\fR is \*(L"3x3+0x0/rect\*(R". .PP \&\fInb_iterations\fR specifies the number of times the transform is applied to the image, and defaults to 1. .PP Follow some example: .PP .Vb 2 \& # use the default values \& ocv=dilate \& \& # dilate using a structuring element with a 5x5 cross, iterate two times \& ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2 \& \& # read the shape from the file diamond.shape, iterate two times \& # the file diamond.shape may contain a pattern of characters like this: \& # * \& # *** \& # ***** \& # *** \& # * \& # the specified cols and rows are ignored (but not the anchor point coordinates) \& ocv=dilate:0x0+2x2/custom=diamond.shape|2 .Ve .PP \fIerode\fR .IX Subsection "erode" .PP Erode an image by using a specific structuring element. This filter corresponds to the libopencv function \f(CW\*(C`cvErode\*(C'\fR. .PP The filter accepts the parameters: \fIstruct_el\fR:\fInb_iterations\fR, with the same syntax and semantics as the dilate filter. .PP \fIsmooth\fR .IX Subsection "smooth" .PP Smooth the input video. .PP The filter takes the following parameters: \&\fItype\fR|\fIparam1\fR|\fIparam2\fR|\fIparam3\fR|\fIparam4\fR. .PP \&\fItype\fR is the type of smooth filter to apply, and can be one of the following values: \*(L"blur\*(R", \*(L"blur_no_scale\*(R", \*(L"median\*(R", \*(L"gaussian\*(R", \&\*(L"bilateral\*(R". The default value is \*(L"gaussian\*(R". .PP \&\fIparam1\fR, \fIparam2\fR, \fIparam3\fR, and \fIparam4\fR are parameters whose meanings depend on smooth type. \fIparam1\fR and \&\fIparam2\fR accept integer positive values or 0, \fIparam3\fR and \&\fIparam4\fR accept float values. .PP The default value for \fIparam1\fR is 3, the default value for the other parameters is 0. .PP These parameters correspond to the parameters assigned to the libopencv function \f(CW\*(C`cvSmooth\*(C'\fR. .SS "overlay" .IX Subsection "overlay" Overlay one video on top of another. .PP It takes two inputs and one output, the first input is the \*(L"main\*(R" video on which the second input is overlayed. .PP This filter accepts the following parameters: .PP A description of the accepted options follows. .IP "\fBx\fR" 4 .IX Item "x" .PD 0 .IP "\fBy\fR" 4 .IX Item "y" .PD Set the expression for the x and y coordinates of the overlayed video on the main video. Default value is \*(L"0\*(R" for both expressions. In case the expression is invalid, it is set to a huge value (meaning that the overlay will not be displayed within the output visible area). .IP "\fBenable\fR" 4 .IX Item "enable" Set the expression which enables the overlay. If the evaluation is different from 0, the overlay is displayed on top of the input frame. By default it is \*(L"1\*(R". .IP "\fBeval\fR" 4 .IX Item "eval" Set when the expressions for \fBx\fR, \fBy\fR, and \&\fBenable\fR are evaluated. .Sp It accepts the following values: .RS 4 .IP "\fBinit\fR" 4 .IX Item "init" only evaluate expressions once during the filter initialization or when a command is processed .IP "\fBframe\fR" 4 .IX Item "frame" evaluate expressions for each incoming frame .RE .RS 4 .Sp Default value is \fBframe\fR. .RE .IP "\fBshortest\fR" 4 .IX Item "shortest" If set to 1, force the output to terminate when the shortest input terminates. Default value is 0. .IP "\fBformat\fR" 4 .IX Item "format" Set the format for the output video. .Sp It accepts the following values: .RS 4 .IP "\fByuv420\fR" 4 .IX Item "yuv420" force \s-1YUV420\s0 output .IP "\fByuv444\fR" 4 .IX Item "yuv444" force \s-1YUV444\s0 output .IP "\fBrgb\fR" 4 .IX Item "rgb" force \s-1RGB\s0 output .RE .RS 4 .Sp Default value is \fByuv420\fR. .RE .IP "\fBrgb\fR \fI(deprecated)\fR" 4 .IX Item "rgb (deprecated)" If set to 1, force the filter to accept inputs in the \s-1RGB\s0 color space. Default value is 0. This option is deprecated, use \&\fBformat\fR instead. .IP "\fBrepeatlast\fR" 4 .IX Item "repeatlast" If set to 1, force the filter to draw the last overlay frame over the main input until the end of the stream. A value of 0 disables this behavior, which is enabled by default. .PP The \fBx\fR, \fBy\fR, and \fBenable\fR expressions can contain the following parameters. .IP "\fBmain_w, W\fR" 4 .IX Item "main_w, W" .PD 0 .IP "\fBmain_h, H\fR" 4 .IX Item "main_h, H" .PD main input width and height .IP "\fBoverlay_w, w\fR" 4 .IX Item "overlay_w, w" .PD 0 .IP "\fBoverlay_h, h\fR" 4 .IX Item "overlay_h, h" .PD overlay input width and height .IP "\fBx\fR" 4 .IX Item "x" .PD 0 .IP "\fBy\fR" 4 .IX Item "y" .PD the computed values for \fIx\fR and \fIy\fR. They are evaluated for each new frame. .IP "\fBhsub\fR" 4 .IX Item "hsub" .PD 0 .IP "\fBvsub\fR" 4 .IX Item "vsub" .PD horizontal and vertical chroma subsample values of the output format. For example for the pixel format \*(L"yuv422p\*(R" \fIhsub\fR is 2 and \&\fIvsub\fR is 1. .IP "\fBn\fR" 4 .IX Item "n" the number of input frame, starting from 0 .IP "\fBpos\fR" 4 .IX Item "pos" the position in the file of the input frame, \s-1NAN\s0 if unknown .IP "\fBt\fR" 4 .IX Item "t" timestamp expressed in seconds, \s-1NAN\s0 if the input timestamp is unknown .PP Note that the \fIn\fR, \fIpos\fR, \fIt\fR variables are available only when evaluation is done \fIper frame\fR, and will evaluate to \s-1NAN\s0 when \fBeval\fR is set to \fBinit\fR. .PP Be aware that frames are taken from each input video in timestamp order, hence, if their initial timestamps differ, it is a a good idea to pass the two inputs through a \fIsetpts=PTS\-STARTPTS\fR filter to have them begin in the same zero timestamp, as it does the example for the \fImovie\fR filter. .PP You can chain together more overlays but you should test the efficiency of such approach. .PP \fICommands\fR .IX Subsection "Commands" .PP This filter supports the following commands: .IP "\fBx\fR" 4 .IX Item "x" .PD 0 .IP "\fBy\fR" 4 .IX Item "y" .IP "\fBenable\fR" 4 .IX Item "enable" .PD Modify the x/y and enable overlay of the overlay input. The command accepts the same syntax of the corresponding option. .Sp If the specified expression is not valid, it is kept at its current value. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Draw the overlay at 10 pixels from the bottom right corner of the main video: .Sp .Vb 1 \& overlay=main_w\-overlay_w\-10:main_h\-overlay_h\-10 .Ve .Sp Using named options the example above becomes: .Sp .Vb 1 \& overlay=x=main_w\-overlay_w\-10:y=main_h\-overlay_h\-10 .Ve .IP "\(bu" 4 Insert a transparent \s-1PNG\s0 logo in the bottom left corner of the input, using the \fBffmpeg\fR tool with the \f(CW\*(C`\-filter_complex\*(C'\fR option: .Sp .Vb 1 \& ffmpeg \-i input \-i logo \-filter_complex \*(Aqoverlay=10:main_h\-overlay_h\-10\*(Aq output .Ve .IP "\(bu" 4 Insert 2 different transparent \s-1PNG\s0 logos (second logo on bottom right corner) using the \fBffmpeg\fR tool: .Sp .Vb 1 \& ffmpeg \-i input \-i logo1 \-i logo2 \-filter_complex \*(Aqoverlay=x=10:y=H\-h\-10,overlay=x=W\-w\-10:y=H\-h\-10\*(Aq output .Ve .IP "\(bu" 4 Add a transparent color layer on top of the main video, \f(CW\*(C`WxH\*(C'\fR must specify the size of the main input to the overlay filter: .Sp .Vb 1 \& color=color=red@.3:size=WxH [over]; [in][over] overlay [out] .Ve .IP "\(bu" 4 Play an original video and a filtered version (here with the deshake filter) side by side using the \fBffplay\fR tool: .Sp .Vb 1 \& ffplay input.avi \-vf \*(Aqsplit[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w\*(Aq .Ve .Sp The above command is the same as: .Sp .Vb 1 \& ffplay input.avi \-vf \*(Aqsplit[b], pad=iw*2[src], [b]deshake, [src]overlay=w\*(Aq .Ve .IP "\(bu" 4 Make a sliding overlay appearing from the left to the right top part of the screen starting since time 2: .Sp .Vb 1 \& overlay=x=\*(Aqif(gte(t,2), \-w+(t\-2)*20, NAN)\*(Aq:y=0 .Ve .IP "\(bu" 4 Compose output by putting two input videos side to side: .Sp .Vb 7 \& ffmpeg \-i left.avi \-i right.avi \-filter_complex " \& nullsrc=size=200x100 [background]; \& [0:v] setpts=PTS\-STARTPTS, scale=100x100 [left]; \& [1:v] setpts=PTS\-STARTPTS, scale=100x100 [right]; \& [background][left] overlay=shortest=1 [background+left]; \& [background+left][right] overlay=shortest=1:x=100 [left+right] \& " .Ve .IP "\(bu" 4 Chain several overlays in cascade: .Sp .Vb 6 \& nullsrc=s=200x200 [bg]; \& testsrc=s=100x100, split=4 [in0][in1][in2][in3]; \& [in0] lutrgb=r=0, [bg] overlay=0:0 [mid0]; \& [in1] lutrgb=g=0, [mid0] overlay=100:0 [mid1]; \& [in2] lutrgb=b=0, [mid1] overlay=0:100 [mid2]; \& [in3] null, [mid2] overlay=100:100 [out0] .Ve .SS "pad" .IX Subsection "pad" Add paddings to the input image, and place the original input at the given coordinates \fIx\fR, \fIy\fR. .PP This filter accepts the following parameters: .IP "\fBwidth, w\fR" 4 .IX Item "width, w" .PD 0 .IP "\fBheight, h\fR" 4 .IX Item "height, h" .PD Specify an expression for the size of the output image with the paddings added. If the value for \fIwidth\fR or \fIheight\fR is 0, the corresponding input size is used for the output. .Sp The \fIwidth\fR expression can reference the value set by the \&\fIheight\fR expression, and vice versa. .Sp The default value of \fIwidth\fR and \fIheight\fR is 0. .IP "\fBx\fR" 4 .IX Item "x" .PD 0 .IP "\fBy\fR" 4 .IX Item "y" .PD Specify an expression for the offsets where to place the input image in the padded area with respect to the top/left border of the output image. .Sp The \fIx\fR expression can reference the value set by the \fIy\fR expression, and vice versa. .Sp The default value of \fIx\fR and \fIy\fR is 0. .IP "\fBcolor\fR" 4 .IX Item "color" Specify the color of the padded area, it can be the name of a color (case insensitive match) or a 0xRRGGBB[\s-1AA\s0] sequence. .Sp The default value of \fIcolor\fR is \*(L"black\*(R". .PP The value for the \fIwidth\fR, \fIheight\fR, \fIx\fR, and \fIy\fR options are expressions containing the following constants: .IP "\fBin_w, in_h\fR" 4 .IX Item "in_w, in_h" the input video width and height .IP "\fBiw, ih\fR" 4 .IX Item "iw, ih" same as \fIin_w\fR and \fIin_h\fR .IP "\fBout_w, out_h\fR" 4 .IX Item "out_w, out_h" the output width and height, that is the size of the padded area as specified by the \fIwidth\fR and \fIheight\fR expressions .IP "\fBow, oh\fR" 4 .IX Item "ow, oh" same as \fIout_w\fR and \fIout_h\fR .IP "\fBx, y\fR" 4 .IX Item "x, y" x and y offsets as specified by the \fIx\fR and \fIy\fR expressions, or \s-1NAN\s0 if not yet specified .IP "\fBa\fR" 4 .IX Item "a" same as \fIiw\fR / \fIih\fR .IP "\fBsar\fR" 4 .IX Item "sar" input sample aspect ratio .IP "\fBdar\fR" 4 .IX Item "dar" input display aspect ratio, it is the same as (\fIiw\fR / \fIih\fR) * \fIsar\fR .IP "\fBhsub, vsub\fR" 4 .IX Item "hsub, vsub" horizontal and vertical chroma subsample values. For example for the pixel format \*(L"yuv422p\*(R" \fIhsub\fR is 2 and \fIvsub\fR is 1. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Add paddings with color \*(L"violet\*(R" to the input video. Output video size is 640x480, the top-left corner of the input video is placed at column 0, row 40: .Sp .Vb 1 \& pad=640:480:0:40:violet .Ve .Sp The example above is equivalent to the following command: .Sp .Vb 1 \& pad=width=640:height=480:x=0:y=40:color=violet .Ve .IP "\(bu" 4 Pad the input to get an output with dimensions increased by 3/2, and put the input video at the center of the padded area: .Sp .Vb 1 \& pad="3/2*iw:3/2*ih:(ow\-iw)/2:(oh\-ih)/2" .Ve .IP "\(bu" 4 Pad the input to get a squared output with size equal to the maximum value between the input width and height, and put the input video at the center of the padded area: .Sp .Vb 1 \& pad="max(iw\e,ih):ow:(ow\-iw)/2:(oh\-ih)/2" .Ve .IP "\(bu" 4 Pad the input to get a final w/h ratio of 16:9: .Sp .Vb 1 \& pad="ih*16/9:ih:(ow\-iw)/2:(oh\-ih)/2" .Ve .IP "\(bu" 4 In case of anamorphic video, in order to set the output display aspect correctly, it is necessary to use \fIsar\fR in the expression, according to the relation: .Sp .Vb 2 \& (ih * X / ih) * sar = output_dar \& X = output_dar / sar .Ve .Sp Thus the previous example needs to be modified to: .Sp .Vb 1 \& pad="ih*16/9/sar:ih:(ow\-iw)/2:(oh\-ih)/2" .Ve .IP "\(bu" 4 Double output size and put the input video in the bottom-right corner of the output padded area: .Sp .Vb 1 \& pad="2*iw:2*ih:ow\-iw:oh\-ih" .Ve .SS "pixdesctest" .IX Subsection "pixdesctest" Pixel format descriptor test filter, mainly useful for internal testing. The output video should be equal to the input video. .PP For example: .PP .Vb 1 \& format=monow, pixdesctest .Ve .PP can be used to test the monowhite pixel format descriptor definition. .SS "pp" .IX Subsection "pp" Enable the specified chain of postprocessing subfilters using libpostproc. This library should be automatically selected with a \s-1GPL\s0 build (\f(CW\*(C`\-\-enable\-gpl\*(C'\fR). Subfilters must be separated by '/' and can be disabled by prepending a '\-'. Each subfilter and some options have a short and a long name that can be used interchangeably, i.e. dr/dering are the same. .PP The filters accept the following options: .IP "\fBsubfilters\fR" 4 .IX Item "subfilters" Set postprocessing subfilters string. .PP All subfilters share common options to determine their scope: .IP "\fBa/autoq\fR" 4 .IX Item "a/autoq" Honor the quality commands for this subfilter. .IP "\fBc/chrom\fR" 4 .IX Item "c/chrom" Do chrominance filtering, too (default). .IP "\fBy/nochrom\fR" 4 .IX Item "y/nochrom" Do luminance filtering only (no chrominance). .IP "\fBn/noluma\fR" 4 .IX Item "n/noluma" Do chrominance filtering only (no luminance). .PP These options can be appended after the subfilter name, separated by a '|'. .PP Available subfilters are: .IP "\fBhb/hdeblock[|difference[|flatness]]\fR" 4 .IX Item "hb/hdeblock[|difference[|flatness]]" Horizontal deblocking filter .RS 4 .IP "\fBdifference\fR" 4 .IX Item "difference" Difference factor where higher values mean more deblocking (default: \f(CW32\fR). .IP "\fBflatness\fR" 4 .IX Item "flatness" Flatness threshold where lower values mean more deblocking (default: \f(CW39\fR). .RE .RS 4 .RE .IP "\fBvb/vdeblock[|difference[|flatness]]\fR" 4 .IX Item "vb/vdeblock[|difference[|flatness]]" Vertical deblocking filter .RS 4 .IP "\fBdifference\fR" 4 .IX Item "difference" Difference factor where higher values mean more deblocking (default: \f(CW32\fR). .IP "\fBflatness\fR" 4 .IX Item "flatness" Flatness threshold where lower values mean more deblocking (default: \f(CW39\fR). .RE .RS 4 .RE .IP "\fBha/hadeblock[|difference[|flatness]]\fR" 4 .IX Item "ha/hadeblock[|difference[|flatness]]" Accurate horizontal deblocking filter .RS 4 .IP "\fBdifference\fR" 4 .IX Item "difference" Difference factor where higher values mean more deblocking (default: \f(CW32\fR). .IP "\fBflatness\fR" 4 .IX Item "flatness" Flatness threshold where lower values mean more deblocking (default: \f(CW39\fR). .RE .RS 4 .RE .IP "\fBva/vadeblock[|difference[|flatness]]\fR" 4 .IX Item "va/vadeblock[|difference[|flatness]]" Accurate vertical deblocking filter .RS 4 .IP "\fBdifference\fR" 4 .IX Item "difference" Difference factor where higher values mean more deblocking (default: \f(CW32\fR). .IP "\fBflatness\fR" 4 .IX Item "flatness" Flatness threshold where lower values mean more deblocking (default: \f(CW39\fR). .RE .RS 4 .RE .PP The horizontal and vertical deblocking filters share the difference and flatness values so you cannot set different horizontal and vertical thresholds. .IP "\fBh1/x1hdeblock\fR" 4 .IX Item "h1/x1hdeblock" Experimental horizontal deblocking filter .IP "\fBv1/x1vdeblock\fR" 4 .IX Item "v1/x1vdeblock" Experimental vertical deblocking filter .IP "\fBdr/dering\fR" 4 .IX Item "dr/dering" Deringing filter .IP "\fBtn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer\fR" 4 .IX Item "tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer" .RS 4 .PD 0 .IP "\fBthreshold1\fR" 4 .IX Item "threshold1" .PD larger \-> stronger filtering .IP "\fBthreshold2\fR" 4 .IX Item "threshold2" larger \-> stronger filtering .IP "\fBthreshold3\fR" 4 .IX Item "threshold3" larger \-> stronger filtering .RE .RS 4 .RE .IP "\fBal/autolevels[:f/fullyrange], automatic brightness / contrast correction\fR" 4 .IX Item "al/autolevels[:f/fullyrange], automatic brightness / contrast correction" .RS 4 .PD 0 .IP "\fBf/fullyrange\fR" 4 .IX Item "f/fullyrange" .PD Stretch luminance to \f(CW\*(C`0\-255\*(C'\fR. .RE .RS 4 .RE .IP "\fBlb/linblenddeint\fR" 4 .IX Item "lb/linblenddeint" Linear blend deinterlacing filter that deinterlaces the given block by filtering all lines with a \f(CW\*(C`(1 2 1)\*(C'\fR filter. .IP "\fBli/linipoldeint\fR" 4 .IX Item "li/linipoldeint" Linear interpolating deinterlacing filter that deinterlaces the given block by linearly interpolating every second line. .IP "\fBci/cubicipoldeint\fR" 4 .IX Item "ci/cubicipoldeint" Cubic interpolating deinterlacing filter deinterlaces the given block by cubically interpolating every second line. .IP "\fBmd/mediandeint\fR" 4 .IX Item "md/mediandeint" Median deinterlacing filter that deinterlaces the given block by applying a median filter to every second line. .IP "\fBfd/ffmpegdeint\fR" 4 .IX Item "fd/ffmpegdeint" FFmpeg deinterlacing filter that deinterlaces the given block by filtering every second line with a \f(CW\*(C`(\-1 4 2 4 \-1)\*(C'\fR filter. .IP "\fBl5/lowpass5\fR" 4 .IX Item "l5/lowpass5" Vertically applied \s-1FIR\s0 lowpass deinterlacing filter that deinterlaces the given block by filtering all lines with a \f(CW\*(C`(\-1 2 6 2 \-1)\*(C'\fR filter. .IP "\fBfq/forceQuant[|quantizer]\fR" 4 .IX Item "fq/forceQuant[|quantizer]" Overrides the quantizer table from the input with the constant quantizer you specify. .RS 4 .IP "\fBquantizer\fR" 4 .IX Item "quantizer" Quantizer to use .RE .RS 4 .RE .IP "\fBde/default\fR" 4 .IX Item "de/default" Default pp filter combination (\f(CW\*(C`hb|a,vb|a,dr|a\*(C'\fR) .IP "\fBfa/fast\fR" 4 .IX Item "fa/fast" Fast pp filter combination (\f(CW\*(C`h1|a,v1|a,dr|a\*(C'\fR) .IP "\fBac\fR" 4 .IX Item "ac" High quality pp filter combination (\f(CW\*(C`ha|a|128|7,va|a,dr|a\*(C'\fR) .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Apply horizontal and vertical deblocking, deringing and automatic brightness/contrast: .Sp .Vb 1 \& pp=hb/vb/dr/al .Ve .IP "\(bu" 4 Apply default filters without brightness/contrast correction: .Sp .Vb 1 \& pp=de/\-al .Ve .IP "\(bu" 4 Apply default filters and temporal denoiser: .Sp .Vb 1 \& pp=default/tmpnoise|1|2|3 .Ve .IP "\(bu" 4 Apply deblocking on luminance only, and switch vertical deblocking on or off automatically depending on available \s-1CPU\s0 time: .Sp .Vb 1 \& pp=hb|y/vb|a .Ve .SS "removelogo" .IX Subsection "removelogo" Suppress a \s-1TV\s0 station logo, using an image file to determine which pixels comprise the logo. It works by filling in the pixels that comprise the logo with neighboring pixels. .PP The filters accept the following options: .IP "\fBfilename, f\fR" 4 .IX Item "filename, f" Set the filter bitmap file, which can be any image format supported by libavformat. The width and height of the image file must match those of the video stream being processed. .PP Pixels in the provided bitmap image with a value of zero are not considered part of the logo, non-zero pixels are considered part of the logo. If you use white (255) for the logo and black (0) for the rest, you will be safe. For making the filter bitmap, it is recommended to take a screen capture of a black frame with the logo visible, and then using a threshold filter followed by the erode filter once or twice. .PP If needed, little splotches can be fixed manually. Remember that if logo pixels are not covered, the filter quality will be much reduced. Marking too many pixels as part of the logo does not hurt as much, but it will increase the amount of blurring needed to cover over the image and will destroy more information than necessary, and extra pixels will slow things down on a large logo. .SS "scale" .IX Subsection "scale" Scale (resize) the input video, using the libswscale library. .PP The scale filter forces the output display aspect ratio to be the same of the input, by changing the output sample aspect ratio. .PP The filter accepts the following options: .IP "\fBwidth, w\fR" 4 .IX Item "width, w" Output video width. default value is \f(CW\*(C`iw\*(C'\fR. See below for the list of accepted constants. .IP "\fBheight, h\fR" 4 .IX Item "height, h" Output video height. default value is \f(CW\*(C`ih\*(C'\fR. See below for the list of accepted constants. .IP "\fBinterl\fR" 4 .IX Item "interl" Set the interlacing. It accepts the following values: .RS 4 .IP "\fB1\fR" 4 .IX Item "1" force interlaced aware scaling .IP "\fB0\fR" 4 .IX Item "0" do not apply interlaced scaling .IP "\fB\-1\fR" 4 .IX Item "-1" select interlaced aware scaling depending on whether the source frames are flagged as interlaced or not .RE .RS 4 .Sp Default value is \f(CW0\fR. .RE .IP "\fBflags\fR" 4 .IX Item "flags" Set libswscale scaling flags. If not explictly specified the filter applies a bilinear scaling algorithm. .IP "\fBsize, s\fR" 4 .IX Item "size, s" Set the video size, the value must be a valid abbreviation or in the form \fIwidth\fRx\fIheight\fR. .PP The values of the \fIw\fR and \fIh\fR options are expressions containing the following constants: .IP "\fBin_w, in_h\fR" 4 .IX Item "in_w, in_h" the input width and height .IP "\fBiw, ih\fR" 4 .IX Item "iw, ih" same as \fIin_w\fR and \fIin_h\fR .IP "\fBout_w, out_h\fR" 4 .IX Item "out_w, out_h" the output (cropped) width and height .IP "\fBow, oh\fR" 4 .IX Item "ow, oh" same as \fIout_w\fR and \fIout_h\fR .IP "\fBa\fR" 4 .IX Item "a" same as \fIiw\fR / \fIih\fR .IP "\fBsar\fR" 4 .IX Item "sar" input sample aspect ratio .IP "\fBdar\fR" 4 .IX Item "dar" input display aspect ratio, it is the same as (\fIiw\fR / \fIih\fR) * \fIsar\fR .IP "\fBhsub, vsub\fR" 4 .IX Item "hsub, vsub" horizontal and vertical chroma subsample values. For example for the pixel format \*(L"yuv422p\*(R" \fIhsub\fR is 2 and \fIvsub\fR is 1. .PP If the input image format is different from the format requested by the next filter, the scale filter will convert the input to the requested format. .PP If the value for \fIw\fR or \fIh\fR is 0, the respective input size is used for the output. .PP If the value for \fIw\fR or \fIh\fR is \-1, the scale filter will use, for the respective output size, a value that maintains the aspect ratio of the input image. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Scale the input video to a size of 200x100: .Sp .Vb 1 \& scale=w=200:h=100 .Ve .Sp This is equivalent to: .Sp .Vb 1 \& scale=w=200:h=100 .Ve .Sp or: .Sp .Vb 1 \& scale=200x100 .Ve .IP "\(bu" 4 Specify a size abbreviation for the output size: .Sp .Vb 1 \& scale=qcif .Ve .Sp which can also be written as: .Sp .Vb 1 \& scale=size=qcif .Ve .IP "\(bu" 4 Scale the input to 2x: .Sp .Vb 1 \& scale=w=2*iw:h=2*ih .Ve .IP "\(bu" 4 The above is the same as: .Sp .Vb 1 \& scale=2*in_w:2*in_h .Ve .IP "\(bu" 4 Scale the input to 2x with forced interlaced scaling: .Sp .Vb 1 \& scale=2*iw:2*ih:interl=1 .Ve .IP "\(bu" 4 Scale the input to half size: .Sp .Vb 1 \& scale=w=iw/2:h=ih/2 .Ve .IP "\(bu" 4 Increase the width, and set the height to the same size: .Sp .Vb 1 \& scale=3/2*iw:ow .Ve .IP "\(bu" 4 Seek for Greek harmony: .Sp .Vb 2 \& scale=iw:1/PHI*iw \& scale=ih*PHI:ih .Ve .IP "\(bu" 4 Increase the height, and set the width to 3/2 of the height: .Sp .Vb 1 \& scale=w=3/2*oh:h=3/5*ih .Ve .IP "\(bu" 4 Increase the size, but make the size a multiple of the chroma subsample values: .Sp .Vb 1 \& scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub" .Ve .IP "\(bu" 4 Increase the width to a maximum of 500 pixels, keep the same input aspect ratio: .Sp .Vb 1 \& scale=w=\*(Aqmin(500\e, iw*3/2):h=\-1\*(Aq .Ve .SS "separatefields" .IX Subsection "separatefields" The \f(CW\*(C`separatefields\*(C'\fR takes a frame-based video input and splits each frame into its components fields, producing a new half height clip with twice the frame rate and twice the frame count. .PP This filter use field-dominance information in frame to decide which of each pair of fields to place first in the output. If it gets it wrong use setfield filter before \f(CW\*(C`separatefields\*(C'\fR filter. .SS "setdar, setsar" .IX Subsection "setdar, setsar" The \f(CW\*(C`setdar\*(C'\fR filter sets the Display Aspect Ratio for the filter output video. .PP This is done by changing the specified Sample (aka Pixel) Aspect Ratio, according to the following equation: .PP .Vb 1 \& <DAR> = <HORIZONTAL_RESOLUTION> / <VERTICAL_RESOLUTION> * <SAR> .Ve .PP Keep in mind that the \f(CW\*(C`setdar\*(C'\fR filter does not modify the pixel dimensions of the video frame. Also the display aspect ratio set by this filter may be changed by later filters in the filterchain, e.g. in case of scaling or if another \*(L"setdar\*(R" or a \*(L"setsar\*(R" filter is applied. .PP The \f(CW\*(C`setsar\*(C'\fR filter sets the Sample (aka Pixel) Aspect Ratio for the filter output video. .PP Note that as a consequence of the application of this filter, the output display aspect ratio will change according to the equation above. .PP Keep in mind that the sample aspect ratio set by the \f(CW\*(C`setsar\*(C'\fR filter may be changed by later filters in the filterchain, e.g. if another \*(L"setsar\*(R" or a \*(L"setdar\*(R" filter is applied. .PP The filters accept the following options: .ie n .IP "\fBr, ratio, dar (\fB""setdar""\fB only), sar (\f(BI""setsar""\fB only)\fR" 4 .el .IP "\fBr, ratio, dar (\f(CBsetdar\fB only), sar (\f(CBsetsar\fB only)\fR" 4 .IX Item "r, ratio, dar (setdar only), sar (setsar only)" Set the aspect ratio used by the filter. .Sp The parameter can be a floating point number string, an expression, or a string of the form \fInum\fR:\fIden\fR, where \fInum\fR and \&\fIden\fR are the numerator and denominator of the aspect ratio. If the parameter is not specified, it is assumed the value \*(L"0\*(R". In case the form "\fInum\fR:\fIden\fR" is used, the \f(CW\*(C`:\*(C'\fR character should be escaped. .IP "\fBmax\fR" 4 .IX Item "max" Set the maximum integer value to use for expressing numerator and denominator when reducing the expressed aspect ratio to a rational. Default value is \f(CW100\fR. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 To change the display aspect ratio to 16:9, specify one of the following: .Sp .Vb 3 \& setdar=dar=1.77777 \& setdar=dar=16/9 \& setdar=dar=1.77777 .Ve .IP "\(bu" 4 To change the sample aspect ratio to 10:11, specify: .Sp .Vb 1 \& setsar=sar=10/11 .Ve .IP "\(bu" 4 To set a display aspect ratio of 16:9, and specify a maximum integer value of 1000 in the aspect ratio reduction, use the command: .Sp .Vb 1 \& setdar=ratio=16/9:max=1000 .Ve .SS "setfield" .IX Subsection "setfield" Force field for the output video frame. .PP The \f(CW\*(C`setfield\*(C'\fR filter marks the interlace type field for the output frames. It does not change the input frame, but only sets the corresponding property, which affects how the frame is treated by following filters (e.g. \f(CW\*(C`fieldorder\*(C'\fR or \f(CW\*(C`yadif\*(C'\fR). .PP The filter accepts the following options: .IP "\fBmode\fR" 4 .IX Item "mode" Available values are: .RS 4 .IP "\fBauto\fR" 4 .IX Item "auto" Keep the same field property. .IP "\fBbff\fR" 4 .IX Item "bff" Mark the frame as bottom-field-first. .IP "\fBtff\fR" 4 .IX Item "tff" Mark the frame as top-field-first. .IP "\fBprog\fR" 4 .IX Item "prog" Mark the frame as progressive. .RE .RS 4 .RE .SS "showinfo" .IX Subsection "showinfo" Show a line containing various information for each input video frame. The input video is not modified. .PP The shown line contains a sequence of key/value pairs of the form \&\fIkey\fR:\fIvalue\fR. .PP A description of each shown parameter follows: .IP "\fBn\fR" 4 .IX Item "n" sequential number of the input frame, starting from 0 .IP "\fBpts\fR" 4 .IX Item "pts" Presentation TimeStamp of the input frame, expressed as a number of time base units. The time base unit depends on the filter input pad. .IP "\fBpts_time\fR" 4 .IX Item "pts_time" Presentation TimeStamp of the input frame, expressed as a number of seconds .IP "\fBpos\fR" 4 .IX Item "pos" position of the frame in the input stream, \-1 if this information in unavailable and/or meaningless (for example in case of synthetic video) .IP "\fBfmt\fR" 4 .IX Item "fmt" pixel format name .IP "\fBsar\fR" 4 .IX Item "sar" sample aspect ratio of the input frame, expressed in the form \&\fInum\fR/\fIden\fR .IP "\fBs\fR" 4 .IX Item "s" size of the input frame, expressed in the form \&\fIwidth\fRx\fIheight\fR .IP "\fBi\fR" 4 .IX Item "i" interlaced mode (\*(L"P\*(R" for \*(L"progressive\*(R", \*(L"T\*(R" for top field first, \*(L"B\*(R" for bottom field first) .IP "\fBiskey\fR" 4 .IX Item "iskey" 1 if the frame is a key frame, 0 otherwise .IP "\fBtype\fR" 4 .IX Item "type" picture type of the input frame (\*(L"I\*(R" for an I\-frame, \*(L"P\*(R" for a P\-frame, \*(L"B\*(R" for a B\-frame, \*(L"?\*(R" for unknown type). Check also the documentation of the \f(CW\*(C`AVPictureType\*(C'\fR enum and of the \f(CW\*(C`av_get_picture_type_char\*(C'\fR function defined in \&\fIlibavutil/avutil.h\fR. .IP "\fBchecksum\fR" 4 .IX Item "checksum" Adler\-32 checksum (printed in hexadecimal) of all the planes of the input frame .IP "\fBplane_checksum\fR" 4 .IX Item "plane_checksum" Adler\-32 checksum (printed in hexadecimal) of each plane of the input frame, expressed in the form "[\fIc0\fR \fIc1\fR \fIc2\fR \fIc3\fR]" .SS "smartblur" .IX Subsection "smartblur" Blur the input video without impacting the outlines. .PP The filter accepts the following options: .IP "\fBluma_radius, lr\fR" 4 .IX Item "luma_radius, lr" Set the luma radius. The option value must be a float number in the range [0.1,5.0] that specifies the variance of the gaussian filter used to blur the image (slower if larger). Default value is 1.0. .IP "\fBluma_strength, ls\fR" 4 .IX Item "luma_strength, ls" Set the luma strength. The option value must be a float number in the range [\-1.0,1.0] that configures the blurring. A value included in [0.0,1.0] will blur the image whereas a value included in [\-1.0,0.0] will sharpen the image. Default value is 1.0. .IP "\fBluma_threshold, lt\fR" 4 .IX Item "luma_threshold, lt" Set the luma threshold used as a coefficient to determine whether a pixel should be blurred or not. The option value must be an integer in the range [\-30,30]. A value of 0 will filter all the image, a value included in [0,30] will filter flat areas and a value included in [\-30,0] will filter edges. Default value is 0. .IP "\fBchroma_radius, cr\fR" 4 .IX Item "chroma_radius, cr" Set the chroma radius. The option value must be a float number in the range [0.1,5.0] that specifies the variance of the gaussian filter used to blur the image (slower if larger). Default value is 1.0. .IP "\fBchroma_strength, cs\fR" 4 .IX Item "chroma_strength, cs" Set the chroma strength. The option value must be a float number in the range [\-1.0,1.0] that configures the blurring. A value included in [0.0,1.0] will blur the image whereas a value included in [\-1.0,0.0] will sharpen the image. Default value is 1.0. .IP "\fBchroma_threshold, ct\fR" 4 .IX Item "chroma_threshold, ct" Set the chroma threshold used as a coefficient to determine whether a pixel should be blurred or not. The option value must be an integer in the range [\-30,30]. A value of 0 will filter all the image, a value included in [0,30] will filter flat areas and a value included in [\-30,0] will filter edges. Default value is 0. .PP If a chroma option is not explicitly set, the corresponding luma value is set. .SS "stereo3d" .IX Subsection "stereo3d" Convert between different stereoscopic image formats. .PP The filters accept the following options: .IP "\fBin\fR" 4 .IX Item "in" Set stereoscopic image format of input. .Sp Available values for input image formats are: .RS 4 .IP "\fBsbsl\fR" 4 .IX Item "sbsl" side by side parallel (left eye left, right eye right) .IP "\fBsbsr\fR" 4 .IX Item "sbsr" side by side crosseye (right eye left, left eye right) .IP "\fBsbs2l\fR" 4 .IX Item "sbs2l" side by side parallel with half width resolution (left eye left, right eye right) .IP "\fBsbs2r\fR" 4 .IX Item "sbs2r" side by side crosseye with half width resolution (right eye left, left eye right) .IP "\fBabl\fR" 4 .IX Item "abl" above-below (left eye above, right eye below) .IP "\fBabr\fR" 4 .IX Item "abr" above-below (right eye above, left eye below) .IP "\fBab2l\fR" 4 .IX Item "ab2l" above-below with half height resolution (left eye above, right eye below) .IP "\fBab2r\fR" 4 .IX Item "ab2r" above-below with half height resolution (right eye above, left eye below) .Sp Default value is \fBsbsl\fR. .RE .RS 4 .RE .IP "\fBout\fR" 4 .IX Item "out" Set stereoscopic image format of output. .Sp Available values for output image formats are all the input formats as well as: .RS 4 .IP "\fBarbg\fR" 4 .IX Item "arbg" anaglyph red/blue gray (red filter on left eye, blue filter on right eye) .IP "\fBargg\fR" 4 .IX Item "argg" anaglyph red/green gray (red filter on left eye, green filter on right eye) .IP "\fBarcg\fR" 4 .IX Item "arcg" anaglyph red/cyan gray (red filter on left eye, cyan filter on right eye) .IP "\fBarch\fR" 4 .IX Item "arch" anaglyph red/cyan half colored (red filter on left eye, cyan filter on right eye) .IP "\fBarcc\fR" 4 .IX Item "arcc" anaglyph red/cyan color (red filter on left eye, cyan filter on right eye) .IP "\fBarcd\fR" 4 .IX Item "arcd" anaglyph red/cyan color optimized with the least squares projection of dubois (red filter on left eye, cyan filter on right eye) .IP "\fBagmg\fR" 4 .IX Item "agmg" anaglyph green/magenta gray (green filter on left eye, magenta filter on right eye) .IP "\fBagmh\fR" 4 .IX Item "agmh" anaglyph green/magenta half colored (green filter on left eye, magenta filter on right eye) .IP "\fBagmc\fR" 4 .IX Item "agmc" anaglyph green/magenta colored (green filter on left eye, magenta filter on right eye) .IP "\fBagmd\fR" 4 .IX Item "agmd" anaglyph green/magenta color optimized with the least squares projection of dubois (green filter on left eye, magenta filter on right eye) .IP "\fBaybg\fR" 4 .IX Item "aybg" anaglyph yellow/blue gray (yellow filter on left eye, blue filter on right eye) .IP "\fBaybh\fR" 4 .IX Item "aybh" anaglyph yellow/blue half colored (yellow filter on left eye, blue filter on right eye) .IP "\fBaybc\fR" 4 .IX Item "aybc" anaglyph yellow/blue colored (yellow filter on left eye, blue filter on right eye) .IP "\fBaybd\fR" 4 .IX Item "aybd" anaglyph yellow/blue color optimized with the least squares projection of dubois (yellow filter on left eye, blue filter on right eye) .IP "\fBirl\fR" 4 .IX Item "irl" interleaved rows (left eye has top row, right eye starts on next row) .IP "\fBirr\fR" 4 .IX Item "irr" interleaved rows (right eye has top row, left eye starts on next row) .IP "\fBml\fR" 4 .IX Item "ml" mono output (left eye only) .IP "\fBmr\fR" 4 .IX Item "mr" mono output (right eye only) .RE .RS 4 .Sp Default value is \fBarcd\fR. .RE .SS "subtitles" .IX Subsection "subtitles" Draw subtitles on top of input video using the libass library. .PP To enable compilation of this filter you need to configure FFmpeg with \&\f(CW\*(C`\-\-enable\-libass\*(C'\fR. This filter also requires a build with libavcodec and libavformat to convert the passed subtitles file to \s-1ASS\s0 (Advanced Substation Alpha) subtitles format. .PP The filter accepts the following options: .IP "\fBfilename, f\fR" 4 .IX Item "filename, f" Set the filename of the subtitle file to read. It must be specified. .IP "\fBoriginal_size\fR" 4 .IX Item "original_size" Specify the size of the original video, the video for which the \s-1ASS\s0 file was composed. Due to a misdesign in \s-1ASS\s0 aspect ratio arithmetic, this is necessary to correctly scale the fonts if the aspect ratio has been changed. .IP "\fBcharenc\fR" 4 .IX Item "charenc" Set subtitles input character encoding. \f(CW\*(C`subtitles\*(C'\fR filter only. Only useful if not \s-1UTF\-8\s0. .PP If the first key is not specified, it is assumed that the first value specifies the \fBfilename\fR. .PP For example, to render the file \fIsub.srt\fR on top of the input video, use the command: .PP .Vb 1 \& subtitles=sub.srt .Ve .PP which is equivalent to: .PP .Vb 1 \& subtitles=filename=sub.srt .Ve .SS "super2xsai" .IX Subsection "super2xsai" Scale the input by 2x and smooth using the Super2xSaI (Scale and Interpolate) pixel art scaling algorithm. .PP Useful for enlarging pixel art images without reducing sharpness. .SS "swapuv" .IX Subsection "swapuv" Swap U & V plane. .SS "telecine" .IX Subsection "telecine" Apply telecine process to the video. .PP This filter accepts the following options: .IP "\fBfirst_field\fR" 4 .IX Item "first_field" .RS 4 .PD 0 .IP "\fBtop, t\fR" 4 .IX Item "top, t" .PD top field first .IP "\fBbottom, b\fR" 4 .IX Item "bottom, b" bottom field first The default value is \f(CW\*(C`top\*(C'\fR. .RE .RS 4 .RE .IP "\fBpattern\fR" 4 .IX Item "pattern" A string of numbers representing the pulldown pattern you wish to apply. The default value is \f(CW23\fR. .PP .Vb 1 \& Some typical patterns: \& \& NTSC output (30i): \& 27.5p: 32222 \& 24p: 23 (classic) \& 24p: 2332 (preferred) \& 20p: 33 \& 18p: 334 \& 16p: 3444 \& \& PAL output (25i): \& 27.5p: 12222 \& 24p: 222222222223 ("Euro pulldown") \& 16.67p: 33 \& 16p: 33333334 .Ve .SS "thumbnail" .IX Subsection "thumbnail" Select the most representative frame in a given sequence of consecutive frames. .PP The filter accepts the following options: .IP "\fBn\fR" 4 .IX Item "n" Set the frames batch size to analyze; in a set of \fIn\fR frames, the filter will pick one of them, and then handle the next batch of \fIn\fR frames until the end. Default is \f(CW100\fR. .PP Since the filter keeps track of the whole frames sequence, a bigger \fIn\fR value will result in a higher memory usage, so a high value is not recommended. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Extract one picture each 50 frames: .Sp .Vb 1 \& thumbnail=50 .Ve .IP "\(bu" 4 Complete example of a thumbnail creation with \fBffmpeg\fR: .Sp .Vb 1 \& ffmpeg \-i in.avi \-vf thumbnail,scale=300:200 \-frames:v 1 out.png .Ve .SS "tile" .IX Subsection "tile" Tile several successive frames together. .PP The filter accepts the following options: .IP "\fBlayout\fR" 4 .IX Item "layout" Set the grid size (i.e. the number of lines and columns) in the form "\fIw\fRx\fIh\fR". .IP "\fBnb_frames\fR" 4 .IX Item "nb_frames" Set the maximum number of frames to render in the given area. It must be less than or equal to \fIw\fRx\fIh\fR. The default value is \f(CW0\fR, meaning all the area will be used. .IP "\fBmargin\fR" 4 .IX Item "margin" Set the outer border margin in pixels. .IP "\fBpadding\fR" 4 .IX Item "padding" Set the inner border thickness (i.e. the number of pixels between frames). For more advanced padding options (such as having different values for the edges), refer to the pad video filter. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Produce 8x8 \s-1PNG\s0 tiles of all keyframes (\fB\-skip_frame nokey\fR) in a movie: .Sp .Vb 1 \& ffmpeg \-skip_frame nokey \-i file.avi \-vf \*(Aqscale=128:72,tile=8x8\*(Aq \-an \-vsync 0 keyframes%03d.png .Ve .Sp The \fB\-vsync 0\fR is necessary to prevent \fBffmpeg\fR from duplicating each output frame to accomodate the originally detected frame rate. .IP "\(bu" 4 Display \f(CW5\fR pictures in an area of \f(CW\*(C`3x2\*(C'\fR frames, with \f(CW7\fR pixels between them, and \f(CW2\fR pixels of initial margin, using mixed flat and named options: .Sp .Vb 1 \& tile=3x2:nb_frames=5:padding=7:margin=2 .Ve .SS "tinterlace" .IX Subsection "tinterlace" Perform various types of temporal field interlacing. .PP Frames are counted starting from 1, so the first input frame is considered odd. .PP The filter accepts the following options: .IP "\fBmode\fR" 4 .IX Item "mode" Specify the mode of the interlacing. This option can also be specified as a value alone. See below for a list of values for this option. .Sp Available values are: .RS 4 .IP "\fBmerge, 0\fR" 4 .IX Item "merge, 0" Move odd frames into the upper field, even into the lower field, generating a double height frame at half frame rate. .IP "\fBdrop_odd, 1\fR" 4 .IX Item "drop_odd, 1" Only output even frames, odd frames are dropped, generating a frame with unchanged height at half frame rate. .IP "\fBdrop_even, 2\fR" 4 .IX Item "drop_even, 2" Only output odd frames, even frames are dropped, generating a frame with unchanged height at half frame rate. .IP "\fBpad, 3\fR" 4 .IX Item "pad, 3" Expand each frame to full height, but pad alternate lines with black, generating a frame with double height at the same input frame rate. .IP "\fBinterleave_top, 4\fR" 4 .IX Item "interleave_top, 4" Interleave the upper field from odd frames with the lower field from even frames, generating a frame with unchanged height at half frame rate. .IP "\fBinterleave_bottom, 5\fR" 4 .IX Item "interleave_bottom, 5" Interleave the lower field from odd frames with the upper field from even frames, generating a frame with unchanged height at half frame rate. .IP "\fBinterlacex2, 6\fR" 4 .IX Item "interlacex2, 6" Double frame rate with unchanged height. Frames are inserted each containing the second temporal field from the previous input frame and the first temporal field from the next input frame. This mode relies on the top_field_first flag. Useful for interlaced video displays with no field synchronisation. .RE .RS 4 .Sp Numeric values are deprecated but are accepted for backward compatibility reasons. .Sp Default mode is \f(CW\*(C`merge\*(C'\fR. .RE .IP "\fBflags\fR" 4 .IX Item "flags" Specify flags influencing the filter process. .Sp Available value for \fIflags\fR is: .RS 4 .IP "\fBlow_pass_filter, vlfp\fR" 4 .IX Item "low_pass_filter, vlfp" Enable vertical low-pass filtering in the filter. Vertical low-pass filtering is required when creating an interlaced destination from a progressive source which contains high-frequency vertical detail. Filtering will reduce interlace 'twitter' and Moire patterning. .Sp Vertical low-pass filtering can only be enabled for \fBmode\fR \&\fIinterleave_top\fR and \fIinterleave_bottom\fR. .RE .RS 4 .RE .SS "transpose" .IX Subsection "transpose" Transpose rows with columns in the input video and optionally flip it. .PP This filter accepts the following options: .IP "\fBdir\fR" 4 .IX Item "dir" The direction of the transpose. .RS 4 .IP "\fB0, 4, cclock_flip\fR" 4 .IX Item "0, 4, cclock_flip" Rotate by 90 degrees counterclockwise and vertically flip (default), that is: .Sp .Vb 3 \& L.R L.l \& . . \-> . . \& l.r R.r .Ve .IP "\fB1, 5, clock\fR" 4 .IX Item "1, 5, clock" Rotate by 90 degrees clockwise, that is: .Sp .Vb 3 \& L.R l.L \& . . \-> . . \& l.r r.R .Ve .IP "\fB2, 6, cclock\fR" 4 .IX Item "2, 6, cclock" Rotate by 90 degrees counterclockwise, that is: .Sp .Vb 3 \& L.R R.r \& . . \-> . . \& l.r L.l .Ve .IP "\fB3, 7, clock_flip\fR" 4 .IX Item "3, 7, clock_flip" Rotate by 90 degrees clockwise and vertically flip, that is: .Sp .Vb 3 \& L.R r.R \& . . \-> . . \& l.r l.L .Ve .RE .RS 4 .Sp For values between 4\-7, the transposition is only done if the input video geometry is portrait and not landscape. These values are deprecated, the \f(CW\*(C`passthrough\*(C'\fR option should be used instead. .RE .IP "\fBpassthrough\fR" 4 .IX Item "passthrough" Do not apply the transposition if the input geometry matches the one specified by the specified value. It accepts the following values: .RS 4 .IP "\fBnone\fR" 4 .IX Item "none" Always apply transposition. .IP "\fBportrait\fR" 4 .IX Item "portrait" Preserve portrait geometry (when \fIheight\fR >= \fIwidth\fR). .IP "\fBlandscape\fR" 4 .IX Item "landscape" Preserve landscape geometry (when \fIwidth\fR >= \fIheight\fR). .RE .RS 4 .Sp Default value is \f(CW\*(C`none\*(C'\fR. .RE .PP For example to rotate by 90 degrees clockwise and preserve portrait layout: .PP .Vb 1 \& transpose=dir=1:passthrough=portrait .Ve .PP The command above can also be specified as: .PP .Vb 1 \& transpose=1:portrait .Ve .SS "unsharp" .IX Subsection "unsharp" Sharpen or blur the input video. .PP It accepts the following parameters: .IP "\fBluma_msize_x, lx\fR" 4 .IX Item "luma_msize_x, lx" .PD 0 .IP "\fBchroma_msize_x, cx\fR" 4 .IX Item "chroma_msize_x, cx" .PD Set the luma/chroma matrix horizontal size. It must be an odd integer between 3 and 63, default value is 5. .IP "\fBluma_msize_y, ly\fR" 4 .IX Item "luma_msize_y, ly" .PD 0 .IP "\fBchroma_msize_y, cy\fR" 4 .IX Item "chroma_msize_y, cy" .PD Set the luma/chroma matrix vertical size. It must be an odd integer between 3 and 63, default value is 5. .IP "\fBluma_amount, la\fR" 4 .IX Item "luma_amount, la" .PD 0 .IP "\fBchroma_amount, ca\fR" 4 .IX Item "chroma_amount, ca" .PD Set the luma/chroma effect strength. It can be a float number, reasonable values lay between \-1.5 and 1.5. .Sp Negative values will blur the input video, while positive values will sharpen it, a value of zero will disable the effect. .Sp Default value is 1.0 for \fBluma_amount\fR, 0.0 for \&\fBchroma_amount\fR. .PP All parameters are optional and default to the equivalent of the string '5:5:1.0:5:5:0.0'. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Apply strong luma sharpen effect: .Sp .Vb 1 \& unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5 .Ve .IP "\(bu" 4 Apply strong blur of both luma and chroma parameters: .Sp .Vb 1 \& unsharp=7:7:\-2:7:7:\-2 .Ve .SS "vflip" .IX Subsection "vflip" Flip the input video vertically. .PP .Vb 1 \& ffmpeg \-i in.avi \-vf "vflip" out.avi .Ve .SS "yadif" .IX Subsection "yadif" Deinterlace the input video (\*(L"yadif\*(R" means \*(L"yet another deinterlacing filter\*(R"). .PP This filter accepts the following options: .IP "\fBmode\fR" 4 .IX Item "mode" The interlacing mode to adopt, accepts one of the following values: .RS 4 .IP "\fB0, send_frame\fR" 4 .IX Item "0, send_frame" output 1 frame for each frame .IP "\fB1, send_field\fR" 4 .IX Item "1, send_field" output 1 frame for each field .IP "\fB2, send_frame_nospatial\fR" 4 .IX Item "2, send_frame_nospatial" like \f(CW\*(C`send_frame\*(C'\fR but skip spatial interlacing check .IP "\fB3, send_field_nospatial\fR" 4 .IX Item "3, send_field_nospatial" like \f(CW\*(C`send_field\*(C'\fR but skip spatial interlacing check .RE .RS 4 .Sp Default value is \f(CW\*(C`send_frame\*(C'\fR. .RE .IP "\fBparity\fR" 4 .IX Item "parity" The picture field parity assumed for the input interlaced video, accepts one of the following values: .RS 4 .IP "\fB0, tff\fR" 4 .IX Item "0, tff" assume top field first .IP "\fB1, bff\fR" 4 .IX Item "1, bff" assume bottom field first .IP "\fB\-1, auto\fR" 4 .IX Item "-1, auto" enable automatic detection .RE .RS 4 .Sp Default value is \f(CW\*(C`auto\*(C'\fR. If interlacing is unknown or decoder does not export this information, top field first will be assumed. .RE .IP "\fBdeint\fR" 4 .IX Item "deint" Specify which frames to deinterlace. Accept one of the following values: .RS 4 .IP "\fB0, all\fR" 4 .IX Item "0, all" deinterlace all frames .IP "\fB1, interlaced\fR" 4 .IX Item "1, interlaced" only deinterlace frames marked as interlaced .RE .RS 4 .Sp Default value is \f(CW\*(C`all\*(C'\fR. .RE .SH "VIDEO SOURCES" .IX Header "VIDEO SOURCES" Below is a description of the currently available video sources. .SS "buffer" .IX Subsection "buffer" Buffer video frames, and make them available to the filter chain. .PP This source is mainly intended for a programmatic use, in particular through the interface defined in \fIlibavfilter/vsrc_buffer.h\fR. .PP This source accepts the following options: .IP "\fBvideo_size\fR" 4 .IX Item "video_size" Specify the size (width and height) of the buffered video frames. .IP "\fBwidth\fR" 4 .IX Item "width" Input video width. .IP "\fBheight\fR" 4 .IX Item "height" Input video height. .IP "\fBpix_fmt\fR" 4 .IX Item "pix_fmt" A string representing the pixel format of the buffered video frames. It may be a number corresponding to a pixel format, or a pixel format name. .IP "\fBtime_base\fR" 4 .IX Item "time_base" Specify the timebase assumed by the timestamps of the buffered frames. .IP "\fBframe_rate\fR" 4 .IX Item "frame_rate" Specify the frame rate expected for the video stream. .IP "\fBpixel_aspect, sar\fR" 4 .IX Item "pixel_aspect, sar" Specify the sample aspect ratio assumed by the video frames. .IP "\fBsws_param\fR" 4 .IX Item "sws_param" Specify the optional parameters to be used for the scale filter which is automatically inserted when an input change is detected in the input size or format. .PP For example: .PP .Vb 1 \& buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1 .Ve .PP will instruct the source to accept video frames with size 320x240 and with format \*(L"yuv410p\*(R", assuming 1/24 as the timestamps timebase and square pixels (1:1 sample aspect ratio). Since the pixel format with name \*(L"yuv410p\*(R" corresponds to the number 6 (check the enum AVPixelFormat definition in \fIlibavutil/pixfmt.h\fR), this example corresponds to: .PP .Vb 1 \& buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1 .Ve .PP Alternatively, the options can be specified as a flat string, but this syntax is deprecated: .PP \&\fIwidth\fR:\fIheight\fR:\fIpix_fmt\fR:\fItime_base.num\fR:\fItime_base.den\fR:\fIpixel_aspect.num\fR:\fIpixel_aspect.den\fR[:\fIsws_param\fR] .SS "cellauto" .IX Subsection "cellauto" Create a pattern generated by an elementary cellular automaton. .PP The initial state of the cellular automaton can be defined through the \&\fBfilename\fR, and \fBpattern\fR options. If such options are not specified an initial state is created randomly. .PP At each new frame a new row in the video is filled with the result of the cellular automaton next generation. The behavior when the whole frame is filled is defined by the \fBscroll\fR option. .PP This source accepts the following options: .IP "\fBfilename, f\fR" 4 .IX Item "filename, f" Read the initial cellular automaton state, i.e. the starting row, from the specified file. In the file, each non-whitespace character is considered an alive cell, a newline will terminate the row, and further characters in the file will be ignored. .IP "\fBpattern, p\fR" 4 .IX Item "pattern, p" Read the initial cellular automaton state, i.e. the starting row, from the specified string. .Sp Each non-whitespace character in the string is considered an alive cell, a newline will terminate the row, and further characters in the string will be ignored. .IP "\fBrate, r\fR" 4 .IX Item "rate, r" Set the video rate, that is the number of frames generated per second. Default is 25. .IP "\fBrandom_fill_ratio, ratio\fR" 4 .IX Item "random_fill_ratio, ratio" Set the random fill ratio for the initial cellular automaton row. It is a floating point number value ranging from 0 to 1, defaults to 1/PHI. .Sp This option is ignored when a file or a pattern is specified. .IP "\fBrandom_seed, seed\fR" 4 .IX Item "random_seed, seed" Set the seed for filling randomly the initial row, must be an integer included between 0 and \s-1UINT32_MAX\s0. If not specified, or if explicitly set to \-1, the filter will try to use a good random seed on a best effort basis. .IP "\fBrule\fR" 4 .IX Item "rule" Set the cellular automaton rule, it is a number ranging from 0 to 255. Default value is 110. .IP "\fBsize, s\fR" 4 .IX Item "size, s" Set the size of the output video. .Sp If \fBfilename\fR or \fBpattern\fR is specified, the size is set by default to the width of the specified initial state row, and the height is set to \fIwidth\fR * \s-1PHI\s0. .Sp If \fBsize\fR is set, it must contain the width of the specified pattern string, and the specified pattern will be centered in the larger row. .Sp If a filename or a pattern string is not specified, the size value defaults to \*(L"320x518\*(R" (used for a randomly generated initial state). .IP "\fBscroll\fR" 4 .IX Item "scroll" If set to 1, scroll the output upward when all the rows in the output have been already filled. If set to 0, the new generated row will be written over the top row just after the bottom row is filled. Defaults to 1. .IP "\fBstart_full, full\fR" 4 .IX Item "start_full, full" If set to 1, completely fill the output with generated rows before outputting the first frame. This is the default behavior, for disabling set the value to 0. .IP "\fBstitch\fR" 4 .IX Item "stitch" If set to 1, stitch the left and right row edges together. This is the default behavior, for disabling set the value to 0. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Read the initial state from \fIpattern\fR, and specify an output of size 200x400. .Sp .Vb 1 \& cellauto=f=pattern:s=200x400 .Ve .IP "\(bu" 4 Generate a random initial row with a width of 200 cells, with a fill ratio of 2/3: .Sp .Vb 1 \& cellauto=ratio=2/3:s=200x200 .Ve .IP "\(bu" 4 Create a pattern generated by rule 18 starting by a single alive cell centered on an initial row with width 100: .Sp .Vb 1 \& cellauto=p=@s=100x400:full=0:rule=18 .Ve .IP "\(bu" 4 Specify a more elaborated initial pattern: .Sp .Vb 1 \& cellauto=p=\*(Aq@@ @ @@\*(Aq:s=100x400:full=0:rule=18 .Ve .SS "mandelbrot" .IX Subsection "mandelbrot" Generate a Mandelbrot set fractal, and progressively zoom towards the point specified with \fIstart_x\fR and \fIstart_y\fR. .PP This source accepts the following options: .IP "\fBend_pts\fR" 4 .IX Item "end_pts" Set the terminal pts value. Default value is 400. .IP "\fBend_scale\fR" 4 .IX Item "end_scale" Set the terminal scale value. Must be a floating point value. Default value is 0.3. .IP "\fBinner\fR" 4 .IX Item "inner" Set the inner coloring mode, that is the algorithm used to draw the Mandelbrot fractal internal region. .Sp It shall assume one of the following values: .RS 4 .IP "\fBblack\fR" 4 .IX Item "black" Set black mode. .IP "\fBconvergence\fR" 4 .IX Item "convergence" Show time until convergence. .IP "\fBmincol\fR" 4 .IX Item "mincol" Set color based on point closest to the origin of the iterations. .IP "\fBperiod\fR" 4 .IX Item "period" Set period mode. .RE .RS 4 .Sp Default value is \fImincol\fR. .RE .IP "\fBbailout\fR" 4 .IX Item "bailout" Set the bailout value. Default value is 10.0. .IP "\fBmaxiter\fR" 4 .IX Item "maxiter" Set the maximum of iterations performed by the rendering algorithm. Default value is 7189. .IP "\fBouter\fR" 4 .IX Item "outer" Set outer coloring mode. It shall assume one of following values: .RS 4 .IP "\fBiteration_count\fR" 4 .IX Item "iteration_count" Set iteration cound mode. .IP "\fBnormalized_iteration_count\fR" 4 .IX Item "normalized_iteration_count" set normalized iteration count mode. .RE .RS 4 .Sp Default value is \fInormalized_iteration_count\fR. .RE .IP "\fBrate, r\fR" 4 .IX Item "rate, r" Set frame rate, expressed as number of frames per second. Default value is \*(L"25\*(R". .IP "\fBsize, s\fR" 4 .IX Item "size, s" Set frame size. Default value is \*(L"640x480\*(R". .IP "\fBstart_scale\fR" 4 .IX Item "start_scale" Set the initial scale value. Default value is 3.0. .IP "\fBstart_x\fR" 4 .IX Item "start_x" Set the initial x position. Must be a floating point value between \&\-100 and 100. Default value is \-0.743643887037158704752191506114774. .IP "\fBstart_y\fR" 4 .IX Item "start_y" Set the initial y position. Must be a floating point value between \&\-100 and 100. Default value is \-0.131825904205311970493132056385139. .SS "mptestsrc" .IX Subsection "mptestsrc" Generate various test patterns, as generated by the MPlayer test filter. .PP The size of the generated video is fixed, and is 256x256. This source is useful in particular for testing encoding features. .PP This source accepts the following options: .IP "\fBrate, r\fR" 4 .IX Item "rate, r" Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format \&\fIframe_rate_num\fR/\fIframe_rate_den\fR, an integer number, a float number or a valid video frame rate abbreviation. The default value is \&\*(L"25\*(R". .IP "\fBduration, d\fR" 4 .IX Item "duration, d" Set the video duration of the sourced video. The accepted syntax is: .Sp .Vb 2 \& [\-]HH:MM:SS[.m...] \& [\-]S+[.m...] .Ve .Sp See also the function \f(CW\*(C`av_parse_time()\*(C'\fR. .Sp If not specified, or the expressed duration is negative, the video is supposed to be generated forever. .IP "\fBtest, t\fR" 4 .IX Item "test, t" Set the number or the name of the test to perform. Supported tests are: .RS 4 .IP "\fBdc_luma\fR" 4 .IX Item "dc_luma" .PD 0 .IP "\fBdc_chroma\fR" 4 .IX Item "dc_chroma" .IP "\fBfreq_luma\fR" 4 .IX Item "freq_luma" .IP "\fBfreq_chroma\fR" 4 .IX Item "freq_chroma" .IP "\fBamp_luma\fR" 4 .IX Item "amp_luma" .IP "\fBamp_chroma\fR" 4 .IX Item "amp_chroma" .IP "\fBcbp\fR" 4 .IX Item "cbp" .IP "\fBmv\fR" 4 .IX Item "mv" .IP "\fBring1\fR" 4 .IX Item "ring1" .IP "\fBring2\fR" 4 .IX Item "ring2" .IP "\fBall\fR" 4 .IX Item "all" .RE .RS 4 .PD .Sp Default value is \*(L"all\*(R", which will cycle through the list of all tests. .RE .PP For example the following: .PP .Vb 1 \& testsrc=t=dc_luma .Ve .PP will generate a \*(L"dc_luma\*(R" test pattern. .SS "frei0r_src" .IX Subsection "frei0r_src" Provide a frei0r source. .PP To enable compilation of this filter you need to install the frei0r header and configure FFmpeg with \f(CW\*(C`\-\-enable\-frei0r\*(C'\fR. .PP This source accepts the following options: .IP "\fBsize\fR" 4 .IX Item "size" The size of the video to generate, may be a string of the form \&\fIwidth\fRx\fIheight\fR or a frame size abbreviation. .IP "\fBframerate\fR" 4 .IX Item "framerate" Framerate of the generated video, may be a string of the form \&\fInum\fR/\fIden\fR or a frame rate abbreviation. .IP "\fBfilter_name\fR" 4 .IX Item "filter_name" The name to the frei0r source to load. For more information regarding frei0r and how to set the parameters read the section frei0r in the description of the video filters. .IP "\fBfilter_params\fR" 4 .IX Item "filter_params" A '|'\-separated list of parameters to pass to the frei0r source. .PP For example, to generate a frei0r partik0l source with size 200x200 and frame rate 10 which is overlayed on the overlay filter main input: .PP .Vb 1 \& frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay .Ve .SS "life" .IX Subsection "life" Generate a life pattern. .PP This source is based on a generalization of John Conway's life game. .PP The sourced input represents a life grid, each pixel represents a cell which can be in one of two possible states, alive or dead. Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent. .PP At each interaction the grid evolves according to the adopted rule, which specifies the number of neighbor alive cells which will make a cell stay alive or born. The \fBrule\fR option allows to specify the rule to adopt. .PP This source accepts the following options: .IP "\fBfilename, f\fR" 4 .IX Item "filename, f" Set the file from which to read the initial grid state. In the file, each non-whitespace character is considered an alive cell, and newline is used to delimit the end of each row. .Sp If this option is not specified, the initial grid is generated randomly. .IP "\fBrate, r\fR" 4 .IX Item "rate, r" Set the video rate, that is the number of frames generated per second. Default is 25. .IP "\fBrandom_fill_ratio, ratio\fR" 4 .IX Item "random_fill_ratio, ratio" Set the random fill ratio for the initial random grid. It is a floating point number value ranging from 0 to 1, defaults to 1/PHI. It is ignored when a file is specified. .IP "\fBrandom_seed, seed\fR" 4 .IX Item "random_seed, seed" Set the seed for filling the initial random grid, must be an integer included between 0 and \s-1UINT32_MAX\s0. If not specified, or if explicitly set to \-1, the filter will try to use a good random seed on a best effort basis. .IP "\fBrule\fR" 4 .IX Item "rule" Set the life rule. .Sp A rule can be specified with a code of the kind "S\fI\s-1NS\s0\fR/B\fI\s-1NB\s0\fR", where \fI\s-1NS\s0\fR and \fI\s-1NB\s0\fR are sequences of numbers in the range 0\-8, \&\fI\s-1NS\s0\fR specifies the number of alive neighbor cells which make a live cell stay alive, and \fI\s-1NB\s0\fR the number of alive neighbor cells which make a dead cell to become alive (i.e. to \*(L"born\*(R"). \&\*(L"s\*(R" and \*(L"b\*(R" can be used in place of \*(L"S\*(R" and \*(L"B\*(R", respectively. .Sp Alternatively a rule can be specified by an 18\-bits integer. The 9 high order bits are used to encode the next cell state if it is alive for each number of neighbor alive cells, the low order bits specify the rule for \*(L"borning\*(R" new cells. Higher order bits encode for an higher number of neighbor cells. For example the number 6153 = \f(CW\*(C`(12<<9)+9\*(C'\fR specifies a stay alive rule of 12 and a born rule of 9, which corresponds to \*(L"S23/B03\*(R". .Sp Default value is \*(L"S23/B3\*(R", which is the original Conway's game of life rule, and will keep a cell alive if it has 2 or 3 neighbor alive cells, and will born a new cell if there are three alive cells around a dead cell. .IP "\fBsize, s\fR" 4 .IX Item "size, s" Set the size of the output video. .Sp If \fBfilename\fR is specified, the size is set by default to the same size of the input file. If \fBsize\fR is set, it must contain the size specified in the input file, and the initial grid defined in that file is centered in the larger resulting area. .Sp If a filename is not specified, the size value defaults to \*(L"320x240\*(R" (used for a randomly generated initial grid). .IP "\fBstitch\fR" 4 .IX Item "stitch" If set to 1, stitch the left and right grid edges together, and the top and bottom edges also. Defaults to 1. .IP "\fBmold\fR" 4 .IX Item "mold" Set cell mold speed. If set, a dead cell will go from \fBdeath_color\fR to \&\fBmold_color\fR with a step of \fBmold\fR. \fBmold\fR can have a value from 0 to 255. .IP "\fBlife_color\fR" 4 .IX Item "life_color" Set the color of living (or new born) cells. .IP "\fBdeath_color\fR" 4 .IX Item "death_color" Set the color of dead cells. If \fBmold\fR is set, this is the first color used to represent a dead cell. .IP "\fBmold_color\fR" 4 .IX Item "mold_color" Set mold color, for definitely dead and moldy cells. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Read a grid from \fIpattern\fR, and center it on a grid of size 300x300 pixels: .Sp .Vb 1 \& life=f=pattern:s=300x300 .Ve .IP "\(bu" 4 Generate a random grid of size 200x200, with a fill ratio of 2/3: .Sp .Vb 1 \& life=ratio=2/3:s=200x200 .Ve .IP "\(bu" 4 Specify a custom rule for evolving a randomly generated grid: .Sp .Vb 1 \& life=rule=S14/B34 .Ve .IP "\(bu" 4 Full example with slow death effect (mold) using \fBffplay\fR: .Sp .Vb 1 \& ffplay \-f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16 .Ve .SS "color, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc" .IX Subsection "color, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc" The \f(CW\*(C`color\*(C'\fR source provides an uniformly colored input. .PP The \f(CW\*(C`nullsrc\*(C'\fR source returns unprocessed video frames. It is mainly useful to be employed in analysis / debugging tools, or as the source for filters which ignore the input data. .PP The \f(CW\*(C`rgbtestsrc\*(C'\fR source generates an \s-1RGB\s0 test pattern useful for detecting \s-1RGB\s0 vs \s-1BGR\s0 issues. You should see a red, green and blue stripe from top to bottom. .PP The \f(CW\*(C`smptebars\*(C'\fR source generates a color bars pattern, based on the \s-1SMPTE\s0 Engineering Guideline \s-1EG\s0 1\-1990. .PP The \f(CW\*(C`smptehdbars\*(C'\fR source generates a color bars pattern, based on the \s-1SMPTE\s0 \s-1RP\s0 219\-2002. .PP The \f(CW\*(C`testsrc\*(C'\fR source generates a test video pattern, showing a color pattern, a scrolling gradient and a timestamp. This is mainly intended for testing purposes. .PP The sources accept the following options: .IP "\fBcolor, c\fR" 4 .IX Item "color, c" Specify the color of the source, only used in the \f(CW\*(C`color\*(C'\fR source. It can be the name of a color (case insensitive match) or a 0xRRGGBB[\s-1AA\s0] sequence, possibly followed by an alpha specifier. The default value is \*(L"black\*(R". .IP "\fBsize, s\fR" 4 .IX Item "size, s" Specify the size of the sourced video, it may be a string of the form \&\fIwidth\fRx\fIheight\fR, or the name of a size abbreviation. The default value is \*(L"320x240\*(R". .IP "\fBrate, r\fR" 4 .IX Item "rate, r" Specify the frame rate of the sourced video, as the number of frames generated per second. It has to be a string in the format \&\fIframe_rate_num\fR/\fIframe_rate_den\fR, an integer number, a float number or a valid video frame rate abbreviation. The default value is \&\*(L"25\*(R". .IP "\fBsar\fR" 4 .IX Item "sar" Set the sample aspect ratio of the sourced video. .IP "\fBduration, d\fR" 4 .IX Item "duration, d" Set the video duration of the sourced video. The accepted syntax is: .Sp .Vb 2 \& [\-]HH[:MM[:SS[.m...]]] \& [\-]S+[.m...] .Ve .Sp See also the function \f(CW\*(C`av_parse_time()\*(C'\fR. .Sp If not specified, or the expressed duration is negative, the video is supposed to be generated forever. .IP "\fBdecimals, n\fR" 4 .IX Item "decimals, n" Set the number of decimals to show in the timestamp, only used in the \&\f(CW\*(C`testsrc\*(C'\fR source. .Sp The displayed timestamp value will correspond to the original timestamp value multiplied by the power of 10 of the specified value. Default value is 0. .PP For example the following: .PP .Vb 1 \& testsrc=duration=5.3:size=qcif:rate=10 .Ve .PP will generate a video with a duration of 5.3 seconds, with size 176x144 and a frame rate of 10 frames per second. .PP The following graph description will generate a red source with an opacity of 0.2, with size \*(L"qcif\*(R" and a frame rate of 10 frames per second. .PP .Vb 1 \& color=c=red@0.2:s=qcif:r=10 .Ve .PP If the input content is to be ignored, \f(CW\*(C`nullsrc\*(C'\fR can be used. The following command generates noise in the luminance plane by employing the \f(CW\*(C`geq\*(C'\fR filter: .PP .Vb 1 \& nullsrc=s=256x256, geq=random(1)*255:128:128 .Ve .SH "VIDEO SINKS" .IX Header "VIDEO SINKS" Below is a description of the currently available video sinks. .SS "buffersink" .IX Subsection "buffersink" Buffer video frames, and make them available to the end of the filter graph. .PP This sink is mainly intended for a programmatic use, in particular through the interface defined in \fIlibavfilter/buffersink.h\fR or the options system. .PP It accepts a pointer to an AVBufferSinkContext structure, which defines the incoming buffers' formats, to be passed as the opaque parameter to \f(CW\*(C`avfilter_init_filter\*(C'\fR for initialization. .SS "nullsink" .IX Subsection "nullsink" Null video sink, do absolutely nothing with the input video. It is mainly useful as a template and to be employed in analysis / debugging tools. .SH "MULTIMEDIA FILTERS" .IX Header "MULTIMEDIA FILTERS" Below is a description of the currently available multimedia filters. .SS "aperms, perms" .IX Subsection "aperms, perms" Set read/write permissions for the output frames. .PP These filters are mainly aimed at developers to test direct path in the following filter in the filtergraph. .PP The filters accept the following options: .IP "\fBmode\fR" 4 .IX Item "mode" Select the permissions mode. .Sp It accepts the following values: .RS 4 .IP "\fBnone\fR" 4 .IX Item "none" Do nothing. This is the default. .IP "\fBro\fR" 4 .IX Item "ro" Set all the output frames read-only. .IP "\fBrw\fR" 4 .IX Item "rw" Set all the output frames directly writable. .IP "\fBtoggle\fR" 4 .IX Item "toggle" Make the frame read-only if writable, and writable if read-only. .IP "\fBrandom\fR" 4 .IX Item "random" Set each output frame read-only or writable randomly. .RE .RS 4 .RE .IP "\fBseed\fR" 4 .IX Item "seed" Set the seed for the \fIrandom\fR mode, must be an integer included between \&\f(CW0\fR and \f(CW\*(C`UINT32_MAX\*(C'\fR. If not specified, or if explicitly set to \&\f(CW\*(C`\-1\*(C'\fR, the filter will try to use a good random seed on a best effort basis. .PP Note: in case of auto-inserted filter between the permission filter and the following one, the permission might not be received as expected in that following filter. Inserting a format or aformat filter before the perms/aperms filter can avoid this problem. .SS "aselect, select" .IX Subsection "aselect, select" Select frames to pass in output. .PP This filter accepts the following options: .IP "\fBexpr, e\fR" 4 .IX Item "expr, e" Set expression, which is evaluated for each input frame. .Sp If the expression is evaluated to zero, the frame is discarded. .Sp If the evaluation result is negative or NaN, the frame is sent to the first output; otherwise it is sent to the output with index \&\f(CW\*(C`ceil(val)\-1\*(C'\fR, assuming that the input index starts from 0. .Sp For example a value of \f(CW1.2\fR corresponds to the output with index \&\f(CW\*(C`ceil(1.2)\-1 = 2\-1 = 1\*(C'\fR, that is the second output. .IP "\fBoutputs, n\fR" 4 .IX Item "outputs, n" Set the number of outputs. The output to which to send the selected frame is based on the result of the evaluation. Default value is 1. .PP The expression can contain the following constants: .IP "\fBn\fR" 4 .IX Item "n" the sequential number of the filtered frame, starting from 0 .IP "\fBselected_n\fR" 4 .IX Item "selected_n" the sequential number of the selected frame, starting from 0 .IP "\fBprev_selected_n\fR" 4 .IX Item "prev_selected_n" the sequential number of the last selected frame, \s-1NAN\s0 if undefined .IP "\fB\s-1TB\s0\fR" 4 .IX Item "TB" timebase of the input timestamps .IP "\fBpts\fR" 4 .IX Item "pts" the \s-1PTS\s0 (Presentation TimeStamp) of the filtered video frame, expressed in \fI\s-1TB\s0\fR units, \s-1NAN\s0 if undefined .IP "\fBt\fR" 4 .IX Item "t" the \s-1PTS\s0 (Presentation TimeStamp) of the filtered video frame, expressed in seconds, \s-1NAN\s0 if undefined .IP "\fBprev_pts\fR" 4 .IX Item "prev_pts" the \s-1PTS\s0 of the previously filtered video frame, \s-1NAN\s0 if undefined .IP "\fBprev_selected_pts\fR" 4 .IX Item "prev_selected_pts" the \s-1PTS\s0 of the last previously filtered video frame, \s-1NAN\s0 if undefined .IP "\fBprev_selected_t\fR" 4 .IX Item "prev_selected_t" the \s-1PTS\s0 of the last previously selected video frame, \s-1NAN\s0 if undefined .IP "\fBstart_pts\fR" 4 .IX Item "start_pts" the \s-1PTS\s0 of the first video frame in the video, \s-1NAN\s0 if undefined .IP "\fBstart_t\fR" 4 .IX Item "start_t" the time of the first video frame in the video, \s-1NAN\s0 if undefined .IP "\fBpict_type\fR \fI(video only)\fR" 4 .IX Item "pict_type (video only)" the type of the filtered frame, can assume one of the following values: .RS 4 .IP "\fBI\fR" 4 .IX Item "I" .PD 0 .IP "\fBP\fR" 4 .IX Item "P" .IP "\fBB\fR" 4 .IX Item "B" .IP "\fBS\fR" 4 .IX Item "S" .IP "\fB\s-1SI\s0\fR" 4 .IX Item "SI" .IP "\fB\s-1SP\s0\fR" 4 .IX Item "SP" .IP "\fB\s-1BI\s0\fR" 4 .IX Item "BI" .RE .RS 4 .RE .IP "\fBinterlace_type\fR \fI(video only)\fR" 4 .IX Item "interlace_type (video only)" .PD the frame interlace type, can assume one of the following values: .RS 4 .IP "\fB\s-1PROGRESSIVE\s0\fR" 4 .IX Item "PROGRESSIVE" the frame is progressive (not interlaced) .IP "\fB\s-1TOPFIRST\s0\fR" 4 .IX Item "TOPFIRST" the frame is top-field-first .IP "\fB\s-1BOTTOMFIRST\s0\fR" 4 .IX Item "BOTTOMFIRST" the frame is bottom-field-first .RE .RS 4 .RE .IP "\fBconsumed_sample_n\fR \fI(audio only)\fR" 4 .IX Item "consumed_sample_n (audio only)" the number of selected samples before the current frame .IP "\fBsamples_n\fR \fI(audio only)\fR" 4 .IX Item "samples_n (audio only)" the number of samples in the current frame .IP "\fBsample_rate\fR \fI(audio only)\fR" 4 .IX Item "sample_rate (audio only)" the input sample rate .IP "\fBkey\fR" 4 .IX Item "key" 1 if the filtered frame is a key-frame, 0 otherwise .IP "\fBpos\fR" 4 .IX Item "pos" the position in the file of the filtered frame, \-1 if the information is not available (e.g. for synthetic video) .IP "\fBscene\fR \fI(video only)\fR" 4 .IX Item "scene (video only)" value between 0 and 1 to indicate a new scene; a low value reflects a low probability for the current frame to introduce a new scene, while a higher value means the current frame is more likely to be one (see the example below) .PP The default value of the select expression is \*(L"1\*(R". .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Select all frames in input: .Sp .Vb 1 \& select .Ve .Sp The example above is the same as: .Sp .Vb 1 \& select=1 .Ve .IP "\(bu" 4 Skip all frames: .Sp .Vb 1 \& select=0 .Ve .IP "\(bu" 4 Select only I\-frames: .Sp .Vb 1 \& select=\*(Aqeq(pict_type\e,I)\*(Aq .Ve .IP "\(bu" 4 Select one frame every 100: .Sp .Vb 1 \& select=\*(Aqnot(mod(n\e,100))\*(Aq .Ve .IP "\(bu" 4 Select only frames contained in the 10\-20 time interval: .Sp .Vb 1 \& select=\*(Aqgte(t\e,10)*lte(t\e,20)\*(Aq .Ve .IP "\(bu" 4 Select only I frames contained in the 10\-20 time interval: .Sp .Vb 1 \& select=\*(Aqgte(t\e,10)*lte(t\e,20)*eq(pict_type\e,I)\*(Aq .Ve .IP "\(bu" 4 Select frames with a minimum distance of 10 seconds: .Sp .Vb 1 \& select=\*(Aqisnan(prev_selected_t)+gte(t\-prev_selected_t\e,10)\*(Aq .Ve .IP "\(bu" 4 Use aselect to select only audio frames with samples number > 100: .Sp .Vb 1 \& aselect=\*(Aqgt(samples_n\e,100)\*(Aq .Ve .IP "\(bu" 4 Create a mosaic of the first scenes: .Sp .Vb 1 \& ffmpeg \-i video.avi \-vf select=\*(Aqgt(scene\e,0.4)\*(Aq,scale=160:120,tile \-frames:v 1 preview.png .Ve .Sp Comparing \fIscene\fR against a value between 0.3 and 0.5 is generally a sane choice. .IP "\(bu" 4 Send even and odd frames to separate outputs, and compose them: .Sp .Vb 1 \& select=n=2:e=\*(Aqmod(n, 2)+1\*(Aq [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h .Ve .SS "asendcmd, sendcmd" .IX Subsection "asendcmd, sendcmd" Send commands to filters in the filtergraph. .PP These filters read commands to be sent to other filters in the filtergraph. .PP \&\f(CW\*(C`asendcmd\*(C'\fR must be inserted between two audio filters, \&\f(CW\*(C`sendcmd\*(C'\fR must be inserted between two video filters, but apart from that they act the same way. .PP The specification of commands can be provided in the filter arguments with the \fIcommands\fR option, or in a file specified by the \&\fIfilename\fR option. .PP These filters accept the following options: .IP "\fBcommands, c\fR" 4 .IX Item "commands, c" Set the commands to be read and sent to the other filters. .IP "\fBfilename, f\fR" 4 .IX Item "filename, f" Set the filename of the commands to be read and sent to the other filters. .PP \fICommands syntax\fR .IX Subsection "Commands syntax" .PP A commands description consists of a sequence of interval specifications, comprising a list of commands to be executed when a particular event related to that interval occurs. The occurring event is typically the current frame time entering or leaving a given time interval. .PP An interval is specified by the following syntax: .PP .Vb 1 \& <START>[\-<END>] <COMMANDS>; .Ve .PP The time interval is specified by the \fI\s-1START\s0\fR and \fI\s-1END\s0\fR times. \&\fI\s-1END\s0\fR is optional and defaults to the maximum time. .PP The current frame time is considered within the specified interval if it is included in the interval [\fI\s-1START\s0\fR, \fI\s-1END\s0\fR), that is when the time is greater or equal to \fI\s-1START\s0\fR and is lesser than \&\fI\s-1END\s0\fR. .PP \&\fI\s-1COMMANDS\s0\fR consists of a sequence of one or more command specifications, separated by \*(L",\*(R", relating to that interval. The syntax of a command specification is given by: .PP .Vb 1 \& [<FLAGS>] <TARGET> <COMMAND> <ARG> .Ve .PP \&\fI\s-1FLAGS\s0\fR is optional and specifies the type of events relating to the time interval which enable sending the specified command, and must be a non-null sequence of identifier flags separated by \*(L"+\*(R" or \*(L"|\*(R" and enclosed between \*(L"[\*(R" and \*(L"]\*(R". .PP The following flags are recognized: .IP "\fBenter\fR" 4 .IX Item "enter" The command is sent when the current frame timestamp enters the specified interval. In other words, the command is sent when the previous frame timestamp was not in the given interval, and the current is. .IP "\fBleave\fR" 4 .IX Item "leave" The command is sent when the current frame timestamp leaves the specified interval. In other words, the command is sent when the previous frame timestamp was in the given interval, and the current is not. .PP If \fI\s-1FLAGS\s0\fR is not specified, a default value of \f(CW\*(C`[enter]\*(C'\fR is assumed. .PP \&\fI\s-1TARGET\s0\fR specifies the target of the command, usually the name of the filter class or a specific filter instance name. .PP \&\fI\s-1COMMAND\s0\fR specifies the name of the command for the target filter. .PP \&\fI\s-1ARG\s0\fR is optional and specifies the optional list of argument for the given \fI\s-1COMMAND\s0\fR. .PP Between one interval specification and another, whitespaces, or sequences of characters starting with \f(CW\*(C`#\*(C'\fR until the end of line, are ignored and can be used to annotate comments. .PP A simplified \s-1BNF\s0 description of the commands specification syntax follows: .PP .Vb 6 \& <COMMAND_FLAG> ::= "enter" | "leave" \& <COMMAND_FLAGS> ::= <COMMAND_FLAG> [(+|"|")<COMMAND_FLAG>] \& <COMMAND> ::= ["[" <COMMAND_FLAGS> "]"] <TARGET> <COMMAND> [<ARG>] \& <COMMANDS> ::= <COMMAND> [,<COMMANDS>] \& <INTERVAL> ::= <START>[\-<END>] <COMMANDS> \& <INTERVALS> ::= <INTERVAL>[;<INTERVALS>] .Ve .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Specify audio tempo change at second 4: .Sp .Vb 1 \& asendcmd=c=\*(Aq4.0 atempo tempo 1.5\*(Aq,atempo .Ve .IP "\(bu" 4 Specify a list of drawtext and hue commands in a file. .Sp .Vb 3 \& # show text in the interval 5\-10 \& 5.0\-10.0 [enter] drawtext reinit \*(Aqfontfile=FreeSerif.ttf:text=hello world\*(Aq, \& [leave] drawtext reinit \*(Aqfontfile=FreeSerif.ttf:text=\*(Aq; \& \& # desaturate the image in the interval 15\-20 \& 15.0\-20.0 [enter] hue s 0, \& [enter] drawtext reinit \*(Aqfontfile=FreeSerif.ttf:text=nocolor\*(Aq, \& [leave] hue s 1, \& [leave] drawtext reinit \*(Aqfontfile=FreeSerif.ttf:text=color\*(Aq; \& \& # apply an exponential saturation fade\-out effect, starting from time 25 \& 25 [enter] hue s exp(25\-t) .Ve .Sp A filtergraph allowing to read and process the above command list stored in a file \fItest.cmd\fR, can be specified with: .Sp .Vb 1 \& sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text=\*(Aq\*(Aq,hue .Ve .SS "asetpts, setpts" .IX Subsection "asetpts, setpts" Change the \s-1PTS\s0 (presentation timestamp) of the input frames. .PP \&\f(CW\*(C`asetpts\*(C'\fR works on audio frames, \f(CW\*(C`setpts\*(C'\fR on video frames. .PP This filter accepts the following options: .IP "\fBexpr\fR" 4 .IX Item "expr" The expression which is evaluated for each frame to construct its timestamp. .PP The expression is evaluated through the eval \s-1API\s0 and can contain the following constants: .IP "\fB\s-1FRAME_RATE\s0\fR" 4 .IX Item "FRAME_RATE" frame rate, only defined for constant frame-rate video .IP "\fB\s-1PTS\s0\fR" 4 .IX Item "PTS" the presentation timestamp in input .IP "\fBN\fR" 4 .IX Item "N" the count of the input frame, starting from 0. .IP "\fB\s-1NB_CONSUMED_SAMPLES\s0\fR" 4 .IX Item "NB_CONSUMED_SAMPLES" the number of consumed samples, not including the current frame (only audio) .IP "\fB\s-1NB_SAMPLES\s0\fR" 4 .IX Item "NB_SAMPLES" the number of samples in the current frame (only audio) .IP "\fB\s-1SAMPLE_RATE\s0\fR" 4 .IX Item "SAMPLE_RATE" audio sample rate .IP "\fB\s-1STARTPTS\s0\fR" 4 .IX Item "STARTPTS" the \s-1PTS\s0 of the first frame .IP "\fB\s-1STARTT\s0\fR" 4 .IX Item "STARTT" the time in seconds of the first frame .IP "\fB\s-1INTERLACED\s0\fR" 4 .IX Item "INTERLACED" tell if the current frame is interlaced .IP "\fBT\fR" 4 .IX Item "T" the time in seconds of the current frame .IP "\fB\s-1TB\s0\fR" 4 .IX Item "TB" the time base .IP "\fB\s-1POS\s0\fR" 4 .IX Item "POS" original position in the file of the frame, or undefined if undefined for the current frame .IP "\fB\s-1PREV_INPTS\s0\fR" 4 .IX Item "PREV_INPTS" previous input \s-1PTS\s0 .IP "\fB\s-1PREV_INT\s0\fR" 4 .IX Item "PREV_INT" previous input time in seconds .IP "\fB\s-1PREV_OUTPTS\s0\fR" 4 .IX Item "PREV_OUTPTS" previous output \s-1PTS\s0 .IP "\fB\s-1PREV_OUTT\s0\fR" 4 .IX Item "PREV_OUTT" previous output time in seconds .IP "\fB\s-1RTCTIME\s0\fR" 4 .IX Item "RTCTIME" wallclock (\s-1RTC\s0) time in microseconds. This is deprecated, use \fItime\fR\|(0) instead. .IP "\fB\s-1RTCSTART\s0\fR" 4 .IX Item "RTCSTART" wallclock (\s-1RTC\s0) time at the start of the movie in microseconds .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Start counting \s-1PTS\s0 from zero .Sp .Vb 1 \& setpts=PTS\-STARTPTS .Ve .IP "\(bu" 4 Apply fast motion effect: .Sp .Vb 1 \& setpts=0.5*PTS .Ve .IP "\(bu" 4 Apply slow motion effect: .Sp .Vb 1 \& setpts=2.0*PTS .Ve .IP "\(bu" 4 Set fixed rate of 25 frames per second: .Sp .Vb 1 \& setpts=N/(25*TB) .Ve .IP "\(bu" 4 Set fixed rate 25 fps with some jitter: .Sp .Vb 1 \& setpts=\*(Aq1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))\*(Aq .Ve .IP "\(bu" 4 Apply an offset of 10 seconds to the input \s-1PTS:\s0 .Sp .Vb 1 \& setpts=PTS+10/TB .Ve .IP "\(bu" 4 Generate timestamps from a \*(L"live source\*(R" and rebase onto the current timebase: .Sp .Vb 1 \& setpts=\*(Aq(RTCTIME \- RTCSTART) / (TB * 1000000)\*(Aq .Ve .SS "ebur128" .IX Subsection "ebur128" \&\s-1EBU\s0 R128 scanner filter. This filter takes an audio stream as input and outputs it unchanged. By default, it logs a message at a frequency of 10Hz with the Momentary loudness (identified by \f(CW\*(C`M\*(C'\fR), Short-term loudness (\f(CW\*(C`S\*(C'\fR), Integrated loudness (\f(CW\*(C`I\*(C'\fR) and Loudness Range (\f(CW\*(C`LRA\*(C'\fR). .PP The filter also has a video output (see the \fIvideo\fR option) with a real time graph to observe the loudness evolution. The graphic contains the logged message mentioned above, so it is not printed anymore when this option is set, unless the verbose logging is set. The main graphing area contains the short-term loudness (3 seconds of analysis), and the gauge on the right is for the momentary loudness (400 milliseconds). .PP More information about the Loudness Recommendation \s-1EBU\s0 R128 on <\fBhttp://tech.ebu.ch/loudness\fR>. .PP The filter accepts the following options: .IP "\fBvideo\fR" 4 .IX Item "video" Activate the video output. The audio stream is passed unchanged whether this option is set or no. The video stream will be the first output stream if activated. Default is \f(CW0\fR. .IP "\fBsize\fR" 4 .IX Item "size" Set the video size. This option is for video only. Default and minimum resolution is \f(CW\*(C`640x480\*(C'\fR. .IP "\fBmeter\fR" 4 .IX Item "meter" Set the \s-1EBU\s0 scale meter. Default is \f(CW9\fR. Common values are \f(CW9\fR and \&\f(CW18\fR, respectively for \s-1EBU\s0 scale meter +9 and \s-1EBU\s0 scale meter +18. Any other integer value between this range is allowed. .IP "\fBmetadata\fR" 4 .IX Item "metadata" Set metadata injection. If set to \f(CW1\fR, the audio input will be segmented into 100ms output frames, each of them containing various loudness information in metadata. All the metadata keys are prefixed with \f(CW\*(C`lavfi.r128.\*(C'\fR. .Sp Default is \f(CW0\fR. .IP "\fBframelog\fR" 4 .IX Item "framelog" Force the frame logging level. .Sp Available values are: .RS 4 .IP "\fBinfo\fR" 4 .IX Item "info" information logging level .IP "\fBverbose\fR" 4 .IX Item "verbose" verbose logging level .RE .RS 4 .Sp By default, the logging level is set to \fIinfo\fR. If the \fBvideo\fR or the \fBmetadata\fR options are set, it switches to \fIverbose\fR. .RE .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Real-time graph using \fBffplay\fR, with a \s-1EBU\s0 scale meter +18: .Sp .Vb 1 \& ffplay \-f lavfi \-i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]" .Ve .IP "\(bu" 4 Run an analysis with \fBffmpeg\fR: .Sp .Vb 1 \& ffmpeg \-nostats \-i input.mp3 \-filter_complex ebur128 \-f null \- .Ve .SS "settb, asettb" .IX Subsection "settb, asettb" Set the timebase to use for the output frames timestamps. It is mainly useful for testing timebase configuration. .PP This filter accepts the following options: .IP "\fBexpr, tb\fR" 4 .IX Item "expr, tb" The expression which is evaluated into the output timebase. .PP The value for \fBtb\fR is an arithmetic expression representing a rational. The expression can contain the constants \*(L"\s-1AVTB\s0\*(R" (the default timebase), \*(L"intb\*(R" (the input timebase) and \*(L"sr\*(R" (the sample rate, audio only). Default value is \*(L"intb\*(R". .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Set the timebase to 1/25: .Sp .Vb 1 \& settb=expr=1/25 .Ve .IP "\(bu" 4 Set the timebase to 1/10: .Sp .Vb 1 \& settb=expr=0.1 .Ve .IP "\(bu" 4 Set the timebase to 1001/1000: .Sp .Vb 1 \& settb=1+0.001 .Ve .IP "\(bu" 4 Set the timebase to 2*intb: .Sp .Vb 1 \& settb=2*intb .Ve .IP "\(bu" 4 Set the default timebase value: .Sp .Vb 1 \& settb=AVTB .Ve .SS "concat" .IX Subsection "concat" Concatenate audio and video streams, joining them together one after the other. .PP The filter works on segments of synchronized video and audio streams. All segments must have the same number of streams of each type, and that will also be the number of streams at output. .PP The filter accepts the following options: .IP "\fBn\fR" 4 .IX Item "n" Set the number of segments. Default is 2. .IP "\fBv\fR" 4 .IX Item "v" Set the number of output video streams, that is also the number of video streams in each segment. Default is 1. .IP "\fBa\fR" 4 .IX Item "a" Set the number of output audio streams, that is also the number of video streams in each segment. Default is 0. .IP "\fBunsafe\fR" 4 .IX Item "unsafe" Activate unsafe mode: do not fail if segments have a different format. .PP The filter has \fIv\fR+\fIa\fR outputs: first \fIv\fR video outputs, then \&\fIa\fR audio outputs. .PP There are \fIn\fRx(\fIv\fR+\fIa\fR) inputs: first the inputs for the first segment, in the same order as the outputs, then the inputs for the second segment, etc. .PP Related streams do not always have exactly the same duration, for various reasons including codec frame size or sloppy authoring. For that reason, related synchronized streams (e.g. a video and its audio track) should be concatenated at once. The concat filter will use the duration of the longest stream in each segment (except the last one), and if necessary pad shorter audio streams with silence. .PP For this filter to work correctly, all segments must start at timestamp 0. .PP All corresponding streams must have the same parameters in all segments; the filtering system will automatically select a common pixel format for video streams, and a common sample format, sample rate and channel layout for audio streams, but other settings, such as resolution, must be converted explicitly by the user. .PP Different frame rates are acceptable but will result in variable frame rate at output; be sure to configure the output file to handle it. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Concatenate an opening, an episode and an ending, all in bilingual version (video in stream 0, audio in streams 1 and 2): .Sp .Vb 4 \& ffmpeg \-i opening.mkv \-i episode.mkv \-i ending.mkv \-filter_complex \e \& \*(Aq[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2] \& concat=n=3:v=1:a=2 [v] [a1] [a2]\*(Aq \e \& \-map \*(Aq[v]\*(Aq \-map \*(Aq[a1]\*(Aq \-map \*(Aq[a2]\*(Aq output.mkv .Ve .IP "\(bu" 4 Concatenate two parts, handling audio and video separately, using the (a)movie sources, and adjusting the resolution: .Sp .Vb 3 \& movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ; \& movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ; \& [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa] .Ve .Sp Note that a desync will happen at the stitch if the audio and video streams do not have exactly the same duration in the first file. .SS "showspectrum" .IX Subsection "showspectrum" Convert input audio to a video output, representing the audio frequency spectrum. .PP The filter accepts the following options: .IP "\fBsize, s\fR" 4 .IX Item "size, s" Specify the video size for the output. Default value is \f(CW\*(C`640x512\*(C'\fR. .IP "\fBslide\fR" 4 .IX Item "slide" Specify if the spectrum should slide along the window. Default value is \&\f(CW0\fR. .IP "\fBmode\fR" 4 .IX Item "mode" Specify display mode. .Sp It accepts the following values: .RS 4 .IP "\fBcombined\fR" 4 .IX Item "combined" all channels are displayed in the same row .IP "\fBseparate\fR" 4 .IX Item "separate" all channels are displayed in separate rows .RE .RS 4 .Sp Default value is \fBcombined\fR. .RE .IP "\fBcolor\fR" 4 .IX Item "color" Specify display color mode. .Sp It accepts the following values: .RS 4 .IP "\fBchannel\fR" 4 .IX Item "channel" each channel is displayed in a separate color .IP "\fBintensity\fR" 4 .IX Item "intensity" each channel is is displayed using the same color scheme .RE .RS 4 .Sp Default value is \fBchannel\fR. .RE .IP "\fBscale\fR" 4 .IX Item "scale" Specify scale used for calculating intensity color values. .Sp It accepts the following values: .RS 4 .IP "\fBlin\fR" 4 .IX Item "lin" linear .IP "\fBsqrt\fR" 4 .IX Item "sqrt" square root, default .IP "\fBcbrt\fR" 4 .IX Item "cbrt" cubic root .IP "\fBlog\fR" 4 .IX Item "log" logarithmic .RE .RS 4 .Sp Default value is \fBsqrt\fR. .RE .IP "\fBsaturation\fR" 4 .IX Item "saturation" Set saturation modifier for displayed colors. Negative values provide alternative color scheme. \f(CW0\fR is no saturation at all. Saturation must be in [\-10.0, 10.0] range. Default value is \f(CW1\fR. .PP The usage is very similar to the showwaves filter; see the examples in that section. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Large window with logarithmic color scaling: .Sp .Vb 1 \& showspectrum=s=1280x480:scale=log .Ve .IP "\(bu" 4 Complete example for a colored and sliding spectrum per channel using \fBffplay\fR: .Sp .Vb 2 \& ffplay \-f lavfi \*(Aqamovie=input.mp3, asplit [a][out1]; \& [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]\*(Aq .Ve .SS "showwaves" .IX Subsection "showwaves" Convert input audio to a video output, representing the samples waves. .PP The filter accepts the following options: .IP "\fBsize, s\fR" 4 .IX Item "size, s" Specify the video size for the output. Default value is \*(L"600x240\*(R". .IP "\fBmode\fR" 4 .IX Item "mode" Set display mode. .Sp Available values are: .RS 4 .IP "\fBpoint\fR" 4 .IX Item "point" Draw a point for each sample. .IP "\fBline\fR" 4 .IX Item "line" Draw a vertical line for each sample. .RE .RS 4 .Sp Default value is \f(CW\*(C`point\*(C'\fR. .RE .IP "\fBn\fR" 4 .IX Item "n" Set the number of samples which are printed on the same column. A larger value will decrease the frame rate. Must be a positive integer. This option can be set only if the value for \fIrate\fR is not explicitly specified. .IP "\fBrate, r\fR" 4 .IX Item "rate, r" Set the (approximate) output frame rate. This is done by setting the option \fIn\fR. Default value is \*(L"25\*(R". .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Output the input file audio and the corresponding video representation at the same time: .Sp .Vb 1 \& amovie=a.mp3,asplit[out0],showwaves[out1] .Ve .IP "\(bu" 4 Create a synthetic signal and show it with showwaves, forcing a frame rate of 30 frames per second: .Sp .Vb 1 \& aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1] .Ve .SS "split, asplit" .IX Subsection "split, asplit" Split input into several identical outputs. .PP \&\f(CW\*(C`asplit\*(C'\fR works with audio input, \f(CW\*(C`split\*(C'\fR with video. .PP The filter accepts a single parameter which specifies the number of outputs. If unspecified, it defaults to 2. .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Create two separate outputs from the same input: .Sp .Vb 1 \& [in] split [out0][out1] .Ve .IP "\(bu" 4 To create 3 or more outputs, you need to specify the number of outputs, like in: .Sp .Vb 1 \& [in] asplit=3 [out0][out1][out2] .Ve .IP "\(bu" 4 Create two separate outputs from the same input, one cropped and one padded: .Sp .Vb 3 \& [in] split [splitout1][splitout2]; \& [splitout1] crop=100:100:0:0 [cropout]; \& [splitout2] pad=200:200:100:100 [padout]; .Ve .IP "\(bu" 4 Create 5 copies of the input audio with \fBffmpeg\fR: .Sp .Vb 1 \& ffmpeg \-i INPUT \-filter_complex asplit=5 OUTPUT .Ve .SH "MULTIMEDIA SOURCES" .IX Header "MULTIMEDIA SOURCES" Below is a description of the currently available multimedia sources. .SS "amovie" .IX Subsection "amovie" This is the same as movie source, except it selects an audio stream by default. .SS "movie" .IX Subsection "movie" Read audio and/or video stream(s) from a movie container. .PP This filter accepts the following options: .IP "\fBfilename\fR" 4 .IX Item "filename" The name of the resource to read (not necessarily a file but also a device or a stream accessed through some protocol). .IP "\fBformat_name, f\fR" 4 .IX Item "format_name, f" Specifies the format assumed for the movie to read, and can be either the name of a container or an input device. If not specified the format is guessed from \fImovie_name\fR or by probing. .IP "\fBseek_point, sp\fR" 4 .IX Item "seek_point, sp" Specifies the seek point in seconds, the frames will be output starting from this seek point, the parameter is evaluated with \&\f(CW\*(C`av_strtod\*(C'\fR so the numerical value may be suffixed by an \s-1IS\s0 postfix. Default value is \*(L"0\*(R". .IP "\fBstreams, s\fR" 4 .IX Item "streams, s" Specifies the streams to read. Several streams can be specified, separated by \*(L"+\*(R". The source will then have as many outputs, in the same order. The syntax is explained in the ``Stream specifiers'' section in the ffmpeg manual. Two special names, \*(L"dv\*(R" and \*(L"da\*(R" specify respectively the default (best suited) video and audio stream. Default is \*(L"dv\*(R", or \*(L"da\*(R" if the filter is called as \*(L"amovie\*(R". .IP "\fBstream_index, si\fR" 4 .IX Item "stream_index, si" Specifies the index of the video stream to read. If the value is \-1, the best suited video stream will be automatically selected. Default value is \*(L"\-1\*(R". Deprecated. If the filter is called \*(L"amovie\*(R", it will select audio instead of video. .IP "\fBloop\fR" 4 .IX Item "loop" Specifies how many times to read the stream in sequence. If the value is less than 1, the stream will be read again and again. Default value is \*(L"1\*(R". .Sp Note that when the movie is looped the source timestamps are not changed, so it will generate non monotonically increasing timestamps. .PP This filter allows to overlay a second video on top of main input of a filtergraph as shown in this graph: .PP .Vb 4 \& input \-\-\-\-\-\-\-\-\-\-\-> deltapts0 \-\-> overlay \-\-> output \& ^ \& | \& movie \-\-> scale\-\-> deltapts1 \-\-\-\-\-\-\-+ .Ve .PP \fIExamples\fR .IX Subsection "Examples" .IP "\(bu" 4 Skip 3.2 seconds from the start of the avi file in.avi, and overlay it on top of the input labelled as \*(L"in\*(R": .Sp .Vb 3 \& movie=in.avi:seek_point=3.2, scale=180:\-1, setpts=PTS\-STARTPTS [over]; \& [in] setpts=PTS\-STARTPTS [main]; \& [main][over] overlay=16:16 [out] .Ve .IP "\(bu" 4 Read from a video4linux2 device, and overlay it on top of the input labelled as \*(L"in\*(R": .Sp .Vb 3 \& movie=/dev/video0:f=video4linux2, scale=180:\-1, setpts=PTS\-STARTPTS [over]; \& [in] setpts=PTS\-STARTPTS [main]; \& [main][over] overlay=16:16 [out] .Ve .IP "\(bu" 4 Read the first video stream and the audio stream with id 0x81 from dvd.vob; the video is connected to the pad named \*(L"video\*(R" and the audio is connected to the pad named \*(L"audio\*(R": .Sp .Vb 1 \& movie=dvd.vob:s=v:0+#0x81 [video] [audio] .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIffmpeg\fR\|(1), \fIffplay\fR\|(1), \fIffprobe\fR\|(1), \fIffserver\fR\|(1), \fIlibavfilter\fR\|(3) .SH "AUTHORS" .IX Header "AUTHORS" The FFmpeg developers. .PP For details about the authorship, see the Git history of the project (git://source.ffmpeg.org/ffmpeg), e.g. by typing the command \&\fBgit log\fR in the FFmpeg source directory, or browsing the online repository at <\fBhttp://source.ffmpeg.org\fR>. .PP Maintainers for the specific components are listed in the file \&\fI\s-1MAINTAINERS\s0\fR in the source code tree.