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