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