]> git.sesse.net Git - casparcg/blob - ffmpeg 0.8/doc/libavfilter.html
2.0.0.2: Updated to ffmpeg 0.8.
[casparcg] / ffmpeg 0.8 / doc / libavfilter.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
2 <html>
3 <!-- Created on July 23, 2011 by texi2html 1.82
4 texi2html was written by: 
5             Lionel Cons <Lionel.Cons@cern.ch> (original author)
6             Karl Berry  <karl@freefriends.org>
7             Olaf Bachmann <obachman@mathematik.uni-kl.de>
8             and many others.
9 Maintained by: Many creative people.
10 Send bugs and suggestions to <texi2html-bug@nongnu.org>
11 -->
12 <head>
13 <title>Libavfilter Documentation</title>
14
15 <meta name="description" content="Libavfilter Documentation">
16 <meta name="keywords" content="Libavfilter Documentation">
17 <meta name="resource-type" content="document">
18 <meta name="distribution" content="global">
19 <meta name="Generator" content="texi2html 1.82">
20 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
21 <style type="text/css">
22 <!--
23 a.summary-letter {text-decoration: none}
24 blockquote.smallquotation {font-size: smaller}
25 pre.display {font-family: serif}
26 pre.format {font-family: serif}
27 pre.menu-comment {font-family: serif}
28 pre.menu-preformatted {font-family: serif}
29 pre.smalldisplay {font-family: serif; font-size: smaller}
30 pre.smallexample {font-size: smaller}
31 pre.smallformat {font-family: serif; font-size: smaller}
32 pre.smalllisp {font-size: smaller}
33 span.roman {font-family:serif; font-weight:normal;}
34 span.sansserif {font-family:sans-serif; font-weight:normal;}
35 ul.toc {list-style: none}
36 -->
37 </style>
38
39
40 </head>
41
42 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
43
44 <a name="SEC_Top"></a>
45 <h1 class="settitle">Libavfilter Documentation</h1>
46
47 <a name="SEC_Contents"></a>
48 <h1>Table of Contents</h1>
49 <div class="contents">
50
51 <ul class="toc">
52   <li><a name="toc-Introduction" href="#Introduction">1. Introduction</a></li>
53   <li><a name="toc-Tutorial" href="#Tutorial">2. Tutorial</a></li>
54   <li><a name="toc-graph2dot" href="#graph2dot">3. graph2dot</a></li>
55   <li><a name="toc-Filtergraph-description" href="#Filtergraph-description">4. Filtergraph description</a>
56   <ul class="toc">
57     <li><a name="toc-Filtergraph-syntax" href="#Filtergraph-syntax">4.1 Filtergraph syntax</a></li>
58   </ul></li>
59   <li><a name="toc-Audio-Filters" href="#Audio-Filters">5. Audio Filters</a>
60   <ul class="toc">
61     <li><a name="toc-anull" href="#anull">5.1 anull</a></li>
62   </ul></li>
63   <li><a name="toc-Audio-Sources" href="#Audio-Sources">6. Audio Sources</a>
64   <ul class="toc">
65     <li><a name="toc-anullsrc" href="#anullsrc">6.1 anullsrc</a></li>
66   </ul></li>
67   <li><a name="toc-Audio-Sinks" href="#Audio-Sinks">7. Audio Sinks</a>
68   <ul class="toc">
69     <li><a name="toc-anullsink" href="#anullsink">7.1 anullsink</a></li>
70   </ul></li>
71   <li><a name="toc-Video-Filters" href="#Video-Filters">8. Video Filters</a>
72   <ul class="toc">
73     <li><a name="toc-blackframe" href="#blackframe">8.1 blackframe</a></li>
74     <li><a name="toc-boxblur" href="#boxblur">8.2 boxblur</a></li>
75     <li><a name="toc-copy" href="#copy">8.3 copy</a></li>
76     <li><a name="toc-crop" href="#crop">8.4 crop</a></li>
77     <li><a name="toc-cropdetect" href="#cropdetect">8.5 cropdetect</a></li>
78     <li><a name="toc-drawbox" href="#drawbox">8.6 drawbox</a></li>
79     <li><a name="toc-drawtext" href="#drawtext">8.7 drawtext</a></li>
80     <li><a name="toc-fade" href="#fade">8.8 fade</a></li>
81     <li><a name="toc-fieldorder" href="#fieldorder">8.9 fieldorder</a></li>
82     <li><a name="toc-fifo" href="#fifo">8.10 fifo</a></li>
83     <li><a name="toc-format" href="#format">8.11 format</a></li>
84     <li><a name="toc-frei0r-1" href="#frei0r-1">8.12 frei0r</a></li>
85     <li><a name="toc-gradfun" href="#gradfun">8.13 gradfun</a></li>
86     <li><a name="toc-hflip" href="#hflip">8.14 hflip</a></li>
87     <li><a name="toc-hqdn3d" href="#hqdn3d">8.15 hqdn3d</a></li>
88     <li><a name="toc-lut_002c-lutrgb_002c-lutyuv" href="#lut_002c-lutrgb_002c-lutyuv">8.16 lut, lutrgb, lutyuv</a></li>
89     <li><a name="toc-mp" href="#mp">8.17 mp</a></li>
90     <li><a name="toc-negate" href="#negate">8.18 negate</a></li>
91     <li><a name="toc-noformat" href="#noformat">8.19 noformat</a></li>
92     <li><a name="toc-null" href="#null">8.20 null</a></li>
93     <li><a name="toc-ocv" href="#ocv">8.21 ocv</a>
94     <ul class="toc">
95       <li><a name="toc-dilate-1" href="#dilate-1">8.21.1 dilate</a></li>
96       <li><a name="toc-erode" href="#erode">8.21.2 erode</a></li>
97       <li><a name="toc-smooth" href="#smooth">8.21.3 smooth</a></li>
98     </ul></li>
99     <li><a name="toc-overlay" href="#overlay">8.22 overlay</a></li>
100     <li><a name="toc-pad" href="#pad">8.23 pad</a></li>
101     <li><a name="toc-pixdesctest" href="#pixdesctest">8.24 pixdesctest</a></li>
102     <li><a name="toc-scale" href="#scale">8.25 scale</a></li>
103     <li><a name="toc-select" href="#select">8.26 select</a></li>
104     <li><a name="toc-setdar-1" href="#setdar-1">8.27 setdar</a></li>
105     <li><a name="toc-setpts" href="#setpts">8.28 setpts</a></li>
106     <li><a name="toc-setsar-1" href="#setsar-1">8.29 setsar</a></li>
107     <li><a name="toc-settb" href="#settb">8.30 settb</a></li>
108     <li><a name="toc-showinfo" href="#showinfo">8.31 showinfo</a></li>
109     <li><a name="toc-slicify" href="#slicify">8.32 slicify</a></li>
110     <li><a name="toc-split" href="#split">8.33 split</a></li>
111     <li><a name="toc-transpose" href="#transpose">8.34 transpose</a></li>
112     <li><a name="toc-unsharp" href="#unsharp">8.35 unsharp</a></li>
113     <li><a name="toc-vflip" href="#vflip">8.36 vflip</a></li>
114     <li><a name="toc-yadif" href="#yadif">8.37 yadif</a></li>
115   </ul></li>
116   <li><a name="toc-Video-Sources" href="#Video-Sources">9. Video Sources</a>
117   <ul class="toc">
118     <li><a name="toc-buffer" href="#buffer">9.1 buffer</a></li>
119     <li><a name="toc-color" href="#color">9.2 color</a></li>
120     <li><a name="toc-movie" href="#movie">9.3 movie</a></li>
121     <li><a name="toc-nullsrc" href="#nullsrc">9.4 nullsrc</a></li>
122     <li><a name="toc-frei0r_005fsrc" href="#frei0r_005fsrc">9.5 frei0r_src</a></li>
123     <li><a name="toc-rgbtestsrc_002c-testsrc" href="#rgbtestsrc_002c-testsrc">9.6 rgbtestsrc, testsrc</a></li>
124   </ul></li>
125   <li><a name="toc-Video-Sinks" href="#Video-Sinks">10. Video Sinks</a>
126   <ul class="toc">
127     <li><a name="toc-buffersink" href="#buffersink">10.1 buffersink</a></li>
128     <li><a name="toc-nullsink" href="#nullsink">10.2 nullsink</a></li>
129   </ul>
130 </li>
131 </ul>
132 </div>
133
134 <hr size="1">
135 <a name="Introduction"></a>
136 <h1 class="chapter"><a href="libavfilter.html#toc-Introduction">1. Introduction</a></h1>
137
138 <p>Libavfilter is the filtering API of FFmpeg. It is the substitute of the
139 now deprecated &rsquo;vhooks&rsquo; and started as a Google Summer of Code project.
140 </p>
141 <p>Integrating libavfilter into the main FFmpeg repository is a work in
142 progress. If you wish to try the unfinished development code of
143 libavfilter then check it out from the libavfilter repository into
144 some directory of your choice by:
145 </p>
146 <table><tr><td>&nbsp;</td><td><pre class="example">   svn checkout svn://svn.ffmpeg.org/soc/libavfilter
147 </pre></td></tr></table>
148
149 <p>And then read the README file in the top directory to learn how to
150 integrate it into ffmpeg and ffplay.
151 </p>
152 <p>But note that there may still be serious bugs in the code and its API
153 and ABI should not be considered stable yet!
154 </p>
155 <a name="Tutorial"></a>
156 <h1 class="chapter"><a href="libavfilter.html#toc-Tutorial">2. Tutorial</a></h1>
157
158 <p>In libavfilter, it is possible for filters to have multiple inputs and
159 multiple outputs.
160 To illustrate the sorts of things that are possible, we can
161 use a complex filter graph. For example, the following one:
162 </p>
163 <table><tr><td>&nbsp;</td><td><pre class="example">input --&gt; split --&gt; fifo -----------------------&gt; overlay --&gt; output
164             |                                        ^
165             |                                        |
166             +------&gt; fifo --&gt; crop --&gt; vflip --------+
167 </pre></td></tr></table>
168
169 <p>splits the stream in two streams, sends one stream through the crop filter
170 and the vflip filter before merging it back with the other stream by
171 overlaying it on top. You can use the following command to achieve this:
172 </p>
173 <table><tr><td>&nbsp;</td><td><pre class="example">./ffmpeg -i in.avi -s 240x320 -vf &quot;[in] split [T1], fifo, [T2] overlay= 0:240 [out]; [T1] fifo, crop=0:0:-1:240, vflip [T2]
174 </pre></td></tr></table>
175
176 <p>where input_video.avi has a vertical resolution of 480 pixels. The
177 result will be that in output the top half of the video is mirrored
178 onto the bottom half.
179 </p>
180 <p>Video filters are loaded using the <var>-vf</var> option passed to
181 ffmpeg or to ffplay. Filters in the same linear chain are separated by
182 commas. In our example, <var>split, fifo, overlay</var> are in one linear
183 chain, and <var>fifo, crop, vflip</var> are in another. The points where
184 the linear chains join are labeled by names enclosed in square
185 brackets. In our example, that is <var>[T1]</var> and <var>[T2]</var>. The magic
186 labels <var>[in]</var> and <var>[out]</var> are the points where video is input
187 and output.
188 </p>
189 <p>Some filters take in input a list of parameters: they are specified
190 after the filter name and an equal sign, and are separated each other
191 by a semicolon.
192 </p>
193 <p>There exist so-called <var>source filters</var> that do not have a video
194 input, and we expect in the future some <var>sink filters</var> that will
195 not have video output.
196 </p>
197 <a name="graph2dot"></a>
198 <h1 class="chapter"><a href="libavfilter.html#toc-graph2dot">3. graph2dot</a></h1>
199
200 <p>The &lsquo;<tt>graph2dot</tt>&rsquo; program included in the FFmpeg &lsquo;<tt>tools</tt>&rsquo;
201 directory can be used to parse a filter graph description and issue a
202 corresponding textual representation in the dot language.
203 </p>
204 <p>Invoke the command:
205 </p><table><tr><td>&nbsp;</td><td><pre class="example">graph2dot -h
206 </pre></td></tr></table>
207
208 <p>to see how to use &lsquo;<tt>graph2dot</tt>&rsquo;.
209 </p>
210 <p>You can then pass the dot description to the &lsquo;<tt>dot</tt>&rsquo; program (from
211 the graphviz suite of programs) and obtain a graphical representation
212 of the filter graph.
213 </p>
214 <p>For example the sequence of commands:
215 </p><table><tr><td>&nbsp;</td><td><pre class="example">echo <var>GRAPH_DESCRIPTION</var> | \
216 tools/graph2dot -o graph.tmp &amp;&amp; \
217 dot -Tpng graph.tmp -o graph.png &amp;&amp; \
218 display graph.png
219 </pre></td></tr></table>
220
221 <p>can be used to create and display an image representing the graph
222 described by the <var>GRAPH_DESCRIPTION</var> string.
223 </p>
224 <a name="Filtergraph-description"></a>
225 <h1 class="chapter"><a href="libavfilter.html#toc-Filtergraph-description">4. Filtergraph description</a></h1>
226
227 <p>A filtergraph is a directed graph of connected filters. It can contain
228 cycles, and there can be multiple links between a pair of
229 filters. Each link has one input pad on one side connecting it to one
230 filter from which it takes its input, and one output pad on the other
231 side connecting it to the one filter accepting its output.
232 </p>
233 <p>Each filter in a filtergraph is an instance of a filter class
234 registered in the application, which defines the features and the
235 number of input and output pads of the filter.
236 </p>
237 <p>A filter with no input pads is called a &quot;source&quot;, a filter with no
238 output pads is called a &quot;sink&quot;.
239 </p>
240 <a name="Filtergraph-syntax"></a>
241 <h2 class="section"><a href="libavfilter.html#toc-Filtergraph-syntax">4.1 Filtergraph syntax</a></h2>
242
243 <p>A filtergraph can be represented using a textual representation, which
244 is recognized by the <code>-vf</code> and <code>-af</code> options of the ff*
245 tools, and by the <code>av_parse_graph()</code> function defined in
246 &lsquo;<tt>libavfilter/avfiltergraph</tt>&rsquo;.
247 </p>
248 <p>A filterchain consists of a sequence of connected filters, each one
249 connected to the previous one in the sequence. A filterchain is
250 represented by a list of &quot;,&quot;-separated filter descriptions.
251 </p>
252 <p>A filtergraph consists of a sequence of filterchains. A sequence of
253 filterchains is represented by a list of &quot;;&quot;-separated filterchain
254 descriptions.
255 </p>
256 <p>A filter is represented by a string of the form:
257 [<var>in_link_1</var>]...[<var>in_link_N</var>]<var>filter_name</var>=<var>arguments</var>[<var>out_link_1</var>]...[<var>out_link_M</var>]
258 </p>
259 <p><var>filter_name</var> is the name of the filter class of which the
260 described filter is an instance of, and has to be the name of one of
261 the filter classes registered in the program.
262 The name of the filter class is optionally followed by a string
263 &quot;=<var>arguments</var>&quot;.
264 </p>
265 <p><var>arguments</var> is a string which contains the parameters used to
266 initialize the filter instance, and are described in the filter
267 descriptions below.
268 </p>
269 <p>The list of arguments can be quoted using the character &quot;&rsquo;&quot; as initial
270 and ending mark, and the character &rsquo;\&rsquo; for escaping the characters
271 within the quoted text; otherwise the argument string is considered
272 terminated when the next special character (belonging to the set
273 &quot;[]=;,&quot;) is encountered.
274 </p>
275 <p>The name and arguments of the filter are optionally preceded and
276 followed by a list of link labels.
277 A link label allows to name a link and associate it to a filter output
278 or input pad. The preceding labels <var>in_link_1</var>
279 ... <var>in_link_N</var>, are associated to the filter input pads,
280 the following labels <var>out_link_1</var> ... <var>out_link_M</var>, are
281 associated to the output pads.
282 </p>
283 <p>When two link labels with the same name are found in the
284 filtergraph, a link between the corresponding input and output pad is
285 created.
286 </p>
287 <p>If an output pad is not labelled, it is linked by default to the first
288 unlabelled input pad of the next filter in the filterchain.
289 For example in the filterchain:
290 </p><table><tr><td>&nbsp;</td><td><pre class="example">nullsrc, split[L1], [L2]overlay, nullsink
291 </pre></td></tr></table>
292 <p>the split filter instance has two output pads, and the overlay filter
293 instance two input pads. The first output pad of split is labelled
294 &quot;L1&quot;, the first input pad of overlay is labelled &quot;L2&quot;, and the second
295 output pad of split is linked to the second input pad of overlay,
296 which are both unlabelled.
297 </p>
298 <p>In a complete filterchain all the unlabelled filter input and output
299 pads must be connected. A filtergraph is considered valid if all the
300 filter input and output pads of all the filterchains are connected.
301 </p>
302 <p>Follows a BNF description for the filtergraph syntax:
303 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>NAME</var>             ::= sequence of alphanumeric characters and '_'
304 <var>LINKLABEL</var>        ::= &quot;[&quot; <var>NAME</var> &quot;]&quot;
305 <var>LINKLABELS</var>       ::= <var>LINKLABEL</var> [<var>LINKLABELS</var>]
306 <var>FILTER_ARGUMENTS</var> ::= sequence of chars (eventually quoted)
307 <var>FILTER</var>           ::= [<var>LINKNAMES</var>] <var>NAME</var> [&quot;=&quot; <var>ARGUMENTS</var>] [<var>LINKNAMES</var>]
308 <var>FILTERCHAIN</var>      ::= <var>FILTER</var> [,<var>FILTERCHAIN</var>]
309 <var>FILTERGRAPH</var>      ::= <var>FILTERCHAIN</var> [;<var>FILTERGRAPH</var>]
310 </pre></td></tr></table>
311
312
313 <a name="Audio-Filters"></a>
314 <h1 class="chapter"><a href="libavfilter.html#toc-Audio-Filters">5. Audio Filters</a></h1>
315
316 <p>When you configure your FFmpeg build, you can disable any of the
317 existing filters using &ndash;disable-filters.
318 The configure output will show the audio filters included in your
319 build.
320 </p>
321 <p>Below is a description of the currently available audio filters.
322 </p>
323 <a name="anull"></a>
324 <h2 class="section"><a href="libavfilter.html#toc-anull">5.1 anull</a></h2>
325
326 <p>Pass the audio source unchanged to the output.
327 </p>
328
329 <a name="Audio-Sources"></a>
330 <h1 class="chapter"><a href="libavfilter.html#toc-Audio-Sources">6. Audio Sources</a></h1>
331
332 <p>Below is a description of the currently available audio sources.
333 </p>
334 <a name="anullsrc"></a>
335 <h2 class="section"><a href="libavfilter.html#toc-anullsrc">6.1 anullsrc</a></h2>
336
337 <p>Null audio source, never return audio frames. It is mainly useful as a
338 template and to be employed in analysis / debugging tools.
339 </p>
340 <p>It accepts as optional parameter a string of the form
341 <var>sample_rate</var>:<var>channel_layout</var>.
342 </p>
343 <p><var>sample_rate</var> specify the sample rate, and defaults to 44100.
344 </p>
345 <p><var>channel_layout</var> specify the channel layout, and can be either an
346 integer or a string representing a channel layout. The default value
347 of <var>channel_layout</var> is 3, which corresponds to CH_LAYOUT_STEREO.
348 </p>
349 <p>Check the channel_layout_map definition in
350 &lsquo;<tt>libavcodec/audioconvert.c</tt>&rsquo; for the mapping between strings and
351 channel layout values.
352 </p>
353 <p>Follow some examples:
354 </p><table><tr><td>&nbsp;</td><td><pre class="example">#  set the sample rate to 48000 Hz and the channel layout to CH_LAYOUT_MONO.
355 anullsrc=48000:4
356
357 # same as
358 anullsrc=48000:mono
359 </pre></td></tr></table>
360
361
362 <a name="Audio-Sinks"></a>
363 <h1 class="chapter"><a href="libavfilter.html#toc-Audio-Sinks">7. Audio Sinks</a></h1>
364
365 <p>Below is a description of the currently available audio sinks.
366 </p>
367 <a name="anullsink"></a>
368 <h2 class="section"><a href="libavfilter.html#toc-anullsink">7.1 anullsink</a></h2>
369
370 <p>Null audio sink, do absolutely nothing with the input audio. It is
371 mainly useful as a template and to be employed in analysis / debugging
372 tools.
373 </p>
374
375 <a name="Video-Filters"></a>
376 <h1 class="chapter"><a href="libavfilter.html#toc-Video-Filters">8. Video Filters</a></h1>
377
378 <p>When you configure your FFmpeg build, you can disable any of the
379 existing filters using &ndash;disable-filters.
380 The configure output will show the video filters included in your
381 build.
382 </p>
383 <p>Below is a description of the currently available video filters.
384 </p>
385 <a name="blackframe"></a>
386 <h2 class="section"><a href="libavfilter.html#toc-blackframe">8.1 blackframe</a></h2>
387
388 <p>Detect frames that are (almost) completely black. Can be useful to
389 detect chapter transitions or commercials. Output lines consist of
390 the frame number of the detected frame, the percentage of blackness,
391 the position in the file if known or -1 and the timestamp in seconds.
392 </p>
393 <p>In order to display the output lines, you need to set the loglevel at
394 least to the AV_LOG_INFO value.
395 </p>
396 <p>The filter accepts the syntax:
397 </p><table><tr><td>&nbsp;</td><td><pre class="example">blackframe[=<var>amount</var>:[<var>threshold</var>]]
398 </pre></td></tr></table>
399
400 <p><var>amount</var> is the percentage of the pixels that have to be below the
401 threshold, and defaults to 98.
402 </p>
403 <p><var>threshold</var> is the threshold below which a pixel value is
404 considered black, and defaults to 32.
405 </p>
406 <a name="boxblur"></a>
407 <h2 class="section"><a href="libavfilter.html#toc-boxblur">8.2 boxblur</a></h2>
408
409 <p>Apply boxblur algorithm to the input video.
410 </p>
411 <p>This filter accepts the parameters:
412 <var>luma_power</var>:<var>luma_radius</var>:<var>chroma_radius</var>:<var>chroma_power</var>:<var>alpha_radius</var>:<var>alpha_power</var>
413 </p>
414 <p>Chroma and alpha parameters are optional, if not specified they default
415 to the corresponding values set for <var>luma_radius</var> and
416 <var>luma_power</var>.
417 </p>
418 <p><var>luma_radius</var>, <var>chroma_radius</var>, and <var>alpha_radius</var> represent
419 the radius in pixels of the box used for blurring the corresponding
420 input plane. They are expressions, and can contain the following
421 constants:
422 </p><dl compact="compact">
423 <dt> &lsquo;<samp>w, h</samp>&rsquo;</dt>
424 <dd><p>the input width and heigth in pixels
425 </p>
426 </dd>
427 <dt> &lsquo;<samp>cw, ch</samp>&rsquo;</dt>
428 <dd><p>the input chroma image width and height in pixels
429 </p>
430 </dd>
431 <dt> &lsquo;<samp>hsub, vsub</samp>&rsquo;</dt>
432 <dd><p>horizontal and vertical chroma subsample values. For example for the
433 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
434 </p></dd>
435 </dl>
436
437 <p>The radius must be a non-negative number, and must be not greater than
438 the value of the expression <code>min(w,h)/2</code> for the luma and alpha planes,
439 and of <code>min(cw,ch)/2</code> for the chroma planes.
440 </p>
441 <p><var>luma_power</var>, <var>chroma_power</var>, and <var>alpha_power</var> represent
442 how many times the boxblur filter is applied to the corresponding
443 plane.
444 </p>
445 <p>Some examples follow:
446 </p>
447 <ul>
448 <li>
449 Apply a boxblur filter with luma, chroma, and alpha radius
450 set to 2:
451 <table><tr><td>&nbsp;</td><td><pre class="example">boxblur=2:1
452 </pre></td></tr></table>
453
454 </li><li>
455 Set luma radius to 2, alpha and chroma radius to 0
456 <table><tr><td>&nbsp;</td><td><pre class="example">boxblur=2:1:0:0:0:0
457 </pre></td></tr></table>
458
459 </li><li>
460 Set luma and chroma radius to a fraction of the video dimension
461 <table><tr><td>&nbsp;</td><td><pre class="example">boxblur=min(h\,w)/10:1:min(cw\,ch)/10:1
462 </pre></td></tr></table>
463
464 </li></ul>
465
466 <a name="copy"></a>
467 <h2 class="section"><a href="libavfilter.html#toc-copy">8.3 copy</a></h2>
468
469 <p>Copy the input source unchanged to the output. Mainly useful for
470 testing purposes.
471 </p>
472 <a name="crop"></a>
473 <h2 class="section"><a href="libavfilter.html#toc-crop">8.4 crop</a></h2>
474
475 <p>Crop the input video to <var>out_w</var>:<var>out_h</var>:<var>x</var>:<var>y</var>.
476 </p>
477 <p>The parameters are expressions containing the following constants:
478 </p>
479 <dl compact="compact">
480 <dt> &lsquo;<samp>E, PI, PHI</samp>&rsquo;</dt>
481 <dd><p>the corresponding mathematical approximated values for e
482 (euler number), pi (greek PI), PHI (golden ratio)
483 </p>
484 </dd>
485 <dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
486 <dd><p>the computed values for <var>x</var> and <var>y</var>. They are evaluated for
487 each new frame.
488 </p>
489 </dd>
490 <dt> &lsquo;<samp>in_w, in_h</samp>&rsquo;</dt>
491 <dd><p>the input width and heigth
492 </p>
493 </dd>
494 <dt> &lsquo;<samp>iw, ih</samp>&rsquo;</dt>
495 <dd><p>same as <var>in_w</var> and <var>in_h</var>
496 </p>
497 </dd>
498 <dt> &lsquo;<samp>out_w, out_h</samp>&rsquo;</dt>
499 <dd><p>the output (cropped) width and heigth
500 </p>
501 </dd>
502 <dt> &lsquo;<samp>ow, oh</samp>&rsquo;</dt>
503 <dd><p>same as <var>out_w</var> and <var>out_h</var>
504 </p>
505 </dd>
506 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
507 <dd><p>the number of input frame, starting from 0
508 </p>
509 </dd>
510 <dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
511 <dd><p>the position in the file of the input frame, NAN if unknown
512 </p>
513 </dd>
514 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
515 <dd><p>timestamp expressed in seconds, NAN if the input timestamp is unknown
516 </p>
517 </dd>
518 </dl>
519
520 <p>The <var>out_w</var> and <var>out_h</var> parameters specify the expressions for
521 the width and height of the output (cropped) video. They are
522 evaluated just at the configuration of the filter.
523 </p>
524 <p>The default value of <var>out_w</var> is &quot;in_w&quot;, and the default value of
525 <var>out_h</var> is &quot;in_h&quot;.
526 </p>
527 <p>The expression for <var>out_w</var> may depend on the value of <var>out_h</var>,
528 and the expression for <var>out_h</var> may depend on <var>out_w</var>, but they
529 cannot depend on <var>x</var> and <var>y</var>, as <var>x</var> and <var>y</var> are
530 evaluated after <var>out_w</var> and <var>out_h</var>.
531 </p>
532 <p>The <var>x</var> and <var>y</var> parameters specify the expressions for the
533 position of the top-left corner of the output (non-cropped) area. They
534 are evaluated for each frame. If the evaluated value is not valid, it
535 is approximated to the nearest valid value.
536 </p>
537 <p>The default value of <var>x</var> is &quot;(in_w-out_w)/2&quot;, and the default
538 value for <var>y</var> is &quot;(in_h-out_h)/2&quot;, which set the cropped area at
539 the center of the input image.
540 </p>
541 <p>The expression for <var>x</var> may depend on <var>y</var>, and the expression
542 for <var>y</var> may depend on <var>x</var>.
543 </p>
544 <p>Follow some examples:
545 </p><table><tr><td>&nbsp;</td><td><pre class="example"># crop the central input area with size 100x100
546 crop=100:100
547
548 # crop the central input area with size 2/3 of the input video
549 &quot;crop=2/3*in_w:2/3*in_h&quot;
550
551 # crop the input video central square
552 crop=in_h
553
554 # delimit the rectangle with the top-left corner placed at position
555 # 100:100 and the right-bottom corner corresponding to the right-bottom
556 # corner of the input image.
557 crop=in_w-100:in_h-100:100:100
558
559 # crop 10 pixels from the left and right borders, and 20 pixels from
560 # the top and bottom borders
561 &quot;crop=in_w-2*10:in_h-2*20&quot;
562
563 # keep only the bottom right quarter of the input image
564 &quot;crop=in_w/2:in_h/2:in_w/2:in_h/2&quot;
565
566 # crop height for getting Greek harmony
567 &quot;crop=in_w:1/PHI*in_w&quot;
568
569 # trembling effect
570 &quot;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)&quot;
571
572 # erratic camera effect depending on timestamp
573 &quot;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)&quot;
574
575 # set x depending on the value of y
576 &quot;crop=in_w/2:in_h/2:y:10+10*sin(n/10)&quot;
577 </pre></td></tr></table>
578
579 <a name="cropdetect"></a>
580 <h2 class="section"><a href="libavfilter.html#toc-cropdetect">8.5 cropdetect</a></h2>
581
582 <p>Auto-detect crop size.
583 </p>
584 <p>Calculate necessary cropping parameters and prints the recommended
585 parameters through the logging system. The detected dimensions
586 correspond to the non-black area of the input video.
587 </p>
588 <p>It accepts the syntax:
589 </p><table><tr><td>&nbsp;</td><td><pre class="example">cropdetect[=<var>limit</var>[:<var>round</var>[:<var>reset</var>]]]
590 </pre></td></tr></table>
591
592 <dl compact="compact">
593 <dt> &lsquo;<samp>limit</samp>&rsquo;</dt>
594 <dd><p>Threshold, which can be optionally specified from nothing (0) to
595 everything (255), defaults to 24.
596 </p>
597 </dd>
598 <dt> &lsquo;<samp>round</samp>&rsquo;</dt>
599 <dd><p>Value which the width/height should be divisible by, defaults to
600 16. The offset is automatically adjusted to center the video. Use 2 to
601 get only even dimensions (needed for 4:2:2 video). 16 is best when
602 encoding to most video codecs.
603 </p>
604 </dd>
605 <dt> &lsquo;<samp>reset</samp>&rsquo;</dt>
606 <dd><p>Counter that determines after how many frames cropdetect will reset
607 the previously detected largest video area and start over to detect
608 the current optimal crop area. Defaults to 0.
609 </p>
610 <p>This can be useful when channel logos distort the video area. 0
611 indicates never reset and return the largest area encountered during
612 playback.
613 </p></dd>
614 </dl>
615
616 <a name="drawbox"></a>
617 <h2 class="section"><a href="libavfilter.html#toc-drawbox">8.6 drawbox</a></h2>
618
619 <p>Draw a colored box on the input image.
620 </p>
621 <p>It accepts the syntax:
622 </p><table><tr><td>&nbsp;</td><td><pre class="example">drawbox=<var>x</var>:<var>y</var>:<var>width</var>:<var>height</var>:<var>color</var>
623 </pre></td></tr></table>
624
625 <dl compact="compact">
626 <dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
627 <dd><p>Specify the top left corner coordinates of the box. Default to 0.
628 </p>
629 </dd>
630 <dt> &lsquo;<samp>width, height</samp>&rsquo;</dt>
631 <dd><p>Specify the width and height of the box, if 0 they are interpreted as
632 the input width and height. Default to 0.
633 </p>
634 </dd>
635 <dt> &lsquo;<samp>color</samp>&rsquo;</dt>
636 <dd><p>Specify the color of the box to write, it can be the name of a color
637 (case insensitive match) or a 0xRRGGBB[AA] sequence.
638 </p></dd>
639 </dl>
640
641 <p>Follow some examples:
642 </p><table><tr><td>&nbsp;</td><td><pre class="example"># draw a black box around the edge of the input image
643 drawbox
644
645 # draw a box with color red and an opacity of 50%
646 drawbox=10:20:200:60:red@0.5&quot;
647 </pre></td></tr></table>
648
649 <a name="drawtext"></a>
650 <h2 class="section"><a href="libavfilter.html#toc-drawtext">8.7 drawtext</a></h2>
651
652 <p>Draw text string or text from specified file on top of video using the
653 libfreetype library.
654 </p>
655 <p>To enable compilation of this filter you need to configure FFmpeg with
656 <code>--enable-libfreetype</code>.
657 </p>
658 <p>The filter also recognizes strftime() sequences in the provided text
659 and expands them accordingly. Check the documentation of strftime().
660 </p>
661 <p>The filter accepts parameters as a list of <var>key</var>=<var>value</var> pairs,
662 separated by &quot;:&quot;.
663 </p>
664 <p>The description of the accepted parameters follows.
665 </p>
666 <dl compact="compact">
667 <dt> &lsquo;<samp>fontfile</samp>&rsquo;</dt>
668 <dd><p>The font file to be used for drawing text. Path must be included.
669 This parameter is mandatory.
670 </p>
671 </dd>
672 <dt> &lsquo;<samp>text</samp>&rsquo;</dt>
673 <dd><p>The text string to be drawn. The text must be a sequence of UTF-8
674 encoded characters.
675 This parameter is mandatory if no file is specified with the parameter
676 <var>textfile</var>.
677 </p>
678 </dd>
679 <dt> &lsquo;<samp>textfile</samp>&rsquo;</dt>
680 <dd><p>A text file containing text to be drawn. The text must be a sequence
681 of UTF-8 encoded characters.
682 </p>
683 <p>This parameter is mandatory if no text string is specified with the
684 parameter <var>text</var>.
685 </p>
686 <p>If both text and textfile are specified, an error is thrown.
687 </p>
688 </dd>
689 <dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
690 <dd><p>The offsets where text will be drawn within the video frame.
691 Relative to the top/left border of the output image.
692 </p>
693 <p>The default value of <var>x</var> and <var>y</var> is 0.
694 </p>
695 </dd>
696 <dt> &lsquo;<samp>fontsize</samp>&rsquo;</dt>
697 <dd><p>The font size to be used for drawing text.
698 The default value of <var>fontsize</var> is 16.
699 </p>
700 </dd>
701 <dt> &lsquo;<samp>fontcolor</samp>&rsquo;</dt>
702 <dd><p>The color to be used for drawing fonts.
703 Either a string (e.g. &quot;red&quot;) or in 0xRRGGBB[AA] format
704 (e.g. &quot;0xff000033&quot;), possibly followed by an alpha specifier.
705 The default value of <var>fontcolor</var> is &quot;black&quot;.
706 </p>
707 </dd>
708 <dt> &lsquo;<samp>boxcolor</samp>&rsquo;</dt>
709 <dd><p>The color to be used for drawing box around text.
710 Either a string (e.g. &quot;yellow&quot;) or in 0xRRGGBB[AA] format
711 (e.g. &quot;0xff00ff&quot;), possibly followed by an alpha specifier.
712 The default value of <var>boxcolor</var> is &quot;white&quot;.
713 </p>
714 </dd>
715 <dt> &lsquo;<samp>box</samp>&rsquo;</dt>
716 <dd><p>Used to draw a box around text using background color.
717 Value should be either 1 (enable) or 0 (disable).
718 The default value of <var>box</var> is 0.
719 </p>
720 </dd>
721 <dt> &lsquo;<samp>shadowx, shadowy</samp>&rsquo;</dt>
722 <dd><p>The x and y offsets for the text shadow position with respect to the
723 position of the text. They can be either positive or negative
724 values. Default value for both is &quot;0&quot;.
725 </p>
726 </dd>
727 <dt> &lsquo;<samp>shadowcolor</samp>&rsquo;</dt>
728 <dd><p>The color to be used for drawing a shadow behind the drawn text.  It
729 can be a color name (e.g. &quot;yellow&quot;) or a string in the 0xRRGGBB[AA]
730 form (e.g. &quot;0xff00ff&quot;), possibly followed by an alpha specifier.
731 The default value of <var>shadowcolor</var> is &quot;black&quot;.
732 </p>
733 </dd>
734 <dt> &lsquo;<samp>ft_load_flags</samp>&rsquo;</dt>
735 <dd><p>Flags to be used for loading the fonts.
736 </p>
737 <p>The flags map the corresponding flags supported by libfreetype, and are
738 a combination of the following values:
739 </p><dl compact="compact">
740 <dt> <var>default</var></dt>
741 <dt> <var>no_scale</var></dt>
742 <dt> <var>no_hinting</var></dt>
743 <dt> <var>render</var></dt>
744 <dt> <var>no_bitmap</var></dt>
745 <dt> <var>vertical_layout</var></dt>
746 <dt> <var>force_autohint</var></dt>
747 <dt> <var>crop_bitmap</var></dt>
748 <dt> <var>pedantic</var></dt>
749 <dt> <var>ignore_global_advance_width</var></dt>
750 <dt> <var>no_recurse</var></dt>
751 <dt> <var>ignore_transform</var></dt>
752 <dt> <var>monochrome</var></dt>
753 <dt> <var>linear_design</var></dt>
754 <dt> <var>no_autohint</var></dt>
755 <dt> <var>end table</var></dt>
756 </dl>
757
758 <p>Default value is &quot;render&quot;.
759 </p>
760 <p>For more information consult the documentation for the FT_LOAD_*
761 libfreetype flags.
762 </p>
763 </dd>
764 <dt> &lsquo;<samp>tabsize</samp>&rsquo;</dt>
765 <dd><p>The size in number of spaces to use for rendering the tab.
766 Default value is 4.
767 </p></dd>
768 </dl>
769
770 <p>For example the command:
771 </p><table><tr><td>&nbsp;</td><td><pre class="example">drawtext=&quot;fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'&quot;
772 </pre></td></tr></table>
773
774 <p>will draw &quot;Test Text&quot; with font FreeSerif, using the default values
775 for the optional parameters.
776 </p>
777 <p>The command:
778 </p><table><tr><td>&nbsp;</td><td><pre class="example">drawtext=&quot;fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
779           x=100: y=50: fontsize=24: fontcolor=yellow@0.2: box=1: boxcolor=red@0.2&quot;
780 </pre></td></tr></table>
781
782 <p>will draw &rsquo;Test Text&rsquo; with font FreeSerif of size 24 at position x=100
783 and y=50 (counting from the top-left corner of the screen), text is
784 yellow with a red box around it. Both the text and the box have an
785 opacity of 20%.
786 </p>
787 <p>Note that the double quotes are not necessary if spaces are not used
788 within the parameter list.
789 </p>
790 <p>For more information about libfreetype, check:
791 <a href="http://www.freetype.org/">http://www.freetype.org/</a>.
792 </p>
793 <a name="fade"></a>
794 <h2 class="section"><a href="libavfilter.html#toc-fade">8.8 fade</a></h2>
795
796 <p>Apply fade-in/out effect to input video.
797 </p>
798 <p>It accepts the parameters:
799 <var>type</var>:<var>start_frame</var>:<var>nb_frames</var>
800 </p>
801 <p><var>type</var> specifies if the effect type, can be either &quot;in&quot; for
802 fade-in, or &quot;out&quot; for a fade-out effect.
803 </p>
804 <p><var>start_frame</var> specifies the number of the start frame for starting
805 to apply the fade effect.
806 </p>
807 <p><var>nb_frames</var> specifies the number of frames for which the fade
808 effect has to last. At the end of the fade-in effect the output video
809 will have the same intensity as the input video, at the end of the
810 fade-out transition the output video will be completely black.
811 </p>
812 <p>A few usage examples follow, usable too as test scenarios.
813 </p><table><tr><td>&nbsp;</td><td><pre class="example"># fade in first 30 frames of video
814 fade=in:0:30
815
816 # fade out last 45 frames of a 200-frame video
817 fade=out:155:45
818
819 # fade in first 25 frames and fade out last 25 frames of a 1000-frame video
820 fade=in:0:25, fade=out:975:25
821
822 # make first 5 frames black, then fade in from frame 5-24
823 fade=in:5:20
824 </pre></td></tr></table>
825
826 <a name="fieldorder"></a>
827 <h2 class="section"><a href="libavfilter.html#toc-fieldorder">8.9 fieldorder</a></h2>
828
829 <p>Transform the field order of the input video.
830 </p>
831 <p>It accepts one parameter which specifies the required field order that
832 the input interlaced video will be transformed to. The parameter can
833 assume one of the following values:
834 </p>
835 <dl compact="compact">
836 <dt> &lsquo;<samp>0 or bff</samp>&rsquo;</dt>
837 <dd><p>output bottom field first
838 </p></dd>
839 <dt> &lsquo;<samp>1 or tff</samp>&rsquo;</dt>
840 <dd><p>output top field first
841 </p></dd>
842 </dl>
843
844 <p>Default value is &quot;tff&quot;.
845 </p>
846 <p>Transformation is achieved by shifting the picture content up or down
847 by one line, and filling the remaining line with appropriate picture content.
848 This method is consistent with most broadcast field order converters.
849 </p>
850 <p>If the input video is not flagged as being interlaced, or it is already
851 flagged as being of the required output field order then this filter does
852 not alter the incoming video.
853 </p>
854 <p>This filter is very useful when converting to or from PAL DV material,
855 which is bottom field first.
856 </p>
857 <p>For example:
858 </p><table><tr><td>&nbsp;</td><td><pre class="example">./ffmpeg -i in.vob -vf &quot;fieldorder=bff&quot; out.dv
859 </pre></td></tr></table>
860
861 <a name="fifo"></a>
862 <h2 class="section"><a href="libavfilter.html#toc-fifo">8.10 fifo</a></h2>
863
864 <p>Buffer input images and send them when they are requested.
865 </p>
866 <p>This filter is mainly useful when auto-inserted by the libavfilter
867 framework.
868 </p>
869 <p>The filter does not take parameters.
870 </p>
871 <a name="format"></a>
872 <h2 class="section"><a href="libavfilter.html#toc-format">8.11 format</a></h2>
873
874 <p>Convert the input video to one of the specified pixel formats.
875 Libavfilter will try to pick one that is supported for the input to
876 the next filter.
877 </p>
878 <p>The filter accepts a list of pixel format names, separated by &quot;:&quot;,
879 for example &quot;yuv420p:monow:rgb24&quot;.
880 </p>
881 <p>Some examples follow:
882 </p><table><tr><td>&nbsp;</td><td><pre class="example"># convert the input video to the format &quot;yuv420p&quot;
883 format=yuv420p
884
885 # convert the input video to any of the formats in the list
886 format=yuv420p:yuv444p:yuv410p
887 </pre></td></tr></table>
888
889 <p><a name="frei0r"></a>
890 </p><a name="frei0r-1"></a>
891 <h2 class="section"><a href="libavfilter.html#toc-frei0r-1">8.12 frei0r</a></h2>
892
893 <p>Apply a frei0r effect to the input video.
894 </p>
895 <p>To enable compilation of this filter you need to install the frei0r
896 header and configure FFmpeg with &ndash;enable-frei0r.
897 </p>
898 <p>The filter supports the syntax:
899 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>filter_name</var>[{:|=}<var>param1</var>:<var>param2</var>:...:<var>paramN</var>]
900 </pre></td></tr></table>
901
902 <p><var>filter_name</var> is the name to the frei0r effect to load. If the
903 environment variable <code>FREI0R_PATH</code> is defined, the frei0r effect
904 is searched in each one of the directories specified by the colon
905 separated list in <code>FREIOR_PATH</code>, otherwise in the standard frei0r
906 paths, which are in this order: &lsquo;<tt>HOME/.frei0r-1/lib/</tt>&rsquo;,
907 &lsquo;<tt>/usr/local/lib/frei0r-1/</tt>&rsquo;, &lsquo;<tt>/usr/lib/frei0r-1/</tt>&rsquo;.
908 </p>
909 <p><var>param1</var>, <var>param2</var>, ... , <var>paramN</var> specify the parameters
910 for the frei0r effect.
911 </p>
912 <p>A frei0r effect parameter can be a boolean (whose values are specified
913 with &quot;y&quot; and &quot;n&quot;), a double, a color (specified by the syntax
914 <var>R</var>/<var>G</var>/<var>B</var>, <var>R</var>, <var>G</var>, and <var>B</var> being float
915 numbers from 0.0 to 1.0) or by an <code>av_parse_color()</code> color
916 description), a position (specified by the syntax <var>X</var>/<var>Y</var>,
917 <var>X</var> and <var>Y</var> being float numbers) and a string.
918 </p>
919 <p>The number and kind of parameters depend on the loaded effect. If an
920 effect parameter is not specified the default value is set.
921 </p>
922 <p>Some examples follow:
923 </p><table><tr><td>&nbsp;</td><td><pre class="example"># apply the distort0r effect, set the first two double parameters
924 frei0r=distort0r:0.5:0.01
925
926 # apply the colordistance effect, takes a color as first parameter
927 frei0r=colordistance:0.2/0.3/0.4
928 frei0r=colordistance:violet
929 frei0r=colordistance:0x112233
930
931 # apply the perspective effect, specify the top left and top right
932 # image positions
933 frei0r=perspective:0.2/0.2:0.8/0.2
934 </pre></td></tr></table>
935
936 <p>For more information see:
937 <a href="http://piksel.org/frei0r">http://piksel.org/frei0r</a>
938 </p>
939 <a name="gradfun"></a>
940 <h2 class="section"><a href="libavfilter.html#toc-gradfun">8.13 gradfun</a></h2>
941
942 <p>Fix the banding artifacts that are sometimes introduced into nearly flat
943 regions by truncation to 8bit colordepth.
944 Interpolate the gradients that should go where the bands are, and
945 dither them.
946 </p>
947 <p>This filter is designed for playback only.  Do not use it prior to
948 lossy compression, because compression tends to lose the dither and
949 bring back the bands.
950 </p>
951 <p>The filter takes two optional parameters, separated by &rsquo;:&rsquo;:
952 <var>strength</var>:<var>radius</var>
953 </p>
954 <p><var>strength</var> is the maximum amount by which the filter will change
955 any one pixel. Also the threshold for detecting nearly flat
956 regions. Acceptable values range from .51 to 255, default value is
957 1.2, out-of-range values will be clipped to the valid range.
958 </p>
959 <p><var>radius</var> is the neighborhood to fit the gradient to. A larger
960 radius makes for smoother gradients, but also prevents the filter from
961 modifying the pixels near detailed regions. Acceptable values are
962 8-32, default value is 16, out-of-range values will be clipped to the
963 valid range.
964 </p>
965 <table><tr><td>&nbsp;</td><td><pre class="example"># default parameters
966 gradfun=1.2:16
967
968 # omitting radius
969 gradfun=1.2
970 </pre></td></tr></table>
971
972 <a name="hflip"></a>
973 <h2 class="section"><a href="libavfilter.html#toc-hflip">8.14 hflip</a></h2>
974
975 <p>Flip the input video horizontally.
976 </p>
977 <p>For example to horizontally flip the video in input with
978 &lsquo;<tt>ffmpeg</tt>&rsquo;:
979 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -vf &quot;hflip&quot; out.avi
980 </pre></td></tr></table>
981
982 <a name="hqdn3d"></a>
983 <h2 class="section"><a href="libavfilter.html#toc-hqdn3d">8.15 hqdn3d</a></h2>
984
985 <p>High precision/quality 3d denoise filter. This filter aims to reduce
986 image noise producing smooth images and making still images really
987 still. It should enhance compressibility.
988 </p>
989 <p>It accepts the following optional parameters:
990 <var>luma_spatial</var>:<var>chroma_spatial</var>:<var>luma_tmp</var>:<var>chroma_tmp</var>
991 </p>
992 <dl compact="compact">
993 <dt> &lsquo;<samp>luma_spatial</samp>&rsquo;</dt>
994 <dd><p>a non-negative float number which specifies spatial luma strength,
995 defaults to 4.0
996 </p>
997 </dd>
998 <dt> &lsquo;<samp>chroma_spatial</samp>&rsquo;</dt>
999 <dd><p>a non-negative float number which specifies spatial chroma strength,
1000 defaults to 3.0*<var>luma_spatial</var>/4.0
1001 </p>
1002 </dd>
1003 <dt> &lsquo;<samp>luma_tmp</samp>&rsquo;</dt>
1004 <dd><p>a float number which specifies luma temporal strength, defaults to
1005 6.0*<var>luma_spatial</var>/4.0
1006 </p>
1007 </dd>
1008 <dt> &lsquo;<samp>chroma_tmp</samp>&rsquo;</dt>
1009 <dd><p>a float number which specifies chroma temporal strength, defaults to
1010 <var>luma_tmp</var>*<var>chroma_spatial</var>/<var>luma_spatial</var>
1011 </p></dd>
1012 </dl>
1013
1014 <a name="lut_002c-lutrgb_002c-lutyuv"></a>
1015 <h2 class="section"><a href="libavfilter.html#toc-lut_002c-lutrgb_002c-lutyuv">8.16 lut, lutrgb, lutyuv</a></h2>
1016
1017 <p>Compute a look-up table for binding each pixel component input value
1018 to an output value, and apply it to input video.
1019 </p>
1020 <p><var>lutyuv</var> applies a lookup table to a YUV input video, <var>lutrgb</var>
1021 to an RGB input video.
1022 </p>
1023 <p>These filters accept in input a &quot;:&quot;-separated list of options, which
1024 specify the expressions used for computing the lookup table for the
1025 corresponding pixel component values.
1026 </p>
1027 <p>The <var>lut</var> filter requires either YUV or RGB pixel formats in
1028 input, and accepts the options:
1029 </p><dl compact="compact">
1030 <dd><p><var>c0</var> (first  pixel component)
1031 <var>c1</var> (second pixel component)
1032 <var>c2</var> (third  pixel component)
1033 <var>c3</var> (fourth pixel component, corresponds to the alpha component)
1034 </p></dd>
1035 </dl>
1036
1037 <p>The exact component associated to each option depends on the format in
1038 input.
1039 </p>
1040 <p>The <var>lutrgb</var> filter requires RGB pixel formats in input, and
1041 accepts the options:
1042 </p><dl compact="compact">
1043 <dd><p><var>r</var> (red component)
1044 <var>g</var> (green component)
1045 <var>b</var> (blue component)
1046 <var>a</var> (alpha component)
1047 </p></dd>
1048 </dl>
1049
1050 <p>The <var>lutyuv</var> filter requires YUV pixel formats in input, and
1051 accepts the options:
1052 </p><dl compact="compact">
1053 <dd><p><var>y</var> (Y/luminance component)
1054 <var>u</var> (U/Cb component)
1055 <var>v</var> (V/Cr component)
1056 <var>a</var> (alpha component)
1057 </p></dd>
1058 </dl>
1059
1060 <p>The expressions can contain the following constants and functions:
1061 </p>
1062 <dl compact="compact">
1063 <dt> &lsquo;<samp>E, PI, PHI</samp>&rsquo;</dt>
1064 <dd><p>the corresponding mathematical approximated values for e
1065 (euler number), pi (greek PI), PHI (golden ratio)
1066 </p>
1067 </dd>
1068 <dt> &lsquo;<samp>w, h</samp>&rsquo;</dt>
1069 <dd><p>the input width and heigth
1070 </p>
1071 </dd>
1072 <dt> &lsquo;<samp>val</samp>&rsquo;</dt>
1073 <dd><p>input value for the pixel component
1074 </p>
1075 </dd>
1076 <dt> &lsquo;<samp>clipval</samp>&rsquo;</dt>
1077 <dd><p>the input value clipped in the <var>minval</var>-<var>maxval</var> range
1078 </p>
1079 </dd>
1080 <dt> &lsquo;<samp>maxval</samp>&rsquo;</dt>
1081 <dd><p>maximum value for the pixel component
1082 </p>
1083 </dd>
1084 <dt> &lsquo;<samp>minval</samp>&rsquo;</dt>
1085 <dd><p>minimum value for the pixel component
1086 </p>
1087 </dd>
1088 <dt> &lsquo;<samp>negval</samp>&rsquo;</dt>
1089 <dd><p>the negated value for the pixel component value clipped in the
1090 <var>minval</var>-<var>maxval</var> range , it corresponds to the expression
1091 &quot;maxval-clipval+minval&quot;
1092 </p>
1093 </dd>
1094 <dt> &lsquo;<samp>clip(val)</samp>&rsquo;</dt>
1095 <dd><p>the computed value in <var>val</var> clipped in the
1096 <var>minval</var>-<var>maxval</var> range
1097 </p>
1098 </dd>
1099 <dt> &lsquo;<samp>gammaval(gamma)</samp>&rsquo;</dt>
1100 <dd><p>the computed gamma correction value of the pixel component value
1101 clipped in the <var>minval</var>-<var>maxval</var> range, corresponds to the
1102 expression
1103 &quot;pow((clipval-minval)/(maxval-minval)\,<var>gamma</var>)*(maxval-minval)+minval&quot;
1104 </p>
1105 </dd>
1106 </dl>
1107
1108 <p>All expressions default to &quot;val&quot;.
1109 </p>
1110 <p>Some examples follow:
1111 </p><table><tr><td>&nbsp;</td><td><pre class="example"># negate input video
1112 lutrgb=&quot;r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val&quot;
1113 lutyuv=&quot;y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val&quot;
1114
1115 # the above is the same as
1116 lutrgb=&quot;r=negval:g=negval:b=negval&quot;
1117 lutyuv=&quot;y=negval:u=negval:v=negval&quot;
1118
1119 # negate luminance
1120 lutyuv=negval
1121
1122 # remove chroma components, turns the video into a graytone image
1123 lutyuv=&quot;u=128:v=128&quot;
1124
1125 # apply a luma burning effect
1126 lutyuv=&quot;y=2*val&quot;
1127
1128 # remove green and blue components
1129 lutrgb=&quot;g=0:b=0&quot;
1130
1131 # set a constant alpha channel value on input
1132 format=rgba,lutrgb=a=&quot;maxval-minval/2&quot;
1133
1134 # correct luminance gamma by a 0.5 factor
1135 lutyuv=y=gammaval(0.5)
1136 </pre></td></tr></table>
1137
1138 <a name="mp"></a>
1139 <h2 class="section"><a href="libavfilter.html#toc-mp">8.17 mp</a></h2>
1140
1141 <p>Apply an MPlayer filter to the input video.
1142 </p>
1143 <p>This filter provides a wrapper around most of the filters of
1144 MPlayer/MEncoder.
1145 </p>
1146 <p>This wrapper is considered experimental. Some of the wrapped filters
1147 may not work properly and we may drop support for them, as they will
1148 be implemented natively into FFmpeg. Thus you should avoid
1149 depending on them when writing portable scripts.
1150 </p>
1151 <p>The filters accepts the parameters:
1152 <var>filter_name</var>[:=]<var>filter_params</var>
1153 </p>
1154 <p><var>filter_name</var> is the name of a supported MPlayer filter,
1155 <var>filter_params</var> is a string containing the parameters accepted by
1156 the named filter.
1157 </p>
1158 <p>The list of the currently supported filters follows:
1159 </p><dl compact="compact">
1160 <dt> <var>2xsai</var></dt>
1161 <dt> <var>decimate</var></dt>
1162 <dt> <var>delogo</var></dt>
1163 <dt> <var>denoise3d</var></dt>
1164 <dt> <var>detc</var></dt>
1165 <dt> <var>dint</var></dt>
1166 <dt> <var>divtc</var></dt>
1167 <dt> <var>down3dright</var></dt>
1168 <dt> <var>dsize</var></dt>
1169 <dt> <var>eq2</var></dt>
1170 <dt> <var>eq</var></dt>
1171 <dt> <var>field</var></dt>
1172 <dt> <var>fil</var></dt>
1173 <dt> <var>fixpts</var></dt>
1174 <dt> <var>framestep</var></dt>
1175 <dt> <var>fspp</var></dt>
1176 <dt> <var>geq</var></dt>
1177 <dt> <var>gradfun</var></dt>
1178 <dt> <var>harddup</var></dt>
1179 <dt> <var>hqdn3d</var></dt>
1180 <dt> <var>hue</var></dt>
1181 <dt> <var>il</var></dt>
1182 <dt> <var>ilpack</var></dt>
1183 <dt> <var>ivtc</var></dt>
1184 <dt> <var>kerndeint</var></dt>
1185 <dt> <var>mcdeint</var></dt>
1186 <dt> <var>mirror</var></dt>
1187 <dt> <var>noise</var></dt>
1188 <dt> <var>ow</var></dt>
1189 <dt> <var>palette</var></dt>
1190 <dt> <var>perspective</var></dt>
1191 <dt> <var>phase</var></dt>
1192 <dt> <var>pp7</var></dt>
1193 <dt> <var>pullup</var></dt>
1194 <dt> <var>qp</var></dt>
1195 <dt> <var>rectangle</var></dt>
1196 <dt> <var>remove-logo</var></dt>
1197 <dt> <var>rotate</var></dt>
1198 <dt> <var>sab</var></dt>
1199 <dt> <var>screenshot</var></dt>
1200 <dt> <var>smartblur</var></dt>
1201 <dt> <var>softpulldown</var></dt>
1202 <dt> <var>softskip</var></dt>
1203 <dt> <var>spp</var></dt>
1204 <dt> <var>swapuv</var></dt>
1205 <dt> <var>telecine</var></dt>
1206 <dt> <var>test</var></dt>
1207 <dt> <var>tile</var></dt>
1208 <dt> <var>tinterlace</var></dt>
1209 <dt> <var>unsharp</var></dt>
1210 <dt> <var>uspp</var></dt>
1211 <dt> <var>yuvcsp</var></dt>
1212 <dt> <var>yvu9</var></dt>
1213 </dl>
1214
1215 <p>The parameter syntax and behavior for the listed filters are the same
1216 of the corresponding MPlayer filters. For detailed instructions check
1217 the &quot;VIDEO FILTERS&quot; section in the MPlayer manual.
1218 </p>
1219 <p>Some examples follow:
1220 </p><table><tr><td>&nbsp;</td><td><pre class="example"># remove a logo by interpolating the surrounding pixels
1221 mp=delogo=200:200:80:20:1
1222
1223 # adjust gamma, brightness, contrast
1224 mp=eq2=1.0:2:0.5
1225
1226 # tweak hue and saturation
1227 mp=hue=100:-10
1228 </pre></td></tr></table>
1229
1230 <p>See also mplayer(1), <a href="http://www.mplayerhq.hu/">http://www.mplayerhq.hu/</a>.
1231 </p>
1232 <a name="negate"></a>
1233 <h2 class="section"><a href="libavfilter.html#toc-negate">8.18 negate</a></h2>
1234
1235 <p>Negate input video.
1236 </p>
1237 <p>This filter accepts an integer in input, if non-zero it negates the
1238 alpha component (if available). The default value in input is 0.
1239 </p>
1240 <a name="noformat"></a>
1241 <h2 class="section"><a href="libavfilter.html#toc-noformat">8.19 noformat</a></h2>
1242
1243 <p>Force libavfilter not to use any of the specified pixel formats for the
1244 input to the next filter.
1245 </p>
1246 <p>The filter accepts a list of pixel format names, separated by &quot;:&quot;,
1247 for example &quot;yuv420p:monow:rgb24&quot;.
1248 </p>
1249 <p>Some examples follow:
1250 </p><table><tr><td>&nbsp;</td><td><pre class="example"># force libavfilter to use a format different from &quot;yuv420p&quot; for the
1251 # input to the vflip filter
1252 noformat=yuv420p,vflip
1253
1254 # convert the input video to any of the formats not contained in the list
1255 noformat=yuv420p:yuv444p:yuv410p
1256 </pre></td></tr></table>
1257
1258 <a name="null"></a>
1259 <h2 class="section"><a href="libavfilter.html#toc-null">8.20 null</a></h2>
1260
1261 <p>Pass the video source unchanged to the output.
1262 </p>
1263 <a name="ocv"></a>
1264 <h2 class="section"><a href="libavfilter.html#toc-ocv">8.21 ocv</a></h2>
1265
1266 <p>Apply video transform using libopencv.
1267 </p>
1268 <p>To enable this filter install libopencv library and headers and
1269 configure FFmpeg with &ndash;enable-libopencv.
1270 </p>
1271 <p>The filter takes the parameters: <var>filter_name</var>{:=}<var>filter_params</var>.
1272 </p>
1273 <p><var>filter_name</var> is the name of the libopencv filter to apply.
1274 </p>
1275 <p><var>filter_params</var> specifies the parameters to pass to the libopencv
1276 filter. If not specified the default values are assumed.
1277 </p>
1278 <p>Refer to the official libopencv documentation for more precise
1279 informations:
1280 <a href="http://opencv.willowgarage.com/documentation/c/image_filtering.html">http://opencv.willowgarage.com/documentation/c/image_filtering.html</a>
1281 </p>
1282 <p>Follows the list of supported libopencv filters.
1283 </p>
1284 <p><a name="dilate"></a>
1285 </p><a name="dilate-1"></a>
1286 <h3 class="subsection"><a href="libavfilter.html#toc-dilate-1">8.21.1 dilate</a></h3>
1287
1288 <p>Dilate an image by using a specific structuring element.
1289 This filter corresponds to the libopencv function <code>cvDilate</code>.
1290 </p>
1291 <p>It accepts the parameters: <var>struct_el</var>:<var>nb_iterations</var>.
1292 </p>
1293 <p><var>struct_el</var> represents a structuring element, and has the syntax:
1294 <var>cols</var>x<var>rows</var>+<var>anchor_x</var>x<var>anchor_y</var>/<var>shape</var>
1295 </p>
1296 <p><var>cols</var> and <var>rows</var> represent the number of colums and rows of
1297 the structuring element, <var>anchor_x</var> and <var>anchor_y</var> the anchor
1298 point, and <var>shape</var> the shape for the structuring element, and
1299 can be one of the values &quot;rect&quot;, &quot;cross&quot;, &quot;ellipse&quot;, &quot;custom&quot;.
1300 </p>
1301 <p>If the value for <var>shape</var> is &quot;custom&quot;, it must be followed by a
1302 string of the form &quot;=<var>filename</var>&quot;. The file with name
1303 <var>filename</var> is assumed to represent a binary image, with each
1304 printable character corresponding to a bright pixel. When a custom
1305 <var>shape</var> is used, <var>cols</var> and <var>rows</var> are ignored, the number
1306 or columns and rows of the read file are assumed instead.
1307 </p>
1308 <p>The default value for <var>struct_el</var> is &quot;3x3+0x0/rect&quot;.
1309 </p>
1310 <p><var>nb_iterations</var> specifies the number of times the transform is
1311 applied to the image, and defaults to 1.
1312 </p>
1313 <p>Follow some example:
1314 </p><table><tr><td>&nbsp;</td><td><pre class="example"># use the default values
1315 ocv=dilate
1316
1317 # dilate using a structuring element with a 5x5 cross, iterate two times
1318 ocv=dilate=5x5+2x2/cross:2
1319
1320 # read the shape from the file diamond.shape, iterate two times
1321 # the file diamond.shape may contain a pattern of characters like this:
1322 #   *
1323 #  ***
1324 # *****
1325 #  ***
1326 #   *
1327 # the specified cols and rows are ignored (but not the anchor point coordinates)
1328 ocv=0x0+2x2/custom=diamond.shape:2
1329 </pre></td></tr></table>
1330
1331 <a name="erode"></a>
1332 <h3 class="subsection"><a href="libavfilter.html#toc-erode">8.21.2 erode</a></h3>
1333
1334 <p>Erode an image by using a specific structuring element.
1335 This filter corresponds to the libopencv function <code>cvErode</code>.
1336 </p>
1337 <p>The filter accepts the parameters: <var>struct_el</var>:<var>nb_iterations</var>,
1338 with the same syntax and semantics as the <a href="#dilate">dilate</a> filter.
1339 </p>
1340 <a name="smooth"></a>
1341 <h3 class="subsection"><a href="libavfilter.html#toc-smooth">8.21.3 smooth</a></h3>
1342
1343 <p>Smooth the input video.
1344 </p>
1345 <p>The filter takes the following parameters:
1346 <var>type</var>:<var>param1</var>:<var>param2</var>:<var>param3</var>:<var>param4</var>.
1347 </p>
1348 <p><var>type</var> is the type of smooth filter to apply, and can be one of
1349 the following values: &quot;blur&quot;, &quot;blur_no_scale&quot;, &quot;median&quot;, &quot;gaussian&quot;,
1350 &quot;bilateral&quot;. The default value is &quot;gaussian&quot;.
1351 </p>
1352 <p><var>param1</var>, <var>param2</var>, <var>param3</var>, and <var>param4</var> are
1353 parameters whose meanings depend on smooth type. <var>param1</var> and
1354 <var>param2</var> accept integer positive values or 0, <var>param3</var> and
1355 <var>param4</var> accept float values.
1356 </p>
1357 <p>The default value for <var>param1</var> is 3, the default value for the
1358 other parameters is 0.
1359 </p>
1360 <p>These parameters correspond to the parameters assigned to the
1361 libopencv function <code>cvSmooth</code>.
1362 </p>
1363 <a name="overlay"></a>
1364 <h2 class="section"><a href="libavfilter.html#toc-overlay">8.22 overlay</a></h2>
1365
1366 <p>Overlay one video on top of another.
1367 </p>
1368 <p>It takes two inputs and one output, the first input is the &quot;main&quot;
1369 video on which the second input is overlayed.
1370 </p>
1371 <p>It accepts the parameters: <var>x</var>:<var>y</var>.
1372 </p>
1373 <p><var>x</var> is the x coordinate of the overlayed video on the main video,
1374 <var>y</var> is the y coordinate. The parameters are expressions containing
1375 the following parameters:
1376 </p>
1377 <dl compact="compact">
1378 <dt> &lsquo;<samp>main_w, main_h</samp>&rsquo;</dt>
1379 <dd><p>main input width and height
1380 </p>
1381 </dd>
1382 <dt> &lsquo;<samp>W, H</samp>&rsquo;</dt>
1383 <dd><p>same as <var>main_w</var> and <var>main_h</var>
1384 </p>
1385 </dd>
1386 <dt> &lsquo;<samp>overlay_w, overlay_h</samp>&rsquo;</dt>
1387 <dd><p>overlay input width and height
1388 </p>
1389 </dd>
1390 <dt> &lsquo;<samp>w, h</samp>&rsquo;</dt>
1391 <dd><p>same as <var>overlay_w</var> and <var>overlay_h</var>
1392 </p></dd>
1393 </dl>
1394
1395 <p>Be aware that frames are taken from each input video in timestamp
1396 order, hence, if their initial timestamps differ, it is a a good idea
1397 to pass the two inputs through a <var>setpts=PTS-STARTPTS</var> filter to
1398 have them begin in the same zero timestamp, as it does the example for
1399 the <var>movie</var> filter.
1400 </p>
1401 <p>Follow some examples:
1402 </p><table><tr><td>&nbsp;</td><td><pre class="example"># draw the overlay at 10 pixels from the bottom right
1403 # corner of the main video.
1404 overlay=main_w-overlay_w-10:main_h-overlay_h-10
1405
1406 # insert a transparent PNG logo in the bottom left corner of the input
1407 movie=logo.png [logo];
1408 [in][logo] overlay=10:main_h-overlay_h-10 [out]
1409
1410 # insert 2 different transparent PNG logos (second logo on bottom
1411 # right corner):
1412 movie=logo1.png [logo1];
1413 movie=logo2.png [logo2];
1414 [in][logo1]       overlay=10:H-h-10 [in+logo1];
1415 [in+logo1][logo2] overlay=W-w-10:H-h-10 [out]
1416
1417 # add a transparent color layer on top of the main video,
1418 # WxH specifies the size of the main input to the overlay filter
1419 color=red.3:WxH [over]; [in][over] overlay [out]
1420 </pre></td></tr></table>
1421
1422 <p>You can chain togheter more overlays but the efficiency of such
1423 approach is yet to be tested.
1424 </p>
1425 <a name="pad"></a>
1426 <h2 class="section"><a href="libavfilter.html#toc-pad">8.23 pad</a></h2>
1427
1428 <p>Add paddings to the input image, and places the original input at the
1429 given coordinates <var>x</var>, <var>y</var>.
1430 </p>
1431 <p>It accepts the following parameters:
1432 <var>width</var>:<var>height</var>:<var>x</var>:<var>y</var>:<var>color</var>.
1433 </p>
1434 <p>The parameters <var>width</var>, <var>height</var>, <var>x</var>, and <var>y</var> are
1435 expressions containing the following constants:
1436 </p>
1437 <dl compact="compact">
1438 <dt> &lsquo;<samp>E, PI, PHI</samp>&rsquo;</dt>
1439 <dd><p>the corresponding mathematical approximated values for e
1440 (euler number), pi (greek PI), phi (golden ratio)
1441 </p>
1442 </dd>
1443 <dt> &lsquo;<samp>in_w, in_h</samp>&rsquo;</dt>
1444 <dd><p>the input video width and heigth
1445 </p>
1446 </dd>
1447 <dt> &lsquo;<samp>iw, ih</samp>&rsquo;</dt>
1448 <dd><p>same as <var>in_w</var> and <var>in_h</var>
1449 </p>
1450 </dd>
1451 <dt> &lsquo;<samp>out_w, out_h</samp>&rsquo;</dt>
1452 <dd><p>the output width and heigth, that is the size of the padded area as
1453 specified by the <var>width</var> and <var>height</var> expressions
1454 </p>
1455 </dd>
1456 <dt> &lsquo;<samp>ow, oh</samp>&rsquo;</dt>
1457 <dd><p>same as <var>out_w</var> and <var>out_h</var>
1458 </p>
1459 </dd>
1460 <dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
1461 <dd><p>x and y offsets as specified by the <var>x</var> and <var>y</var>
1462 expressions, or NAN if not yet specified
1463 </p>
1464 </dd>
1465 <dt> &lsquo;<samp>dar, a</samp>&rsquo;</dt>
1466 <dd><p>input display aspect ratio, same as <var>iw</var> / <var>ih</var>
1467 </p>
1468 </dd>
1469 <dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
1470 <dd><p>input sample aspect ratio
1471 </p>
1472 </dd>
1473 <dt> &lsquo;<samp>hsub, vsub</samp>&rsquo;</dt>
1474 <dd><p>horizontal and vertical chroma subsample values. For example for the
1475 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
1476 </p></dd>
1477 </dl>
1478
1479 <p>Follows the description of the accepted parameters.
1480 </p>
1481 <dl compact="compact">
1482 <dt> &lsquo;<samp>width, height</samp>&rsquo;</dt>
1483 <dd>
1484 <p>Specify the size of the output image with the paddings added. If the
1485 value for <var>width</var> or <var>height</var> is 0, the corresponding input size
1486 is used for the output.
1487 </p>
1488 <p>The <var>width</var> expression can reference the value set by the
1489 <var>height</var> expression, and viceversa.
1490 </p>
1491 <p>The default value of <var>width</var> and <var>height</var> is 0.
1492 </p>
1493 </dd>
1494 <dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
1495 <dd>
1496 <p>Specify the offsets where to place the input image in the padded area
1497 with respect to the top/left border of the output image.
1498 </p>
1499 <p>The <var>x</var> expression can reference the value set by the <var>y</var>
1500 expression, and viceversa.
1501 </p>
1502 <p>The default value of <var>x</var> and <var>y</var> is 0.
1503 </p>
1504 </dd>
1505 <dt> &lsquo;<samp>color</samp>&rsquo;</dt>
1506 <dd>
1507 <p>Specify the color of the padded area, it can be the name of a color
1508 (case insensitive match) or a 0xRRGGBB[AA] sequence.
1509 </p>
1510 <p>The default value of <var>color</var> is &quot;black&quot;.
1511 </p>
1512 </dd>
1513 </dl>
1514
1515 <p>Some examples follow:
1516 </p>
1517 <table><tr><td>&nbsp;</td><td><pre class="example"># Add paddings with color &quot;violet&quot; to the input video. Output video
1518 # size is 640x480, the top-left corner of the input video is placed at
1519 # column 0, row 40.
1520 pad=640:480:0:40:violet
1521
1522 # pad the input to get an output with dimensions increased bt 3/2,
1523 # and put the input video at the center of the padded area
1524 pad=&quot;3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2&quot;
1525
1526 # pad the input to get a squared output with size equal to the maximum
1527 # value between the input width and height, and put the input video at
1528 # the center of the padded area
1529 pad=&quot;max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2&quot;
1530
1531 # pad the input to get a final w/h ratio of 16:9
1532 pad=&quot;ih*16/9:ih:(ow-iw)/2:(oh-ih)/2&quot;
1533
1534 # double output size and put the input video in the bottom-right
1535 # corner of the output padded area
1536 pad=&quot;2*iw:2*ih:ow-iw:oh-ih&quot;
1537 </pre></td></tr></table>
1538
1539 <a name="pixdesctest"></a>
1540 <h2 class="section"><a href="libavfilter.html#toc-pixdesctest">8.24 pixdesctest</a></h2>
1541
1542 <p>Pixel format descriptor test filter, mainly useful for internal
1543 testing. The output video should be equal to the input video.
1544 </p>
1545 <p>For example:
1546 </p><table><tr><td>&nbsp;</td><td><pre class="example">format=monow, pixdesctest
1547 </pre></td></tr></table>
1548
1549 <p>can be used to test the monowhite pixel format descriptor definition.
1550 </p>
1551 <a name="scale"></a>
1552 <h2 class="section"><a href="libavfilter.html#toc-scale">8.25 scale</a></h2>
1553
1554 <p>Scale the input video to <var>width</var>:<var>height</var> and/or convert the image format.
1555 </p>
1556 <p>The parameters <var>width</var> and <var>height</var> are expressions containing
1557 the following constants:
1558 </p>
1559 <dl compact="compact">
1560 <dt> &lsquo;<samp>E, PI, PHI</samp>&rsquo;</dt>
1561 <dd><p>the corresponding mathematical approximated values for e
1562 (euler number), pi (greek PI), phi (golden ratio)
1563 </p>
1564 </dd>
1565 <dt> &lsquo;<samp>in_w, in_h</samp>&rsquo;</dt>
1566 <dd><p>the input width and heigth
1567 </p>
1568 </dd>
1569 <dt> &lsquo;<samp>iw, ih</samp>&rsquo;</dt>
1570 <dd><p>same as <var>in_w</var> and <var>in_h</var>
1571 </p>
1572 </dd>
1573 <dt> &lsquo;<samp>out_w, out_h</samp>&rsquo;</dt>
1574 <dd><p>the output (cropped) width and heigth
1575 </p>
1576 </dd>
1577 <dt> &lsquo;<samp>ow, oh</samp>&rsquo;</dt>
1578 <dd><p>same as <var>out_w</var> and <var>out_h</var>
1579 </p>
1580 </dd>
1581 <dt> &lsquo;<samp>dar, a</samp>&rsquo;</dt>
1582 <dd><p>input display aspect ratio, same as <var>iw</var> / <var>ih</var>
1583 </p>
1584 </dd>
1585 <dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
1586 <dd><p>input sample aspect ratio
1587 </p>
1588 </dd>
1589 <dt> &lsquo;<samp>hsub, vsub</samp>&rsquo;</dt>
1590 <dd><p>horizontal and vertical chroma subsample values. For example for the
1591 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
1592 </p></dd>
1593 </dl>
1594
1595 <p>If the input image format is different from the format requested by
1596 the next filter, the scale filter will convert the input to the
1597 requested format.
1598 </p>
1599 <p>If the value for <var>width</var> or <var>height</var> is 0, the respective input
1600 size is used for the output.
1601 </p>
1602 <p>If the value for <var>width</var> or <var>height</var> is -1, the scale filter will
1603 use, for the respective output size, a value that maintains the aspect
1604 ratio of the input image.
1605 </p>
1606 <p>The default value of <var>width</var> and <var>height</var> is 0.
1607 </p>
1608 <p>Some examples follow:
1609 </p><table><tr><td>&nbsp;</td><td><pre class="example"># scale the input video to a size of 200x100.
1610 scale=200:100
1611
1612 # scale the input to 2x
1613 scale=2*iw:2*ih
1614 # the above is the same as
1615 scale=2*in_w:2*in_h
1616
1617 # scale the input to half size
1618 scale=iw/2:ih/2
1619
1620 # increase the width, and set the height to the same size
1621 scale=3/2*iw:ow
1622
1623 # seek for Greek harmony
1624 scale=iw:1/PHI*iw
1625 scale=ih*PHI:ih
1626
1627 # increase the height, and set the width to 3/2 of the height
1628 scale=3/2*oh:3/5*ih
1629
1630 # increase the size, but make the size a multiple of the chroma
1631 scale=&quot;trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub&quot;
1632
1633 # increase the width to a maximum of 500 pixels, keep the same input aspect ratio
1634 scale='min(500\, iw*3/2):-1'
1635 </pre></td></tr></table>
1636
1637 <a name="select"></a>
1638 <h2 class="section"><a href="libavfilter.html#toc-select">8.26 select</a></h2>
1639 <p>Select frames to pass in output.
1640 </p>
1641 <p>It accepts in input an expression, which is evaluated for each input
1642 frame. If the expression is evaluated to a non-zero value, the frame
1643 is selected and passed to the output, otherwise it is discarded.
1644 </p>
1645 <p>The expression can contain the following constants:
1646 </p>
1647 <dl compact="compact">
1648 <dt> &lsquo;<samp>PI</samp>&rsquo;</dt>
1649 <dd><p>Greek PI
1650 </p>
1651 </dd>
1652 <dt> &lsquo;<samp>PHI</samp>&rsquo;</dt>
1653 <dd><p>golden ratio
1654 </p>
1655 </dd>
1656 <dt> &lsquo;<samp>E</samp>&rsquo;</dt>
1657 <dd><p>Euler number
1658 </p>
1659 </dd>
1660 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
1661 <dd><p>the sequential number of the filtered frame, starting from 0
1662 </p>
1663 </dd>
1664 <dt> &lsquo;<samp>selected_n</samp>&rsquo;</dt>
1665 <dd><p>the sequential number of the selected frame, starting from 0
1666 </p>
1667 </dd>
1668 <dt> &lsquo;<samp>prev_selected_n</samp>&rsquo;</dt>
1669 <dd><p>the sequential number of the last selected frame, NAN if undefined
1670 </p>
1671 </dd>
1672 <dt> &lsquo;<samp>TB</samp>&rsquo;</dt>
1673 <dd><p>timebase of the input timestamps
1674 </p>
1675 </dd>
1676 <dt> &lsquo;<samp>pts</samp>&rsquo;</dt>
1677 <dd><p>the PTS (Presentation TimeStamp) of the filtered video frame,
1678 expressed in <var>TB</var> units, NAN if undefined
1679 </p>
1680 </dd>
1681 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
1682 <dd><p>the PTS (Presentation TimeStamp) of the filtered video frame,
1683 expressed in seconds, NAN if undefined
1684 </p>
1685 </dd>
1686 <dt> &lsquo;<samp>prev_pts</samp>&rsquo;</dt>
1687 <dd><p>the PTS of the previously filtered video frame, NAN if undefined
1688 </p>
1689 </dd>
1690 <dt> &lsquo;<samp>prev_selected_pts</samp>&rsquo;</dt>
1691 <dd><p>the PTS of the last previously filtered video frame, NAN if undefined
1692 </p>
1693 </dd>
1694 <dt> &lsquo;<samp>prev_selected_t</samp>&rsquo;</dt>
1695 <dd><p>the PTS of the last previously selected video frame, NAN if undefined
1696 </p>
1697 </dd>
1698 <dt> &lsquo;<samp>start_pts</samp>&rsquo;</dt>
1699 <dd><p>the PTS of the first video frame in the video, NAN if undefined
1700 </p>
1701 </dd>
1702 <dt> &lsquo;<samp>start_t</samp>&rsquo;</dt>
1703 <dd><p>the time of the first video frame in the video, NAN if undefined
1704 </p>
1705 </dd>
1706 <dt> &lsquo;<samp>pict_type</samp>&rsquo;</dt>
1707 <dd><p>the picture type of the filtered frame, can assume one of the following
1708 values:
1709 </p><dl compact="compact">
1710 <dt> &lsquo;<samp>PICT_TYPE_I</samp>&rsquo;</dt>
1711 <dt> &lsquo;<samp>PICT_TYPE_P</samp>&rsquo;</dt>
1712 <dt> &lsquo;<samp>PICT_TYPE_B</samp>&rsquo;</dt>
1713 <dt> &lsquo;<samp>PICT_TYPE_S</samp>&rsquo;</dt>
1714 <dt> &lsquo;<samp>PICT_TYPE_SI</samp>&rsquo;</dt>
1715 <dt> &lsquo;<samp>PICT_TYPE_SP</samp>&rsquo;</dt>
1716 <dt> &lsquo;<samp>PICT_TYPE_BI</samp>&rsquo;</dt>
1717 </dl>
1718
1719 </dd>
1720 <dt> &lsquo;<samp>interlace_type</samp>&rsquo;</dt>
1721 <dd><p>the frame interlace type, can assume one of the following values:
1722 </p><dl compact="compact">
1723 <dt> &lsquo;<samp>INTERLACE_TYPE_P</samp>&rsquo;</dt>
1724 <dd><p>the frame is progressive (not interlaced)
1725 </p></dd>
1726 <dt> &lsquo;<samp>INTERLACE_TYPE_T</samp>&rsquo;</dt>
1727 <dd><p>the frame is top-field-first
1728 </p></dd>
1729 <dt> &lsquo;<samp>INTERLACE_TYPE_B</samp>&rsquo;</dt>
1730 <dd><p>the frame is bottom-field-first
1731 </p></dd>
1732 </dl>
1733
1734 </dd>
1735 <dt> &lsquo;<samp>key</samp>&rsquo;</dt>
1736 <dd><p>1 if the filtered frame is a key-frame, 0 otherwise
1737 </p>
1738 </dd>
1739 <dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
1740 <dd><p>the position in the file of the filtered frame, -1 if the information
1741 is not available (e.g. for synthetic video)
1742 </p></dd>
1743 </dl>
1744
1745 <p>The default value of the select expression is &quot;1&quot;.
1746 </p>
1747 <p>Some examples follow:
1748 </p>
1749 <table><tr><td>&nbsp;</td><td><pre class="example"># select all frames in input
1750 select
1751
1752 # the above is the same as:
1753 select=1
1754
1755 # skip all frames:
1756 select=0
1757
1758 # select only I-frames
1759 select='eq(pict_type\,PICT_TYPE_I)'
1760
1761 # select one frame every 100
1762 select='not(mod(n\,100))'
1763
1764 # select only frames contained in the 10-20 time interval
1765 select='gte(t\,10)*lte(t\,20)'
1766
1767 # select only I frames contained in the 10-20 time interval
1768 select='gte(t\,10)*lte(t\,20)*eq(pict_type\,PICT_TYPE_I)'
1769
1770 # select frames with a minimum distance of 10 seconds
1771 select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
1772 </pre></td></tr></table>
1773
1774 <p><a name="setdar"></a>
1775 </p><a name="setdar-1"></a>
1776 <h2 class="section"><a href="libavfilter.html#toc-setdar-1">8.27 setdar</a></h2>
1777
1778 <p>Set the Display Aspect Ratio for the filter output video.
1779 </p>
1780 <p>This is done by changing the specified Sample (aka Pixel) Aspect
1781 Ratio, according to the following equation:
1782 <em>DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR</em>
1783 </p>
1784 <p>Keep in mind that this filter does not modify the pixel dimensions of
1785 the video frame. Also the display aspect ratio set by this filter may
1786 be changed by later filters in the filterchain, e.g. in case of
1787 scaling or if another &quot;setdar&quot; or a &quot;setsar&quot; filter is applied.
1788 </p>
1789 <p>The filter accepts a parameter string which represents the wanted
1790 display aspect ratio.
1791 The parameter can be a floating point number string, or an expression
1792 of the form <var>num</var>:<var>den</var>, where <var>num</var> and <var>den</var> are the
1793 numerator and denominator of the aspect ratio.
1794 If the parameter is not specified, it is assumed the value &quot;0:1&quot;.
1795 </p>
1796 <p>For example to change the display aspect ratio to 16:9, specify:
1797 </p><table><tr><td>&nbsp;</td><td><pre class="example">setdar=16:9
1798 # the above is equivalent to
1799 setdar=1.77777
1800 </pre></td></tr></table>
1801
1802 <p>See also the <a href="#setsar">setsar</a> filter documentation.
1803 </p>
1804 <a name="setpts"></a>
1805 <h2 class="section"><a href="libavfilter.html#toc-setpts">8.28 setpts</a></h2>
1806
1807 <p>Change the PTS (presentation timestamp) of the input video frames.
1808 </p>
1809 <p>Accept in input an expression evaluated through the eval API, which
1810 can contain the following constants:
1811 </p>
1812 <dl compact="compact">
1813 <dt> &lsquo;<samp>PTS</samp>&rsquo;</dt>
1814 <dd><p>the presentation timestamp in input
1815 </p>
1816 </dd>
1817 <dt> &lsquo;<samp>PI</samp>&rsquo;</dt>
1818 <dd><p>Greek PI
1819 </p>
1820 </dd>
1821 <dt> &lsquo;<samp>PHI</samp>&rsquo;</dt>
1822 <dd><p>golden ratio
1823 </p>
1824 </dd>
1825 <dt> &lsquo;<samp>E</samp>&rsquo;</dt>
1826 <dd><p>Euler number
1827 </p>
1828 </dd>
1829 <dt> &lsquo;<samp>N</samp>&rsquo;</dt>
1830 <dd><p>the count of the input frame, starting from 0.
1831 </p>
1832 </dd>
1833 <dt> &lsquo;<samp>STARTPTS</samp>&rsquo;</dt>
1834 <dd><p>the PTS of the first video frame
1835 </p>
1836 </dd>
1837 <dt> &lsquo;<samp>INTERLACED</samp>&rsquo;</dt>
1838 <dd><p>tell if the current frame is interlaced
1839 </p>
1840 </dd>
1841 <dt> &lsquo;<samp>POS</samp>&rsquo;</dt>
1842 <dd><p>original position in the file of the frame, or undefined if undefined
1843 for the current frame
1844 </p>
1845 </dd>
1846 <dt> &lsquo;<samp>PREV_INPTS</samp>&rsquo;</dt>
1847 <dd><p>previous input PTS
1848 </p>
1849 </dd>
1850 <dt> &lsquo;<samp>PREV_OUTPTS</samp>&rsquo;</dt>
1851 <dd><p>previous output PTS
1852 </p>
1853 </dd>
1854 </dl>
1855
1856 <p>Some examples follow:
1857 </p>
1858 <table><tr><td>&nbsp;</td><td><pre class="example"># start counting PTS from zero
1859 setpts=PTS-STARTPTS
1860
1861 # fast motion
1862 setpts=0.5*PTS
1863
1864 # slow motion
1865 setpts=2.0*PTS
1866
1867 # fixed rate 25 fps
1868 setpts=N/(25*TB)
1869
1870 # fixed rate 25 fps with some jitter
1871 setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
1872 </pre></td></tr></table>
1873
1874 <p><a name="setsar"></a>
1875 </p><a name="setsar-1"></a>
1876 <h2 class="section"><a href="libavfilter.html#toc-setsar-1">8.29 setsar</a></h2>
1877
1878 <p>Set the Sample (aka Pixel) Aspect Ratio for the filter output video.
1879 </p>
1880 <p>Note that as a consequence of the application of this filter, the
1881 output display aspect ratio will change according to the following
1882 equation:
1883 <em>DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR</em>
1884 </p>
1885 <p>Keep in mind that the sample aspect ratio set by this filter may be
1886 changed by later filters in the filterchain, e.g. if another &quot;setsar&quot;
1887 or a &quot;setdar&quot; filter is applied.
1888 </p>
1889 <p>The filter accepts a parameter string which represents the wanted
1890 sample aspect ratio.
1891 The parameter can be a floating point number string, or an expression
1892 of the form <var>num</var>:<var>den</var>, where <var>num</var> and <var>den</var> are the
1893 numerator and denominator of the aspect ratio.
1894 If the parameter is not specified, it is assumed the value &quot;0:1&quot;.
1895 </p>
1896 <p>For example to change the sample aspect ratio to 10:11, specify:
1897 </p><table><tr><td>&nbsp;</td><td><pre class="example">setsar=10:11
1898 </pre></td></tr></table>
1899
1900 <a name="settb"></a>
1901 <h2 class="section"><a href="libavfilter.html#toc-settb">8.30 settb</a></h2>
1902
1903 <p>Set the timebase to use for the output frames timestamps.
1904 It is mainly useful for testing timebase configuration.
1905 </p>
1906 <p>It accepts in input an arithmetic expression representing a rational.
1907 The expression can contain the constants &quot;PI&quot;, &quot;E&quot;, &quot;PHI&quot;, &quot;AVTB&quot; (the
1908 default timebase), and &quot;intb&quot; (the input timebase).
1909 </p>
1910 <p>The default value for the input is &quot;intb&quot;.
1911 </p>
1912 <p>Follow some examples.
1913 </p>
1914 <table><tr><td>&nbsp;</td><td><pre class="example"># set the timebase to 1/25
1915 settb=1/25
1916
1917 # set the timebase to 1/10
1918 settb=0.1
1919
1920 #set the timebase to 1001/1000
1921 settb=1+0.001
1922
1923 #set the timebase to 2*intb
1924 settb=2*intb
1925
1926 #set the default timebase value
1927 settb=AVTB
1928 </pre></td></tr></table>
1929
1930 <a name="showinfo"></a>
1931 <h2 class="section"><a href="libavfilter.html#toc-showinfo">8.31 showinfo</a></h2>
1932
1933 <p>Show a line containing various information for each input video frame.
1934 The input video is not modified.
1935 </p>
1936 <p>The shown line contains a sequence of key/value pairs of the form
1937 <var>key</var>:<var>value</var>.
1938 </p>
1939 <p>A description of each shown parameter follows:
1940 </p>
1941 <dl compact="compact">
1942 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
1943 <dd><p>sequential number of the input frame, starting from 0
1944 </p>
1945 </dd>
1946 <dt> &lsquo;<samp>pts</samp>&rsquo;</dt>
1947 <dd><p>Presentation TimeStamp of the input frame, expressed as a number of
1948 time base units. The time base unit depends on the filter input pad.
1949 </p>
1950 </dd>
1951 <dt> &lsquo;<samp>pts_time</samp>&rsquo;</dt>
1952 <dd><p>Presentation TimeStamp of the input frame, expressed as a number of
1953 seconds
1954 </p>
1955 </dd>
1956 <dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
1957 <dd><p>position of the frame in the input stream, -1 if this information in
1958 unavailable and/or meanigless (for example in case of synthetic video)
1959 </p>
1960 </dd>
1961 <dt> &lsquo;<samp>fmt</samp>&rsquo;</dt>
1962 <dd><p>pixel format name
1963 </p>
1964 </dd>
1965 <dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
1966 <dd><p>sample aspect ratio of the input frame, expressed in the form
1967 <var>num</var>/<var>den</var>
1968 </p>
1969 </dd>
1970 <dt> &lsquo;<samp>s</samp>&rsquo;</dt>
1971 <dd><p>size of the input frame, expressed in the form
1972 <var>width</var>x<var>height</var>
1973 </p>
1974 </dd>
1975 <dt> &lsquo;<samp>i</samp>&rsquo;</dt>
1976 <dd><p>interlaced mode (&quot;P&quot; for &quot;progressive&quot;, &quot;T&quot; for top field first, &quot;B&quot;
1977 for bottom field first)
1978 </p>
1979 </dd>
1980 <dt> &lsquo;<samp>iskey</samp>&rsquo;</dt>
1981 <dd><p>1 if the frame is a key frame, 0 otherwise
1982 </p>
1983 </dd>
1984 <dt> &lsquo;<samp>type</samp>&rsquo;</dt>
1985 <dd><p>picture type of the input frame (&quot;I&quot; for an I-frame, &quot;P&quot; for a
1986 P-frame, &quot;B&quot; for a B-frame, &quot;?&quot; for unknown type).
1987 Check also the documentation of the <code>AVPictureType</code> enum and of
1988 the <code>av_get_picture_type_char</code> function defined in
1989 &lsquo;<tt>libavutil/avutil.h</tt>&rsquo;.
1990 </p>
1991 </dd>
1992 <dt> &lsquo;<samp>checksum</samp>&rsquo;</dt>
1993 <dd><p>Adler-32 checksum of all the planes of the input frame
1994 </p>
1995 </dd>
1996 <dt> &lsquo;<samp>plane_checksum</samp>&rsquo;</dt>
1997 <dd><p>Adler-32 checksum of each plane of the input frame, expressed in the form
1998 &quot;[<var>c0</var> <var>c1</var> <var>c2</var> <var>c3</var>]&quot;
1999 </p></dd>
2000 </dl>
2001
2002 <a name="slicify"></a>
2003 <h2 class="section"><a href="libavfilter.html#toc-slicify">8.32 slicify</a></h2>
2004
2005 <p>Pass the images of input video on to next video filter as multiple
2006 slices.
2007 </p>
2008 <table><tr><td>&nbsp;</td><td><pre class="example">./ffmpeg -i in.avi -vf &quot;slicify=32&quot; out.avi
2009 </pre></td></tr></table>
2010
2011 <p>The filter accepts the slice height as parameter. If the parameter is
2012 not specified it will use the default value of 16.
2013 </p>
2014 <p>Adding this in the beginning of filter chains should make filtering
2015 faster due to better use of the memory cache.
2016 </p>
2017 <a name="split"></a>
2018 <h2 class="section"><a href="libavfilter.html#toc-split">8.33 split</a></h2>
2019
2020 <p>Pass on the input video to two outputs. Both outputs are identical to
2021 the input video.
2022 </p>
2023 <p>For example:
2024 </p><table><tr><td>&nbsp;</td><td><pre class="example">[in] split [splitout1][splitout2];
2025 [splitout1] crop=100:100:0:0    [cropout];
2026 [splitout2] pad=200:200:100:100 [padout];
2027 </pre></td></tr></table>
2028
2029 <p>will create two separate outputs from the same input, one cropped and
2030 one padded.
2031 </p>
2032 <a name="transpose"></a>
2033 <h2 class="section"><a href="libavfilter.html#toc-transpose">8.34 transpose</a></h2>
2034
2035 <p>Transpose rows with columns in the input video and optionally flip it.
2036 </p>
2037 <p>It accepts a parameter representing an integer, which can assume the
2038 values:
2039 </p>
2040 <dl compact="compact">
2041 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
2042 <dd><p>Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
2043 </p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     L.l
2044 . . -&gt;  . .
2045 l.r     R.r
2046 </pre></td></tr></table>
2047
2048 </dd>
2049 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
2050 <dd><p>Rotate by 90 degrees clockwise, that is:
2051 </p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     l.L
2052 . . -&gt;  . .
2053 l.r     r.R
2054 </pre></td></tr></table>
2055
2056 </dd>
2057 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
2058 <dd><p>Rotate by 90 degrees counterclockwise, that is:
2059 </p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     R.r
2060 . . -&gt;  . .
2061 l.r     L.l
2062 </pre></td></tr></table>
2063
2064 </dd>
2065 <dt> &lsquo;<samp>3</samp>&rsquo;</dt>
2066 <dd><p>Rotate by 90 degrees clockwise and vertically flip, that is:
2067 </p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     r.R
2068 . . -&gt;  . .
2069 l.r     l.L
2070 </pre></td></tr></table>
2071 </dd>
2072 </dl>
2073
2074 <a name="unsharp"></a>
2075 <h2 class="section"><a href="libavfilter.html#toc-unsharp">8.35 unsharp</a></h2>
2076
2077 <p>Sharpen or blur the input video.
2078 </p>
2079 <p>It accepts the following parameters:
2080 <var>luma_msize_x</var>:<var>luma_msize_y</var>:<var>luma_amount</var>:<var>chroma_msize_x</var>:<var>chroma_msize_y</var>:<var>chroma_amount</var>
2081 </p>
2082 <p>Negative values for the amount will blur the input video, while positive
2083 values will sharpen. All parameters are optional and default to the
2084 equivalent of the string &rsquo;5:5:1.0:0:0:0.0&rsquo;.
2085 </p>
2086 <dl compact="compact">
2087 <dt> &lsquo;<samp>luma_msize_x</samp>&rsquo;</dt>
2088 <dd><p>Set the luma matrix horizontal size. It can be an integer between 3
2089 and 13, default value is 5.
2090 </p>
2091 </dd>
2092 <dt> &lsquo;<samp>luma_msize_y</samp>&rsquo;</dt>
2093 <dd><p>Set the luma matrix vertical size. It can be an integer between 3
2094 and 13, default value is 5.
2095 </p>
2096 </dd>
2097 <dt> &lsquo;<samp>luma_amount</samp>&rsquo;</dt>
2098 <dd><p>Set the luma effect strength. It can be a float number between -2.0
2099 and 5.0, default value is 1.0.
2100 </p>
2101 </dd>
2102 <dt> &lsquo;<samp>chroma_msize_x</samp>&rsquo;</dt>
2103 <dd><p>Set the chroma matrix horizontal size. It can be an integer between 3
2104 and 13, default value is 0.
2105 </p>
2106 </dd>
2107 <dt> &lsquo;<samp>chroma_msize_y</samp>&rsquo;</dt>
2108 <dd><p>Set the chroma matrix vertical size. It can be an integer between 3
2109 and 13, default value is 0.
2110 </p>
2111 </dd>
2112 <dt> &lsquo;<samp>luma_amount</samp>&rsquo;</dt>
2113 <dd><p>Set the chroma effect strength. It can be a float number between -2.0
2114 and 5.0, default value is 0.0.
2115 </p>
2116 </dd>
2117 </dl>
2118
2119 <table><tr><td>&nbsp;</td><td><pre class="example"># Strong luma sharpen effect parameters
2120 unsharp=7:7:2.5
2121
2122 # Strong blur of both luma and chroma parameters
2123 unsharp=7:7:-2:7:7:-2
2124
2125 # Use the default values with <code>ffmpeg</code>
2126 ./ffmpeg -i in.avi -vf &quot;unsharp&quot; out.mp4
2127 </pre></td></tr></table>
2128
2129 <a name="vflip"></a>
2130 <h2 class="section"><a href="libavfilter.html#toc-vflip">8.36 vflip</a></h2>
2131
2132 <p>Flip the input video vertically.
2133 </p>
2134 <table><tr><td>&nbsp;</td><td><pre class="example">./ffmpeg -i in.avi -vf &quot;vflip&quot; out.avi
2135 </pre></td></tr></table>
2136
2137 <a name="yadif"></a>
2138 <h2 class="section"><a href="libavfilter.html#toc-yadif">8.37 yadif</a></h2>
2139
2140 <p>Deinterlace the input video (&quot;yadif&quot; means &quot;yet another deinterlacing
2141 filter&quot;).
2142 </p>
2143 <p>It accepts the optional parameters: <var>mode</var>:<var>parity</var>:<var>auto</var>.
2144 </p>
2145 <p><var>mode</var> specifies the interlacing mode to adopt, accepts one of the
2146 following values:
2147 </p>
2148 <dl compact="compact">
2149 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
2150 <dd><p>output 1 frame for each frame
2151 </p></dd>
2152 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
2153 <dd><p>output 1 frame for each field
2154 </p></dd>
2155 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
2156 <dd><p>like 0 but skips spatial interlacing check
2157 </p></dd>
2158 <dt> &lsquo;<samp>3</samp>&rsquo;</dt>
2159 <dd><p>like 1 but skips spatial interlacing check
2160 </p></dd>
2161 </dl>
2162
2163 <p>Default value is 0.
2164 </p>
2165 <p><var>parity</var> specifies the picture field parity assumed for the input
2166 interlaced video, accepts one of the following values:
2167 </p>
2168 <dl compact="compact">
2169 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
2170 <dd><p>assume bottom field first
2171 </p></dd>
2172 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
2173 <dd><p>assume top field first
2174 </p></dd>
2175 <dt> &lsquo;<samp>-1</samp>&rsquo;</dt>
2176 <dd><p>enable automatic detection
2177 </p></dd>
2178 </dl>
2179
2180 <p>Default value is -1.
2181 If interlacing is unknown or decoder does not export this information,
2182 top field first will be assumed.
2183 </p>
2184 <p><var>auto</var> specifies if deinterlacer should trust the interlaced flag
2185 and only deinterlace frames marked as interlaced
2186 </p>
2187 <dl compact="compact">
2188 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
2189 <dd><p>deinterlace all frames
2190 </p></dd>
2191 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
2192 <dd><p>only deinterlace frames marked as interlaced
2193 </p></dd>
2194 </dl>
2195
2196 <p>Default value is 0.
2197 </p>
2198
2199 <a name="Video-Sources"></a>
2200 <h1 class="chapter"><a href="libavfilter.html#toc-Video-Sources">9. Video Sources</a></h1>
2201
2202 <p>Below is a description of the currently available video sources.
2203 </p>
2204 <a name="buffer"></a>
2205 <h2 class="section"><a href="libavfilter.html#toc-buffer">9.1 buffer</a></h2>
2206
2207 <p>Buffer video frames, and make them available to the filter chain.
2208 </p>
2209 <p>This source is mainly intended for a programmatic use, in particular
2210 through the interface defined in &lsquo;<tt>libavfilter/vsrc_buffer.h</tt>&rsquo;.
2211 </p>
2212 <p>It accepts the following parameters:
2213 <var>width</var>:<var>height</var>:<var>pix_fmt_string</var>:<var>timebase_num</var>:<var>timebase_den</var>:<var>sample_aspect_ratio_num</var>:<var>sample_aspect_ratio.den</var>:<var>scale_params</var>
2214 </p>
2215 <p>All the parameters but <var>scale_params</var> need to be explicitely
2216 defined.
2217 </p>
2218 <p>Follows the list of the accepted parameters.
2219 </p>
2220 <dl compact="compact">
2221 <dt> &lsquo;<samp>width, height</samp>&rsquo;</dt>
2222 <dd><p>Specify the width and height of the buffered video frames.
2223 </p>
2224 </dd>
2225 <dt> &lsquo;<samp>pix_fmt_string</samp>&rsquo;</dt>
2226 <dd><p>A string representing the pixel format of the buffered video frames.
2227 It may be a number corresponding to a pixel format, or a pixel format
2228 name.
2229 </p>
2230 </dd>
2231 <dt> &lsquo;<samp>timebase_num, timebase_den</samp>&rsquo;</dt>
2232 <dd><p>Specify numerator and denomitor of the timebase assumed by the
2233 timestamps of the buffered frames.
2234 </p>
2235 </dd>
2236 <dt> &lsquo;<samp>sample_aspect_ratio.num, sample_aspect_ratio.den</samp>&rsquo;</dt>
2237 <dd><p>Specify numerator and denominator of the sample aspect ratio assumed
2238 by the video frames.
2239 </p>
2240 </dd>
2241 <dt> &lsquo;<samp>scale_params</samp>&rsquo;</dt>
2242 <dd><p>Specify the optional parameters to be used for the scale filter which
2243 is automatically inserted when an input change is detected in the
2244 input size or format.
2245 </p></dd>
2246 </dl>
2247
2248 <p>For example:
2249 </p><table><tr><td>&nbsp;</td><td><pre class="example">buffer=320:240:yuv410p:1:24:1:1
2250 </pre></td></tr></table>
2251
2252 <p>will instruct the source to accept video frames with size 320x240 and
2253 with format &quot;yuv410p&quot;, assuming 1/24 as the timestamps timebase and
2254 square pixels (1:1 sample aspect ratio).
2255 Since the pixel format with name &quot;yuv410p&quot; corresponds to the number 6
2256 (check the enum PixelFormat definition in &lsquo;<tt>libavutil/pixfmt.h</tt>&rsquo;),
2257 this example corresponds to:
2258 </p><table><tr><td>&nbsp;</td><td><pre class="example">buffer=320:240:6:1:24:1:1
2259 </pre></td></tr></table>
2260
2261 <a name="color"></a>
2262 <h2 class="section"><a href="libavfilter.html#toc-color">9.2 color</a></h2>
2263
2264 <p>Provide an uniformly colored input.
2265 </p>
2266 <p>It accepts the following parameters:
2267 <var>color</var>:<var>frame_size</var>:<var>frame_rate</var>
2268 </p>
2269 <p>Follows the description of the accepted parameters.
2270 </p>
2271 <dl compact="compact">
2272 <dt> &lsquo;<samp>color</samp>&rsquo;</dt>
2273 <dd><p>Specify the color of the source. It can be the name of a color (case
2274 insensitive match) or a 0xRRGGBB[AA] sequence, possibly followed by an
2275 alpha specifier. The default value is &quot;black&quot;.
2276 </p>
2277 </dd>
2278 <dt> &lsquo;<samp>frame_size</samp>&rsquo;</dt>
2279 <dd><p>Specify the size of the sourced video, it may be a string of the form
2280 <var>width</var>x<var>heigth</var>, or the name of a size abbreviation. The
2281 default value is &quot;320x240&quot;.
2282 </p>
2283 </dd>
2284 <dt> &lsquo;<samp>frame_rate</samp>&rsquo;</dt>
2285 <dd><p>Specify the frame rate of the sourced video, as the number of frames
2286 generated per second. It has to be a string in the format
2287 <var>frame_rate_num</var>/<var>frame_rate_den</var>, an integer number, a float
2288 number or a valid video frame rate abbreviation. The default value is
2289 &quot;25&quot;.
2290 </p>
2291 </dd>
2292 </dl>
2293
2294 <p>For example the following graph description will generate a red source
2295 with an opacity of 0.2, with size &quot;qcif&quot; and a frame rate of 10
2296 frames per second, which will be overlayed over the source connected
2297 to the pad with identifier &quot;in&quot;.
2298 </p>
2299 <table><tr><td>&nbsp;</td><td><pre class="example">&quot;color=red@0.2:qcif:10 [color]; [in][color] overlay [out]&quot;
2300 </pre></td></tr></table>
2301
2302 <a name="movie"></a>
2303 <h2 class="section"><a href="libavfilter.html#toc-movie">9.3 movie</a></h2>
2304
2305 <p>Read a video stream from a movie container.
2306 </p>
2307 <p>It accepts the syntax: <var>movie_name</var>[:<var>options</var>] where
2308 <var>movie_name</var> is the name of the resource to read (not necessarily
2309 a file but also a device or a stream accessed through some protocol),
2310 and <var>options</var> is an optional sequence of <var>key</var>=<var>value</var>
2311 pairs, separated by &quot;:&quot;.
2312 </p>
2313 <p>The description of the accepted options follows.
2314 </p>
2315 <dl compact="compact">
2316 <dt> &lsquo;<samp>format_name, f</samp>&rsquo;</dt>
2317 <dd><p>Specifies the format assumed for the movie to read, and can be either
2318 the name of a container or an input device. If not specified the
2319 format is guessed from <var>movie_name</var> or by probing.
2320 </p>
2321 </dd>
2322 <dt> &lsquo;<samp>seek_point, sp</samp>&rsquo;</dt>
2323 <dd><p>Specifies the seek point in seconds, the frames will be output
2324 starting from this seek point, the parameter is evaluated with
2325 <code>av_strtod</code> so the numerical value may be suffixed by an IS
2326 postfix. Default value is &quot;0&quot;.
2327 </p>
2328 </dd>
2329 <dt> &lsquo;<samp>stream_index, si</samp>&rsquo;</dt>
2330 <dd><p>Specifies the index of the video stream to read. If the value is -1,
2331 the best suited video stream will be automatically selected. Default
2332 value is &quot;-1&quot;.
2333 </p>
2334 </dd>
2335 </dl>
2336
2337 <p>This filter allows to overlay a second video on top of main input of
2338 a filtergraph as shown in this graph:
2339 </p><table><tr><td>&nbsp;</td><td><pre class="example">input -----------&gt; deltapts0 --&gt; overlay --&gt; output
2340                                     ^
2341                                     |
2342 movie --&gt; scale--&gt; deltapts1 -------+
2343 </pre></td></tr></table>
2344
2345 <p>Some examples follow:
2346 </p><table><tr><td>&nbsp;</td><td><pre class="example"># skip 3.2 seconds from the start of the avi file in.avi, and overlay it
2347 # on top of the input labelled as &quot;in&quot;.
2348 movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [movie];
2349 [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
2350
2351 # read from a video4linux2 device, and overlay it on top of the input
2352 # labelled as &quot;in&quot;
2353 movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie];
2354 [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
2355
2356 </pre></td></tr></table>
2357
2358 <a name="nullsrc"></a>
2359 <h2 class="section"><a href="libavfilter.html#toc-nullsrc">9.4 nullsrc</a></h2>
2360
2361 <p>Null video source, never return images. It is mainly useful as a
2362 template and to be employed in analysis / debugging tools.
2363 </p>
2364 <p>It accepts as optional parameter a string of the form
2365 <var>width</var>:<var>height</var>:<var>timebase</var>.
2366 </p>
2367 <p><var>width</var> and <var>height</var> specify the size of the configured
2368 source. The default values of <var>width</var> and <var>height</var> are
2369 respectively 352 and 288 (corresponding to the CIF size format).
2370 </p>
2371 <p><var>timebase</var> specifies an arithmetic expression representing a
2372 timebase. The expression can contain the constants &quot;PI&quot;, &quot;E&quot;, &quot;PHI&quot;,
2373 &quot;AVTB&quot; (the default timebase), and defaults to the value &quot;AVTB&quot;.
2374 </p>
2375 <a name="frei0r_005fsrc"></a>
2376 <h2 class="section"><a href="libavfilter.html#toc-frei0r_005fsrc">9.5 frei0r_src</a></h2>
2377
2378 <p>Provide a frei0r source.
2379 </p>
2380 <p>To enable compilation of this filter you need to install the frei0r
2381 header and configure FFmpeg with &ndash;enable-frei0r.
2382 </p>
2383 <p>The source supports the syntax:
2384 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>size</var>:<var>rate</var>:<var>src_name</var>[{=|:}<var>param1</var>:<var>param2</var>:...:<var>paramN</var>]
2385 </pre></td></tr></table>
2386
2387 <p><var>size</var> is the size of the video to generate, may be a string of the
2388 form <var>width</var>x<var>height</var> or a frame size abbreviation.
2389 <var>rate</var> is the rate of the video to generate, may be a string of
2390 the form <var>num</var>/<var>den</var> or a frame rate abbreviation.
2391 <var>src_name</var> is the name to the frei0r source to load. For more
2392 information regarding frei0r and how to set the parameters read the
2393 section <a href="#frei0r">frei0r</a> in the description of the video filters.
2394 </p>
2395 <p>Some examples follow:
2396 </p><table><tr><td>&nbsp;</td><td><pre class="example"># generate a frei0r partik0l source with size 200x200 and framerate 10
2397 # which is overlayed on the overlay filter main input
2398 frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay
2399 </pre></td></tr></table>
2400
2401 <a name="rgbtestsrc_002c-testsrc"></a>
2402 <h2 class="section"><a href="libavfilter.html#toc-rgbtestsrc_002c-testsrc">9.6 rgbtestsrc, testsrc</a></h2>
2403
2404 <p>The <code>rgbtestsrc</code> source generates an RGB test pattern useful for
2405 detecting RGB vs BGR issues. You should see a red, green and blue
2406 stripe from top to bottom.
2407 </p>
2408 <p>The <code>testsrc</code> source generates a test video pattern, showing a
2409 color pattern, a scrolling gradient and a timestamp. This is mainly
2410 intended for testing purposes.
2411 </p>
2412 <p>Both sources accept an optional sequence of <var>key</var>=<var>value</var> pairs,
2413 separated by &quot;:&quot;. The description of the accepted options follows.
2414 </p>
2415 <dl compact="compact">
2416 <dt> &lsquo;<samp>size, s</samp>&rsquo;</dt>
2417 <dd><p>Specify the size of the sourced video, it may be a string of the form
2418 <var>width</var>x<var>heigth</var>, or the name of a size abbreviation. The
2419 default value is &quot;320x240&quot;.
2420 </p>
2421 </dd>
2422 <dt> &lsquo;<samp>rate, r</samp>&rsquo;</dt>
2423 <dd><p>Specify the frame rate of the sourced video, as the number of frames
2424 generated per second. It has to be a string in the format
2425 <var>frame_rate_num</var>/<var>frame_rate_den</var>, an integer number, a float
2426 number or a valid video frame rate abbreviation. The default value is
2427 &quot;25&quot;.
2428 </p>
2429 </dd>
2430 <dt> &lsquo;<samp>duration</samp>&rsquo;</dt>
2431 <dd><p>Set the video duration of the sourced video. The accepted syntax is:
2432 </p><table><tr><td>&nbsp;</td><td><pre class="example">[-]HH[:MM[:SS[.m...]]]
2433 [-]S+[.m...]
2434 </pre></td></tr></table>
2435 <p>See also the function <code>av_parse_time()</code>.
2436 </p>
2437 <p>If not specified, or the expressed duration is negative, the video is
2438 supposed to be generated forever.
2439 </p></dd>
2440 </dl>
2441
2442 <p>For example the following:
2443 </p><table><tr><td>&nbsp;</td><td><pre class="example">testsrc=duration=5.3:size=qcif:rate=10
2444 </pre></td></tr></table>
2445
2446 <p>will generate a video with a duration of 5.3 seconds, with size
2447 176x144 and a framerate of 10 frames per second.
2448 </p>
2449
2450 <a name="Video-Sinks"></a>
2451 <h1 class="chapter"><a href="libavfilter.html#toc-Video-Sinks">10. Video Sinks</a></h1>
2452
2453 <p>Below is a description of the currently available video sinks.
2454 </p>
2455 <a name="buffersink"></a>
2456 <h2 class="section"><a href="libavfilter.html#toc-buffersink">10.1 buffersink</a></h2>
2457
2458 <p>Buffer video frames, and make them available to the end of the filter
2459 graph.
2460 </p>
2461 <p>This sink is mainly intended for a programmatic use, in particular
2462 through the interface defined in &lsquo;<tt>libavfilter/vsink_buffer.h</tt>&rsquo;.
2463 </p>
2464 <p>It does not require a string parameter in input, but you need to
2465 specify a pointer to a list of supported pixel formats terminated by
2466 -1 in the opaque parameter provided to <code>avfilter_init_filter</code>
2467 when initializing this sink.
2468 </p>
2469 <a name="nullsink"></a>
2470 <h2 class="section"><a href="libavfilter.html#toc-nullsink">10.2 nullsink</a></h2>
2471
2472 <p>Null video sink, do absolutely nothing with the input video. It is
2473 mainly useful as a template and to be employed in analysis / debugging
2474 tools.
2475 </p>
2476
2477
2478 <hr size="1">
2479 <p>
2480  <font size="-1">
2481   This document was generated by <em>Kyle Schwarz</em> on <em>July 23, 2011</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
2482  </font>
2483  <br>
2484
2485 </p>
2486 </body>
2487 </html>