]> git.sesse.net Git - casparcg/blob - dependencies64/ffmpeg/doc/ffmpeg-filters.html
Updated to ffmpeg version 2.2.3
[casparcg] / dependencies64 / ffmpeg / doc / ffmpeg-filters.html
1 <!DOCTYPE html>
2 <html>
3 <!-- Created on June 19, 2014 by texi2html 1.82 -->
4 <!--
5 texi2html was written by: 
6             Lionel Cons <Lionel.Cons@cern.ch> (original author)
7             Karl Berry  <karl@freefriends.org>
8             Olaf Bachmann <obachman@mathematik.uni-kl.de>
9             and many others.
10 Maintained by: Many creative people.
11 Send bugs and suggestions to <texi2html-bug@nongnu.org>
12
13 -->
14 <head>
15 <title>FFmpeg documentation : FFmpeg Filters </title>
16
17 <meta name="description" content="FFmpeg Filters Documentation: ">
18 <meta name="keywords" content="FFmpeg documentation : FFmpeg Filters ">
19 <meta name="Generator" content="texi2html 1.82">
20 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
21 <link rel="stylesheet" type="text/css" href="default.css" />
22
23 <link rel="icon" href="favicon.png" type="image/png" />
24 </head>
25 <body>
26 <div id="container">
27 <div id="body">
28
29 <a name="SEC_Top"></a>
30 <h1 class="settitle">FFmpeg Filters Documentation</h1>
31
32 <a name="SEC_Contents"></a>
33 <h1>Table of Contents</h1>
34 <div class="contents">
35
36 <ul class="toc">
37   <li><a name="toc-Description" href="#Description">1. Description</a></li>
38   <li><a name="toc-Filtering-Introduction" href="#Filtering-Introduction">2. Filtering Introduction</a></li>
39   <li><a name="toc-graph2dot" href="#graph2dot">3. graph2dot</a></li>
40   <li><a name="toc-Filtergraph-description" href="#Filtergraph-description">4. Filtergraph description</a>
41   <ul class="toc">
42     <li><a name="toc-Filtergraph-syntax-1" href="#Filtergraph-syntax-1">4.1 Filtergraph syntax</a></li>
43     <li><a name="toc-Notes-on-filtergraph-escaping" href="#Notes-on-filtergraph-escaping">4.2 Notes on filtergraph escaping</a></li>
44   </ul></li>
45   <li><a name="toc-Timeline-editing" href="#Timeline-editing">5. Timeline editing</a></li>
46   <li><a name="toc-Audio-Filters" href="#Audio-Filters">6. Audio Filters</a>
47   <ul class="toc">
48     <li><a name="toc-aconvert" href="#aconvert">6.1 aconvert</a>
49     <ul class="toc">
50       <li><a name="toc-Examples-37" href="#Examples-37">6.1.1 Examples</a></li>
51     </ul></li>
52     <li><a name="toc-adelay" href="#adelay">6.2 adelay</a>
53     <ul class="toc">
54       <li><a name="toc-Examples-32" href="#Examples-32">6.2.1 Examples</a></li>
55     </ul></li>
56     <li><a name="toc-aecho" href="#aecho">6.3 aecho</a>
57     <ul class="toc">
58       <li><a name="toc-Examples-20" href="#Examples-20">6.3.1 Examples</a></li>
59     </ul></li>
60     <li><a name="toc-aeval" href="#aeval">6.4 aeval</a>
61     <ul class="toc">
62       <li><a name="toc-Examples-64" href="#Examples-64">6.4.1 Examples</a></li>
63     </ul></li>
64     <li><a name="toc-afade" href="#afade">6.5 afade</a>
65     <ul class="toc">
66       <li><a name="toc-Examples-28" href="#Examples-28">6.5.1 Examples</a></li>
67     </ul></li>
68     <li><a name="toc-aformat-1" href="#aformat-1">6.6 aformat</a></li>
69     <li><a name="toc-allpass" href="#allpass">6.7 allpass</a></li>
70     <li><a name="toc-amerge" href="#amerge">6.8 amerge</a>
71     <ul class="toc">
72       <li><a name="toc-Examples-38" href="#Examples-38">6.8.1 Examples</a></li>
73     </ul></li>
74     <li><a name="toc-amix" href="#amix">6.9 amix</a></li>
75     <li><a name="toc-anull" href="#anull">6.10 anull</a></li>
76     <li><a name="toc-apad" href="#apad">6.11 apad</a></li>
77     <li><a name="toc-aphaser" href="#aphaser">6.12 aphaser</a></li>
78     <li><a name="toc-aresample-1" href="#aresample-1">6.13 aresample</a>
79     <ul class="toc">
80       <li><a name="toc-Examples-5" href="#Examples-5">6.13.1 Examples</a></li>
81     </ul></li>
82     <li><a name="toc-asetnsamples" href="#asetnsamples">6.14 asetnsamples</a></li>
83     <li><a name="toc-asetrate" href="#asetrate">6.15 asetrate</a></li>
84     <li><a name="toc-ashowinfo" href="#ashowinfo">6.16 ashowinfo</a></li>
85     <li><a name="toc-astats" href="#astats">6.17 astats</a></li>
86     <li><a name="toc-astreamsync" href="#astreamsync">6.18 astreamsync</a>
87     <ul class="toc">
88       <li><a name="toc-Examples-45" href="#Examples-45">6.18.1 Examples</a></li>
89     </ul></li>
90     <li><a name="toc-asyncts" href="#asyncts">6.19 asyncts</a></li>
91     <li><a name="toc-atempo" href="#atempo">6.20 atempo</a>
92     <ul class="toc">
93       <li><a name="toc-Examples-23" href="#Examples-23">6.20.1 Examples</a></li>
94     </ul></li>
95     <li><a name="toc-atrim" href="#atrim">6.21 atrim</a></li>
96     <li><a name="toc-bandpass" href="#bandpass">6.22 bandpass</a></li>
97     <li><a name="toc-bandreject" href="#bandreject">6.23 bandreject</a></li>
98     <li><a name="toc-bass" href="#bass">6.24 bass</a></li>
99     <li><a name="toc-biquad" href="#biquad">6.25 biquad</a></li>
100     <li><a name="toc-channelmap" href="#channelmap">6.26 channelmap</a></li>
101     <li><a name="toc-channelsplit" href="#channelsplit">6.27 channelsplit</a></li>
102     <li><a name="toc-compand" href="#compand">6.28 compand</a>
103     <ul class="toc">
104       <li><a name="toc-Examples-65" href="#Examples-65">6.28.1 Examples</a></li>
105     </ul></li>
106     <li><a name="toc-earwax" href="#earwax">6.29 earwax</a></li>
107     <li><a name="toc-equalizer" href="#equalizer">6.30 equalizer</a>
108     <ul class="toc">
109       <li><a name="toc-Examples-14" href="#Examples-14">6.30.1 Examples</a></li>
110     </ul></li>
111     <li><a name="toc-highpass" href="#highpass">6.31 highpass</a></li>
112     <li><a name="toc-join" href="#join">6.32 join</a></li>
113     <li><a name="toc-ladspa" href="#ladspa">6.33 ladspa</a>
114     <ul class="toc">
115       <li><a name="toc-Examples-35" href="#Examples-35">6.33.1 Examples</a></li>
116       <li><a name="toc-Commands" href="#Commands">6.33.2 Commands</a></li>
117     </ul></li>
118     <li><a name="toc-lowpass" href="#lowpass">6.34 lowpass</a></li>
119     <li><a name="toc-pan" href="#pan">6.35 pan</a>
120     <ul class="toc">
121       <li><a name="toc-Mixing-examples" href="#Mixing-examples">6.35.1 Mixing examples</a></li>
122       <li><a name="toc-Remapping-examples" href="#Remapping-examples">6.35.2 Remapping examples</a></li>
123     </ul></li>
124     <li><a name="toc-replaygain" href="#replaygain">6.36 replaygain</a></li>
125     <li><a name="toc-resample" href="#resample">6.37 resample</a></li>
126     <li><a name="toc-silencedetect" href="#silencedetect">6.38 silencedetect</a>
127     <ul class="toc">
128       <li><a name="toc-Examples-3" href="#Examples-3">6.38.1 Examples</a></li>
129     </ul></li>
130     <li><a name="toc-treble" href="#treble">6.39 treble</a></li>
131     <li><a name="toc-volume" href="#volume">6.40 volume</a>
132     <ul class="toc">
133       <li><a name="toc-Commands-5" href="#Commands-5">6.40.1 Commands</a></li>
134       <li><a name="toc-Examples-55" href="#Examples-55">6.40.2 Examples</a></li>
135     </ul></li>
136     <li><a name="toc-volumedetect" href="#volumedetect">6.41 volumedetect</a>
137     <ul class="toc">
138       <li><a name="toc-Examples-17" href="#Examples-17">6.41.1 Examples</a></li>
139     </ul>
140 </li>
141   </ul></li>
142   <li><a name="toc-Audio-Sources" href="#Audio-Sources">7. Audio Sources</a>
143   <ul class="toc">
144     <li><a name="toc-abuffer" href="#abuffer">7.1 abuffer</a>
145     <ul class="toc">
146       <li><a name="toc-Examples-44" href="#Examples-44">7.1.1 Examples</a></li>
147     </ul></li>
148     <li><a name="toc-aevalsrc" href="#aevalsrc">7.2 aevalsrc</a>
149     <ul class="toc">
150       <li><a name="toc-Examples-9" href="#Examples-9">7.2.1 Examples</a></li>
151     </ul></li>
152     <li><a name="toc-anullsrc" href="#anullsrc">7.3 anullsrc</a>
153     <ul class="toc">
154       <li><a name="toc-Examples-72" href="#Examples-72">7.3.1 Examples</a></li>
155     </ul></li>
156     <li><a name="toc-flite" href="#flite">7.4 flite</a>
157     <ul class="toc">
158       <li><a name="toc-Examples-74" href="#Examples-74">7.4.1 Examples</a></li>
159     </ul></li>
160     <li><a name="toc-sine" href="#sine">7.5 sine</a>
161     <ul class="toc">
162       <li><a name="toc-Examples-58" href="#Examples-58">7.5.1 Examples</a></li>
163     </ul>
164 </li>
165   </ul></li>
166   <li><a name="toc-Audio-Sinks" href="#Audio-Sinks">8. Audio Sinks</a>
167   <ul class="toc">
168     <li><a name="toc-abuffersink" href="#abuffersink">8.1 abuffersink</a></li>
169     <li><a name="toc-anullsink" href="#anullsink">8.2 anullsink</a></li>
170   </ul></li>
171   <li><a name="toc-Video-Filters" href="#Video-Filters">9. Video Filters</a>
172   <ul class="toc">
173     <li><a name="toc-alphaextract" href="#alphaextract">9.1 alphaextract</a></li>
174     <li><a name="toc-alphamerge" href="#alphamerge">9.2 alphamerge</a></li>
175     <li><a name="toc-ass" href="#ass">9.3 ass</a></li>
176     <li><a name="toc-bbox" href="#bbox">9.4 bbox</a></li>
177     <li><a name="toc-blackdetect" href="#blackdetect">9.5 blackdetect</a></li>
178     <li><a name="toc-blackframe" href="#blackframe">9.6 blackframe</a></li>
179     <li><a name="toc-blend" href="#blend">9.7 blend</a>
180     <ul class="toc">
181       <li><a name="toc-Examples-73" href="#Examples-73">9.7.1 Examples</a></li>
182     </ul></li>
183     <li><a name="toc-boxblur" href="#boxblur">9.8 boxblur</a>
184     <ul class="toc">
185       <li><a name="toc-Examples-15" href="#Examples-15">9.8.1 Examples</a></li>
186     </ul></li>
187     <li><a name="toc-colorbalance" href="#colorbalance">9.9 colorbalance</a>
188     <ul class="toc">
189       <li><a name="toc-Examples-21" href="#Examples-21">9.9.1 Examples</a></li>
190     </ul></li>
191     <li><a name="toc-colorchannelmixer" href="#colorchannelmixer">9.10 colorchannelmixer</a>
192     <ul class="toc">
193       <li><a name="toc-Examples-12" href="#Examples-12">9.10.1 Examples</a></li>
194     </ul></li>
195     <li><a name="toc-colormatrix" href="#colormatrix">9.11 colormatrix</a></li>
196     <li><a name="toc-copy" href="#copy">9.12 copy</a></li>
197     <li><a name="toc-crop" href="#crop">9.13 crop</a>
198     <ul class="toc">
199       <li><a name="toc-Examples-8" href="#Examples-8">9.13.1 Examples</a></li>
200     </ul></li>
201     <li><a name="toc-cropdetect" href="#cropdetect">9.14 cropdetect</a></li>
202     <li><a name="toc-curves-1" href="#curves-1">9.15 curves</a>
203     <ul class="toc">
204       <li><a name="toc-Examples-1" href="#Examples-1">9.15.1 Examples</a></li>
205     </ul></li>
206     <li><a name="toc-dctdnoiz" href="#dctdnoiz">9.16 dctdnoiz</a>
207     <ul class="toc">
208       <li><a name="toc-Examples-70" href="#Examples-70">9.16.1 Examples</a></li>
209     </ul></li>
210     <li><a name="toc-decimate-1" href="#decimate-1">9.17 decimate</a></li>
211     <li><a name="toc-dejudder" href="#dejudder">9.18 dejudder</a></li>
212     <li><a name="toc-delogo" href="#delogo">9.19 delogo</a>
213     <ul class="toc">
214       <li><a name="toc-Examples-27" href="#Examples-27">9.19.1 Examples</a></li>
215     </ul></li>
216     <li><a name="toc-deshake" href="#deshake">9.20 deshake</a></li>
217     <li><a name="toc-drawbox" href="#drawbox">9.21 drawbox</a>
218     <ul class="toc">
219       <li><a name="toc-Examples-46" href="#Examples-46">9.21.1 Examples</a></li>
220     </ul></li>
221     <li><a name="toc-drawgrid" href="#drawgrid">9.22 drawgrid</a>
222     <ul class="toc">
223       <li><a name="toc-Examples-18" href="#Examples-18">9.22.1 Examples</a></li>
224     </ul></li>
225     <li><a name="toc-drawtext-1" href="#drawtext-1">9.23 drawtext</a>
226     <ul class="toc">
227       <li><a name="toc-Syntax" href="#Syntax">9.23.1 Syntax</a></li>
228       <li><a name="toc-Text-expansion" href="#Text-expansion">9.23.2 Text expansion</a></li>
229       <li><a name="toc-Examples-34" href="#Examples-34">9.23.3 Examples</a></li>
230     </ul></li>
231     <li><a name="toc-edgedetect" href="#edgedetect">9.24 edgedetect</a></li>
232     <li><a name="toc-extractplanes" href="#extractplanes">9.25 extractplanes</a>
233     <ul class="toc">
234       <li><a name="toc-Examples-54" href="#Examples-54">9.25.1 Examples</a></li>
235     </ul></li>
236     <li><a name="toc-elbg" href="#elbg">9.26 elbg</a></li>
237     <li><a name="toc-fade" href="#fade">9.27 fade</a>
238     <ul class="toc">
239       <li><a name="toc-Examples-22" href="#Examples-22">9.27.1 Examples</a></li>
240     </ul></li>
241     <li><a name="toc-field" href="#field">9.28 field</a></li>
242     <li><a name="toc-fieldmatch" href="#fieldmatch">9.29 fieldmatch</a>
243     <ul class="toc">
244       <li><a name="toc-p_002fc_002fn_002fu_002fb-meaning-1" href="#p_002fc_002fn_002fu_002fb-meaning-1">9.29.1 p/c/n/u/b meaning</a>
245       <ul class="toc">
246         <li><a name="toc-p_002fc_002fn" href="#p_002fc_002fn">9.29.1.1 p/c/n</a></li>
247         <li><a name="toc-u_002fb" href="#u_002fb">9.29.1.2 u/b</a></li>
248       </ul></li>
249       <li><a name="toc-Examples-30" href="#Examples-30">9.29.2 Examples</a></li>
250     </ul></li>
251     <li><a name="toc-fieldorder" href="#fieldorder">9.30 fieldorder</a></li>
252     <li><a name="toc-fifo" href="#fifo">9.31 fifo</a></li>
253     <li><a name="toc-format-1" href="#format-1">9.32 format</a>
254     <ul class="toc">
255       <li><a name="toc-Examples-71" href="#Examples-71">9.32.1 Examples</a></li>
256     </ul></li>
257     <li><a name="toc-fps-1" href="#fps-1">9.33 fps</a>
258     <ul class="toc">
259       <li><a name="toc-Examples-31" href="#Examples-31">9.33.1 Examples</a></li>
260     </ul></li>
261     <li><a name="toc-framepack" href="#framepack">9.34 framepack</a></li>
262     <li><a name="toc-framestep" href="#framestep">9.35 framestep</a></li>
263     <li><a name="toc-frei0r-1" href="#frei0r-1">9.36 frei0r</a>
264     <ul class="toc">
265       <li><a name="toc-Examples-49" href="#Examples-49">9.36.1 Examples</a></li>
266     </ul></li>
267     <li><a name="toc-geq" href="#geq">9.37 geq</a>
268     <ul class="toc">
269       <li><a name="toc-Examples-29" href="#Examples-29">9.37.1 Examples</a></li>
270     </ul></li>
271     <li><a name="toc-gradfun" href="#gradfun">9.38 gradfun</a>
272     <ul class="toc">
273       <li><a name="toc-Examples-41" href="#Examples-41">9.38.1 Examples</a></li>
274     </ul></li>
275     <li><a name="toc-haldclut-1" href="#haldclut-1">9.39 haldclut</a>
276     <ul class="toc">
277       <li><a name="toc-Workflow-examples" href="#Workflow-examples">9.39.1 Workflow examples</a>
278       <ul class="toc">
279         <li><a name="toc-Hald-CLUT-video-stream" href="#Hald-CLUT-video-stream">9.39.1.1 Hald CLUT video stream</a></li>
280         <li><a name="toc-Hald-CLUT-with-preview" href="#Hald-CLUT-with-preview">9.39.1.2 Hald CLUT with preview</a></li>
281       </ul>
282 </li>
283     </ul></li>
284     <li><a name="toc-hflip" href="#hflip">9.40 hflip</a></li>
285     <li><a name="toc-histeq" href="#histeq">9.41 histeq</a></li>
286     <li><a name="toc-histogram" href="#histogram">9.42 histogram</a>
287     <ul class="toc">
288       <li><a name="toc-Examples-52" href="#Examples-52">9.42.1 Examples</a></li>
289     </ul></li>
290     <li><a name="toc-hqdn3d-1" href="#hqdn3d-1">9.43 hqdn3d</a></li>
291     <li><a name="toc-hue" href="#hue">9.44 hue</a>
292     <ul class="toc">
293       <li><a name="toc-Examples-42" href="#Examples-42">9.44.1 Examples</a></li>
294       <li><a name="toc-Commands-3" href="#Commands-3">9.44.2 Commands</a></li>
295     </ul></li>
296     <li><a name="toc-idet" href="#idet">9.45 idet</a></li>
297     <li><a name="toc-il" href="#il">9.46 il</a></li>
298     <li><a name="toc-interlace" href="#interlace">9.47 interlace</a></li>
299     <li><a name="toc-kerndeint" href="#kerndeint">9.48 kerndeint</a>
300     <ul class="toc">
301       <li><a name="toc-Examples-26" href="#Examples-26">9.48.1 Examples</a></li>
302     </ul></li>
303     <li><a name="toc-lut3d-1" href="#lut3d-1">9.49 lut3d</a></li>
304     <li><a name="toc-lut_002c-lutrgb_002c-lutyuv" href="#lut_002c-lutrgb_002c-lutyuv">9.50 lut, lutrgb, lutyuv</a>
305     <ul class="toc">
306       <li><a name="toc-Examples-4" href="#Examples-4">9.50.1 Examples</a></li>
307     </ul></li>
308     <li><a name="toc-mergeplanes" href="#mergeplanes">9.51 mergeplanes</a>
309     <ul class="toc">
310       <li><a name="toc-Examples-56" href="#Examples-56">9.51.1 Examples</a></li>
311     </ul></li>
312     <li><a name="toc-mcdeint" href="#mcdeint">9.52 mcdeint</a></li>
313     <li><a name="toc-mp" href="#mp">9.53 mp</a>
314     <ul class="toc">
315       <li><a name="toc-Examples-50" href="#Examples-50">9.53.1 Examples</a></li>
316     </ul></li>
317     <li><a name="toc-mpdecimate" href="#mpdecimate">9.54 mpdecimate</a></li>
318     <li><a name="toc-negate" href="#negate">9.55 negate</a></li>
319     <li><a name="toc-noformat" href="#noformat">9.56 noformat</a>
320     <ul class="toc">
321       <li><a name="toc-Examples-25" href="#Examples-25">9.56.1 Examples</a></li>
322     </ul></li>
323     <li><a name="toc-noise" href="#noise">9.57 noise</a>
324     <ul class="toc">
325       <li><a name="toc-Examples-53" href="#Examples-53">9.57.1 Examples</a></li>
326     </ul></li>
327     <li><a name="toc-null" href="#null">9.58 null</a></li>
328     <li><a name="toc-ocv" href="#ocv">9.59 ocv</a>
329     <ul class="toc">
330       <li><a name="toc-dilate-1" href="#dilate-1">9.59.1 dilate</a></li>
331       <li><a name="toc-erode" href="#erode">9.59.2 erode</a></li>
332       <li><a name="toc-smooth" href="#smooth">9.59.3 smooth</a></li>
333     </ul></li>
334     <li><a name="toc-overlay-1" href="#overlay-1">9.60 overlay</a>
335     <ul class="toc">
336       <li><a name="toc-Commands-2" href="#Commands-2">9.60.1 Commands</a></li>
337       <li><a name="toc-Examples-33" href="#Examples-33">9.60.2 Examples</a></li>
338     </ul></li>
339     <li><a name="toc-owdenoise" href="#owdenoise">9.61 owdenoise</a></li>
340     <li><a name="toc-pad" href="#pad">9.62 pad</a>
341     <ul class="toc">
342       <li><a name="toc-Examples-39" href="#Examples-39">9.62.1 Examples</a></li>
343     </ul></li>
344     <li><a name="toc-perspective" href="#perspective">9.63 perspective</a></li>
345     <li><a name="toc-phase" href="#phase">9.64 phase</a></li>
346     <li><a name="toc-pixdesctest" href="#pixdesctest">9.65 pixdesctest</a></li>
347     <li><a name="toc-pp" href="#pp">9.66 pp</a>
348     <ul class="toc">
349       <li><a name="toc-Examples-43" href="#Examples-43">9.66.1 Examples</a></li>
350     </ul></li>
351     <li><a name="toc-psnr" href="#psnr">9.67 psnr</a></li>
352     <li><a name="toc-pullup-1" href="#pullup-1">9.68 pullup</a></li>
353     <li><a name="toc-removelogo" href="#removelogo">9.69 removelogo</a></li>
354     <li><a name="toc-rotate" href="#rotate">9.70 rotate</a>
355     <ul class="toc">
356       <li><a name="toc-Examples-62" href="#Examples-62">9.70.1 Examples</a></li>
357       <li><a name="toc-Commands-4" href="#Commands-4">9.70.2 Commands</a></li>
358     </ul></li>
359     <li><a name="toc-sab" href="#sab">9.71 sab</a></li>
360     <li><a name="toc-scale-1" href="#scale-1">9.72 scale</a>
361     <ul class="toc">
362       <li><a name="toc-Options-1" href="#Options-1">9.72.1 Options</a></li>
363       <li><a name="toc-Examples-24" href="#Examples-24">9.72.2 Examples</a></li>
364     </ul></li>
365     <li><a name="toc-separatefields" href="#separatefields">9.73 separatefields</a></li>
366     <li><a name="toc-setdar_002c-setsar" href="#setdar_002c-setsar">9.74 setdar, setsar</a>
367     <ul class="toc">
368       <li><a name="toc-Examples-66" href="#Examples-66">9.74.1 Examples</a></li>
369     </ul></li>
370     <li><a name="toc-setfield-1" href="#setfield-1">9.75 setfield</a></li>
371     <li><a name="toc-showinfo" href="#showinfo">9.76 showinfo</a></li>
372     <li><a name="toc-smartblur-1" href="#smartblur-1">9.77 smartblur</a></li>
373     <li><a name="toc-stereo3d" href="#stereo3d">9.78 stereo3d</a>
374     <ul class="toc">
375       <li><a name="toc-Examples-16" href="#Examples-16">9.78.1 Examples</a></li>
376     </ul></li>
377     <li><a name="toc-spp" href="#spp">9.79 spp</a></li>
378     <li><a name="toc-subtitles-1" href="#subtitles-1">9.80 subtitles</a></li>
379     <li><a name="toc-super2xsai" href="#super2xsai">9.81 super2xsai</a></li>
380     <li><a name="toc-swapuv" href="#swapuv">9.82 swapuv</a></li>
381     <li><a name="toc-telecine" href="#telecine">9.83 telecine</a></li>
382     <li><a name="toc-thumbnail" href="#thumbnail">9.84 thumbnail</a>
383     <ul class="toc">
384       <li><a name="toc-Examples-51" href="#Examples-51">9.84.1 Examples</a></li>
385     </ul></li>
386     <li><a name="toc-tile" href="#tile">9.85 tile</a>
387     <ul class="toc">
388       <li><a name="toc-Examples-2" href="#Examples-2">9.85.1 Examples</a></li>
389     </ul></li>
390     <li><a name="toc-tinterlace" href="#tinterlace">9.86 tinterlace</a></li>
391     <li><a name="toc-transpose" href="#transpose">9.87 transpose</a></li>
392     <li><a name="toc-trim" href="#trim">9.88 trim</a></li>
393     <li><a name="toc-unsharp" href="#unsharp">9.89 unsharp</a>
394     <ul class="toc">
395       <li><a name="toc-Examples-19" href="#Examples-19">9.89.1 Examples</a></li>
396     </ul></li>
397     <li><a name="toc-vidstabdetect-1" href="#vidstabdetect-1">9.90 vidstabdetect</a>
398     <ul class="toc">
399       <li><a name="toc-Examples-59" href="#Examples-59">9.90.1 Examples</a></li>
400     </ul></li>
401     <li><a name="toc-vidstabtransform-1" href="#vidstabtransform-1">9.91 vidstabtransform</a>
402     <ul class="toc">
403       <li><a name="toc-Options" href="#Options">9.91.1 Options</a></li>
404       <li><a name="toc-Examples-13" href="#Examples-13">9.91.2 Examples</a></li>
405     </ul></li>
406     <li><a name="toc-vflip" href="#vflip">9.92 vflip</a></li>
407     <li><a name="toc-vignette" href="#vignette">9.93 vignette</a>
408     <ul class="toc">
409       <li><a name="toc-Expressions" href="#Expressions">9.93.1 Expressions</a></li>
410       <li><a name="toc-Examples-48" href="#Examples-48">9.93.2 Examples</a></li>
411     </ul></li>
412     <li><a name="toc-w3fdif" href="#w3fdif">9.94 w3fdif</a></li>
413     <li><a name="toc-yadif-1" href="#yadif-1">9.95 yadif</a></li>
414   </ul></li>
415   <li><a name="toc-Video-Sources" href="#Video-Sources">10. Video Sources</a>
416   <ul class="toc">
417     <li><a name="toc-buffer" href="#buffer">10.1 buffer</a></li>
418     <li><a name="toc-cellauto" href="#cellauto">10.2 cellauto</a>
419     <ul class="toc">
420       <li><a name="toc-Examples-36" href="#Examples-36">10.2.1 Examples</a></li>
421     </ul></li>
422     <li><a name="toc-mandelbrot" href="#mandelbrot">10.3 mandelbrot</a></li>
423     <li><a name="toc-mptestsrc" href="#mptestsrc">10.4 mptestsrc</a></li>
424     <li><a name="toc-frei0r_005fsrc" href="#frei0r_005fsrc">10.5 frei0r_src</a></li>
425     <li><a name="toc-life" href="#life">10.6 life</a>
426     <ul class="toc">
427       <li><a name="toc-Examples-11" href="#Examples-11">10.6.1 Examples</a></li>
428     </ul></li>
429     <li><a name="toc-color_002c-haldclutsrc_002c-nullsrc_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc" href="#color_002c-haldclutsrc_002c-nullsrc_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc">10.7 color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc</a>
430     <ul class="toc">
431       <li><a name="toc-Commands-1" href="#Commands-1">10.7.1 Commands</a></li>
432     </ul>
433 </li>
434   </ul></li>
435   <li><a name="toc-Video-Sinks" href="#Video-Sinks">11. Video Sinks</a>
436   <ul class="toc">
437     <li><a name="toc-buffersink" href="#buffersink">11.1 buffersink</a></li>
438     <li><a name="toc-nullsink" href="#nullsink">11.2 nullsink</a></li>
439   </ul></li>
440   <li><a name="toc-Multimedia-Filters" href="#Multimedia-Filters">12. Multimedia Filters</a>
441   <ul class="toc">
442     <li><a name="toc-avectorscope" href="#avectorscope">12.1 avectorscope</a>
443     <ul class="toc">
444       <li><a name="toc-Examples-57" href="#Examples-57">12.1.1 Examples</a></li>
445     </ul></li>
446     <li><a name="toc-concat" href="#concat">12.2 concat</a>
447     <ul class="toc">
448       <li><a name="toc-Examples-10" href="#Examples-10">12.2.1 Examples</a></li>
449     </ul></li>
450     <li><a name="toc-ebur128" href="#ebur128">12.3 ebur128</a>
451     <ul class="toc">
452       <li><a name="toc-Examples-6" href="#Examples-6">12.3.1 Examples</a></li>
453     </ul></li>
454     <li><a name="toc-interleave_002c-ainterleave" href="#interleave_002c-ainterleave">12.4 interleave, ainterleave</a>
455     <ul class="toc">
456       <li><a name="toc-Examples-60" href="#Examples-60">12.4.1 Examples</a></li>
457     </ul></li>
458     <li><a name="toc-perms_002c-aperms" href="#perms_002c-aperms">12.5 perms, aperms</a></li>
459     <li><a name="toc-select_002c-aselect" href="#select_002c-aselect">12.6 select, aselect</a>
460     <ul class="toc">
461       <li><a name="toc-Examples-40" href="#Examples-40">12.6.1 Examples</a></li>
462     </ul></li>
463     <li><a name="toc-sendcmd_002c-asendcmd" href="#sendcmd_002c-asendcmd">12.7 sendcmd, asendcmd</a>
464     <ul class="toc">
465       <li><a name="toc-Commands-syntax" href="#Commands-syntax">12.7.1 Commands syntax</a></li>
466       <li><a name="toc-Examples-7" href="#Examples-7">12.7.2 Examples</a></li>
467     </ul></li>
468     <li><a name="toc-setpts_002c-asetpts" href="#setpts_002c-asetpts">12.8 setpts, asetpts</a>
469     <ul class="toc">
470       <li><a name="toc-Examples" href="#Examples">12.8.1 Examples</a></li>
471     </ul></li>
472     <li><a name="toc-settb_002c-asettb" href="#settb_002c-asettb">12.9 settb, asettb</a>
473     <ul class="toc">
474       <li><a name="toc-Examples-67" href="#Examples-67">12.9.1 Examples</a></li>
475     </ul></li>
476     <li><a name="toc-showspectrum" href="#showspectrum">12.10 showspectrum</a>
477     <ul class="toc">
478       <li><a name="toc-Examples-68" href="#Examples-68">12.10.1 Examples</a></li>
479     </ul></li>
480     <li><a name="toc-showwaves" href="#showwaves">12.11 showwaves</a>
481     <ul class="toc">
482       <li><a name="toc-Examples-47" href="#Examples-47">12.11.1 Examples</a></li>
483     </ul></li>
484     <li><a name="toc-split_002c-asplit" href="#split_002c-asplit">12.12 split, asplit</a>
485     <ul class="toc">
486       <li><a name="toc-Examples-63" href="#Examples-63">12.12.1 Examples</a></li>
487     </ul></li>
488     <li><a name="toc-zmq_002c-azmq" href="#zmq_002c-azmq">12.13 zmq, azmq</a>
489     <ul class="toc">
490       <li><a name="toc-Examples-61" href="#Examples-61">12.13.1 Examples</a></li>
491     </ul>
492 </li>
493   </ul></li>
494   <li><a name="toc-Multimedia-Sources" href="#Multimedia-Sources">13. Multimedia Sources</a>
495   <ul class="toc">
496     <li><a name="toc-amovie" href="#amovie">13.1 amovie</a></li>
497     <li><a name="toc-movie-1" href="#movie-1">13.2 movie</a>
498     <ul class="toc">
499       <li><a name="toc-Examples-69" href="#Examples-69">13.2.1 Examples</a></li>
500     </ul>
501 </li>
502   </ul></li>
503   <li><a name="toc-See-Also" href="#See-Also">14. See Also</a></li>
504   <li><a name="toc-Authors" href="#Authors">15. Authors</a></li>
505 </ul>
506 </div>
507
508 <a name="Description"></a>
509 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Description">1. Description</a></h1>
510
511 <p>This document describes filters, sources, and sinks provided by the
512 libavfilter library.
513 </p>
514
515 <a name="Filtering-Introduction"></a>
516 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Filtering-Introduction">2. Filtering Introduction</a></h1>
517
518 <p>Filtering in FFmpeg is enabled through the libavfilter library.
519 </p>
520 <p>In libavfilter, a filter can have multiple inputs and multiple
521 outputs.
522 To illustrate the sorts of things that are possible, we consider the
523 following filtergraph.
524 </p>
525 <table><tr><td>&nbsp;</td><td><pre class="example">                [main]
526 input --&gt; split ---------------------&gt; overlay --&gt; output
527             |                             ^
528             |[tmp]                  [flip]|
529             +-----&gt; crop --&gt; vflip -------+
530 </pre></td></tr></table>
531
532 <p>This filtergraph splits the input stream in two streams, sends one
533 stream through the crop filter and the vflip filter before merging it
534 back with the other stream by overlaying it on top. You can use the
535 following command to achieve this:
536 </p>
537 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -vf &quot;split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2&quot; OUTPUT
538 </pre></td></tr></table>
539
540 <p>The result will be that in output the top half of the video is mirrored
541 onto the bottom half.
542 </p>
543 <p>Filters in the same linear chain are separated by commas, and distinct
544 linear chains of filters are separated by semicolons. In our example,
545 <var>crop,vflip</var> are in one linear chain, <var>split</var> and
546 <var>overlay</var> are separately in another. The points where the linear
547 chains join are labelled by names enclosed in square brackets. In the
548 example, the split filter generates two outputs that are associated to
549 the labels <var>[main]</var> and <var>[tmp]</var>.
550 </p>
551 <p>The stream sent to the second output of <var>split</var>, labelled as
552 <var>[tmp]</var>, is processed through the <var>crop</var> filter, which crops
553 away the lower half part of the video, and then vertically flipped. The
554 <var>overlay</var> filter takes in input the first unchanged output of the
555 split filter (which was labelled as <var>[main]</var>), and overlay on its
556 lower half the output generated by the <var>crop,vflip</var> filterchain.
557 </p>
558 <p>Some filters take in input a list of parameters: they are specified
559 after the filter name and an equal sign, and are separated from each other
560 by a colon.
561 </p>
562 <p>There exist so-called <var>source filters</var> that do not have an
563 audio/video input, and <var>sink filters</var> that will not have audio/video
564 output.
565 </p>
566
567 <a name="graph2dot"></a>
568 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-graph2dot">3. graph2dot</a></h1>
569
570 <p>The &lsquo;<tt>graph2dot</tt>&rsquo; program included in the FFmpeg &lsquo;<tt>tools</tt>&rsquo;
571 directory can be used to parse a filtergraph description and issue a
572 corresponding textual representation in the dot language.
573 </p>
574 <p>Invoke the command:
575 </p><table><tr><td>&nbsp;</td><td><pre class="example">graph2dot -h
576 </pre></td></tr></table>
577
578 <p>to see how to use &lsquo;<tt>graph2dot</tt>&rsquo;.
579 </p>
580 <p>You can then pass the dot description to the &lsquo;<tt>dot</tt>&rsquo; program (from
581 the graphviz suite of programs) and obtain a graphical representation
582 of the filtergraph.
583 </p>
584 <p>For example the sequence of commands:
585 </p><table><tr><td>&nbsp;</td><td><pre class="example">echo <var>GRAPH_DESCRIPTION</var> | \
586 tools/graph2dot -o graph.tmp &amp;&amp; \
587 dot -Tpng graph.tmp -o graph.png &amp;&amp; \
588 display graph.png
589 </pre></td></tr></table>
590
591 <p>can be used to create and display an image representing the graph
592 described by the <var>GRAPH_DESCRIPTION</var> string. Note that this string must be
593 a complete self-contained graph, with its inputs and outputs explicitly defined.
594 For example if your command line is of the form:
595 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i infile -vf scale=640:360 outfile
596 </pre></td></tr></table>
597 <p>your <var>GRAPH_DESCRIPTION</var> string will need to be of the form:
598 </p><table><tr><td>&nbsp;</td><td><pre class="example">nullsrc,scale=640:360,nullsink
599 </pre></td></tr></table>
600 <p>you may also need to set the <var>nullsrc</var> parameters and add a <var>format</var>
601 filter in order to simulate a specific input file.
602 </p>
603
604 <a name="Filtergraph-description"></a>
605 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Filtergraph-description">4. Filtergraph description</a></h1>
606
607 <p>A filtergraph is a directed graph of connected filters. It can contain
608 cycles, and there can be multiple links between a pair of
609 filters. Each link has one input pad on one side connecting it to one
610 filter from which it takes its input, and one output pad on the other
611 side connecting it to the one filter accepting its output.
612 </p>
613 <p>Each filter in a filtergraph is an instance of a filter class
614 registered in the application, which defines the features and the
615 number of input and output pads of the filter.
616 </p>
617 <p>A filter with no input pads is called a &quot;source&quot;, a filter with no
618 output pads is called a &quot;sink&quot;.
619 </p>
620 <p><a name="Filtergraph-syntax"></a>
621 </p><a name="Filtergraph-syntax-1"></a>
622 <h2 class="section"><a href="ffmpeg-filters.html#toc-Filtergraph-syntax-1">4.1 Filtergraph syntax</a></h2>
623
624 <p>A filtergraph can be represented using a textual representation, which is
625 recognized by the &lsquo;<samp>-filter</samp>&rsquo;/&lsquo;<samp>-vf</samp>&rsquo; and &lsquo;<samp>-filter_complex</samp>&rsquo;
626 options in <code>ffmpeg</code> and &lsquo;<samp>-vf</samp>&rsquo; in <code>ffplay</code>, and by the
627 <code>avfilter_graph_parse()</code>/<code>avfilter_graph_parse2()</code> function defined in
628 &lsquo;<tt>libavfilter/avfilter.h</tt>&rsquo;.
629 </p>
630 <p>A filterchain consists of a sequence of connected filters, each one
631 connected to the previous one in the sequence. A filterchain is
632 represented by a list of &quot;,&quot;-separated filter descriptions.
633 </p>
634 <p>A filtergraph consists of a sequence of filterchains. A sequence of
635 filterchains is represented by a list of &quot;;&quot;-separated filterchain
636 descriptions.
637 </p>
638 <p>A filter is represented by a string of the form:
639 [<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>]
640 </p>
641 <p><var>filter_name</var> is the name of the filter class of which the
642 described filter is an instance of, and has to be the name of one of
643 the filter classes registered in the program.
644 The name of the filter class is optionally followed by a string
645 &quot;=<var>arguments</var>&quot;.
646 </p>
647 <p><var>arguments</var> is a string which contains the parameters used to
648 initialize the filter instance. It may have one of the following forms:
649 </p><ul>
650 <li>
651 A &rsquo;:&rsquo;-separated list of <var>key=value</var> pairs.
652
653 </li><li>
654 A &rsquo;:&rsquo;-separated list of <var>value</var>. In this case, the keys are assumed to be
655 the option names in the order they are declared. E.g. the <code>fade</code> filter
656 declares three options in this order &ndash; &lsquo;<samp>type</samp>&rsquo;, &lsquo;<samp>start_frame</samp>&rsquo; and
657 &lsquo;<samp>nb_frames</samp>&rsquo;. Then the parameter list <var>in:0:30</var> means that the value
658 <var>in</var> is assigned to the option &lsquo;<samp>type</samp>&rsquo;, <var>0</var> to
659 &lsquo;<samp>start_frame</samp>&rsquo; and <var>30</var> to &lsquo;<samp>nb_frames</samp>&rsquo;.
660
661 </li><li>
662 A &rsquo;:&rsquo;-separated list of mixed direct <var>value</var> and long <var>key=value</var>
663 pairs. The direct <var>value</var> must precede the <var>key=value</var> pairs, and
664 follow the same constraints order of the previous point. The following
665 <var>key=value</var> pairs can be set in any preferred order.
666
667 </li></ul>
668
669 <p>If the option value itself is a list of items (e.g. the <code>format</code> filter
670 takes a list of pixel formats), the items in the list are usually separated by
671 &rsquo;|&rsquo;.
672 </p>
673 <p>The list of arguments can be quoted using the character &quot;&rsquo;&quot; as initial
674 and ending mark, and the character &rsquo;\&rsquo; for escaping the characters
675 within the quoted text; otherwise the argument string is considered
676 terminated when the next special character (belonging to the set
677 &quot;[]=;,&quot;) is encountered.
678 </p>
679 <p>The name and arguments of the filter are optionally preceded and
680 followed by a list of link labels.
681 A link label allows one to name a link and associate it to a filter output
682 or input pad. The preceding labels <var>in_link_1</var>
683 ... <var>in_link_N</var>, are associated to the filter input pads,
684 the following labels <var>out_link_1</var> ... <var>out_link_M</var>, are
685 associated to the output pads.
686 </p>
687 <p>When two link labels with the same name are found in the
688 filtergraph, a link between the corresponding input and output pad is
689 created.
690 </p>
691 <p>If an output pad is not labelled, it is linked by default to the first
692 unlabelled input pad of the next filter in the filterchain.
693 For example in the filterchain:
694 </p><table><tr><td>&nbsp;</td><td><pre class="example">nullsrc, split[L1], [L2]overlay, nullsink
695 </pre></td></tr></table>
696 <p>the split filter instance has two output pads, and the overlay filter
697 instance two input pads. The first output pad of split is labelled
698 &quot;L1&quot;, the first input pad of overlay is labelled &quot;L2&quot;, and the second
699 output pad of split is linked to the second input pad of overlay,
700 which are both unlabelled.
701 </p>
702 <p>In a complete filterchain all the unlabelled filter input and output
703 pads must be connected. A filtergraph is considered valid if all the
704 filter input and output pads of all the filterchains are connected.
705 </p>
706 <p>Libavfilter will automatically insert <a href="#scale">scale</a> filters where format
707 conversion is required. It is possible to specify swscale flags
708 for those automatically inserted scalers by prepending
709 <code>sws_flags=<var>flags</var>;</code>
710 to the filtergraph description.
711 </p>
712 <p>Follows a BNF description for the filtergraph syntax:
713 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>NAME</var>             ::= sequence of alphanumeric characters and '_'
714 <var>LINKLABEL</var>        ::= &quot;[&quot; <var>NAME</var> &quot;]&quot;
715 <var>LINKLABELS</var>       ::= <var>LINKLABEL</var> [<var>LINKLABELS</var>]
716 <var>FILTER_ARGUMENTS</var> ::= sequence of chars (eventually quoted)
717 <var>FILTER</var>           ::= [<var>LINKLABELS</var>] <var>NAME</var> [&quot;=&quot; <var>FILTER_ARGUMENTS</var>] [<var>LINKLABELS</var>]
718 <var>FILTERCHAIN</var>      ::= <var>FILTER</var> [,<var>FILTERCHAIN</var>]
719 <var>FILTERGRAPH</var>      ::= [sws_flags=<var>flags</var>;] <var>FILTERCHAIN</var> [;<var>FILTERGRAPH</var>]
720 </pre></td></tr></table>
721
722 <a name="Notes-on-filtergraph-escaping"></a>
723 <h2 class="section"><a href="ffmpeg-filters.html#toc-Notes-on-filtergraph-escaping">4.2 Notes on filtergraph escaping</a></h2>
724
725 <p>Filtergraph description composition entails several levels of
726 escaping. See <a href="ffmpeg-utils.html#quoting_005fand_005fescaping">(ffmpeg-utils)quoting_and_escaping</a> for more
727 information about the employed escaping procedure.
728 </p>
729 <p>A first level escaping affects the content of each filter option
730 value, which may contain the special character <code>:</code> used to
731 separate values, or one of the escaping characters <code>\'</code>.
732 </p>
733 <p>A second level escaping affects the whole filter description, which
734 may contain the escaping characters <code>\'</code> or the special
735 characters <code>[],;</code> used by the filtergraph description.
736 </p>
737 <p>Finally, when you specify a filtergraph on a shell commandline, you
738 need to perform a third level escaping for the shell special
739 characters contained within it.
740 </p>
741 <p>For example, consider the following string to be embedded in
742 the <a href="#drawtext">drawtext</a> filter description &lsquo;<samp>text</samp>&rsquo; value:
743 </p><table><tr><td>&nbsp;</td><td><pre class="example">this is a 'string': may contain one, or more, special characters
744 </pre></td></tr></table>
745
746 <p>This string contains the <code>'</code> special escaping character, and the
747 <code>:</code> special character, so it needs to be escaped in this way:
748 </p><table><tr><td>&nbsp;</td><td><pre class="example">text=this is a \'string\'\: may contain one, or more, special characters
749 </pre></td></tr></table>
750
751 <p>A second level of escaping is required when embedding the filter
752 description in a filtergraph description, in order to escape all the
753 filtergraph special characters. Thus the example above becomes:
754 </p><table><tr><td>&nbsp;</td><td><pre class="example">drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
755 </pre></td></tr></table>
756 <p>(note that in addition to the <code>\'</code> escaping special characters,
757 also <code>,</code> needs to be escaped).
758 </p>
759 <p>Finally an additional level of escaping is needed when writing the
760 filtergraph description in a shell command, which depends on the
761 escaping rules of the adopted shell. For example, assuming that
762 <code>\</code> is special and needs to be escaped with another <code>\</code>, the
763 previous string will finally result in:
764 </p><table><tr><td>&nbsp;</td><td><pre class="example">-vf &quot;drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters&quot;
765 </pre></td></tr></table>
766
767 <a name="Timeline-editing"></a>
768 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Timeline-editing">5. Timeline editing</a></h1>
769
770 <p>Some filters support a generic &lsquo;<samp>enable</samp>&rsquo; option. For the filters
771 supporting timeline editing, this option can be set to an expression which is
772 evaluated before sending a frame to the filter. If the evaluation is non-zero,
773 the filter will be enabled, otherwise the frame will be sent unchanged to the
774 next filter in the filtergraph.
775 </p>
776 <p>The expression accepts the following values:
777 </p><dl compact="compact">
778 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
779 <dd><p>timestamp expressed in seconds, NAN if the input timestamp is unknown
780 </p>
781 </dd>
782 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
783 <dd><p>sequential number of the input frame, starting from 0
784 </p>
785 </dd>
786 <dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
787 <dd><p>the position in the file of the input frame, NAN if unknown
788 </p></dd>
789 </dl>
790
791 <p>Additionally, these filters support an &lsquo;<samp>enable</samp>&rsquo; command that can be used
792 to re-define the expression.
793 </p>
794 <p>Like any other filtering option, the &lsquo;<samp>enable</samp>&rsquo; option follows the same
795 rules.
796 </p>
797 <p>For example, to enable a blur filter (<a href="#smartblur">smartblur</a>) from 10 seconds to 3
798 minutes, and a <a href="#curves">curves</a> filter starting at 3 seconds:
799 </p><table><tr><td>&nbsp;</td><td><pre class="example">smartblur = enable='between(t,10,3*60)',
800 curves    = enable='gte(t,3)' : preset=cross_process
801 </pre></td></tr></table>
802
803
804 <a name="Audio-Filters"></a>
805 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Audio-Filters">6. Audio Filters</a></h1>
806
807 <p>When you configure your FFmpeg build, you can disable any of the
808 existing filters using <code>--disable-filters</code>.
809 The configure output will show the audio filters included in your
810 build.
811 </p>
812 <p>Below is a description of the currently available audio filters.
813 </p>
814 <a name="aconvert"></a>
815 <h2 class="section"><a href="ffmpeg-filters.html#toc-aconvert">6.1 aconvert</a></h2>
816
817 <p>Convert the input audio format to the specified formats.
818 </p>
819 <p><em>This filter is deprecated. Use <a href="#aformat">aformat</a> instead.</em>
820 </p>
821 <p>The filter accepts a string of the form:
822 &quot;<var>sample_format</var>:<var>channel_layout</var>&quot;.
823 </p>
824 <p><var>sample_format</var> specifies the sample format, and can be a string or the
825 corresponding numeric value defined in &lsquo;<tt>libavutil/samplefmt.h</tt>&rsquo;. Use &rsquo;p&rsquo;
826 suffix for a planar sample format.
827 </p>
828 <p><var>channel_layout</var> specifies the channel layout, and can be a string
829 or the corresponding number value defined in &lsquo;<tt>libavutil/channel_layout.h</tt>&rsquo;.
830 </p>
831 <p>The special parameter &quot;auto&quot;, signifies that the filter will
832 automatically select the output format depending on the output filter.
833 </p>
834 <a name="Examples-37"></a>
835 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-37">6.1.1 Examples</a></h3>
836
837 <ul>
838 <li>
839 Convert input to float, planar, stereo:
840 <table><tr><td>&nbsp;</td><td><pre class="example">aconvert=fltp:stereo
841 </pre></td></tr></table>
842
843 </li><li>
844 Convert input to unsigned 8-bit, automatically select out channel layout:
845 <table><tr><td>&nbsp;</td><td><pre class="example">aconvert=u8:auto
846 </pre></td></tr></table>
847 </li></ul>
848
849 <a name="adelay"></a>
850 <h2 class="section"><a href="ffmpeg-filters.html#toc-adelay">6.2 adelay</a></h2>
851
852 <p>Delay one or more audio channels.
853 </p>
854 <p>Samples in delayed channel are filled with silence.
855 </p>
856 <p>The filter accepts the following option:
857 </p>
858 <dl compact="compact">
859 <dt> &lsquo;<samp>delays</samp>&rsquo;</dt>
860 <dd><p>Set list of delays in milliseconds for each channel separated by &rsquo;|&rsquo;.
861 At least one delay greater than 0 should be provided.
862 Unused delays will be silently ignored. If number of given delays is
863 smaller than number of channels all remaining channels will not be delayed.
864 </p></dd>
865 </dl>
866
867 <a name="Examples-32"></a>
868 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-32">6.2.1 Examples</a></h3>
869
870 <ul>
871 <li>
872 Delay first channel by 1.5 seconds, the third channel by 0.5 seconds and leave
873 the second channel (and any other channels that may be present) unchanged.
874 <table><tr><td>&nbsp;</td><td><pre class="example">adelay=1500|0|500
875 </pre></td></tr></table>
876 </li></ul>
877
878 <a name="aecho"></a>
879 <h2 class="section"><a href="ffmpeg-filters.html#toc-aecho">6.3 aecho</a></h2>
880
881 <p>Apply echoing to the input audio.
882 </p>
883 <p>Echoes are reflected sound and can occur naturally amongst mountains
884 (and sometimes large buildings) when talking or shouting; digital echo
885 effects emulate this behaviour and are often used to help fill out the
886 sound of a single instrument or vocal. The time difference between the
887 original signal and the reflection is the <code>delay</code>, and the
888 loudness of the reflected signal is the <code>decay</code>.
889 Multiple echoes can have different delays and decays.
890 </p>
891 <p>A description of the accepted parameters follows.
892 </p>
893 <dl compact="compact">
894 <dt> &lsquo;<samp>in_gain</samp>&rsquo;</dt>
895 <dd><p>Set input gain of reflected signal. Default is <code>0.6</code>.
896 </p>
897 </dd>
898 <dt> &lsquo;<samp>out_gain</samp>&rsquo;</dt>
899 <dd><p>Set output gain of reflected signal. Default is <code>0.3</code>.
900 </p>
901 </dd>
902 <dt> &lsquo;<samp>delays</samp>&rsquo;</dt>
903 <dd><p>Set list of time intervals in milliseconds between original signal and reflections
904 separated by &rsquo;|&rsquo;. Allowed range for each <code>delay</code> is <code>(0 - 90000.0]</code>.
905 Default is <code>1000</code>.
906 </p>
907 </dd>
908 <dt> &lsquo;<samp>decays</samp>&rsquo;</dt>
909 <dd><p>Set list of loudnesses of reflected signals separated by &rsquo;|&rsquo;.
910 Allowed range for each <code>decay</code> is <code>(0 - 1.0]</code>.
911 Default is <code>0.5</code>.
912 </p></dd>
913 </dl>
914
915 <a name="Examples-20"></a>
916 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-20">6.3.1 Examples</a></h3>
917
918 <ul>
919 <li>
920 Make it sound as if there are twice as many instruments as are actually playing:
921 <table><tr><td>&nbsp;</td><td><pre class="example">aecho=0.8:0.88:60:0.4
922 </pre></td></tr></table>
923
924 </li><li>
925 If delay is very short, then it sound like a (metallic) robot playing music:
926 <table><tr><td>&nbsp;</td><td><pre class="example">aecho=0.8:0.88:6:0.4
927 </pre></td></tr></table>
928
929 </li><li>
930 A longer delay will sound like an open air concert in the mountains:
931 <table><tr><td>&nbsp;</td><td><pre class="example">aecho=0.8:0.9:1000:0.3
932 </pre></td></tr></table>
933
934 </li><li>
935 Same as above but with one more mountain:
936 <table><tr><td>&nbsp;</td><td><pre class="example">aecho=0.8:0.9:1000|1800:0.3|0.25
937 </pre></td></tr></table>
938 </li></ul>
939
940 <a name="aeval"></a>
941 <h2 class="section"><a href="ffmpeg-filters.html#toc-aeval">6.4 aeval</a></h2>
942
943 <p>Modify an audio signal according to the specified expressions.
944 </p>
945 <p>This filter accepts one or more expressions (one for each channel),
946 which are evaluated and used to modify a corresponding audio signal.
947 </p>
948 <p>This filter accepts the following options:
949 </p>
950 <dl compact="compact">
951 <dt> &lsquo;<samp>exprs</samp>&rsquo;</dt>
952 <dd><p>Set the &rsquo;|&rsquo;-separated expressions list for each separate channel. If
953 the number of input channels is greater than the number of
954 expressions, the last specified expression is used for the remaining
955 output channels.
956 </p>
957 </dd>
958 <dt> &lsquo;<samp>channel_layout, c</samp>&rsquo;</dt>
959 <dd><p>Set output channel layout. If not specified, the channel layout is
960 specified by the number of expressions. If set to &lsquo;<samp>same</samp>&rsquo;, it will
961 use by default the same input channel layout.
962 </p></dd>
963 </dl>
964
965 <p>Each expression in <var>exprs</var> can contain the following constants and functions:
966 </p>
967 <dl compact="compact">
968 <dt> &lsquo;<samp>ch</samp>&rsquo;</dt>
969 <dd><p>channel number of the current expression
970 </p>
971 </dd>
972 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
973 <dd><p>number of the evaluated sample, starting from 0
974 </p>
975 </dd>
976 <dt> &lsquo;<samp>s</samp>&rsquo;</dt>
977 <dd><p>sample rate
978 </p>
979 </dd>
980 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
981 <dd><p>time of the evaluated sample expressed in seconds
982 </p>
983 </dd>
984 <dt> &lsquo;<samp>nb_in_channels</samp>&rsquo;</dt>
985 <dt> &lsquo;<samp>nb_out_channels</samp>&rsquo;</dt>
986 <dd><p>input and output number of channels
987 </p>
988 </dd>
989 <dt> &lsquo;<samp>val(CH)</samp>&rsquo;</dt>
990 <dd><p>the value of input channel with number <var>CH</var>
991 </p></dd>
992 </dl>
993
994 <p>Note: this filter is slow. For faster processing you should use a
995 dedicated filter.
996 </p>
997 <a name="Examples-64"></a>
998 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-64">6.4.1 Examples</a></h3>
999
1000 <ul>
1001 <li>
1002 Half volume:
1003 <table><tr><td>&nbsp;</td><td><pre class="example">aeval=val(ch)/2:c=same
1004 </pre></td></tr></table>
1005
1006 </li><li>
1007 Invert phase of the second channel:
1008 <table><tr><td>&nbsp;</td><td><pre class="example">eval=val(0)|-val(1)
1009 </pre></td></tr></table>
1010 </li></ul>
1011
1012 <a name="afade"></a>
1013 <h2 class="section"><a href="ffmpeg-filters.html#toc-afade">6.5 afade</a></h2>
1014
1015 <p>Apply fade-in/out effect to input audio.
1016 </p>
1017 <p>A description of the accepted parameters follows.
1018 </p>
1019 <dl compact="compact">
1020 <dt> &lsquo;<samp>type, t</samp>&rsquo;</dt>
1021 <dd><p>Specify the effect type, can be either <code>in</code> for fade-in, or
1022 <code>out</code> for a fade-out effect. Default is <code>in</code>.
1023 </p>
1024 </dd>
1025 <dt> &lsquo;<samp>start_sample, ss</samp>&rsquo;</dt>
1026 <dd><p>Specify the number of the start sample for starting to apply the fade
1027 effect. Default is 0.
1028 </p>
1029 </dd>
1030 <dt> &lsquo;<samp>nb_samples, ns</samp>&rsquo;</dt>
1031 <dd><p>Specify the number of samples for which the fade effect has to last. At
1032 the end of the fade-in effect the output audio will have the same
1033 volume as the input audio, at the end of the fade-out transition
1034 the output audio will be silence. Default is 44100.
1035 </p>
1036 </dd>
1037 <dt> &lsquo;<samp>start_time, st</samp>&rsquo;</dt>
1038 <dd><p>Specify time for starting to apply the fade effect. Default is 0.
1039 The accepted syntax is:
1040 </p><table><tr><td>&nbsp;</td><td><pre class="example">[-]HH[:MM[:SS[.m...]]]
1041 [-]S+[.m...]
1042 </pre></td></tr></table>
1043 <p>See also the function <code>av_parse_time()</code>.
1044 If set this option is used instead of <var>start_sample</var> one.
1045 </p>
1046 </dd>
1047 <dt> &lsquo;<samp>duration, d</samp>&rsquo;</dt>
1048 <dd><p>Specify the duration for which the fade effect has to last. Default is 0.
1049 The accepted syntax is:
1050 </p><table><tr><td>&nbsp;</td><td><pre class="example">[-]HH[:MM[:SS[.m...]]]
1051 [-]S+[.m...]
1052 </pre></td></tr></table>
1053 <p>See also the function <code>av_parse_time()</code>.
1054 At the end of the fade-in effect the output audio will have the same
1055 volume as the input audio, at the end of the fade-out transition
1056 the output audio will be silence.
1057 If set this option is used instead of <var>nb_samples</var> one.
1058 </p>
1059 </dd>
1060 <dt> &lsquo;<samp>curve</samp>&rsquo;</dt>
1061 <dd><p>Set curve for fade transition.
1062 </p>
1063 <p>It accepts the following values:
1064 </p><dl compact="compact">
1065 <dt> &lsquo;<samp>tri</samp>&rsquo;</dt>
1066 <dd><p>select triangular, linear slope (default)
1067 </p></dd>
1068 <dt> &lsquo;<samp>qsin</samp>&rsquo;</dt>
1069 <dd><p>select quarter of sine wave
1070 </p></dd>
1071 <dt> &lsquo;<samp>hsin</samp>&rsquo;</dt>
1072 <dd><p>select half of sine wave
1073 </p></dd>
1074 <dt> &lsquo;<samp>esin</samp>&rsquo;</dt>
1075 <dd><p>select exponential sine wave
1076 </p></dd>
1077 <dt> &lsquo;<samp>log</samp>&rsquo;</dt>
1078 <dd><p>select logarithmic
1079 </p></dd>
1080 <dt> &lsquo;<samp>par</samp>&rsquo;</dt>
1081 <dd><p>select inverted parabola
1082 </p></dd>
1083 <dt> &lsquo;<samp>qua</samp>&rsquo;</dt>
1084 <dd><p>select quadratic
1085 </p></dd>
1086 <dt> &lsquo;<samp>cub</samp>&rsquo;</dt>
1087 <dd><p>select cubic
1088 </p></dd>
1089 <dt> &lsquo;<samp>squ</samp>&rsquo;</dt>
1090 <dd><p>select square root
1091 </p></dd>
1092 <dt> &lsquo;<samp>cbr</samp>&rsquo;</dt>
1093 <dd><p>select cubic root
1094 </p></dd>
1095 </dl>
1096 </dd>
1097 </dl>
1098
1099 <a name="Examples-28"></a>
1100 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-28">6.5.1 Examples</a></h3>
1101
1102 <ul>
1103 <li>
1104 Fade in first 15 seconds of audio:
1105 <table><tr><td>&nbsp;</td><td><pre class="example">afade=t=in:ss=0:d=15
1106 </pre></td></tr></table>
1107
1108 </li><li>
1109 Fade out last 25 seconds of a 900 seconds audio:
1110 <table><tr><td>&nbsp;</td><td><pre class="example">afade=t=out:st=875:d=25
1111 </pre></td></tr></table>
1112 </li></ul>
1113
1114 <p><a name="aformat"></a>
1115 </p><a name="aformat-1"></a>
1116 <h2 class="section"><a href="ffmpeg-filters.html#toc-aformat-1">6.6 aformat</a></h2>
1117
1118 <p>Set output format constraints for the input audio. The framework will
1119 negotiate the most appropriate format to minimize conversions.
1120 </p>
1121 <p>The filter accepts the following named parameters:
1122 </p><dl compact="compact">
1123 <dt> &lsquo;<samp>sample_fmts</samp>&rsquo;</dt>
1124 <dd><p>A &rsquo;|&rsquo;-separated list of requested sample formats.
1125 </p>
1126 </dd>
1127 <dt> &lsquo;<samp>sample_rates</samp>&rsquo;</dt>
1128 <dd><p>A &rsquo;|&rsquo;-separated list of requested sample rates.
1129 </p>
1130 </dd>
1131 <dt> &lsquo;<samp>channel_layouts</samp>&rsquo;</dt>
1132 <dd><p>A &rsquo;|&rsquo;-separated list of requested channel layouts.
1133 </p>
1134 <p>See <a href="ffmpeg-utils.html#channel-layout-syntax">(ffmpeg-utils)channel layout syntax</a>
1135 for the required syntax.
1136 </p></dd>
1137 </dl>
1138
1139 <p>If a parameter is omitted, all values are allowed.
1140 </p>
1141 <p>For example to force the output to either unsigned 8-bit or signed 16-bit stereo:
1142 </p><table><tr><td>&nbsp;</td><td><pre class="example">aformat=sample_fmts=u8|s16:channel_layouts=stereo
1143 </pre></td></tr></table>
1144
1145 <a name="allpass"></a>
1146 <h2 class="section"><a href="ffmpeg-filters.html#toc-allpass">6.7 allpass</a></h2>
1147
1148 <p>Apply a two-pole all-pass filter with central frequency (in Hz)
1149 <var>frequency</var>, and filter-width <var>width</var>.
1150 An all-pass filter changes the audio&rsquo;s frequency to phase relationship
1151 without changing its frequency to amplitude relationship.
1152 </p>
1153 <p>The filter accepts the following options:
1154 </p>
1155 <dl compact="compact">
1156 <dt> &lsquo;<samp>frequency, f</samp>&rsquo;</dt>
1157 <dd><p>Set frequency in Hz.
1158 </p>
1159 </dd>
1160 <dt> &lsquo;<samp>width_type</samp>&rsquo;</dt>
1161 <dd><p>Set method to specify band-width of filter.
1162 </p><dl compact="compact">
1163 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
1164 <dd><p>Hz
1165 </p></dd>
1166 <dt> &lsquo;<samp>q</samp>&rsquo;</dt>
1167 <dd><p>Q-Factor
1168 </p></dd>
1169 <dt> &lsquo;<samp>o</samp>&rsquo;</dt>
1170 <dd><p>octave
1171 </p></dd>
1172 <dt> &lsquo;<samp>s</samp>&rsquo;</dt>
1173 <dd><p>slope
1174 </p></dd>
1175 </dl>
1176
1177 </dd>
1178 <dt> &lsquo;<samp>width, w</samp>&rsquo;</dt>
1179 <dd><p>Specify the band-width of a filter in width_type units.
1180 </p></dd>
1181 </dl>
1182
1183 <a name="amerge"></a>
1184 <h2 class="section"><a href="ffmpeg-filters.html#toc-amerge">6.8 amerge</a></h2>
1185
1186 <p>Merge two or more audio streams into a single multi-channel stream.
1187 </p>
1188 <p>The filter accepts the following options:
1189 </p>
1190 <dl compact="compact">
1191 <dt> &lsquo;<samp>inputs</samp>&rsquo;</dt>
1192 <dd><p>Set the number of inputs. Default is 2.
1193 </p>
1194 </dd>
1195 </dl>
1196
1197 <p>If the channel layouts of the inputs are disjoint, and therefore compatible,
1198 the channel layout of the output will be set accordingly and the channels
1199 will be reordered as necessary. If the channel layouts of the inputs are not
1200 disjoint, the output will have all the channels of the first input then all
1201 the channels of the second input, in that order, and the channel layout of
1202 the output will be the default value corresponding to the total number of
1203 channels.
1204 </p>
1205 <p>For example, if the first input is in 2.1 (FL+FR+LF) and the second input
1206 is FC+BL+BR, then the output will be in 5.1, with the channels in the
1207 following order: a1, a2, b1, a3, b2, b3 (a1 is the first channel of the
1208 first input, b1 is the first channel of the second input).
1209 </p>
1210 <p>On the other hand, if both input are in stereo, the output channels will be
1211 in the default order: a1, a2, b1, b2, and the channel layout will be
1212 arbitrarily set to 4.0, which may or may not be the expected value.
1213 </p>
1214 <p>All inputs must have the same sample rate, and format.
1215 </p>
1216 <p>If inputs do not have the same duration, the output will stop with the
1217 shortest.
1218 </p>
1219 <a name="Examples-38"></a>
1220 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-38">6.8.1 Examples</a></h3>
1221
1222 <ul>
1223 <li>
1224 Merge two mono files into a stereo stream:
1225 <table><tr><td>&nbsp;</td><td><pre class="example">amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
1226 </pre></td></tr></table>
1227
1228 </li><li>
1229 Multiple merges assuming 1 video stream and 6 audio streams in &lsquo;<tt>input.mkv</tt>&rsquo;:
1230 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i input.mkv -filter_complex &quot;[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6&quot; -c:a pcm_s16le output.mkv
1231 </pre></td></tr></table>
1232 </li></ul>
1233
1234 <a name="amix"></a>
1235 <h2 class="section"><a href="ffmpeg-filters.html#toc-amix">6.9 amix</a></h2>
1236
1237 <p>Mixes multiple audio inputs into a single output.
1238 </p>
1239 <p>For example
1240 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex amix=inputs=3:duration=first:dropout_transition=3 OUTPUT
1241 </pre></td></tr></table>
1242 <p>will mix 3 input audio streams to a single output with the same duration as the
1243 first input and a dropout transition time of 3 seconds.
1244 </p>
1245 <p>The filter accepts the following named parameters:
1246 </p><dl compact="compact">
1247 <dt> &lsquo;<samp>inputs</samp>&rsquo;</dt>
1248 <dd><p>Number of inputs. If unspecified, it defaults to 2.
1249 </p>
1250 </dd>
1251 <dt> &lsquo;<samp>duration</samp>&rsquo;</dt>
1252 <dd><p>How to determine the end-of-stream.
1253 </p><dl compact="compact">
1254 <dt> &lsquo;<samp>longest</samp>&rsquo;</dt>
1255 <dd><p>Duration of longest input. (default)
1256 </p>
1257 </dd>
1258 <dt> &lsquo;<samp>shortest</samp>&rsquo;</dt>
1259 <dd><p>Duration of shortest input.
1260 </p>
1261 </dd>
1262 <dt> &lsquo;<samp>first</samp>&rsquo;</dt>
1263 <dd><p>Duration of first input.
1264 </p>
1265 </dd>
1266 </dl>
1267
1268 </dd>
1269 <dt> &lsquo;<samp>dropout_transition</samp>&rsquo;</dt>
1270 <dd><p>Transition time, in seconds, for volume renormalization when an input
1271 stream ends. The default value is 2 seconds.
1272 </p>
1273 </dd>
1274 </dl>
1275
1276 <a name="anull"></a>
1277 <h2 class="section"><a href="ffmpeg-filters.html#toc-anull">6.10 anull</a></h2>
1278
1279 <p>Pass the audio source unchanged to the output.
1280 </p>
1281 <a name="apad"></a>
1282 <h2 class="section"><a href="ffmpeg-filters.html#toc-apad">6.11 apad</a></h2>
1283
1284 <p>Pad the end of a audio stream with silence, this can be used together with
1285 -shortest to extend audio streams to the same length as the video stream.
1286 </p>
1287 <a name="aphaser"></a>
1288 <h2 class="section"><a href="ffmpeg-filters.html#toc-aphaser">6.12 aphaser</a></h2>
1289 <p>Add a phasing effect to the input audio.
1290 </p>
1291 <p>A phaser filter creates series of peaks and troughs in the frequency spectrum.
1292 The position of the peaks and troughs are modulated so that they vary over time, creating a sweeping effect.
1293 </p>
1294 <p>A description of the accepted parameters follows.
1295 </p>
1296 <dl compact="compact">
1297 <dt> &lsquo;<samp>in_gain</samp>&rsquo;</dt>
1298 <dd><p>Set input gain. Default is 0.4.
1299 </p>
1300 </dd>
1301 <dt> &lsquo;<samp>out_gain</samp>&rsquo;</dt>
1302 <dd><p>Set output gain. Default is 0.74
1303 </p>
1304 </dd>
1305 <dt> &lsquo;<samp>delay</samp>&rsquo;</dt>
1306 <dd><p>Set delay in milliseconds. Default is 3.0.
1307 </p>
1308 </dd>
1309 <dt> &lsquo;<samp>decay</samp>&rsquo;</dt>
1310 <dd><p>Set decay. Default is 0.4.
1311 </p>
1312 </dd>
1313 <dt> &lsquo;<samp>speed</samp>&rsquo;</dt>
1314 <dd><p>Set modulation speed in Hz. Default is 0.5.
1315 </p>
1316 </dd>
1317 <dt> &lsquo;<samp>type</samp>&rsquo;</dt>
1318 <dd><p>Set modulation type. Default is triangular.
1319 </p>
1320 <p>It accepts the following values:
1321 </p><dl compact="compact">
1322 <dt> &lsquo;<samp>triangular, t</samp>&rsquo;</dt>
1323 <dt> &lsquo;<samp>sinusoidal, s</samp>&rsquo;</dt>
1324 </dl>
1325 </dd>
1326 </dl>
1327
1328 <p><a name="aresample"></a>
1329 </p><a name="aresample-1"></a>
1330 <h2 class="section"><a href="ffmpeg-filters.html#toc-aresample-1">6.13 aresample</a></h2>
1331
1332 <p>Resample the input audio to the specified parameters, using the
1333 libswresample library. If none are specified then the filter will
1334 automatically convert between its input and output.
1335 </p>
1336 <p>This filter is also able to stretch/squeeze the audio data to make it match
1337 the timestamps or to inject silence / cut out audio to make it match the
1338 timestamps, do a combination of both or do neither.
1339 </p>
1340 <p>The filter accepts the syntax
1341 [<var>sample_rate</var>:]<var>resampler_options</var>, where <var>sample_rate</var>
1342 expresses a sample rate and <var>resampler_options</var> is a list of
1343 <var>key</var>=<var>value</var> pairs, separated by &quot;:&quot;. See the
1344 ffmpeg-resampler manual for the complete list of supported options.
1345 </p>
1346 <a name="Examples-5"></a>
1347 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-5">6.13.1 Examples</a></h3>
1348
1349 <ul>
1350 <li>
1351 Resample the input audio to 44100Hz:
1352 <table><tr><td>&nbsp;</td><td><pre class="example">aresample=44100
1353 </pre></td></tr></table>
1354
1355 </li><li>
1356 Stretch/squeeze samples to the given timestamps, with a maximum of 1000
1357 samples per second compensation:
1358 <table><tr><td>&nbsp;</td><td><pre class="example">aresample=async=1000
1359 </pre></td></tr></table>
1360 </li></ul>
1361
1362 <a name="asetnsamples"></a>
1363 <h2 class="section"><a href="ffmpeg-filters.html#toc-asetnsamples">6.14 asetnsamples</a></h2>
1364
1365 <p>Set the number of samples per each output audio frame.
1366 </p>
1367 <p>The last output packet may contain a different number of samples, as
1368 the filter will flush all the remaining samples when the input audio
1369 signal its end.
1370 </p>
1371 <p>The filter accepts the following options:
1372 </p>
1373 <dl compact="compact">
1374 <dt> &lsquo;<samp>nb_out_samples, n</samp>&rsquo;</dt>
1375 <dd><p>Set the number of frames per each output audio frame. The number is
1376 intended as the number of samples <em>per each channel</em>.
1377 Default value is 1024.
1378 </p>
1379 </dd>
1380 <dt> &lsquo;<samp>pad, p</samp>&rsquo;</dt>
1381 <dd><p>If set to 1, the filter will pad the last audio frame with zeroes, so
1382 that the last frame will contain the same number of samples as the
1383 previous ones. Default value is 1.
1384 </p></dd>
1385 </dl>
1386
1387 <p>For example, to set the number of per-frame samples to 1234 and
1388 disable padding for the last frame, use:
1389 </p><table><tr><td>&nbsp;</td><td><pre class="example">asetnsamples=n=1234:p=0
1390 </pre></td></tr></table>
1391
1392 <a name="asetrate"></a>
1393 <h2 class="section"><a href="ffmpeg-filters.html#toc-asetrate">6.15 asetrate</a></h2>
1394
1395 <p>Set the sample rate without altering the PCM data.
1396 This will result in a change of speed and pitch.
1397 </p>
1398 <p>The filter accepts the following options:
1399 </p>
1400 <dl compact="compact">
1401 <dt> &lsquo;<samp>sample_rate, r</samp>&rsquo;</dt>
1402 <dd><p>Set the output sample rate. Default is 44100 Hz.
1403 </p></dd>
1404 </dl>
1405
1406 <a name="ashowinfo"></a>
1407 <h2 class="section"><a href="ffmpeg-filters.html#toc-ashowinfo">6.16 ashowinfo</a></h2>
1408
1409 <p>Show a line containing various information for each input audio frame.
1410 The input audio is not modified.
1411 </p>
1412 <p>The shown line contains a sequence of key/value pairs of the form
1413 <var>key</var>:<var>value</var>.
1414 </p>
1415 <p>A description of each shown parameter follows:
1416 </p>
1417 <dl compact="compact">
1418 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
1419 <dd><p>sequential number of the input frame, starting from 0
1420 </p>
1421 </dd>
1422 <dt> &lsquo;<samp>pts</samp>&rsquo;</dt>
1423 <dd><p>Presentation timestamp of the input frame, in time base units; the time base
1424 depends on the filter input pad, and is usually 1/<var>sample_rate</var>.
1425 </p>
1426 </dd>
1427 <dt> &lsquo;<samp>pts_time</samp>&rsquo;</dt>
1428 <dd><p>presentation timestamp of the input frame in seconds
1429 </p>
1430 </dd>
1431 <dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
1432 <dd><p>position of the frame in the input stream, -1 if this information in
1433 unavailable and/or meaningless (for example in case of synthetic audio)
1434 </p>
1435 </dd>
1436 <dt> &lsquo;<samp>fmt</samp>&rsquo;</dt>
1437 <dd><p>sample format
1438 </p>
1439 </dd>
1440 <dt> &lsquo;<samp>chlayout</samp>&rsquo;</dt>
1441 <dd><p>channel layout
1442 </p>
1443 </dd>
1444 <dt> &lsquo;<samp>rate</samp>&rsquo;</dt>
1445 <dd><p>sample rate for the audio frame
1446 </p>
1447 </dd>
1448 <dt> &lsquo;<samp>nb_samples</samp>&rsquo;</dt>
1449 <dd><p>number of samples (per channel) in the frame
1450 </p>
1451 </dd>
1452 <dt> &lsquo;<samp>checksum</samp>&rsquo;</dt>
1453 <dd><p>Adler-32 checksum (printed in hexadecimal) of the audio data. For planar audio
1454 the data is treated as if all the planes were concatenated.
1455 </p>
1456 </dd>
1457 <dt> &lsquo;<samp>plane_checksums</samp>&rsquo;</dt>
1458 <dd><p>A list of Adler-32 checksums for each data plane.
1459 </p></dd>
1460 </dl>
1461
1462 <a name="astats"></a>
1463 <h2 class="section"><a href="ffmpeg-filters.html#toc-astats">6.17 astats</a></h2>
1464
1465 <p>Display time domain statistical information about the audio channels.
1466 Statistics are calculated and displayed for each audio channel and,
1467 where applicable, an overall figure is also given.
1468 </p>
1469 <p>The filter accepts the following option:
1470 </p><dl compact="compact">
1471 <dt> &lsquo;<samp>length</samp>&rsquo;</dt>
1472 <dd><p>Short window length in seconds, used for peak and trough RMS measurement.
1473 Default is <code>0.05</code> (50 miliseconds). Allowed range is <code>[0.1 - 10]</code>.
1474 </p></dd>
1475 </dl>
1476
1477 <p>A description of each shown parameter follows:
1478 </p>
1479 <dl compact="compact">
1480 <dt> &lsquo;<samp>DC offset</samp>&rsquo;</dt>
1481 <dd><p>Mean amplitude displacement from zero.
1482 </p>
1483 </dd>
1484 <dt> &lsquo;<samp>Min level</samp>&rsquo;</dt>
1485 <dd><p>Minimal sample level.
1486 </p>
1487 </dd>
1488 <dt> &lsquo;<samp>Max level</samp>&rsquo;</dt>
1489 <dd><p>Maximal sample level.
1490 </p>
1491 </dd>
1492 <dt> &lsquo;<samp>Peak level dB</samp>&rsquo;</dt>
1493 <dt> &lsquo;<samp>RMS level dB</samp>&rsquo;</dt>
1494 <dd><p>Standard peak and RMS level measured in dBFS.
1495 </p>
1496 </dd>
1497 <dt> &lsquo;<samp>RMS peak dB</samp>&rsquo;</dt>
1498 <dt> &lsquo;<samp>RMS trough dB</samp>&rsquo;</dt>
1499 <dd><p>Peak and trough values for RMS level measured over a short window.
1500 </p>
1501 </dd>
1502 <dt> &lsquo;<samp>Crest factor</samp>&rsquo;</dt>
1503 <dd><p>Standard ratio of peak to RMS level (note: not in dB).
1504 </p>
1505 </dd>
1506 <dt> &lsquo;<samp>Flat factor</samp>&rsquo;</dt>
1507 <dd><p>Flatness (i.e. consecutive samples with the same value) of the signal at its peak levels
1508 (i.e. either <var>Min level</var> or <var>Max level</var>).
1509 </p>
1510 </dd>
1511 <dt> &lsquo;<samp>Peak count</samp>&rsquo;</dt>
1512 <dd><p>Number of occasions (not the number of samples) that the signal attained either
1513 <var>Min level</var> or <var>Max level</var>.
1514 </p></dd>
1515 </dl>
1516
1517 <a name="astreamsync"></a>
1518 <h2 class="section"><a href="ffmpeg-filters.html#toc-astreamsync">6.18 astreamsync</a></h2>
1519
1520 <p>Forward two audio streams and control the order the buffers are forwarded.
1521 </p>
1522 <p>The filter accepts the following options:
1523 </p>
1524 <dl compact="compact">
1525 <dt> &lsquo;<samp>expr, e</samp>&rsquo;</dt>
1526 <dd><p>Set the expression deciding which stream should be
1527 forwarded next: if the result is negative, the first stream is forwarded; if
1528 the result is positive or zero, the second stream is forwarded. It can use
1529 the following variables:
1530 </p>
1531 <dl compact="compact">
1532 <dt> <var>b1 b2</var></dt>
1533 <dd><p>number of buffers forwarded so far on each stream
1534 </p></dd>
1535 <dt> <var>s1 s2</var></dt>
1536 <dd><p>number of samples forwarded so far on each stream
1537 </p></dd>
1538 <dt> <var>t1 t2</var></dt>
1539 <dd><p>current timestamp of each stream
1540 </p></dd>
1541 </dl>
1542
1543 <p>The default value is <code>t1-t2</code>, which means to always forward the stream
1544 that has a smaller timestamp.
1545 </p></dd>
1546 </dl>
1547
1548 <a name="Examples-45"></a>
1549 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-45">6.18.1 Examples</a></h3>
1550
1551 <p>Stress-test <code>amerge</code> by randomly sending buffers on the wrong
1552 input, while avoiding too much of a desynchronization:
1553 </p><table><tr><td>&nbsp;</td><td><pre class="example">amovie=file.ogg [a] ; amovie=file.mp3 [b] ;
1554 [a] [b] astreamsync=(2*random(1))-1+tanh(5*(t1-t2)) [a2] [b2] ;
1555 [a2] [b2] amerge
1556 </pre></td></tr></table>
1557
1558 <a name="asyncts"></a>
1559 <h2 class="section"><a href="ffmpeg-filters.html#toc-asyncts">6.19 asyncts</a></h2>
1560
1561 <p>Synchronize audio data with timestamps by squeezing/stretching it and/or
1562 dropping samples/adding silence when needed.
1563 </p>
1564 <p>This filter is not built by default, please use <a href="#aresample">aresample</a> to do squeezing/stretching.
1565 </p>
1566 <p>The filter accepts the following named parameters:
1567 </p><dl compact="compact">
1568 <dt> &lsquo;<samp>compensate</samp>&rsquo;</dt>
1569 <dd><p>Enable stretching/squeezing the data to make it match the timestamps. Disabled
1570 by default. When disabled, time gaps are covered with silence.
1571 </p>
1572 </dd>
1573 <dt> &lsquo;<samp>min_delta</samp>&rsquo;</dt>
1574 <dd><p>Minimum difference between timestamps and audio data (in seconds) to trigger
1575 adding/dropping samples. Default value is 0.1. If you get non-perfect sync with
1576 this filter, try setting this parameter to 0.
1577 </p>
1578 </dd>
1579 <dt> &lsquo;<samp>max_comp</samp>&rsquo;</dt>
1580 <dd><p>Maximum compensation in samples per second. Relevant only with compensate=1.
1581 Default value 500.
1582 </p>
1583 </dd>
1584 <dt> &lsquo;<samp>first_pts</samp>&rsquo;</dt>
1585 <dd><p>Assume the first pts should be this value. The time base is 1 / sample rate.
1586 This allows for padding/trimming at the start of stream. By default, no
1587 assumption is made about the first frame&rsquo;s expected pts, so no padding or
1588 trimming is done. For example, this could be set to 0 to pad the beginning with
1589 silence if an audio stream starts after the video stream or to trim any samples
1590 with a negative pts due to encoder delay.
1591 </p>
1592 </dd>
1593 </dl>
1594
1595 <a name="atempo"></a>
1596 <h2 class="section"><a href="ffmpeg-filters.html#toc-atempo">6.20 atempo</a></h2>
1597
1598 <p>Adjust audio tempo.
1599 </p>
1600 <p>The filter accepts exactly one parameter, the audio tempo. If not
1601 specified then the filter will assume nominal 1.0 tempo. Tempo must
1602 be in the [0.5, 2.0] range.
1603 </p>
1604 <a name="Examples-23"></a>
1605 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-23">6.20.1 Examples</a></h3>
1606
1607 <ul>
1608 <li>
1609 Slow down audio to 80% tempo:
1610 <table><tr><td>&nbsp;</td><td><pre class="example">atempo=0.8
1611 </pre></td></tr></table>
1612
1613 </li><li>
1614 To speed up audio to 125% tempo:
1615 <table><tr><td>&nbsp;</td><td><pre class="example">atempo=1.25
1616 </pre></td></tr></table>
1617 </li></ul>
1618
1619 <a name="atrim"></a>
1620 <h2 class="section"><a href="ffmpeg-filters.html#toc-atrim">6.21 atrim</a></h2>
1621
1622 <p>Trim the input so that the output contains one continuous subpart of the input.
1623 </p>
1624 <p>This filter accepts the following options:
1625 </p><dl compact="compact">
1626 <dt> &lsquo;<samp>start</samp>&rsquo;</dt>
1627 <dd><p>Specify time of the start of the kept section, i.e. the audio sample
1628 with the timestamp <var>start</var> will be the first sample in the output.
1629 </p>
1630 </dd>
1631 <dt> &lsquo;<samp>end</samp>&rsquo;</dt>
1632 <dd><p>Specify time of the first audio sample that will be dropped, i.e. the
1633 audio sample immediately preceding the one with the timestamp <var>end</var> will be
1634 the last sample in the output.
1635 </p>
1636 </dd>
1637 <dt> &lsquo;<samp>start_pts</samp>&rsquo;</dt>
1638 <dd><p>Same as <var>start</var>, except this option sets the start timestamp in samples
1639 instead of seconds.
1640 </p>
1641 </dd>
1642 <dt> &lsquo;<samp>end_pts</samp>&rsquo;</dt>
1643 <dd><p>Same as <var>end</var>, except this option sets the end timestamp in samples instead
1644 of seconds.
1645 </p>
1646 </dd>
1647 <dt> &lsquo;<samp>duration</samp>&rsquo;</dt>
1648 <dd><p>Specify maximum duration of the output.
1649 </p>
1650 </dd>
1651 <dt> &lsquo;<samp>start_sample</samp>&rsquo;</dt>
1652 <dd><p>Number of the first sample that should be passed to output.
1653 </p>
1654 </dd>
1655 <dt> &lsquo;<samp>end_sample</samp>&rsquo;</dt>
1656 <dd><p>Number of the first sample that should be dropped.
1657 </p></dd>
1658 </dl>
1659
1660 <p>&lsquo;<samp>start</samp>&rsquo;, &lsquo;<samp>end</samp>&rsquo;, &lsquo;<samp>duration</samp>&rsquo; are expressed as time
1661 duration specifications, check the &quot;Time duration&quot; section in the
1662 ffmpeg-utils manual.
1663 </p>
1664 <p>Note that the first two sets of the start/end options and the &lsquo;<samp>duration</samp>&rsquo;
1665 option look at the frame timestamp, while the _sample options simply count the
1666 samples that pass through the filter. So start/end_pts and start/end_sample will
1667 give different results when the timestamps are wrong, inexact or do not start at
1668 zero. Also note that this filter does not modify the timestamps. If you wish
1669 that the output timestamps start at zero, insert the asetpts filter after the
1670 atrim filter.
1671 </p>
1672 <p>If multiple start or end options are set, this filter tries to be greedy and
1673 keep all samples that match at least one of the specified constraints. To keep
1674 only the part that matches all the constraints at once, chain multiple atrim
1675 filters.
1676 </p>
1677 <p>The defaults are such that all the input is kept. So it is possible to set e.g.
1678 just the end values to keep everything before the specified time.
1679 </p>
1680 <p>Examples:
1681 </p><ul>
1682 <li>
1683 drop everything except the second minute of input
1684 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -af atrim=60:120
1685 </pre></td></tr></table>
1686
1687 </li><li>
1688 keep only the first 1000 samples
1689 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -af atrim=end_sample=1000
1690 </pre></td></tr></table>
1691
1692 </li></ul>
1693
1694 <a name="bandpass"></a>
1695 <h2 class="section"><a href="ffmpeg-filters.html#toc-bandpass">6.22 bandpass</a></h2>
1696
1697 <p>Apply a two-pole Butterworth band-pass filter with central
1698 frequency <var>frequency</var>, and (3dB-point) band-width width.
1699 The <var>csg</var> option selects a constant skirt gain (peak gain = Q)
1700 instead of the default: constant 0dB peak gain.
1701 The filter roll off at 6dB per octave (20dB per decade).
1702 </p>
1703 <p>The filter accepts the following options:
1704 </p>
1705 <dl compact="compact">
1706 <dt> &lsquo;<samp>frequency, f</samp>&rsquo;</dt>
1707 <dd><p>Set the filter&rsquo;s central frequency. Default is <code>3000</code>.
1708 </p>
1709 </dd>
1710 <dt> &lsquo;<samp>csg</samp>&rsquo;</dt>
1711 <dd><p>Constant skirt gain if set to 1. Defaults to 0.
1712 </p>
1713 </dd>
1714 <dt> &lsquo;<samp>width_type</samp>&rsquo;</dt>
1715 <dd><p>Set method to specify band-width of filter.
1716 </p><dl compact="compact">
1717 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
1718 <dd><p>Hz
1719 </p></dd>
1720 <dt> &lsquo;<samp>q</samp>&rsquo;</dt>
1721 <dd><p>Q-Factor
1722 </p></dd>
1723 <dt> &lsquo;<samp>o</samp>&rsquo;</dt>
1724 <dd><p>octave
1725 </p></dd>
1726 <dt> &lsquo;<samp>s</samp>&rsquo;</dt>
1727 <dd><p>slope
1728 </p></dd>
1729 </dl>
1730
1731 </dd>
1732 <dt> &lsquo;<samp>width, w</samp>&rsquo;</dt>
1733 <dd><p>Specify the band-width of a filter in width_type units.
1734 </p></dd>
1735 </dl>
1736
1737 <a name="bandreject"></a>
1738 <h2 class="section"><a href="ffmpeg-filters.html#toc-bandreject">6.23 bandreject</a></h2>
1739
1740 <p>Apply a two-pole Butterworth band-reject filter with central
1741 frequency <var>frequency</var>, and (3dB-point) band-width <var>width</var>.
1742 The filter roll off at 6dB per octave (20dB per decade).
1743 </p>
1744 <p>The filter accepts the following options:
1745 </p>
1746 <dl compact="compact">
1747 <dt> &lsquo;<samp>frequency, f</samp>&rsquo;</dt>
1748 <dd><p>Set the filter&rsquo;s central frequency. Default is <code>3000</code>.
1749 </p>
1750 </dd>
1751 <dt> &lsquo;<samp>width_type</samp>&rsquo;</dt>
1752 <dd><p>Set method to specify band-width of filter.
1753 </p><dl compact="compact">
1754 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
1755 <dd><p>Hz
1756 </p></dd>
1757 <dt> &lsquo;<samp>q</samp>&rsquo;</dt>
1758 <dd><p>Q-Factor
1759 </p></dd>
1760 <dt> &lsquo;<samp>o</samp>&rsquo;</dt>
1761 <dd><p>octave
1762 </p></dd>
1763 <dt> &lsquo;<samp>s</samp>&rsquo;</dt>
1764 <dd><p>slope
1765 </p></dd>
1766 </dl>
1767
1768 </dd>
1769 <dt> &lsquo;<samp>width, w</samp>&rsquo;</dt>
1770 <dd><p>Specify the band-width of a filter in width_type units.
1771 </p></dd>
1772 </dl>
1773
1774 <a name="bass"></a>
1775 <h2 class="section"><a href="ffmpeg-filters.html#toc-bass">6.24 bass</a></h2>
1776
1777 <p>Boost or cut the bass (lower) frequencies of the audio using a two-pole
1778 shelving filter with a response similar to that of a standard
1779 hi-fi&rsquo;s tone-controls. This is also known as shelving equalisation (EQ).
1780 </p>
1781 <p>The filter accepts the following options:
1782 </p>
1783 <dl compact="compact">
1784 <dt> &lsquo;<samp>gain, g</samp>&rsquo;</dt>
1785 <dd><p>Give the gain at 0 Hz. Its useful range is about -20
1786 (for a large cut) to +20 (for a large boost).
1787 Beware of clipping when using a positive gain.
1788 </p>
1789 </dd>
1790 <dt> &lsquo;<samp>frequency, f</samp>&rsquo;</dt>
1791 <dd><p>Set the filter&rsquo;s central frequency and so can be used
1792 to extend or reduce the frequency range to be boosted or cut.
1793 The default value is <code>100</code> Hz.
1794 </p>
1795 </dd>
1796 <dt> &lsquo;<samp>width_type</samp>&rsquo;</dt>
1797 <dd><p>Set method to specify band-width of filter.
1798 </p><dl compact="compact">
1799 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
1800 <dd><p>Hz
1801 </p></dd>
1802 <dt> &lsquo;<samp>q</samp>&rsquo;</dt>
1803 <dd><p>Q-Factor
1804 </p></dd>
1805 <dt> &lsquo;<samp>o</samp>&rsquo;</dt>
1806 <dd><p>octave
1807 </p></dd>
1808 <dt> &lsquo;<samp>s</samp>&rsquo;</dt>
1809 <dd><p>slope
1810 </p></dd>
1811 </dl>
1812
1813 </dd>
1814 <dt> &lsquo;<samp>width, w</samp>&rsquo;</dt>
1815 <dd><p>Determine how steep is the filter&rsquo;s shelf transition.
1816 </p></dd>
1817 </dl>
1818
1819 <a name="biquad"></a>
1820 <h2 class="section"><a href="ffmpeg-filters.html#toc-biquad">6.25 biquad</a></h2>
1821
1822 <p>Apply a biquad IIR filter with the given coefficients.
1823 Where <var>b0</var>, <var>b1</var>, <var>b2</var> and <var>a0</var>, <var>a1</var>, <var>a2</var>
1824 are the numerator and denominator coefficients respectively.
1825 </p>
1826 <a name="channelmap"></a>
1827 <h2 class="section"><a href="ffmpeg-filters.html#toc-channelmap">6.26 channelmap</a></h2>
1828
1829 <p>Remap input channels to new locations.
1830 </p>
1831 <p>This filter accepts the following named parameters:
1832 </p><dl compact="compact">
1833 <dt> &lsquo;<samp>channel_layout</samp>&rsquo;</dt>
1834 <dd><p>Channel layout of the output stream.
1835 </p>
1836 </dd>
1837 <dt> &lsquo;<samp>map</samp>&rsquo;</dt>
1838 <dd><p>Map channels from input to output. The argument is a &rsquo;|&rsquo;-separated list of
1839 mappings, each in the <code><var>in_channel</var>-<var>out_channel</var></code> or
1840 <var>in_channel</var> form. <var>in_channel</var> can be either the name of the input
1841 channel (e.g. FL for front left) or its index in the input channel layout.
1842 <var>out_channel</var> is the name of the output channel or its index in the output
1843 channel layout. If <var>out_channel</var> is not given then it is implicitly an
1844 index, starting with zero and increasing by one for each mapping.
1845 </p></dd>
1846 </dl>
1847
1848 <p>If no mapping is present, the filter will implicitly map input channels to
1849 output channels preserving index.
1850 </p>
1851 <p>For example, assuming a 5.1+downmix input MOV file
1852 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.mov -filter 'channelmap=map=DL-FL|DR-FR' out.wav
1853 </pre></td></tr></table>
1854 <p>will create an output WAV file tagged as stereo from the downmix channels of
1855 the input.
1856 </p>
1857 <p>To fix a 5.1 WAV improperly encoded in AAC&rsquo;s native channel order
1858 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.wav -filter 'channelmap=1|2|0|5|3|4:channel_layout=5.1' out.wav
1859 </pre></td></tr></table>
1860
1861 <a name="channelsplit"></a>
1862 <h2 class="section"><a href="ffmpeg-filters.html#toc-channelsplit">6.27 channelsplit</a></h2>
1863
1864 <p>Split each channel in input audio stream into a separate output stream.
1865 </p>
1866 <p>This filter accepts the following named parameters:
1867 </p><dl compact="compact">
1868 <dt> &lsquo;<samp>channel_layout</samp>&rsquo;</dt>
1869 <dd><p>Channel layout of the input stream. Default is &quot;stereo&quot;.
1870 </p></dd>
1871 </dl>
1872
1873 <p>For example, assuming a stereo input MP3 file
1874 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv
1875 </pre></td></tr></table>
1876 <p>will create an output Matroska file with two audio streams, one containing only
1877 the left channel and the other the right channel.
1878 </p>
1879 <p>To split a 5.1 WAV file into per-channel files
1880 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.wav -filter_complex
1881 'channelsplit=channel_layout=5.1[FL][FR][FC][LFE][SL][SR]'
1882 -map '[FL]' front_left.wav -map '[FR]' front_right.wav -map '[FC]'
1883 front_center.wav -map '[LFE]' lfe.wav -map '[SL]' side_left.wav -map '[SR]'
1884 side_right.wav
1885 </pre></td></tr></table>
1886
1887 <a name="compand"></a>
1888 <h2 class="section"><a href="ffmpeg-filters.html#toc-compand">6.28 compand</a></h2>
1889 <p>Compress or expand audio dynamic range.
1890 </p>
1891 <p>A description of the accepted options follows.
1892 </p>
1893 <dl compact="compact">
1894 <dt> &lsquo;<samp>attacks</samp>&rsquo;</dt>
1895 <dt> &lsquo;<samp>decays</samp>&rsquo;</dt>
1896 <dd><p>Set list of times in seconds for each channel over which the instantaneous level
1897 of the input signal is averaged to determine its volume. <var>attacks</var> refers to
1898 increase of volume and <var>decays</var> refers to decrease of volume. For most
1899 situations, the attack time (response to the audio getting louder) should be
1900 shorter than the decay time because the human ear is more sensitive to sudden
1901 loud audio than sudden soft audio. A typical value for attack is 0.3 seconds and
1902 a typical value for decay is 0.8 seconds.
1903 </p>
1904 </dd>
1905 <dt> &lsquo;<samp>points</samp>&rsquo;</dt>
1906 <dd><p>Set list of points for the transfer function, specified in dB relative to the
1907 maximum possible signal amplitude. Each key points list must be defined using
1908 the following syntax: <code>x0/y0|x1/y1|x2/y2|....</code> or
1909 <code>x0/y0 x1/y1 x2/y2 ....</code>
1910 </p>
1911 <p>The input values must be in strictly increasing order but the transfer function
1912 does not have to be monotonically rising. The point <code>0/0</code> is assumed but
1913 may be overridden (by <code>0/out-dBn</code>). Typical values for the transfer
1914 function are <code>-70/-70|-60/-20</code>.
1915 </p>
1916 </dd>
1917 <dt> &lsquo;<samp>soft-knee</samp>&rsquo;</dt>
1918 <dd><p>Set the curve radius in dB for all joints. Defaults to 0.01.
1919 </p>
1920 </dd>
1921 <dt> &lsquo;<samp>gain</samp>&rsquo;</dt>
1922 <dd><p>Set additional gain in dB to be applied at all points on the transfer function.
1923 This allows easy adjustment of the overall gain. Defaults to 0.
1924 </p>
1925 </dd>
1926 <dt> &lsquo;<samp>volume</samp>&rsquo;</dt>
1927 <dd><p>Set initial volume in dB to be assumed for each channel when filtering starts.
1928 This permits the user to supply a nominal level initially, so that, for
1929 example, a very large gain is not applied to initial signal levels before the
1930 companding has begun to operate. A typical value for audio which is initially
1931 quiet is -90 dB. Defaults to 0.
1932 </p>
1933 </dd>
1934 <dt> &lsquo;<samp>delay</samp>&rsquo;</dt>
1935 <dd><p>Set delay in seconds. The input audio is analyzed immediately, but audio is
1936 delayed before being fed to the volume adjuster. Specifying a delay
1937 approximately equal to the attack/decay times allows the filter to effectively
1938 operate in predictive rather than reactive mode. Defaults to 0.
1939 </p>
1940 </dd>
1941 </dl>
1942
1943 <a name="Examples-65"></a>
1944 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-65">6.28.1 Examples</a></h3>
1945
1946 <ul>
1947 <li>
1948 Make music with both quiet and loud passages suitable for listening in a noisy
1949 environment:
1950 <table><tr><td>&nbsp;</td><td><pre class="example">compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2
1951 </pre></td></tr></table>
1952
1953 </li><li>
1954 Noise gate for when the noise is at a lower level than the signal:
1955 <table><tr><td>&nbsp;</td><td><pre class="example">compand=.1|.1:.2|.2:-900/-900|-50.1/-900|-50/-50:.01:0:-90:.1
1956 </pre></td></tr></table>
1957
1958 </li><li>
1959 Here is another noise gate, this time for when the noise is at a higher level
1960 than the signal (making it, in some ways, similar to squelch):
1961 <table><tr><td>&nbsp;</td><td><pre class="example">compand=.1|.1:.1|.1:-45.1/-45.1|-45/-900|0/-900:.01:45:-90:.1
1962 </pre></td></tr></table>
1963 </li></ul>
1964
1965 <a name="earwax"></a>
1966 <h2 class="section"><a href="ffmpeg-filters.html#toc-earwax">6.29 earwax</a></h2>
1967
1968 <p>Make audio easier to listen to on headphones.
1969 </p>
1970 <p>This filter adds &lsquo;cues&rsquo; to 44.1kHz stereo (i.e. audio CD format) audio
1971 so that when listened to on headphones the stereo image is moved from
1972 inside your head (standard for headphones) to outside and in front of
1973 the listener (standard for speakers).
1974 </p>
1975 <p>Ported from SoX.
1976 </p>
1977 <a name="equalizer"></a>
1978 <h2 class="section"><a href="ffmpeg-filters.html#toc-equalizer">6.30 equalizer</a></h2>
1979
1980 <p>Apply a two-pole peaking equalisation (EQ) filter. With this
1981 filter, the signal-level at and around a selected frequency can
1982 be increased or decreased, whilst (unlike bandpass and bandreject
1983 filters) that at all other frequencies is unchanged.
1984 </p>
1985 <p>In order to produce complex equalisation curves, this filter can
1986 be given several times, each with a different central frequency.
1987 </p>
1988 <p>The filter accepts the following options:
1989 </p>
1990 <dl compact="compact">
1991 <dt> &lsquo;<samp>frequency, f</samp>&rsquo;</dt>
1992 <dd><p>Set the filter&rsquo;s central frequency in Hz.
1993 </p>
1994 </dd>
1995 <dt> &lsquo;<samp>width_type</samp>&rsquo;</dt>
1996 <dd><p>Set method to specify band-width of filter.
1997 </p><dl compact="compact">
1998 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
1999 <dd><p>Hz
2000 </p></dd>
2001 <dt> &lsquo;<samp>q</samp>&rsquo;</dt>
2002 <dd><p>Q-Factor
2003 </p></dd>
2004 <dt> &lsquo;<samp>o</samp>&rsquo;</dt>
2005 <dd><p>octave
2006 </p></dd>
2007 <dt> &lsquo;<samp>s</samp>&rsquo;</dt>
2008 <dd><p>slope
2009 </p></dd>
2010 </dl>
2011
2012 </dd>
2013 <dt> &lsquo;<samp>width, w</samp>&rsquo;</dt>
2014 <dd><p>Specify the band-width of a filter in width_type units.
2015 </p>
2016 </dd>
2017 <dt> &lsquo;<samp>gain, g</samp>&rsquo;</dt>
2018 <dd><p>Set the required gain or attenuation in dB.
2019 Beware of clipping when using a positive gain.
2020 </p></dd>
2021 </dl>
2022
2023 <a name="Examples-14"></a>
2024 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-14">6.30.1 Examples</a></h3>
2025 <ul>
2026 <li>
2027 Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
2028 <table><tr><td>&nbsp;</td><td><pre class="example">equalizer=f=1000:width_type=h:width=200:g=-10
2029 </pre></td></tr></table>
2030
2031 </li><li>
2032 Apply 2 dB gain at 1000 Hz with Q 1 and attenuate 5 dB at 100 Hz with Q 2:
2033 <table><tr><td>&nbsp;</td><td><pre class="example">equalizer=f=1000:width_type=q:width=1:g=2,equalizer=f=100:width_type=q:width=2:g=-5
2034 </pre></td></tr></table>
2035 </li></ul>
2036
2037 <a name="highpass"></a>
2038 <h2 class="section"><a href="ffmpeg-filters.html#toc-highpass">6.31 highpass</a></h2>
2039
2040 <p>Apply a high-pass filter with 3dB point frequency.
2041 The filter can be either single-pole, or double-pole (the default).
2042 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
2043 </p>
2044 <p>The filter accepts the following options:
2045 </p>
2046 <dl compact="compact">
2047 <dt> &lsquo;<samp>frequency, f</samp>&rsquo;</dt>
2048 <dd><p>Set frequency in Hz. Default is 3000.
2049 </p>
2050 </dd>
2051 <dt> &lsquo;<samp>poles, p</samp>&rsquo;</dt>
2052 <dd><p>Set number of poles. Default is 2.
2053 </p>
2054 </dd>
2055 <dt> &lsquo;<samp>width_type</samp>&rsquo;</dt>
2056 <dd><p>Set method to specify band-width of filter.
2057 </p><dl compact="compact">
2058 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
2059 <dd><p>Hz
2060 </p></dd>
2061 <dt> &lsquo;<samp>q</samp>&rsquo;</dt>
2062 <dd><p>Q-Factor
2063 </p></dd>
2064 <dt> &lsquo;<samp>o</samp>&rsquo;</dt>
2065 <dd><p>octave
2066 </p></dd>
2067 <dt> &lsquo;<samp>s</samp>&rsquo;</dt>
2068 <dd><p>slope
2069 </p></dd>
2070 </dl>
2071
2072 </dd>
2073 <dt> &lsquo;<samp>width, w</samp>&rsquo;</dt>
2074 <dd><p>Specify the band-width of a filter in width_type units.
2075 Applies only to double-pole filter.
2076 The default is 0.707q and gives a Butterworth response.
2077 </p></dd>
2078 </dl>
2079
2080 <a name="join"></a>
2081 <h2 class="section"><a href="ffmpeg-filters.html#toc-join">6.32 join</a></h2>
2082
2083 <p>Join multiple input streams into one multi-channel stream.
2084 </p>
2085 <p>The filter accepts the following named parameters:
2086 </p><dl compact="compact">
2087 <dt> &lsquo;<samp>inputs</samp>&rsquo;</dt>
2088 <dd><p>Number of input streams. Defaults to 2.
2089 </p>
2090 </dd>
2091 <dt> &lsquo;<samp>channel_layout</samp>&rsquo;</dt>
2092 <dd><p>Desired output channel layout. Defaults to stereo.
2093 </p>
2094 </dd>
2095 <dt> &lsquo;<samp>map</samp>&rsquo;</dt>
2096 <dd><p>Map channels from inputs to output. The argument is a &rsquo;|&rsquo;-separated list of
2097 mappings, each in the <code><var>input_idx</var>.<var>in_channel</var>-<var>out_channel</var></code>
2098 form. <var>input_idx</var> is the 0-based index of the input stream. <var>in_channel</var>
2099 can be either the name of the input channel (e.g. FL for front left) or its
2100 index in the specified input stream. <var>out_channel</var> is the name of the output
2101 channel.
2102 </p></dd>
2103 </dl>
2104
2105 <p>The filter will attempt to guess the mappings when those are not specified
2106 explicitly. It does so by first trying to find an unused matching input channel
2107 and if that fails it picks the first unused input channel.
2108 </p>
2109 <p>E.g. to join 3 inputs (with properly set channel layouts)
2110 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
2111 </pre></td></tr></table>
2112
2113 <p>To build a 5.1 output from 6 single-channel streams:
2114 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i fl -i fr -i fc -i sl -i sr -i lfe -filter_complex
2115 'join=inputs=6:channel_layout=5.1:map=0.0-FL|1.0-FR|2.0-FC|3.0-SL|4.0-SR|5.0-LFE'
2116 out
2117 </pre></td></tr></table>
2118
2119 <a name="ladspa"></a>
2120 <h2 class="section"><a href="ffmpeg-filters.html#toc-ladspa">6.33 ladspa</a></h2>
2121
2122 <p>Load a LADSPA (Linux Audio Developer&rsquo;s Simple Plugin API) plugin.
2123 </p>
2124 <p>To enable compilation of this filter you need to configure FFmpeg with
2125 <code>--enable-ladspa</code>.
2126 </p>
2127 <dl compact="compact">
2128 <dt> &lsquo;<samp>file, f</samp>&rsquo;</dt>
2129 <dd><p>Specifies the name of LADSPA plugin library to load. If the environment
2130 variable <code>LADSPA_PATH</code> is defined, the LADSPA plugin is searched in
2131 each one of the directories specified by the colon separated list in
2132 <code>LADSPA_PATH</code>, otherwise in the standard LADSPA paths, which are in
2133 this order: &lsquo;<tt>HOME/.ladspa/lib/</tt>&rsquo;, &lsquo;<tt>/usr/local/lib/ladspa/</tt>&rsquo;,
2134 &lsquo;<tt>/usr/lib/ladspa/</tt>&rsquo;.
2135 </p>
2136 </dd>
2137 <dt> &lsquo;<samp>plugin, p</samp>&rsquo;</dt>
2138 <dd><p>Specifies the plugin within the library. Some libraries contain only
2139 one plugin, but others contain many of them. If this is not set filter
2140 will list all available plugins within the specified library.
2141 </p>
2142 </dd>
2143 <dt> &lsquo;<samp>controls, c</samp>&rsquo;</dt>
2144 <dd><p>Set the &rsquo;|&rsquo; separated list of controls which are zero or more floating point
2145 values that determine the behavior of the loaded plugin (for example delay,
2146 threshold or gain).
2147 Controls need to be defined using the following syntax:
2148 c0=<var>value0</var>|c1=<var>value1</var>|c2=<var>value2</var>|..., where
2149 <var>valuei</var> is the value set on the <var>i</var>-th control.
2150 If &lsquo;<samp>controls</samp>&rsquo; is set to <code>help</code>, all available controls and
2151 their valid ranges are printed.
2152 </p>
2153 </dd>
2154 <dt> &lsquo;<samp>sample_rate, s</samp>&rsquo;</dt>
2155 <dd><p>Specify the sample rate, default to 44100. Only used if plugin have
2156 zero inputs.
2157 </p>
2158 </dd>
2159 <dt> &lsquo;<samp>nb_samples, n</samp>&rsquo;</dt>
2160 <dd><p>Set the number of samples per channel per each output frame, default
2161 is 1024. Only used if plugin have zero inputs.
2162 </p>
2163 </dd>
2164 <dt> &lsquo;<samp>duration, d</samp>&rsquo;</dt>
2165 <dd><p>Set the minimum duration of the sourced audio. See the function
2166 <code>av_parse_time()</code> for the accepted format, also check the &quot;Time duration&quot;
2167 section in the ffmpeg-utils manual.
2168 Note that the resulting duration may be greater than the specified duration,
2169 as the generated audio is always cut at the end of a complete frame.
2170 If not specified, or the expressed duration is negative, the audio is
2171 supposed to be generated forever.
2172 Only used if plugin have zero inputs.
2173 </p>
2174 </dd>
2175 </dl>
2176
2177 <a name="Examples-35"></a>
2178 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-35">6.33.1 Examples</a></h3>
2179
2180 <ul>
2181 <li>
2182 List all available plugins within amp (LADSPA example plugin) library:
2183 <table><tr><td>&nbsp;</td><td><pre class="example">ladspa=file=amp
2184 </pre></td></tr></table>
2185
2186 </li><li>
2187 List all available controls and their valid ranges for <code>vcf_notch</code>
2188 plugin from <code>VCF</code> library:
2189 <table><tr><td>&nbsp;</td><td><pre class="example">ladspa=f=vcf:p=vcf_notch:c=help
2190 </pre></td></tr></table>
2191
2192 </li><li>
2193 Simulate low quality audio equipment using <code>Computer Music Toolkit</code> (CMT)
2194 plugin library:
2195 <table><tr><td>&nbsp;</td><td><pre class="example">ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
2196 </pre></td></tr></table>
2197
2198 </li><li>
2199 Add reverberation to the audio using TAP-plugins
2200 (Tom&rsquo;s Audio Processing plugins):
2201 <table><tr><td>&nbsp;</td><td><pre class="example">ladspa=file=tap_reverb:tap_reverb
2202 </pre></td></tr></table>
2203
2204 </li><li>
2205 Generate white noise, with 0.2 amplitude:
2206 <table><tr><td>&nbsp;</td><td><pre class="example">ladspa=file=cmt:noise_source_white:c=c0=.2
2207 </pre></td></tr></table>
2208
2209 </li><li>
2210 Generate 20 bpm clicks using plugin <code>C* Click - Metronome</code> from the
2211 <code>C* Audio Plugin Suite</code> (CAPS) library:
2212 <table><tr><td>&nbsp;</td><td><pre class="example">ladspa=file=caps:Click:c=c1=20'
2213 </pre></td></tr></table>
2214
2215 </li><li>
2216 Apply <code>C* Eq10X2 - Stereo 10-band equaliser</code> effect:
2217 <table><tr><td>&nbsp;</td><td><pre class="example">ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
2218 </pre></td></tr></table>
2219 </li></ul>
2220
2221 <a name="Commands"></a>
2222 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Commands">6.33.2 Commands</a></h3>
2223
2224 <p>This filter supports the following commands:
2225 </p><dl compact="compact">
2226 <dt> &lsquo;<samp>cN</samp>&rsquo;</dt>
2227 <dd><p>Modify the <var>N</var>-th control value.
2228 </p>
2229 <p>If the specified value is not valid, it is ignored and prior one is kept.
2230 </p></dd>
2231 </dl>
2232
2233 <a name="lowpass"></a>
2234 <h2 class="section"><a href="ffmpeg-filters.html#toc-lowpass">6.34 lowpass</a></h2>
2235
2236 <p>Apply a low-pass filter with 3dB point frequency.
2237 The filter can be either single-pole or double-pole (the default).
2238 The filter roll off at 6dB per pole per octave (20dB per pole per decade).
2239 </p>
2240 <p>The filter accepts the following options:
2241 </p>
2242 <dl compact="compact">
2243 <dt> &lsquo;<samp>frequency, f</samp>&rsquo;</dt>
2244 <dd><p>Set frequency in Hz. Default is 500.
2245 </p>
2246 </dd>
2247 <dt> &lsquo;<samp>poles, p</samp>&rsquo;</dt>
2248 <dd><p>Set number of poles. Default is 2.
2249 </p>
2250 </dd>
2251 <dt> &lsquo;<samp>width_type</samp>&rsquo;</dt>
2252 <dd><p>Set method to specify band-width of filter.
2253 </p><dl compact="compact">
2254 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
2255 <dd><p>Hz
2256 </p></dd>
2257 <dt> &lsquo;<samp>q</samp>&rsquo;</dt>
2258 <dd><p>Q-Factor
2259 </p></dd>
2260 <dt> &lsquo;<samp>o</samp>&rsquo;</dt>
2261 <dd><p>octave
2262 </p></dd>
2263 <dt> &lsquo;<samp>s</samp>&rsquo;</dt>
2264 <dd><p>slope
2265 </p></dd>
2266 </dl>
2267
2268 </dd>
2269 <dt> &lsquo;<samp>width, w</samp>&rsquo;</dt>
2270 <dd><p>Specify the band-width of a filter in width_type units.
2271 Applies only to double-pole filter.
2272 The default is 0.707q and gives a Butterworth response.
2273 </p></dd>
2274 </dl>
2275
2276 <a name="pan"></a>
2277 <h2 class="section"><a href="ffmpeg-filters.html#toc-pan">6.35 pan</a></h2>
2278
2279 <p>Mix channels with specific gain levels. The filter accepts the output
2280 channel layout followed by a set of channels definitions.
2281 </p>
2282 <p>This filter is also designed to remap efficiently the channels of an audio
2283 stream.
2284 </p>
2285 <p>The filter accepts parameters of the form:
2286 &quot;<var>l</var>:<var>outdef</var>:<var>outdef</var>:...&quot;
2287 </p>
2288 <dl compact="compact">
2289 <dt> &lsquo;<samp>l</samp>&rsquo;</dt>
2290 <dd><p>output channel layout or number of channels
2291 </p>
2292 </dd>
2293 <dt> &lsquo;<samp>outdef</samp>&rsquo;</dt>
2294 <dd><p>output channel specification, of the form:
2295 &quot;<var>out_name</var>=[<var>gain</var>*]<var>in_name</var>[+[<var>gain</var>*]<var>in_name</var>...]&quot;
2296 </p>
2297 </dd>
2298 <dt> &lsquo;<samp>out_name</samp>&rsquo;</dt>
2299 <dd><p>output channel to define, either a channel name (FL, FR, etc.) or a channel
2300 number (c0, c1, etc.)
2301 </p>
2302 </dd>
2303 <dt> &lsquo;<samp>gain</samp>&rsquo;</dt>
2304 <dd><p>multiplicative coefficient for the channel, 1 leaving the volume unchanged
2305 </p>
2306 </dd>
2307 <dt> &lsquo;<samp>in_name</samp>&rsquo;</dt>
2308 <dd><p>input channel to use, see out_name for details; it is not possible to mix
2309 named and numbered input channels
2310 </p></dd>
2311 </dl>
2312
2313 <p>If the &lsquo;=&rsquo; in a channel specification is replaced by &lsquo;&lt;&rsquo;, then the gains for
2314 that specification will be renormalized so that the total is 1, thus
2315 avoiding clipping noise.
2316 </p>
2317 <a name="Mixing-examples"></a>
2318 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Mixing-examples">6.35.1 Mixing examples</a></h3>
2319
2320 <p>For example, if you want to down-mix from stereo to mono, but with a bigger
2321 factor for the left channel:
2322 </p><table><tr><td>&nbsp;</td><td><pre class="example">pan=1:c0=0.9*c0+0.1*c1
2323 </pre></td></tr></table>
2324
2325 <p>A customized down-mix to stereo that works automatically for 3-, 4-, 5- and
2326 7-channels surround:
2327 </p><table><tr><td>&nbsp;</td><td><pre class="example">pan=stereo: FL &lt; FL + 0.5*FC + 0.6*BL + 0.6*SL : FR &lt; FR + 0.5*FC + 0.6*BR + 0.6*SR
2328 </pre></td></tr></table>
2329
2330 <p>Note that <code>ffmpeg</code> integrates a default down-mix (and up-mix) system
2331 that should be preferred (see &quot;-ac&quot; option) unless you have very specific
2332 needs.
2333 </p>
2334 <a name="Remapping-examples"></a>
2335 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Remapping-examples">6.35.2 Remapping examples</a></h3>
2336
2337 <p>The channel remapping will be effective if, and only if:
2338 </p>
2339 <ul>
2340 <li> gain coefficients are zeroes or ones,
2341 </li><li> only one input per channel output,
2342 </li></ul>
2343
2344 <p>If all these conditions are satisfied, the filter will notify the user (&quot;Pure
2345 channel mapping detected&quot;), and use an optimized and lossless method to do the
2346 remapping.
2347 </p>
2348 <p>For example, if you have a 5.1 source and want a stereo audio stream by
2349 dropping the extra channels:
2350 </p><table><tr><td>&nbsp;</td><td><pre class="example">pan=&quot;stereo: c0=FL : c1=FR&quot;
2351 </pre></td></tr></table>
2352
2353 <p>Given the same source, you can also switch front left and front right channels
2354 and keep the input channel layout:
2355 </p><table><tr><td>&nbsp;</td><td><pre class="example">pan=&quot;5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5&quot;
2356 </pre></td></tr></table>
2357
2358 <p>If the input is a stereo audio stream, you can mute the front left channel (and
2359 still keep the stereo channel layout) with:
2360 </p><table><tr><td>&nbsp;</td><td><pre class="example">pan=&quot;stereo:c1=c1&quot;
2361 </pre></td></tr></table>
2362
2363 <p>Still with a stereo audio stream input, you can copy the right channel in both
2364 front left and right:
2365 </p><table><tr><td>&nbsp;</td><td><pre class="example">pan=&quot;stereo: c0=FR : c1=FR&quot;
2366 </pre></td></tr></table>
2367
2368 <a name="replaygain"></a>
2369 <h2 class="section"><a href="ffmpeg-filters.html#toc-replaygain">6.36 replaygain</a></h2>
2370
2371 <p>ReplayGain scanner filter. This filter takes an audio stream as an input and
2372 outputs it unchanged.
2373 At end of filtering it displays <code>track_gain</code> and <code>track_peak</code>.
2374 </p>
2375 <a name="resample"></a>
2376 <h2 class="section"><a href="ffmpeg-filters.html#toc-resample">6.37 resample</a></h2>
2377
2378 <p>Convert the audio sample format, sample rate and channel layout. This filter is
2379 not meant to be used directly.
2380 </p>
2381 <a name="silencedetect"></a>
2382 <h2 class="section"><a href="ffmpeg-filters.html#toc-silencedetect">6.38 silencedetect</a></h2>
2383
2384 <p>Detect silence in an audio stream.
2385 </p>
2386 <p>This filter logs a message when it detects that the input audio volume is less
2387 or equal to a noise tolerance value for a duration greater or equal to the
2388 minimum detected noise duration.
2389 </p>
2390 <p>The printed times and duration are expressed in seconds.
2391 </p>
2392 <p>The filter accepts the following options:
2393 </p>
2394 <dl compact="compact">
2395 <dt> &lsquo;<samp>duration, d</samp>&rsquo;</dt>
2396 <dd><p>Set silence duration until notification (default is 2 seconds).
2397 </p>
2398 </dd>
2399 <dt> &lsquo;<samp>noise, n</samp>&rsquo;</dt>
2400 <dd><p>Set noise tolerance. Can be specified in dB (in case &quot;dB&quot; is appended to the
2401 specified value) or amplitude ratio. Default is -60dB, or 0.001.
2402 </p></dd>
2403 </dl>
2404
2405 <a name="Examples-3"></a>
2406 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-3">6.38.1 Examples</a></h3>
2407
2408 <ul>
2409 <li>
2410 Detect 5 seconds of silence with -50dB noise tolerance:
2411 <table><tr><td>&nbsp;</td><td><pre class="example">silencedetect=n=-50dB:d=5
2412 </pre></td></tr></table>
2413
2414 </li><li>
2415 Complete example with <code>ffmpeg</code> to detect silence with 0.0001 noise
2416 tolerance in &lsquo;<tt>silence.mp3</tt>&rsquo;:
2417 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
2418 </pre></td></tr></table>
2419 </li></ul>
2420
2421 <a name="treble"></a>
2422 <h2 class="section"><a href="ffmpeg-filters.html#toc-treble">6.39 treble</a></h2>
2423
2424 <p>Boost or cut treble (upper) frequencies of the audio using a two-pole
2425 shelving filter with a response similar to that of a standard
2426 hi-fi&rsquo;s tone-controls. This is also known as shelving equalisation (EQ).
2427 </p>
2428 <p>The filter accepts the following options:
2429 </p>
2430 <dl compact="compact">
2431 <dt> &lsquo;<samp>gain, g</samp>&rsquo;</dt>
2432 <dd><p>Give the gain at whichever is the lower of ~22 kHz and the
2433 Nyquist frequency. Its useful range is about -20 (for a large cut)
2434 to +20 (for a large boost). Beware of clipping when using a positive gain.
2435 </p>
2436 </dd>
2437 <dt> &lsquo;<samp>frequency, f</samp>&rsquo;</dt>
2438 <dd><p>Set the filter&rsquo;s central frequency and so can be used
2439 to extend or reduce the frequency range to be boosted or cut.
2440 The default value is <code>3000</code> Hz.
2441 </p>
2442 </dd>
2443 <dt> &lsquo;<samp>width_type</samp>&rsquo;</dt>
2444 <dd><p>Set method to specify band-width of filter.
2445 </p><dl compact="compact">
2446 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
2447 <dd><p>Hz
2448 </p></dd>
2449 <dt> &lsquo;<samp>q</samp>&rsquo;</dt>
2450 <dd><p>Q-Factor
2451 </p></dd>
2452 <dt> &lsquo;<samp>o</samp>&rsquo;</dt>
2453 <dd><p>octave
2454 </p></dd>
2455 <dt> &lsquo;<samp>s</samp>&rsquo;</dt>
2456 <dd><p>slope
2457 </p></dd>
2458 </dl>
2459
2460 </dd>
2461 <dt> &lsquo;<samp>width, w</samp>&rsquo;</dt>
2462 <dd><p>Determine how steep is the filter&rsquo;s shelf transition.
2463 </p></dd>
2464 </dl>
2465
2466 <a name="volume"></a>
2467 <h2 class="section"><a href="ffmpeg-filters.html#toc-volume">6.40 volume</a></h2>
2468
2469 <p>Adjust the input audio volume.
2470 </p>
2471 <p>The filter accepts the following options:
2472 </p>
2473 <dl compact="compact">
2474 <dt> &lsquo;<samp>volume</samp>&rsquo;</dt>
2475 <dd><p>Set audio volume expression.
2476 </p>
2477 <p>Output values are clipped to the maximum value.
2478 </p>
2479 <p>The output audio volume is given by the relation:
2480 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>output_volume</var> = <var>volume</var> * <var>input_volume</var>
2481 </pre></td></tr></table>
2482
2483 <p>Default value for <var>volume</var> is &quot;1.0&quot;.
2484 </p>
2485 </dd>
2486 <dt> &lsquo;<samp>precision</samp>&rsquo;</dt>
2487 <dd><p>Set the mathematical precision.
2488 </p>
2489 <p>This determines which input sample formats will be allowed, which affects the
2490 precision of the volume scaling.
2491 </p>
2492 <dl compact="compact">
2493 <dt> &lsquo;<samp>fixed</samp>&rsquo;</dt>
2494 <dd><p>8-bit fixed-point; limits input sample format to U8, S16, and S32.
2495 </p></dd>
2496 <dt> &lsquo;<samp>float</samp>&rsquo;</dt>
2497 <dd><p>32-bit floating-point; limits input sample format to FLT. (default)
2498 </p></dd>
2499 <dt> &lsquo;<samp>double</samp>&rsquo;</dt>
2500 <dd><p>64-bit floating-point; limits input sample format to DBL.
2501 </p></dd>
2502 </dl>
2503
2504 </dd>
2505 <dt> &lsquo;<samp>eval</samp>&rsquo;</dt>
2506 <dd><p>Set when the volume expression is evaluated.
2507 </p>
2508 <p>It accepts the following values:
2509 </p><dl compact="compact">
2510 <dt> &lsquo;<samp>once</samp>&rsquo;</dt>
2511 <dd><p>only evaluate expression once during the filter initialization, or
2512 when the &lsquo;<samp>volume</samp>&rsquo; command is sent
2513 </p>
2514 </dd>
2515 <dt> &lsquo;<samp>frame</samp>&rsquo;</dt>
2516 <dd><p>evaluate expression for each incoming frame
2517 </p></dd>
2518 </dl>
2519
2520 <p>Default value is &lsquo;<samp>once</samp>&rsquo;.
2521 </p></dd>
2522 </dl>
2523
2524 <p>The volume expression can contain the following parameters.
2525 </p>
2526 <dl compact="compact">
2527 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
2528 <dd><p>frame number (starting at zero)
2529 </p></dd>
2530 <dt> &lsquo;<samp>nb_channels</samp>&rsquo;</dt>
2531 <dd><p>number of channels
2532 </p></dd>
2533 <dt> &lsquo;<samp>nb_consumed_samples</samp>&rsquo;</dt>
2534 <dd><p>number of samples consumed by the filter
2535 </p></dd>
2536 <dt> &lsquo;<samp>nb_samples</samp>&rsquo;</dt>
2537 <dd><p>number of samples in the current frame
2538 </p></dd>
2539 <dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
2540 <dd><p>original frame position in the file
2541 </p></dd>
2542 <dt> &lsquo;<samp>pts</samp>&rsquo;</dt>
2543 <dd><p>frame PTS
2544 </p></dd>
2545 <dt> &lsquo;<samp>sample_rate</samp>&rsquo;</dt>
2546 <dd><p>sample rate
2547 </p></dd>
2548 <dt> &lsquo;<samp>startpts</samp>&rsquo;</dt>
2549 <dd><p>PTS at start of stream
2550 </p></dd>
2551 <dt> &lsquo;<samp>startt</samp>&rsquo;</dt>
2552 <dd><p>time at start of stream
2553 </p></dd>
2554 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
2555 <dd><p>frame time
2556 </p></dd>
2557 <dt> &lsquo;<samp>tb</samp>&rsquo;</dt>
2558 <dd><p>timestamp timebase
2559 </p></dd>
2560 <dt> &lsquo;<samp>volume</samp>&rsquo;</dt>
2561 <dd><p>last set volume value
2562 </p></dd>
2563 </dl>
2564
2565 <p>Note that when &lsquo;<samp>eval</samp>&rsquo; is set to &lsquo;<samp>once</samp>&rsquo; only the
2566 <var>sample_rate</var> and <var>tb</var> variables are available, all other
2567 variables will evaluate to NAN.
2568 </p>
2569 <a name="Commands-5"></a>
2570 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Commands-5">6.40.1 Commands</a></h3>
2571
2572 <p>This filter supports the following commands:
2573 </p><dl compact="compact">
2574 <dt> &lsquo;<samp>volume</samp>&rsquo;</dt>
2575 <dd><p>Modify the volume expression.
2576 The command accepts the same syntax of the corresponding option.
2577 </p>
2578 <p>If the specified expression is not valid, it is kept at its current
2579 value.
2580 </p></dd>
2581 </dl>
2582
2583 <a name="Examples-55"></a>
2584 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-55">6.40.2 Examples</a></h3>
2585
2586 <ul>
2587 <li>
2588 Halve the input audio volume:
2589 <table><tr><td>&nbsp;</td><td><pre class="example">volume=volume=0.5
2590 volume=volume=1/2
2591 volume=volume=-6.0206dB
2592 </pre></td></tr></table>
2593
2594 <p>In all the above example the named key for &lsquo;<samp>volume</samp>&rsquo; can be
2595 omitted, for example like in:
2596 </p><table><tr><td>&nbsp;</td><td><pre class="example">volume=0.5
2597 </pre></td></tr></table>
2598
2599 </li><li>
2600 Increase input audio power by 6 decibels using fixed-point precision:
2601 <table><tr><td>&nbsp;</td><td><pre class="example">volume=volume=6dB:precision=fixed
2602 </pre></td></tr></table>
2603
2604 </li><li>
2605 Fade volume after time 10 with an annihilation period of 5 seconds:
2606 <table><tr><td>&nbsp;</td><td><pre class="example">volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
2607 </pre></td></tr></table>
2608 </li></ul>
2609
2610 <a name="volumedetect"></a>
2611 <h2 class="section"><a href="ffmpeg-filters.html#toc-volumedetect">6.41 volumedetect</a></h2>
2612
2613 <p>Detect the volume of the input video.
2614 </p>
2615 <p>The filter has no parameters. The input is not modified. Statistics about
2616 the volume will be printed in the log when the input stream end is reached.
2617 </p>
2618 <p>In particular it will show the mean volume (root mean square), maximum
2619 volume (on a per-sample basis), and the beginning of a histogram of the
2620 registered volume values (from the maximum value to a cumulated 1/1000 of
2621 the samples).
2622 </p>
2623 <p>All volumes are in decibels relative to the maximum PCM value.
2624 </p>
2625 <a name="Examples-17"></a>
2626 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-17">6.41.1 Examples</a></h3>
2627
2628 <p>Here is an excerpt of the output:
2629 </p><table><tr><td>&nbsp;</td><td><pre class="example">[Parsed_volumedetect_0 &nbsp;0xa23120] mean_volume: -27 dB
2630 [Parsed_volumedetect_0 &nbsp;0xa23120] max_volume: -4 dB
2631 [Parsed_volumedetect_0 &nbsp;0xa23120] histogram_4db: 6
2632 [Parsed_volumedetect_0 &nbsp;0xa23120] histogram_5db: 62
2633 [Parsed_volumedetect_0 &nbsp;0xa23120] histogram_6db: 286
2634 [Parsed_volumedetect_0 &nbsp;0xa23120] histogram_7db: 1042
2635 [Parsed_volumedetect_0 &nbsp;0xa23120] histogram_8db: 2551
2636 [Parsed_volumedetect_0 &nbsp;0xa23120] histogram_9db: 4609
2637 [Parsed_volumedetect_0 &nbsp;0xa23120] histogram_10db: 8409
2638 </pre></td></tr></table>
2639
2640 <p>It means that:
2641 </p><ul>
2642 <li>
2643 The mean square energy is approximately -27 dB, or 10^-2.7.
2644 </li><li>
2645 The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
2646 </li><li>
2647 There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
2648 </li></ul>
2649
2650 <p>In other words, raising the volume by +4 dB does not cause any clipping,
2651 raising it by +5 dB causes clipping for 6 samples, etc.
2652 </p>
2653
2654 <a name="Audio-Sources"></a>
2655 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Audio-Sources">7. Audio Sources</a></h1>
2656
2657 <p>Below is a description of the currently available audio sources.
2658 </p>
2659 <a name="abuffer"></a>
2660 <h2 class="section"><a href="ffmpeg-filters.html#toc-abuffer">7.1 abuffer</a></h2>
2661
2662 <p>Buffer audio frames, and make them available to the filter chain.
2663 </p>
2664 <p>This source is mainly intended for a programmatic use, in particular
2665 through the interface defined in &lsquo;<tt>libavfilter/asrc_abuffer.h</tt>&rsquo;.
2666 </p>
2667 <p>It accepts the following named parameters:
2668 </p>
2669 <dl compact="compact">
2670 <dt> &lsquo;<samp>time_base</samp>&rsquo;</dt>
2671 <dd><p>Timebase which will be used for timestamps of submitted frames. It must be
2672 either a floating-point number or in <var>numerator</var>/<var>denominator</var> form.
2673 </p>
2674 </dd>
2675 <dt> &lsquo;<samp>sample_rate</samp>&rsquo;</dt>
2676 <dd><p>The sample rate of the incoming audio buffers.
2677 </p>
2678 </dd>
2679 <dt> &lsquo;<samp>sample_fmt</samp>&rsquo;</dt>
2680 <dd><p>The sample format of the incoming audio buffers.
2681 Either a sample format name or its corresponging integer representation from
2682 the enum AVSampleFormat in &lsquo;<tt>libavutil/samplefmt.h</tt>&rsquo;
2683 </p>
2684 </dd>
2685 <dt> &lsquo;<samp>channel_layout</samp>&rsquo;</dt>
2686 <dd><p>The channel layout of the incoming audio buffers.
2687 Either a channel layout name from channel_layout_map in
2688 &lsquo;<tt>libavutil/channel_layout.c</tt>&rsquo; or its corresponding integer representation
2689 from the AV_CH_LAYOUT_* macros in &lsquo;<tt>libavutil/channel_layout.h</tt>&rsquo;
2690 </p>
2691 </dd>
2692 <dt> &lsquo;<samp>channels</samp>&rsquo;</dt>
2693 <dd><p>The number of channels of the incoming audio buffers.
2694 If both <var>channels</var> and <var>channel_layout</var> are specified, then they
2695 must be consistent.
2696 </p>
2697 </dd>
2698 </dl>
2699
2700 <a name="Examples-44"></a>
2701 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-44">7.1.1 Examples</a></h3>
2702
2703 <table><tr><td>&nbsp;</td><td><pre class="example">abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
2704 </pre></td></tr></table>
2705
2706 <p>will instruct the source to accept planar 16bit signed stereo at 44100Hz.
2707 Since the sample format with name &quot;s16p&quot; corresponds to the number
2708 6 and the &quot;stereo&quot; channel layout corresponds to the value 0x3, this is
2709 equivalent to:
2710 </p><table><tr><td>&nbsp;</td><td><pre class="example">abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
2711 </pre></td></tr></table>
2712
2713 <a name="aevalsrc"></a>
2714 <h2 class="section"><a href="ffmpeg-filters.html#toc-aevalsrc">7.2 aevalsrc</a></h2>
2715
2716 <p>Generate an audio signal specified by an expression.
2717 </p>
2718 <p>This source accepts in input one or more expressions (one for each
2719 channel), which are evaluated and used to generate a corresponding
2720 audio signal.
2721 </p>
2722 <p>This source accepts the following options:
2723 </p>
2724 <dl compact="compact">
2725 <dt> &lsquo;<samp>exprs</samp>&rsquo;</dt>
2726 <dd><p>Set the &rsquo;|&rsquo;-separated expressions list for each separate channel. In case the
2727 &lsquo;<samp>channel_layout</samp>&rsquo; option is not specified, the selected channel layout
2728 depends on the number of provided expressions. Otherwise the last
2729 specified expression is applied to the remaining output channels.
2730 </p>
2731 </dd>
2732 <dt> &lsquo;<samp>channel_layout, c</samp>&rsquo;</dt>
2733 <dd><p>Set the channel layout. The number of channels in the specified layout
2734 must be equal to the number of specified expressions.
2735 </p>
2736 </dd>
2737 <dt> &lsquo;<samp>duration, d</samp>&rsquo;</dt>
2738 <dd><p>Set the minimum duration of the sourced audio. See the function
2739 <code>av_parse_time()</code> for the accepted format.
2740 Note that the resulting duration may be greater than the specified
2741 duration, as the generated audio is always cut at the end of a
2742 complete frame.
2743 </p>
2744 <p>If not specified, or the expressed duration is negative, the audio is
2745 supposed to be generated forever.
2746 </p>
2747 </dd>
2748 <dt> &lsquo;<samp>nb_samples, n</samp>&rsquo;</dt>
2749 <dd><p>Set the number of samples per channel per each output frame,
2750 default to 1024.
2751 </p>
2752 </dd>
2753 <dt> &lsquo;<samp>sample_rate, s</samp>&rsquo;</dt>
2754 <dd><p>Specify the sample rate, default to 44100.
2755 </p></dd>
2756 </dl>
2757
2758 <p>Each expression in <var>exprs</var> can contain the following constants:
2759 </p>
2760 <dl compact="compact">
2761 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
2762 <dd><p>number of the evaluated sample, starting from 0
2763 </p>
2764 </dd>
2765 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
2766 <dd><p>time of the evaluated sample expressed in seconds, starting from 0
2767 </p>
2768 </dd>
2769 <dt> &lsquo;<samp>s</samp>&rsquo;</dt>
2770 <dd><p>sample rate
2771 </p>
2772 </dd>
2773 </dl>
2774
2775 <a name="Examples-9"></a>
2776 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-9">7.2.1 Examples</a></h3>
2777
2778 <ul>
2779 <li>
2780 Generate silence:
2781 <table><tr><td>&nbsp;</td><td><pre class="example">aevalsrc=0
2782 </pre></td></tr></table>
2783
2784 </li><li>
2785 Generate a sin signal with frequency of 440 Hz, set sample rate to
2786 8000 Hz:
2787 <table><tr><td>&nbsp;</td><td><pre class="example">aevalsrc=&quot;sin(440*2*PI*t):s=8000&quot;
2788 </pre></td></tr></table>
2789
2790 </li><li>
2791 Generate a two channels signal, specify the channel layout (Front
2792 Center + Back Center) explicitly:
2793 <table><tr><td>&nbsp;</td><td><pre class="example">aevalsrc=&quot;sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC&quot;
2794 </pre></td></tr></table>
2795
2796 </li><li>
2797 Generate white noise:
2798 <table><tr><td>&nbsp;</td><td><pre class="example">aevalsrc=&quot;-2+random(0)&quot;
2799 </pre></td></tr></table>
2800
2801 </li><li>
2802 Generate an amplitude modulated signal:
2803 <table><tr><td>&nbsp;</td><td><pre class="example">aevalsrc=&quot;sin(10*2*PI*t)*sin(880*2*PI*t)&quot;
2804 </pre></td></tr></table>
2805
2806 </li><li>
2807 Generate 2.5 Hz binaural beats on a 360 Hz carrier:
2808 <table><tr><td>&nbsp;</td><td><pre class="example">aevalsrc=&quot;0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)&quot;
2809 </pre></td></tr></table>
2810
2811 </li></ul>
2812
2813 <a name="anullsrc"></a>
2814 <h2 class="section"><a href="ffmpeg-filters.html#toc-anullsrc">7.3 anullsrc</a></h2>
2815
2816 <p>Null audio source, return unprocessed audio frames. It is mainly useful
2817 as a template and to be employed in analysis / debugging tools, or as
2818 the source for filters which ignore the input data (for example the sox
2819 synth filter).
2820 </p>
2821 <p>This source accepts the following options:
2822 </p>
2823 <dl compact="compact">
2824 <dt> &lsquo;<samp>channel_layout, cl</samp>&rsquo;</dt>
2825 <dd>
2826 <p>Specify the channel layout, and can be either an integer or a string
2827 representing a channel layout. The default value of <var>channel_layout</var>
2828 is &quot;stereo&quot;.
2829 </p>
2830 <p>Check the channel_layout_map definition in
2831 &lsquo;<tt>libavutil/channel_layout.c</tt>&rsquo; for the mapping between strings and
2832 channel layout values.
2833 </p>
2834 </dd>
2835 <dt> &lsquo;<samp>sample_rate, r</samp>&rsquo;</dt>
2836 <dd><p>Specify the sample rate, and defaults to 44100.
2837 </p>
2838 </dd>
2839 <dt> &lsquo;<samp>nb_samples, n</samp>&rsquo;</dt>
2840 <dd><p>Set the number of samples per requested frames.
2841 </p>
2842 </dd>
2843 </dl>
2844
2845 <a name="Examples-72"></a>
2846 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-72">7.3.1 Examples</a></h3>
2847
2848 <ul>
2849 <li>
2850 Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
2851 <table><tr><td>&nbsp;</td><td><pre class="example">anullsrc=r=48000:cl=4
2852 </pre></td></tr></table>
2853
2854 </li><li>
2855 Do the same operation with a more obvious syntax:
2856 <table><tr><td>&nbsp;</td><td><pre class="example">anullsrc=r=48000:cl=mono
2857 </pre></td></tr></table>
2858 </li></ul>
2859
2860 <p>All the parameters need to be explicitly defined.
2861 </p>
2862 <a name="flite"></a>
2863 <h2 class="section"><a href="ffmpeg-filters.html#toc-flite">7.4 flite</a></h2>
2864
2865 <p>Synthesize a voice utterance using the libflite library.
2866 </p>
2867 <p>To enable compilation of this filter you need to configure FFmpeg with
2868 <code>--enable-libflite</code>.
2869 </p>
2870 <p>Note that the flite library is not thread-safe.
2871 </p>
2872 <p>The filter accepts the following options:
2873 </p>
2874 <dl compact="compact">
2875 <dt> &lsquo;<samp>list_voices</samp>&rsquo;</dt>
2876 <dd><p>If set to 1, list the names of the available voices and exit
2877 immediately. Default value is 0.
2878 </p>
2879 </dd>
2880 <dt> &lsquo;<samp>nb_samples, n</samp>&rsquo;</dt>
2881 <dd><p>Set the maximum number of samples per frame. Default value is 512.
2882 </p>
2883 </dd>
2884 <dt> &lsquo;<samp>textfile</samp>&rsquo;</dt>
2885 <dd><p>Set the filename containing the text to speak.
2886 </p>
2887 </dd>
2888 <dt> &lsquo;<samp>text</samp>&rsquo;</dt>
2889 <dd><p>Set the text to speak.
2890 </p>
2891 </dd>
2892 <dt> &lsquo;<samp>voice, v</samp>&rsquo;</dt>
2893 <dd><p>Set the voice to use for the speech synthesis. Default value is
2894 <code>kal</code>. See also the <var>list_voices</var> option.
2895 </p></dd>
2896 </dl>
2897
2898 <a name="Examples-74"></a>
2899 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-74">7.4.1 Examples</a></h3>
2900
2901 <ul>
2902 <li>
2903 Read from file &lsquo;<tt>speech.txt</tt>&rsquo;, and synthetize the text using the
2904 standard flite voice:
2905 <table><tr><td>&nbsp;</td><td><pre class="example">flite=textfile=speech.txt
2906 </pre></td></tr></table>
2907
2908 </li><li>
2909 Read the specified text selecting the <code>slt</code> voice:
2910 <table><tr><td>&nbsp;</td><td><pre class="example">flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
2911 </pre></td></tr></table>
2912
2913 </li><li>
2914 Input text to ffmpeg:
2915 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f lavfi -i flite=text='So fare thee well, poor devil of a Sub-Sub, whose commentator I am':voice=slt
2916 </pre></td></tr></table>
2917
2918 </li><li>
2919 Make &lsquo;<tt>ffplay</tt>&rsquo; speak the specified text, using <code>flite</code> and
2920 the <code>lavfi</code> device:
2921 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay -f lavfi flite=text='No more be grieved for which that thou hast done.'
2922 </pre></td></tr></table>
2923 </li></ul>
2924
2925 <p>For more information about libflite, check:
2926 <a href="http://www.speech.cs.cmu.edu/flite/">http://www.speech.cs.cmu.edu/flite/</a>
2927 </p>
2928 <a name="sine"></a>
2929 <h2 class="section"><a href="ffmpeg-filters.html#toc-sine">7.5 sine</a></h2>
2930
2931 <p>Generate an audio signal made of a sine wave with amplitude 1/8.
2932 </p>
2933 <p>The audio signal is bit-exact.
2934 </p>
2935 <p>The filter accepts the following options:
2936 </p>
2937 <dl compact="compact">
2938 <dt> &lsquo;<samp>frequency, f</samp>&rsquo;</dt>
2939 <dd><p>Set the carrier frequency. Default is 440 Hz.
2940 </p>
2941 </dd>
2942 <dt> &lsquo;<samp>beep_factor, b</samp>&rsquo;</dt>
2943 <dd><p>Enable a periodic beep every second with frequency <var>beep_factor</var> times
2944 the carrier frequency. Default is 0, meaning the beep is disabled.
2945 </p>
2946 </dd>
2947 <dt> &lsquo;<samp>sample_rate, r</samp>&rsquo;</dt>
2948 <dd><p>Specify the sample rate, default is 44100.
2949 </p>
2950 </dd>
2951 <dt> &lsquo;<samp>duration, d</samp>&rsquo;</dt>
2952 <dd><p>Specify the duration of the generated audio stream.
2953 </p>
2954 </dd>
2955 <dt> &lsquo;<samp>samples_per_frame</samp>&rsquo;</dt>
2956 <dd><p>Set the number of samples per output frame, default is 1024.
2957 </p></dd>
2958 </dl>
2959
2960 <a name="Examples-58"></a>
2961 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-58">7.5.1 Examples</a></h3>
2962
2963 <ul>
2964 <li>
2965 Generate a simple 440 Hz sine wave:
2966 <table><tr><td>&nbsp;</td><td><pre class="example">sine
2967 </pre></td></tr></table>
2968
2969 </li><li>
2970 Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
2971 <table><tr><td>&nbsp;</td><td><pre class="example">sine=220:4:d=5
2972 sine=f=220:b=4:d=5
2973 sine=frequency=220:beep_factor=4:duration=5
2974 </pre></td></tr></table>
2975
2976 </li></ul>
2977
2978
2979 <a name="Audio-Sinks"></a>
2980 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Audio-Sinks">8. Audio Sinks</a></h1>
2981
2982 <p>Below is a description of the currently available audio sinks.
2983 </p>
2984 <a name="abuffersink"></a>
2985 <h2 class="section"><a href="ffmpeg-filters.html#toc-abuffersink">8.1 abuffersink</a></h2>
2986
2987 <p>Buffer audio frames, and make them available to the end of filter chain.
2988 </p>
2989 <p>This sink is mainly intended for programmatic use, in particular
2990 through the interface defined in &lsquo;<tt>libavfilter/buffersink.h</tt>&rsquo;
2991 or the options system.
2992 </p>
2993 <p>It accepts a pointer to an AVABufferSinkContext structure, which
2994 defines the incoming buffers&rsquo; formats, to be passed as the opaque
2995 parameter to <code>avfilter_init_filter</code> for initialization.
2996 </p>
2997 <a name="anullsink"></a>
2998 <h2 class="section"><a href="ffmpeg-filters.html#toc-anullsink">8.2 anullsink</a></h2>
2999
3000 <p>Null audio sink, do absolutely nothing with the input audio. It is
3001 mainly useful as a template and to be employed in analysis / debugging
3002 tools.
3003 </p>
3004
3005 <a name="Video-Filters"></a>
3006 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Video-Filters">9. Video Filters</a></h1>
3007
3008 <p>When you configure your FFmpeg build, you can disable any of the
3009 existing filters using <code>--disable-filters</code>.
3010 The configure output will show the video filters included in your
3011 build.
3012 </p>
3013 <p>Below is a description of the currently available video filters.
3014 </p>
3015 <a name="alphaextract"></a>
3016 <h2 class="section"><a href="ffmpeg-filters.html#toc-alphaextract">9.1 alphaextract</a></h2>
3017
3018 <p>Extract the alpha component from the input as a grayscale video. This
3019 is especially useful with the <var>alphamerge</var> filter.
3020 </p>
3021 <a name="alphamerge"></a>
3022 <h2 class="section"><a href="ffmpeg-filters.html#toc-alphamerge">9.2 alphamerge</a></h2>
3023
3024 <p>Add or replace the alpha component of the primary input with the
3025 grayscale value of a second input. This is intended for use with
3026 <var>alphaextract</var> to allow the transmission or storage of frame
3027 sequences that have alpha in a format that doesn&rsquo;t support an alpha
3028 channel.
3029 </p>
3030 <p>For example, to reconstruct full frames from a normal YUV-encoded video
3031 and a separate video created with <var>alphaextract</var>, you might use:
3032 </p><table><tr><td>&nbsp;</td><td><pre class="example">movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
3033 </pre></td></tr></table>
3034
3035 <p>Since this filter is designed for reconstruction, it operates on frame
3036 sequences without considering timestamps, and terminates when either
3037 input reaches end of stream. This will cause problems if your encoding
3038 pipeline drops frames. If you&rsquo;re trying to apply an image as an
3039 overlay to a video stream, consider the <var>overlay</var> filter instead.
3040 </p>
3041 <a name="ass"></a>
3042 <h2 class="section"><a href="ffmpeg-filters.html#toc-ass">9.3 ass</a></h2>
3043
3044 <p>Same as the <a href="#subtitles">subtitles</a> filter, except that it doesn&rsquo;t require libavcodec
3045 and libavformat to work. On the other hand, it is limited to ASS (Advanced
3046 Substation Alpha) subtitles files.
3047 </p>
3048 <a name="bbox"></a>
3049 <h2 class="section"><a href="ffmpeg-filters.html#toc-bbox">9.4 bbox</a></h2>
3050
3051 <p>Compute the bounding box for the non-black pixels in the input frame
3052 luminance plane.
3053 </p>
3054 <p>This filter computes the bounding box containing all the pixels with a
3055 luminance value greater than the minimum allowed value.
3056 The parameters describing the bounding box are printed on the filter
3057 log.
3058 </p>
3059 <p>The filter accepts the following option:
3060 </p>
3061 <dl compact="compact">
3062 <dt> &lsquo;<samp>min_val</samp>&rsquo;</dt>
3063 <dd><p>Set the minimal luminance value. Default is <code>16</code>.
3064 </p></dd>
3065 </dl>
3066
3067 <a name="blackdetect"></a>
3068 <h2 class="section"><a href="ffmpeg-filters.html#toc-blackdetect">9.5 blackdetect</a></h2>
3069
3070 <p>Detect video intervals that are (almost) completely black. Can be
3071 useful to detect chapter transitions, commercials, or invalid
3072 recordings. Output lines contains the time for the start, end and
3073 duration of the detected black interval expressed in seconds.
3074 </p>
3075 <p>In order to display the output lines, you need to set the loglevel at
3076 least to the AV_LOG_INFO value.
3077 </p>
3078 <p>The filter accepts the following options:
3079 </p>
3080 <dl compact="compact">
3081 <dt> &lsquo;<samp>black_min_duration, d</samp>&rsquo;</dt>
3082 <dd><p>Set the minimum detected black duration expressed in seconds. It must
3083 be a non-negative floating point number.
3084 </p>
3085 <p>Default value is 2.0.
3086 </p>
3087 </dd>
3088 <dt> &lsquo;<samp>picture_black_ratio_th, pic_th</samp>&rsquo;</dt>
3089 <dd><p>Set the threshold for considering a picture &quot;black&quot;.
3090 Express the minimum value for the ratio:
3091 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>nb_black_pixels</var> / <var>nb_pixels</var>
3092 </pre></td></tr></table>
3093
3094 <p>for which a picture is considered black.
3095 Default value is 0.98.
3096 </p>
3097 </dd>
3098 <dt> &lsquo;<samp>pixel_black_th, pix_th</samp>&rsquo;</dt>
3099 <dd><p>Set the threshold for considering a pixel &quot;black&quot;.
3100 </p>
3101 <p>The threshold expresses the maximum pixel luminance value for which a
3102 pixel is considered &quot;black&quot;. The provided value is scaled according to
3103 the following equation:
3104 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>absolute_threshold</var> = <var>luminance_minimum_value</var> + <var>pixel_black_th</var> * <var>luminance_range_size</var>
3105 </pre></td></tr></table>
3106
3107 <p><var>luminance_range_size</var> and <var>luminance_minimum_value</var> depend on
3108 the input video format, the range is [0-255] for YUV full-range
3109 formats and [16-235] for YUV non full-range formats.
3110 </p>
3111 <p>Default value is 0.10.
3112 </p></dd>
3113 </dl>
3114
3115 <p>The following example sets the maximum pixel threshold to the minimum
3116 value, and detects only black intervals of 2 or more seconds:
3117 </p><table><tr><td>&nbsp;</td><td><pre class="example">blackdetect=d=2:pix_th=0.00
3118 </pre></td></tr></table>
3119
3120 <a name="blackframe"></a>
3121 <h2 class="section"><a href="ffmpeg-filters.html#toc-blackframe">9.6 blackframe</a></h2>
3122
3123 <p>Detect frames that are (almost) completely black. Can be useful to
3124 detect chapter transitions or commercials. Output lines consist of
3125 the frame number of the detected frame, the percentage of blackness,
3126 the position in the file if known or -1 and the timestamp in seconds.
3127 </p>
3128 <p>In order to display the output lines, you need to set the loglevel at
3129 least to the AV_LOG_INFO value.
3130 </p>
3131 <p>The filter accepts the following options:
3132 </p>
3133 <dl compact="compact">
3134 <dt> &lsquo;<samp>amount</samp>&rsquo;</dt>
3135 <dd><p>Set the percentage of the pixels that have to be below the threshold, defaults
3136 to <code>98</code>.
3137 </p>
3138 </dd>
3139 <dt> &lsquo;<samp>threshold, thresh</samp>&rsquo;</dt>
3140 <dd><p>Set the threshold below which a pixel value is considered black, defaults to
3141 <code>32</code>.
3142 </p>
3143 </dd>
3144 </dl>
3145
3146 <a name="blend"></a>
3147 <h2 class="section"><a href="ffmpeg-filters.html#toc-blend">9.7 blend</a></h2>
3148
3149 <p>Blend two video frames into each other.
3150 </p>
3151 <p>It takes two input streams and outputs one stream, the first input is the
3152 &quot;top&quot; layer and second input is &quot;bottom&quot; layer.
3153 Output terminates when shortest input terminates.
3154 </p>
3155 <p>A description of the accepted options follows.
3156 </p>
3157 <dl compact="compact">
3158 <dt> &lsquo;<samp>c0_mode</samp>&rsquo;</dt>
3159 <dt> &lsquo;<samp>c1_mode</samp>&rsquo;</dt>
3160 <dt> &lsquo;<samp>c2_mode</samp>&rsquo;</dt>
3161 <dt> &lsquo;<samp>c3_mode</samp>&rsquo;</dt>
3162 <dt> &lsquo;<samp>all_mode</samp>&rsquo;</dt>
3163 <dd><p>Set blend mode for specific pixel component or all pixel components in case
3164 of <var>all_mode</var>. Default value is <code>normal</code>.
3165 </p>
3166 <p>Available values for component modes are:
3167 </p><dl compact="compact">
3168 <dt> &lsquo;<samp>addition</samp>&rsquo;</dt>
3169 <dt> &lsquo;<samp>and</samp>&rsquo;</dt>
3170 <dt> &lsquo;<samp>average</samp>&rsquo;</dt>
3171 <dt> &lsquo;<samp>burn</samp>&rsquo;</dt>
3172 <dt> &lsquo;<samp>darken</samp>&rsquo;</dt>
3173 <dt> &lsquo;<samp>difference</samp>&rsquo;</dt>
3174 <dt> &lsquo;<samp>divide</samp>&rsquo;</dt>
3175 <dt> &lsquo;<samp>dodge</samp>&rsquo;</dt>
3176 <dt> &lsquo;<samp>exclusion</samp>&rsquo;</dt>
3177 <dt> &lsquo;<samp>hardlight</samp>&rsquo;</dt>
3178 <dt> &lsquo;<samp>lighten</samp>&rsquo;</dt>
3179 <dt> &lsquo;<samp>multiply</samp>&rsquo;</dt>
3180 <dt> &lsquo;<samp>negation</samp>&rsquo;</dt>
3181 <dt> &lsquo;<samp>normal</samp>&rsquo;</dt>
3182 <dt> &lsquo;<samp>or</samp>&rsquo;</dt>
3183 <dt> &lsquo;<samp>overlay</samp>&rsquo;</dt>
3184 <dt> &lsquo;<samp>phoenix</samp>&rsquo;</dt>
3185 <dt> &lsquo;<samp>pinlight</samp>&rsquo;</dt>
3186 <dt> &lsquo;<samp>reflect</samp>&rsquo;</dt>
3187 <dt> &lsquo;<samp>screen</samp>&rsquo;</dt>
3188 <dt> &lsquo;<samp>softlight</samp>&rsquo;</dt>
3189 <dt> &lsquo;<samp>subtract</samp>&rsquo;</dt>
3190 <dt> &lsquo;<samp>vividlight</samp>&rsquo;</dt>
3191 <dt> &lsquo;<samp>xor</samp>&rsquo;</dt>
3192 </dl>
3193
3194 </dd>
3195 <dt> &lsquo;<samp>c0_opacity</samp>&rsquo;</dt>
3196 <dt> &lsquo;<samp>c1_opacity</samp>&rsquo;</dt>
3197 <dt> &lsquo;<samp>c2_opacity</samp>&rsquo;</dt>
3198 <dt> &lsquo;<samp>c3_opacity</samp>&rsquo;</dt>
3199 <dt> &lsquo;<samp>all_opacity</samp>&rsquo;</dt>
3200 <dd><p>Set blend opacity for specific pixel component or all pixel components in case
3201 of <var>all_opacity</var>. Only used in combination with pixel component blend modes.
3202 </p>
3203 </dd>
3204 <dt> &lsquo;<samp>c0_expr</samp>&rsquo;</dt>
3205 <dt> &lsquo;<samp>c1_expr</samp>&rsquo;</dt>
3206 <dt> &lsquo;<samp>c2_expr</samp>&rsquo;</dt>
3207 <dt> &lsquo;<samp>c3_expr</samp>&rsquo;</dt>
3208 <dt> &lsquo;<samp>all_expr</samp>&rsquo;</dt>
3209 <dd><p>Set blend expression for specific pixel component or all pixel components in case
3210 of <var>all_expr</var>. Note that related mode options will be ignored if those are set.
3211 </p>
3212 <p>The expressions can use the following variables:
3213 </p>
3214 <dl compact="compact">
3215 <dt> &lsquo;<samp>N</samp>&rsquo;</dt>
3216 <dd><p>The sequential number of the filtered frame, starting from <code>0</code>.
3217 </p>
3218 </dd>
3219 <dt> &lsquo;<samp>X</samp>&rsquo;</dt>
3220 <dt> &lsquo;<samp>Y</samp>&rsquo;</dt>
3221 <dd><p>the coordinates of the current sample
3222 </p>
3223 </dd>
3224 <dt> &lsquo;<samp>W</samp>&rsquo;</dt>
3225 <dt> &lsquo;<samp>H</samp>&rsquo;</dt>
3226 <dd><p>the width and height of currently filtered plane
3227 </p>
3228 </dd>
3229 <dt> &lsquo;<samp>SW</samp>&rsquo;</dt>
3230 <dt> &lsquo;<samp>SH</samp>&rsquo;</dt>
3231 <dd><p>Width and height scale depending on the currently filtered plane. It is the
3232 ratio between the corresponding luma plane number of pixels and the current
3233 plane ones. E.g. for YUV4:2:0 the values are <code>1,1</code> for the luma plane, and
3234 <code>0.5,0.5</code> for chroma planes.
3235 </p>
3236 </dd>
3237 <dt> &lsquo;<samp>T</samp>&rsquo;</dt>
3238 <dd><p>Time of the current frame, expressed in seconds.
3239 </p>
3240 </dd>
3241 <dt> &lsquo;<samp>TOP, A</samp>&rsquo;</dt>
3242 <dd><p>Value of pixel component at current location for first video frame (top layer).
3243 </p>
3244 </dd>
3245 <dt> &lsquo;<samp>BOTTOM, B</samp>&rsquo;</dt>
3246 <dd><p>Value of pixel component at current location for second video frame (bottom layer).
3247 </p></dd>
3248 </dl>
3249
3250 </dd>
3251 <dt> &lsquo;<samp>shortest</samp>&rsquo;</dt>
3252 <dd><p>Force termination when the shortest input terminates. Default is <code>0</code>.
3253 </p></dd>
3254 <dt> &lsquo;<samp>repeatlast</samp>&rsquo;</dt>
3255 <dd><p>Continue applying the last bottom frame after the end of the stream. A value of
3256 <code>0</code> disable the filter after the last frame of the bottom layer is reached.
3257 Default is <code>1</code>.
3258 </p></dd>
3259 </dl>
3260
3261 <a name="Examples-73"></a>
3262 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-73">9.7.1 Examples</a></h3>
3263
3264 <ul>
3265 <li>
3266 Apply transition from bottom layer to top layer in first 10 seconds:
3267 <table><tr><td>&nbsp;</td><td><pre class="example">blend=all_expr='A*(if(gte(T,10),1,T/10))+B*(1-(if(gte(T,10),1,T/10)))'
3268 </pre></td></tr></table>
3269
3270 </li><li>
3271 Apply 1x1 checkerboard effect:
3272 <table><tr><td>&nbsp;</td><td><pre class="example">blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
3273 </pre></td></tr></table>
3274
3275 </li><li>
3276 Apply uncover left effect:
3277 <table><tr><td>&nbsp;</td><td><pre class="example">blend=all_expr='if(gte(N*SW+X,W),A,B)'
3278 </pre></td></tr></table>
3279
3280 </li><li>
3281 Apply uncover down effect:
3282 <table><tr><td>&nbsp;</td><td><pre class="example">blend=all_expr='if(gte(Y-N*SH,0),A,B)'
3283 </pre></td></tr></table>
3284
3285 </li><li>
3286 Apply uncover up-left effect:
3287 <table><tr><td>&nbsp;</td><td><pre class="example">blend=all_expr='if(gte(T*SH*40+Y,H)*gte((T*40*SW+X)*W/H,W),A,B)'
3288 </pre></td></tr></table>
3289 </li></ul>
3290
3291 <a name="boxblur"></a>
3292 <h2 class="section"><a href="ffmpeg-filters.html#toc-boxblur">9.8 boxblur</a></h2>
3293
3294 <p>Apply boxblur algorithm to the input video.
3295 </p>
3296 <p>The filter accepts the following options:
3297 </p>
3298 <dl compact="compact">
3299 <dt> &lsquo;<samp>luma_radius, lr</samp>&rsquo;</dt>
3300 <dt> &lsquo;<samp>luma_power, lp</samp>&rsquo;</dt>
3301 <dt> &lsquo;<samp>chroma_radius, cr</samp>&rsquo;</dt>
3302 <dt> &lsquo;<samp>chroma_power, cp</samp>&rsquo;</dt>
3303 <dt> &lsquo;<samp>alpha_radius, ar</samp>&rsquo;</dt>
3304 <dt> &lsquo;<samp>alpha_power, ap</samp>&rsquo;</dt>
3305 </dl>
3306
3307 <p>A description of the accepted options follows.
3308 </p>
3309 <dl compact="compact">
3310 <dt> &lsquo;<samp>luma_radius, lr</samp>&rsquo;</dt>
3311 <dt> &lsquo;<samp>chroma_radius, cr</samp>&rsquo;</dt>
3312 <dt> &lsquo;<samp>alpha_radius, ar</samp>&rsquo;</dt>
3313 <dd><p>Set an expression for the box radius in pixels used for blurring the
3314 corresponding input plane.
3315 </p>
3316 <p>The radius value must be a non-negative number, and must not be
3317 greater than the value of the expression <code>min(w,h)/2</code> for the
3318 luma and alpha planes, and of <code>min(cw,ch)/2</code> for the chroma
3319 planes.
3320 </p>
3321 <p>Default value for &lsquo;<samp>luma_radius</samp>&rsquo; is &quot;2&quot;. If not specified,
3322 &lsquo;<samp>chroma_radius</samp>&rsquo; and &lsquo;<samp>alpha_radius</samp>&rsquo; default to the
3323 corresponding value set for &lsquo;<samp>luma_radius</samp>&rsquo;.
3324 </p>
3325 <p>The expressions can contain the following constants:
3326 </p><dl compact="compact">
3327 <dt> &lsquo;<samp>w</samp>&rsquo;</dt>
3328 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
3329 <dd><p>the input width and height in pixels
3330 </p>
3331 </dd>
3332 <dt> &lsquo;<samp>cw</samp>&rsquo;</dt>
3333 <dt> &lsquo;<samp>ch</samp>&rsquo;</dt>
3334 <dd><p>the input chroma image width and height in pixels
3335 </p>
3336 </dd>
3337 <dt> &lsquo;<samp>hsub</samp>&rsquo;</dt>
3338 <dt> &lsquo;<samp>vsub</samp>&rsquo;</dt>
3339 <dd><p>horizontal and vertical chroma subsample values. For example for the
3340 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
3341 </p></dd>
3342 </dl>
3343
3344 </dd>
3345 <dt> &lsquo;<samp>luma_power, lp</samp>&rsquo;</dt>
3346 <dt> &lsquo;<samp>chroma_power, cp</samp>&rsquo;</dt>
3347 <dt> &lsquo;<samp>alpha_power, ap</samp>&rsquo;</dt>
3348 <dd><p>Specify how many times the boxblur filter is applied to the
3349 corresponding plane.
3350 </p>
3351 <p>Default value for &lsquo;<samp>luma_power</samp>&rsquo; is 2. If not specified,
3352 &lsquo;<samp>chroma_power</samp>&rsquo; and &lsquo;<samp>alpha_power</samp>&rsquo; default to the
3353 corresponding value set for &lsquo;<samp>luma_power</samp>&rsquo;.
3354 </p>
3355 <p>A value of 0 will disable the effect.
3356 </p></dd>
3357 </dl>
3358
3359 <a name="Examples-15"></a>
3360 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-15">9.8.1 Examples</a></h3>
3361
3362 <ul>
3363 <li>
3364 Apply a boxblur filter with luma, chroma, and alpha radius
3365 set to 2:
3366 <table><tr><td>&nbsp;</td><td><pre class="example">boxblur=luma_radius=2:luma_power=1
3367 boxblur=2:1
3368 </pre></td></tr></table>
3369
3370 </li><li>
3371 Set luma radius to 2, alpha and chroma radius to 0:
3372 <table><tr><td>&nbsp;</td><td><pre class="example">boxblur=2:1:cr=0:ar=0
3373 </pre></td></tr></table>
3374
3375 </li><li>
3376 Set luma and chroma radius to a fraction of the video dimension:
3377 <table><tr><td>&nbsp;</td><td><pre class="example">boxblur=luma_radius=min(h\,w)/10:luma_power=1:chroma_radius=min(cw\,ch)/10:chroma_power=1
3378 </pre></td></tr></table>
3379 </li></ul>
3380
3381 <a name="colorbalance"></a>
3382 <h2 class="section"><a href="ffmpeg-filters.html#toc-colorbalance">9.9 colorbalance</a></h2>
3383 <p>Modify intensity of primary colors (red, green and blue) of input frames.
3384 </p>
3385 <p>The filter allows an input frame to be adjusted in the shadows, midtones or highlights
3386 regions for the red-cyan, green-magenta or blue-yellow balance.
3387 </p>
3388 <p>A positive adjustment value shifts the balance towards the primary color, a negative
3389 value towards the complementary color.
3390 </p>
3391 <p>The filter accepts the following options:
3392 </p>
3393 <dl compact="compact">
3394 <dt> &lsquo;<samp>rs</samp>&rsquo;</dt>
3395 <dt> &lsquo;<samp>gs</samp>&rsquo;</dt>
3396 <dt> &lsquo;<samp>bs</samp>&rsquo;</dt>
3397 <dd><p>Adjust red, green and blue shadows (darkest pixels).
3398 </p>
3399 </dd>
3400 <dt> &lsquo;<samp>rm</samp>&rsquo;</dt>
3401 <dt> &lsquo;<samp>gm</samp>&rsquo;</dt>
3402 <dt> &lsquo;<samp>bm</samp>&rsquo;</dt>
3403 <dd><p>Adjust red, green and blue midtones (medium pixels).
3404 </p>
3405 </dd>
3406 <dt> &lsquo;<samp>rh</samp>&rsquo;</dt>
3407 <dt> &lsquo;<samp>gh</samp>&rsquo;</dt>
3408 <dt> &lsquo;<samp>bh</samp>&rsquo;</dt>
3409 <dd><p>Adjust red, green and blue highlights (brightest pixels).
3410 </p>
3411 <p>Allowed ranges for options are <code>[-1.0, 1.0]</code>. Defaults are <code>0</code>.
3412 </p></dd>
3413 </dl>
3414
3415 <a name="Examples-21"></a>
3416 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-21">9.9.1 Examples</a></h3>
3417
3418 <ul>
3419 <li>
3420 Add red color cast to shadows:
3421 <table><tr><td>&nbsp;</td><td><pre class="example">colorbalance=rs=.3
3422 </pre></td></tr></table>
3423 </li></ul>
3424
3425 <a name="colorchannelmixer"></a>
3426 <h2 class="section"><a href="ffmpeg-filters.html#toc-colorchannelmixer">9.10 colorchannelmixer</a></h2>
3427
3428 <p>Adjust video input frames by re-mixing color channels.
3429 </p>
3430 <p>This filter modifies a color channel by adding the values associated to
3431 the other channels of the same pixels. For example if the value to
3432 modify is red, the output value will be:
3433 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>red</var>=<var>red</var>*<var>rr</var> + <var>blue</var>*<var>rb</var> + <var>green</var>*<var>rg</var> + <var>alpha</var>*<var>ra</var>
3434 </pre></td></tr></table>
3435
3436 <p>The filter accepts the following options:
3437 </p>
3438 <dl compact="compact">
3439 <dt> &lsquo;<samp>rr</samp>&rsquo;</dt>
3440 <dt> &lsquo;<samp>rg</samp>&rsquo;</dt>
3441 <dt> &lsquo;<samp>rb</samp>&rsquo;</dt>
3442 <dt> &lsquo;<samp>ra</samp>&rsquo;</dt>
3443 <dd><p>Adjust contribution of input red, green, blue and alpha channels for output red channel.
3444 Default is <code>1</code> for <var>rr</var>, and <code>0</code> for <var>rg</var>, <var>rb</var> and <var>ra</var>.
3445 </p>
3446 </dd>
3447 <dt> &lsquo;<samp>gr</samp>&rsquo;</dt>
3448 <dt> &lsquo;<samp>gg</samp>&rsquo;</dt>
3449 <dt> &lsquo;<samp>gb</samp>&rsquo;</dt>
3450 <dt> &lsquo;<samp>ga</samp>&rsquo;</dt>
3451 <dd><p>Adjust contribution of input red, green, blue and alpha channels for output green channel.
3452 Default is <code>1</code> for <var>gg</var>, and <code>0</code> for <var>gr</var>, <var>gb</var> and <var>ga</var>.
3453 </p>
3454 </dd>
3455 <dt> &lsquo;<samp>br</samp>&rsquo;</dt>
3456 <dt> &lsquo;<samp>bg</samp>&rsquo;</dt>
3457 <dt> &lsquo;<samp>bb</samp>&rsquo;</dt>
3458 <dt> &lsquo;<samp>ba</samp>&rsquo;</dt>
3459 <dd><p>Adjust contribution of input red, green, blue and alpha channels for output blue channel.
3460 Default is <code>1</code> for <var>bb</var>, and <code>0</code> for <var>br</var>, <var>bg</var> and <var>ba</var>.
3461 </p>
3462 </dd>
3463 <dt> &lsquo;<samp>ar</samp>&rsquo;</dt>
3464 <dt> &lsquo;<samp>ag</samp>&rsquo;</dt>
3465 <dt> &lsquo;<samp>ab</samp>&rsquo;</dt>
3466 <dt> &lsquo;<samp>aa</samp>&rsquo;</dt>
3467 <dd><p>Adjust contribution of input red, green, blue and alpha channels for output alpha channel.
3468 Default is <code>1</code> for <var>aa</var>, and <code>0</code> for <var>ar</var>, <var>ag</var> and <var>ab</var>.
3469 </p>
3470 <p>Allowed ranges for options are <code>[-2.0, 2.0]</code>.
3471 </p></dd>
3472 </dl>
3473
3474 <a name="Examples-12"></a>
3475 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-12">9.10.1 Examples</a></h3>
3476
3477 <ul>
3478 <li>
3479 Convert source to grayscale:
3480 <table><tr><td>&nbsp;</td><td><pre class="example">colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
3481 </pre></td></tr></table>
3482 </li><li>
3483 Simulate sepia tones:
3484 <table><tr><td>&nbsp;</td><td><pre class="example">colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
3485 </pre></td></tr></table>
3486 </li></ul>
3487
3488 <a name="colormatrix"></a>
3489 <h2 class="section"><a href="ffmpeg-filters.html#toc-colormatrix">9.11 colormatrix</a></h2>
3490
3491 <p>Convert color matrix.
3492 </p>
3493 <p>The filter accepts the following options:
3494 </p>
3495 <dl compact="compact">
3496 <dt> &lsquo;<samp>src</samp>&rsquo;</dt>
3497 <dt> &lsquo;<samp>dst</samp>&rsquo;</dt>
3498 <dd><p>Specify the source and destination color matrix. Both values must be
3499 specified.
3500 </p>
3501 <p>The accepted values are:
3502 </p><dl compact="compact">
3503 <dt> &lsquo;<samp>bt709</samp>&rsquo;</dt>
3504 <dd><p>BT.709
3505 </p>
3506 </dd>
3507 <dt> &lsquo;<samp>bt601</samp>&rsquo;</dt>
3508 <dd><p>BT.601
3509 </p>
3510 </dd>
3511 <dt> &lsquo;<samp>smpte240m</samp>&rsquo;</dt>
3512 <dd><p>SMPTE-240M
3513 </p>
3514 </dd>
3515 <dt> &lsquo;<samp>fcc</samp>&rsquo;</dt>
3516 <dd><p>FCC
3517 </p></dd>
3518 </dl>
3519 </dd>
3520 </dl>
3521
3522 <p>For example to convert from BT.601 to SMPTE-240M, use the command:
3523 </p><table><tr><td>&nbsp;</td><td><pre class="example">colormatrix=bt601:smpte240m
3524 </pre></td></tr></table>
3525
3526 <a name="copy"></a>
3527 <h2 class="section"><a href="ffmpeg-filters.html#toc-copy">9.12 copy</a></h2>
3528
3529 <p>Copy the input source unchanged to the output. Mainly useful for
3530 testing purposes.
3531 </p>
3532 <a name="crop"></a>
3533 <h2 class="section"><a href="ffmpeg-filters.html#toc-crop">9.13 crop</a></h2>
3534
3535 <p>Crop the input video to given dimensions.
3536 </p>
3537 <p>The filter accepts the following options:
3538 </p>
3539 <dl compact="compact">
3540 <dt> &lsquo;<samp>w, out_w</samp>&rsquo;</dt>
3541 <dd><p>Width of the output video. It defaults to <code>iw</code>.
3542 This expression is evaluated only once during the filter
3543 configuration.
3544 </p>
3545 </dd>
3546 <dt> &lsquo;<samp>h, out_h</samp>&rsquo;</dt>
3547 <dd><p>Height of the output video. It defaults to <code>ih</code>.
3548 This expression is evaluated only once during the filter
3549 configuration.
3550 </p>
3551 </dd>
3552 <dt> &lsquo;<samp>x</samp>&rsquo;</dt>
3553 <dd><p>Horizontal position, in the input video, of the left edge of the output video.
3554 It defaults to <code>(in_w-out_w)/2</code>.
3555 This expression is evaluated per-frame.
3556 </p>
3557 </dd>
3558 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
3559 <dd><p>Vertical position, in the input video, of the top edge of the output video.
3560 It defaults to <code>(in_h-out_h)/2</code>.
3561 This expression is evaluated per-frame.
3562 </p>
3563 </dd>
3564 <dt> &lsquo;<samp>keep_aspect</samp>&rsquo;</dt>
3565 <dd><p>If set to 1 will force the output display aspect ratio
3566 to be the same of the input, by changing the output sample aspect
3567 ratio. It defaults to 0.
3568 </p></dd>
3569 </dl>
3570
3571 <p>The <var>out_w</var>, <var>out_h</var>, <var>x</var>, <var>y</var> parameters are
3572 expressions containing the following constants:
3573 </p>
3574 <dl compact="compact">
3575 <dt> &lsquo;<samp>x</samp>&rsquo;</dt>
3576 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
3577 <dd><p>the computed values for <var>x</var> and <var>y</var>. They are evaluated for
3578 each new frame.
3579 </p>
3580 </dd>
3581 <dt> &lsquo;<samp>in_w</samp>&rsquo;</dt>
3582 <dt> &lsquo;<samp>in_h</samp>&rsquo;</dt>
3583 <dd><p>the input width and height
3584 </p>
3585 </dd>
3586 <dt> &lsquo;<samp>iw</samp>&rsquo;</dt>
3587 <dt> &lsquo;<samp>ih</samp>&rsquo;</dt>
3588 <dd><p>same as <var>in_w</var> and <var>in_h</var>
3589 </p>
3590 </dd>
3591 <dt> &lsquo;<samp>out_w</samp>&rsquo;</dt>
3592 <dt> &lsquo;<samp>out_h</samp>&rsquo;</dt>
3593 <dd><p>the output (cropped) width and height
3594 </p>
3595 </dd>
3596 <dt> &lsquo;<samp>ow</samp>&rsquo;</dt>
3597 <dt> &lsquo;<samp>oh</samp>&rsquo;</dt>
3598 <dd><p>same as <var>out_w</var> and <var>out_h</var>
3599 </p>
3600 </dd>
3601 <dt> &lsquo;<samp>a</samp>&rsquo;</dt>
3602 <dd><p>same as <var>iw</var> / <var>ih</var>
3603 </p>
3604 </dd>
3605 <dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
3606 <dd><p>input sample aspect ratio
3607 </p>
3608 </dd>
3609 <dt> &lsquo;<samp>dar</samp>&rsquo;</dt>
3610 <dd><p>input display aspect ratio, it is the same as (<var>iw</var> / <var>ih</var>) * <var>sar</var>
3611 </p>
3612 </dd>
3613 <dt> &lsquo;<samp>hsub</samp>&rsquo;</dt>
3614 <dt> &lsquo;<samp>vsub</samp>&rsquo;</dt>
3615 <dd><p>horizontal and vertical chroma subsample values. For example for the
3616 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
3617 </p>
3618 </dd>
3619 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
3620 <dd><p>the number of input frame, starting from 0
3621 </p>
3622 </dd>
3623 <dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
3624 <dd><p>the position in the file of the input frame, NAN if unknown
3625 </p>
3626 </dd>
3627 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
3628 <dd><p>timestamp expressed in seconds, NAN if the input timestamp is unknown
3629 </p>
3630 </dd>
3631 </dl>
3632
3633 <p>The expression for <var>out_w</var> may depend on the value of <var>out_h</var>,
3634 and the expression for <var>out_h</var> may depend on <var>out_w</var>, but they
3635 cannot depend on <var>x</var> and <var>y</var>, as <var>x</var> and <var>y</var> are
3636 evaluated after <var>out_w</var> and <var>out_h</var>.
3637 </p>
3638 <p>The <var>x</var> and <var>y</var> parameters specify the expressions for the
3639 position of the top-left corner of the output (non-cropped) area. They
3640 are evaluated for each frame. If the evaluated value is not valid, it
3641 is approximated to the nearest valid value.
3642 </p>
3643 <p>The expression for <var>x</var> may depend on <var>y</var>, and the expression
3644 for <var>y</var> may depend on <var>x</var>.
3645 </p>
3646 <a name="Examples-8"></a>
3647 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-8">9.13.1 Examples</a></h3>
3648
3649 <ul>
3650 <li>
3651 Crop area with size 100x100 at position (12,34).
3652 <table><tr><td>&nbsp;</td><td><pre class="example">crop=100:100:12:34
3653 </pre></td></tr></table>
3654
3655 <p>Using named options, the example above becomes:
3656 </p><table><tr><td>&nbsp;</td><td><pre class="example">crop=w=100:h=100:x=12:y=34
3657 </pre></td></tr></table>
3658
3659 </li><li>
3660 Crop the central input area with size 100x100:
3661 <table><tr><td>&nbsp;</td><td><pre class="example">crop=100:100
3662 </pre></td></tr></table>
3663
3664 </li><li>
3665 Crop the central input area with size 2/3 of the input video:
3666 <table><tr><td>&nbsp;</td><td><pre class="example">crop=2/3*in_w:2/3*in_h
3667 </pre></td></tr></table>
3668
3669 </li><li>
3670 Crop the input video central square:
3671 <table><tr><td>&nbsp;</td><td><pre class="example">crop=out_w=in_h
3672 crop=in_h
3673 </pre></td></tr></table>
3674
3675 </li><li>
3676 Delimit the rectangle with the top-left corner placed at position
3677 100:100 and the right-bottom corner corresponding to the right-bottom
3678 corner of the input image:
3679 <table><tr><td>&nbsp;</td><td><pre class="example">crop=in_w-100:in_h-100:100:100
3680 </pre></td></tr></table>
3681
3682 </li><li>
3683 Crop 10 pixels from the left and right borders, and 20 pixels from
3684 the top and bottom borders
3685 <table><tr><td>&nbsp;</td><td><pre class="example">crop=in_w-2*10:in_h-2*20
3686 </pre></td></tr></table>
3687
3688 </li><li>
3689 Keep only the bottom right quarter of the input image:
3690 <table><tr><td>&nbsp;</td><td><pre class="example">crop=in_w/2:in_h/2:in_w/2:in_h/2
3691 </pre></td></tr></table>
3692
3693 </li><li>
3694 Crop height for getting Greek harmony:
3695 <table><tr><td>&nbsp;</td><td><pre class="example">crop=in_w:1/PHI*in_w
3696 </pre></td></tr></table>
3697
3698 </li><li>
3699 Appply trembling effect:
3700 <table><tr><td>&nbsp;</td><td><pre class="example">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)
3701 </pre></td></tr></table>
3702
3703 </li><li>
3704 Apply erratic camera effect depending on timestamp:
3705 <table><tr><td>&nbsp;</td><td><pre class="example">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;
3706 </pre></td></tr></table>
3707
3708 </li><li>
3709 Set x depending on the value of y:
3710 <table><tr><td>&nbsp;</td><td><pre class="example">crop=in_w/2:in_h/2:y:10+10*sin(n/10)
3711 </pre></td></tr></table>
3712 </li></ul>
3713
3714 <a name="cropdetect"></a>
3715 <h2 class="section"><a href="ffmpeg-filters.html#toc-cropdetect">9.14 cropdetect</a></h2>
3716
3717 <p>Auto-detect crop size.
3718 </p>
3719 <p>Calculate necessary cropping parameters and prints the recommended
3720 parameters through the logging system. The detected dimensions
3721 correspond to the non-black area of the input video.
3722 </p>
3723 <p>The filter accepts the following options:
3724 </p>
3725 <dl compact="compact">
3726 <dt> &lsquo;<samp>limit</samp>&rsquo;</dt>
3727 <dd><p>Set higher black value threshold, which can be optionally specified
3728 from nothing (0) to everything (255). An intensity value greater
3729 to the set value is considered non-black. Default value is 24.
3730 </p>
3731 </dd>
3732 <dt> &lsquo;<samp>round</samp>&rsquo;</dt>
3733 <dd><p>Set the value for which the width/height should be divisible by. The
3734 offset is automatically adjusted to center the video. Use 2 to get
3735 only even dimensions (needed for 4:2:2 video). 16 is best when
3736 encoding to most video codecs. Default value is 16.
3737 </p>
3738 </dd>
3739 <dt> &lsquo;<samp>reset_count, reset</samp>&rsquo;</dt>
3740 <dd><p>Set the counter that determines after how many frames cropdetect will
3741 reset the previously detected largest video area and start over to
3742 detect the current optimal crop area. Default value is 0.
3743 </p>
3744 <p>This can be useful when channel logos distort the video area. 0
3745 indicates never reset and return the largest area encountered during
3746 playback.
3747 </p></dd>
3748 </dl>
3749
3750 <p><a name="curves"></a>
3751 </p><a name="curves-1"></a>
3752 <h2 class="section"><a href="ffmpeg-filters.html#toc-curves-1">9.15 curves</a></h2>
3753
3754 <p>Apply color adjustments using curves.
3755 </p>
3756 <p>This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
3757 component (red, green and blue) has its values defined by <var>N</var> key points
3758 tied from each other using a smooth curve. The x-axis represents the pixel
3759 values from the input frame, and the y-axis the new pixel values to be set for
3760 the output frame.
3761 </p>
3762 <p>By default, a component curve is defined by the two points <var>(0;0)</var> and
3763 <var>(1;1)</var>. This creates a straight line where each original pixel value is
3764 &quot;adjusted&quot; to its own value, which means no change to the image.
3765 </p>
3766 <p>The filter allows you to redefine these two points and add some more. A new
3767 curve (using a natural cubic spline interpolation) will be define to pass
3768 smoothly through all these new coordinates. The new defined points needs to be
3769 strictly increasing over the x-axis, and their <var>x</var> and <var>y</var> values must
3770 be in the <var>[0;1]</var> interval.  If the computed curves happened to go outside
3771 the vector spaces, the values will be clipped accordingly.
3772 </p>
3773 <p>If there is no key point defined in <code>x=0</code>, the filter will automatically
3774 insert a <var>(0;0)</var> point. In the same way, if there is no key point defined
3775 in <code>x=1</code>, the filter will automatically insert a <var>(1;1)</var> point.
3776 </p>
3777 <p>The filter accepts the following options:
3778 </p>
3779 <dl compact="compact">
3780 <dt> &lsquo;<samp>preset</samp>&rsquo;</dt>
3781 <dd><p>Select one of the available color presets. This option can be used in addition
3782 to the &lsquo;<samp>r</samp>&rsquo;, &lsquo;<samp>g</samp>&rsquo;, &lsquo;<samp>b</samp>&rsquo; parameters; in this case, the later
3783 options takes priority on the preset values.
3784 Available presets are:
3785 </p><dl compact="compact">
3786 <dt> &lsquo;<samp>none</samp>&rsquo;</dt>
3787 <dt> &lsquo;<samp>color_negative</samp>&rsquo;</dt>
3788 <dt> &lsquo;<samp>cross_process</samp>&rsquo;</dt>
3789 <dt> &lsquo;<samp>darker</samp>&rsquo;</dt>
3790 <dt> &lsquo;<samp>increase_contrast</samp>&rsquo;</dt>
3791 <dt> &lsquo;<samp>lighter</samp>&rsquo;</dt>
3792 <dt> &lsquo;<samp>linear_contrast</samp>&rsquo;</dt>
3793 <dt> &lsquo;<samp>medium_contrast</samp>&rsquo;</dt>
3794 <dt> &lsquo;<samp>negative</samp>&rsquo;</dt>
3795 <dt> &lsquo;<samp>strong_contrast</samp>&rsquo;</dt>
3796 <dt> &lsquo;<samp>vintage</samp>&rsquo;</dt>
3797 </dl>
3798 <p>Default is <code>none</code>.
3799 </p></dd>
3800 <dt> &lsquo;<samp>master, m</samp>&rsquo;</dt>
3801 <dd><p>Set the master key points. These points will define a second pass mapping. It
3802 is sometimes called a &quot;luminance&quot; or &quot;value&quot; mapping. It can be used with
3803 &lsquo;<samp>r</samp>&rsquo;, &lsquo;<samp>g</samp>&rsquo;, &lsquo;<samp>b</samp>&rsquo; or &lsquo;<samp>all</samp>&rsquo; since it acts like a
3804 post-processing LUT.
3805 </p></dd>
3806 <dt> &lsquo;<samp>red, r</samp>&rsquo;</dt>
3807 <dd><p>Set the key points for the red component.
3808 </p></dd>
3809 <dt> &lsquo;<samp>green, g</samp>&rsquo;</dt>
3810 <dd><p>Set the key points for the green component.
3811 </p></dd>
3812 <dt> &lsquo;<samp>blue, b</samp>&rsquo;</dt>
3813 <dd><p>Set the key points for the blue component.
3814 </p></dd>
3815 <dt> &lsquo;<samp>all</samp>&rsquo;</dt>
3816 <dd><p>Set the key points for all components (not including master).
3817 Can be used in addition to the other key points component
3818 options. In this case, the unset component(s) will fallback on this
3819 &lsquo;<samp>all</samp>&rsquo; setting.
3820 </p></dd>
3821 <dt> &lsquo;<samp>psfile</samp>&rsquo;</dt>
3822 <dd><p>Specify a Photoshop curves file (<code>.asv</code>) to import the settings from.
3823 </p></dd>
3824 </dl>
3825
3826 <p>To avoid some filtergraph syntax conflicts, each key points list need to be
3827 defined using the following syntax: <code>x0/y0 x1/y1 x2/y2 ...</code>.
3828 </p>
3829 <a name="Examples-1"></a>
3830 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-1">9.15.1 Examples</a></h3>
3831
3832 <ul>
3833 <li>
3834 Increase slightly the middle level of blue:
3835 <table><tr><td>&nbsp;</td><td><pre class="example">curves=blue='0.5/0.58'
3836 </pre></td></tr></table>
3837
3838 </li><li>
3839 Vintage effect:
3840 <table><tr><td>&nbsp;</td><td><pre class="example">curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
3841 </pre></td></tr></table>
3842 <p>Here we obtain the following coordinates for each components:
3843 </p><dl compact="compact">
3844 <dt> <var>red</var></dt>
3845 <dd><p><code>(0;0.11) (0.42;0.51) (1;0.95)</code>
3846 </p></dd>
3847 <dt> <var>green</var></dt>
3848 <dd><p><code>(0;0) (0.50;0.48) (1;1)</code>
3849 </p></dd>
3850 <dt> <var>blue</var></dt>
3851 <dd><p><code>(0;0.22) (0.49;0.44) (1;0.80)</code>
3852 </p></dd>
3853 </dl>
3854
3855 </li><li>
3856 The previous example can also be achieved with the associated built-in preset:
3857 <table><tr><td>&nbsp;</td><td><pre class="example">curves=preset=vintage
3858 </pre></td></tr></table>
3859
3860 </li><li>
3861 Or simply:
3862 <table><tr><td>&nbsp;</td><td><pre class="example">curves=vintage
3863 </pre></td></tr></table>
3864
3865 </li><li>
3866 Use a Photoshop preset and redefine the points of the green component:
3867 <table><tr><td>&nbsp;</td><td><pre class="example">curves=psfile='MyCurvesPresets/purple.asv':green='0.45/0.53'
3868 </pre></td></tr></table>
3869 </li></ul>
3870
3871 <a name="dctdnoiz"></a>
3872 <h2 class="section"><a href="ffmpeg-filters.html#toc-dctdnoiz">9.16 dctdnoiz</a></h2>
3873
3874 <p>Denoise frames using 2D DCT (frequency domain filtering).
3875 </p>
3876 <p>This filter is not designed for real time and can be extremely slow.
3877 </p>
3878 <p>The filter accepts the following options:
3879 </p>
3880 <dl compact="compact">
3881 <dt> &lsquo;<samp>sigma, s</samp>&rsquo;</dt>
3882 <dd><p>Set the noise sigma constant.
3883 </p>
3884 <p>This <var>sigma</var> defines a hard threshold of <code>3 * sigma</code>; every DCT
3885 coefficient (absolute value) below this threshold with be dropped.
3886 </p>
3887 <p>If you need a more advanced filtering, see &lsquo;<samp>expr</samp>&rsquo;.
3888 </p>
3889 <p>Default is <code>0</code>.
3890 </p>
3891 </dd>
3892 <dt> &lsquo;<samp>overlap</samp>&rsquo;</dt>
3893 <dd><p>Set number overlapping pixels for each block. Each block is of size
3894 <code>16x16</code>. Since the filter can be slow, you may want to reduce this value,
3895 at the cost of a less effective filter and the risk of various artefacts.
3896 </p>
3897 <p>If the overlapping value doesn&rsquo;t allow to process the whole input width or
3898 height, a warning will be displayed and according borders won&rsquo;t be denoised.
3899 </p>
3900 <p>Default value is <code>15</code>.
3901 </p>
3902 </dd>
3903 <dt> &lsquo;<samp>expr, e</samp>&rsquo;</dt>
3904 <dd><p>Set the coefficient factor expression.
3905 </p>
3906 <p>For each coefficient of a DCT block, this expression will be evaluated as a
3907 multiplier value for the coefficient.
3908 </p>
3909 <p>If this is option is set, the &lsquo;<samp>sigma</samp>&rsquo; option will be ignored.
3910 </p>
3911 <p>The absolute value of the coefficient can be accessed through the <var>c</var>
3912 variable.
3913 </p></dd>
3914 </dl>
3915
3916 <a name="Examples-70"></a>
3917 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-70">9.16.1 Examples</a></h3>
3918
3919 <p>Apply a denoise with a &lsquo;<samp>sigma</samp>&rsquo; of <code>4.5</code>:
3920 </p><table><tr><td>&nbsp;</td><td><pre class="example">dctdnoiz=4.5
3921 </pre></td></tr></table>
3922
3923 <p>The same operation can be achieved using the expression system:
3924 </p><table><tr><td>&nbsp;</td><td><pre class="example">dctdnoiz=e='gte(c, 4.5*3)'
3925 </pre></td></tr></table>
3926
3927 <p><a name="decimate"></a>
3928 </p><a name="decimate-1"></a>
3929 <h2 class="section"><a href="ffmpeg-filters.html#toc-decimate-1">9.17 decimate</a></h2>
3930
3931 <p>Drop duplicated frames at regular intervals.
3932 </p>
3933 <p>The filter accepts the following options:
3934 </p>
3935 <dl compact="compact">
3936 <dt> &lsquo;<samp>cycle</samp>&rsquo;</dt>
3937 <dd><p>Set the number of frames from which one will be dropped. Setting this to
3938 <var>N</var> means one frame in every batch of <var>N</var> frames will be dropped.
3939 Default is <code>5</code>.
3940 </p>
3941 </dd>
3942 <dt> &lsquo;<samp>dupthresh</samp>&rsquo;</dt>
3943 <dd><p>Set the threshold for duplicate detection. If the difference metric for a frame
3944 is less than or equal to this value, then it is declared as duplicate. Default
3945 is <code>1.1</code>
3946 </p>
3947 </dd>
3948 <dt> &lsquo;<samp>scthresh</samp>&rsquo;</dt>
3949 <dd><p>Set scene change threshold. Default is <code>15</code>.
3950 </p>
3951 </dd>
3952 <dt> &lsquo;<samp>blockx</samp>&rsquo;</dt>
3953 <dt> &lsquo;<samp>blocky</samp>&rsquo;</dt>
3954 <dd><p>Set the size of the x and y-axis blocks used during metric calculations.
3955 Larger blocks give better noise suppression, but also give worse detection of
3956 small movements. Must be a power of two. Default is <code>32</code>.
3957 </p>
3958 </dd>
3959 <dt> &lsquo;<samp>ppsrc</samp>&rsquo;</dt>
3960 <dd><p>Mark main input as a pre-processed input and activate clean source input
3961 stream. This allows the input to be pre-processed with various filters to help
3962 the metrics calculation while keeping the frame selection lossless. When set to
3963 <code>1</code>, the first stream is for the pre-processed input, and the second
3964 stream is the clean source from where the kept frames are chosen. Default is
3965 <code>0</code>.
3966 </p>
3967 </dd>
3968 <dt> &lsquo;<samp>chroma</samp>&rsquo;</dt>
3969 <dd><p>Set whether or not chroma is considered in the metric calculations. Default is
3970 <code>1</code>.
3971 </p></dd>
3972 </dl>
3973
3974 <a name="dejudder"></a>
3975 <h2 class="section"><a href="ffmpeg-filters.html#toc-dejudder">9.18 dejudder</a></h2>
3976
3977 <p>Remove judder produced by partially interlaced telecined content.
3978 </p>
3979 <p>Judder can be introduced, for instance, by <a href="#pullup">pullup</a> filter. If the original
3980 source was partially telecined content then the output of <code>pullup,dejudder</code>
3981 will have a variable frame rate. May change the recorded frame rate of the
3982 container. Aside from that change, this filter will not affect constant frame
3983 rate video.
3984 </p>
3985 <p>The option available in this filter is:
3986 </p><dl compact="compact">
3987 <dt> &lsquo;<samp>cycle</samp>&rsquo;</dt>
3988 <dd><p>Specify the length of the window over which the judder repeats.
3989 </p>
3990 <p>Accepts any interger greater than 1. Useful values are:
3991 </p><dl compact="compact">
3992 <dt> &lsquo;<samp>4</samp>&rsquo;</dt>
3993 <dd><p>If the original was telecined from 24 to 30 fps (Film to NTSC).
3994 </p>
3995 </dd>
3996 <dt> &lsquo;<samp>5</samp>&rsquo;</dt>
3997 <dd><p>If the original was telecined from 25 to 30 fps (PAL to NTSC).
3998 </p>
3999 </dd>
4000 <dt> &lsquo;<samp>20</samp>&rsquo;</dt>
4001 <dd><p>If a mixture of the two.
4002 </p></dd>
4003 </dl>
4004
4005 <p>The default is &lsquo;<samp>4</samp>&rsquo;.
4006 </p></dd>
4007 </dl>
4008
4009 <a name="delogo"></a>
4010 <h2 class="section"><a href="ffmpeg-filters.html#toc-delogo">9.19 delogo</a></h2>
4011
4012 <p>Suppress a TV station logo by a simple interpolation of the surrounding
4013 pixels. Just set a rectangle covering the logo and watch it disappear
4014 (and sometimes something even uglier appear - your mileage may vary).
4015 </p>
4016 <p>This filter accepts the following options:
4017 </p><dl compact="compact">
4018 <dt> &lsquo;<samp>x</samp>&rsquo;</dt>
4019 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
4020 <dd><p>Specify the top left corner coordinates of the logo. They must be
4021 specified.
4022 </p>
4023 </dd>
4024 <dt> &lsquo;<samp>w</samp>&rsquo;</dt>
4025 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
4026 <dd><p>Specify the width and height of the logo to clear. They must be
4027 specified.
4028 </p>
4029 </dd>
4030 <dt> &lsquo;<samp>band, t</samp>&rsquo;</dt>
4031 <dd><p>Specify the thickness of the fuzzy edge of the rectangle (added to
4032 <var>w</var> and <var>h</var>). The default value is 4.
4033 </p>
4034 </dd>
4035 <dt> &lsquo;<samp>show</samp>&rsquo;</dt>
4036 <dd><p>When set to 1, a green rectangle is drawn on the screen to simplify
4037 finding the right <var>x</var>, <var>y</var>, <var>w</var>, and <var>h</var> parameters.
4038 The default value is 0.
4039 </p>
4040 <p>The rectangle is drawn on the outermost pixels which will be (partly)
4041 replaced with interpolated values. The values of the next pixels
4042 immediately outside this rectangle in each direction will be used to
4043 compute the interpolated pixel values inside the rectangle.
4044 </p>
4045 </dd>
4046 </dl>
4047
4048 <a name="Examples-27"></a>
4049 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-27">9.19.1 Examples</a></h3>
4050
4051 <ul>
4052 <li>
4053 Set a rectangle covering the area with top left corner coordinates 0,0
4054 and size 100x77, setting a band of size 10:
4055 <table><tr><td>&nbsp;</td><td><pre class="example">delogo=x=0:y=0:w=100:h=77:band=10
4056 </pre></td></tr></table>
4057
4058 </li></ul>
4059
4060 <a name="deshake"></a>
4061 <h2 class="section"><a href="ffmpeg-filters.html#toc-deshake">9.20 deshake</a></h2>
4062
4063 <p>Attempt to fix small changes in horizontal and/or vertical shift. This
4064 filter helps remove camera shake from hand-holding a camera, bumping a
4065 tripod, moving on a vehicle, etc.
4066 </p>
4067 <p>The filter accepts the following options:
4068 </p>
4069 <dl compact="compact">
4070 <dt> &lsquo;<samp>x</samp>&rsquo;</dt>
4071 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
4072 <dt> &lsquo;<samp>w</samp>&rsquo;</dt>
4073 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
4074 <dd><p>Specify a rectangular area where to limit the search for motion
4075 vectors.
4076 If desired the search for motion vectors can be limited to a
4077 rectangular area of the frame defined by its top left corner, width
4078 and height. These parameters have the same meaning as the drawbox
4079 filter which can be used to visualise the position of the bounding
4080 box.
4081 </p>
4082 <p>This is useful when simultaneous movement of subjects within the frame
4083 might be confused for camera motion by the motion vector search.
4084 </p>
4085 <p>If any or all of <var>x</var>, <var>y</var>, <var>w</var> and <var>h</var> are set to -1
4086 then the full frame is used. This allows later options to be set
4087 without specifying the bounding box for the motion vector search.
4088 </p>
4089 <p>Default - search the whole frame.
4090 </p>
4091 </dd>
4092 <dt> &lsquo;<samp>rx</samp>&rsquo;</dt>
4093 <dt> &lsquo;<samp>ry</samp>&rsquo;</dt>
4094 <dd><p>Specify the maximum extent of movement in x and y directions in the
4095 range 0-64 pixels. Default 16.
4096 </p>
4097 </dd>
4098 <dt> &lsquo;<samp>edge</samp>&rsquo;</dt>
4099 <dd><p>Specify how to generate pixels to fill blanks at the edge of the
4100 frame. Available values are:
4101 </p><dl compact="compact">
4102 <dt> &lsquo;<samp>blank, 0</samp>&rsquo;</dt>
4103 <dd><p>Fill zeroes at blank locations
4104 </p></dd>
4105 <dt> &lsquo;<samp>original, 1</samp>&rsquo;</dt>
4106 <dd><p>Original image at blank locations
4107 </p></dd>
4108 <dt> &lsquo;<samp>clamp, 2</samp>&rsquo;</dt>
4109 <dd><p>Extruded edge value at blank locations
4110 </p></dd>
4111 <dt> &lsquo;<samp>mirror, 3</samp>&rsquo;</dt>
4112 <dd><p>Mirrored edge at blank locations
4113 </p></dd>
4114 </dl>
4115 <p>Default value is &lsquo;<samp>mirror</samp>&rsquo;.
4116 </p>
4117 </dd>
4118 <dt> &lsquo;<samp>blocksize</samp>&rsquo;</dt>
4119 <dd><p>Specify the blocksize to use for motion search. Range 4-128 pixels,
4120 default 8.
4121 </p>
4122 </dd>
4123 <dt> &lsquo;<samp>contrast</samp>&rsquo;</dt>
4124 <dd><p>Specify the contrast threshold for blocks. Only blocks with more than
4125 the specified contrast (difference between darkest and lightest
4126 pixels) will be considered. Range 1-255, default 125.
4127 </p>
4128 </dd>
4129 <dt> &lsquo;<samp>search</samp>&rsquo;</dt>
4130 <dd><p>Specify the search strategy. Available values are:
4131 </p><dl compact="compact">
4132 <dt> &lsquo;<samp>exhaustive, 0</samp>&rsquo;</dt>
4133 <dd><p>Set exhaustive search
4134 </p></dd>
4135 <dt> &lsquo;<samp>less, 1</samp>&rsquo;</dt>
4136 <dd><p>Set less exhaustive search.
4137 </p></dd>
4138 </dl>
4139 <p>Default value is &lsquo;<samp>exhaustive</samp>&rsquo;.
4140 </p>
4141 </dd>
4142 <dt> &lsquo;<samp>filename</samp>&rsquo;</dt>
4143 <dd><p>If set then a detailed log of the motion search is written to the
4144 specified file.
4145 </p>
4146 </dd>
4147 <dt> &lsquo;<samp>opencl</samp>&rsquo;</dt>
4148 <dd><p>If set to 1, specify using OpenCL capabilities, only available if
4149 FFmpeg was configured with <code>--enable-opencl</code>. Default value is 0.
4150 </p>
4151 </dd>
4152 </dl>
4153
4154 <a name="drawbox"></a>
4155 <h2 class="section"><a href="ffmpeg-filters.html#toc-drawbox">9.21 drawbox</a></h2>
4156
4157 <p>Draw a colored box on the input image.
4158 </p>
4159 <p>This filter accepts the following options:
4160 </p>
4161 <dl compact="compact">
4162 <dt> &lsquo;<samp>x</samp>&rsquo;</dt>
4163 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
4164 <dd><p>The expressions which specify the top left corner coordinates of the box. Default to 0.
4165 </p>
4166 </dd>
4167 <dt> &lsquo;<samp>width, w</samp>&rsquo;</dt>
4168 <dt> &lsquo;<samp>height, h</samp>&rsquo;</dt>
4169 <dd><p>The expressions which specify the width and height of the box, if 0 they are interpreted as
4170 the input width and height. Default to 0.
4171 </p>
4172 </dd>
4173 <dt> &lsquo;<samp>color, c</samp>&rsquo;</dt>
4174 <dd><p>Specify the color of the box to write. For the general syntax of this option,
4175 check the &quot;Color&quot; section in the ffmpeg-utils manual. If the special
4176 value <code>invert</code> is used, the box edge color is the same as the
4177 video with inverted luma.
4178 </p>
4179 </dd>
4180 <dt> &lsquo;<samp>thickness, t</samp>&rsquo;</dt>
4181 <dd><p>The expression which sets the thickness of the box edge. Default value is <code>3</code>.
4182 </p>
4183 <p>See below for the list of accepted constants.
4184 </p></dd>
4185 </dl>
4186
4187 <p>The parameters for <var>x</var>, <var>y</var>, <var>w</var> and <var>h</var> and <var>t</var> are expressions containing the
4188 following constants:
4189 </p>
4190 <dl compact="compact">
4191 <dt> &lsquo;<samp>dar</samp>&rsquo;</dt>
4192 <dd><p>The input display aspect ratio, it is the same as (<var>w</var> / <var>h</var>) * <var>sar</var>.
4193 </p>
4194 </dd>
4195 <dt> &lsquo;<samp>hsub</samp>&rsquo;</dt>
4196 <dt> &lsquo;<samp>vsub</samp>&rsquo;</dt>
4197 <dd><p>horizontal and vertical chroma subsample values. For example for the
4198 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
4199 </p>
4200 </dd>
4201 <dt> &lsquo;<samp>in_h, ih</samp>&rsquo;</dt>
4202 <dt> &lsquo;<samp>in_w, iw</samp>&rsquo;</dt>
4203 <dd><p>The input width and height.
4204 </p>
4205 </dd>
4206 <dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
4207 <dd><p>The input sample aspect ratio.
4208 </p>
4209 </dd>
4210 <dt> &lsquo;<samp>x</samp>&rsquo;</dt>
4211 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
4212 <dd><p>The x and y offset coordinates where the box is drawn.
4213 </p>
4214 </dd>
4215 <dt> &lsquo;<samp>w</samp>&rsquo;</dt>
4216 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
4217 <dd><p>The width and height of the drawn box.
4218 </p>
4219 </dd>
4220 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
4221 <dd><p>The thickness of the drawn box.
4222 </p>
4223 <p>These constants allow the <var>x</var>, <var>y</var>, <var>w</var>, <var>h</var> and <var>t</var> expressions to refer to
4224 each other, so you may for example specify <code>y=x/dar</code> or <code>h=w/dar</code>.
4225 </p>
4226 </dd>
4227 </dl>
4228
4229 <a name="Examples-46"></a>
4230 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-46">9.21.1 Examples</a></h3>
4231
4232 <ul>
4233 <li>
4234 Draw a black box around the edge of the input image:
4235 <table><tr><td>&nbsp;</td><td><pre class="example">drawbox
4236 </pre></td></tr></table>
4237
4238 </li><li>
4239 Draw a box with color red and an opacity of 50%:
4240 <table><tr><td>&nbsp;</td><td><pre class="example">drawbox=10:20:200:60:red@0.5
4241 </pre></td></tr></table>
4242
4243 <p>The previous example can be specified as:
4244 </p><table><tr><td>&nbsp;</td><td><pre class="example">drawbox=x=10:y=20:w=200:h=60:color=red@0.5
4245 </pre></td></tr></table>
4246
4247 </li><li>
4248 Fill the box with pink color:
4249 <table><tr><td>&nbsp;</td><td><pre class="example">drawbox=x=10:y=10:w=100:h=100:color=pink@0.5:t=max
4250 </pre></td></tr></table>
4251
4252 </li><li>
4253 Draw a 2-pixel red 2.40:1 mask:
4254 <table><tr><td>&nbsp;</td><td><pre class="example">drawbox=x=-t:y=0.5*(ih-iw/2.4)-t:w=iw+t*2:h=iw/2.4+t*2:t=2:c=red
4255 </pre></td></tr></table>
4256 </li></ul>
4257
4258 <a name="drawgrid"></a>
4259 <h2 class="section"><a href="ffmpeg-filters.html#toc-drawgrid">9.22 drawgrid</a></h2>
4260
4261 <p>Draw a grid on the input image.
4262 </p>
4263 <p>This filter accepts the following options:
4264 </p>
4265 <dl compact="compact">
4266 <dt> &lsquo;<samp>x</samp>&rsquo;</dt>
4267 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
4268 <dd><p>The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
4269 </p>
4270 </dd>
4271 <dt> &lsquo;<samp>width, w</samp>&rsquo;</dt>
4272 <dt> &lsquo;<samp>height, h</samp>&rsquo;</dt>
4273 <dd><p>The expressions which specify the width and height of the grid cell, if 0 they are interpreted as the
4274 input width and height, respectively, minus <code>thickness</code>, so image gets
4275 framed. Default to 0.
4276 </p>
4277 </dd>
4278 <dt> &lsquo;<samp>color, c</samp>&rsquo;</dt>
4279 <dd><p>Specify the color of the grid. For the general syntax of this option,
4280 check the &quot;Color&quot; section in the ffmpeg-utils manual. If the special
4281 value <code>invert</code> is used, the grid color is the same as the
4282 video with inverted luma.
4283 </p>
4284 </dd>
4285 <dt> &lsquo;<samp>thickness, t</samp>&rsquo;</dt>
4286 <dd><p>The expression which sets the thickness of the grid line. Default value is <code>1</code>.
4287 </p>
4288 <p>See below for the list of accepted constants.
4289 </p></dd>
4290 </dl>
4291
4292 <p>The parameters for <var>x</var>, <var>y</var>, <var>w</var> and <var>h</var> and <var>t</var> are expressions containing the
4293 following constants:
4294 </p>
4295 <dl compact="compact">
4296 <dt> &lsquo;<samp>dar</samp>&rsquo;</dt>
4297 <dd><p>The input display aspect ratio, it is the same as (<var>w</var> / <var>h</var>) * <var>sar</var>.
4298 </p>
4299 </dd>
4300 <dt> &lsquo;<samp>hsub</samp>&rsquo;</dt>
4301 <dt> &lsquo;<samp>vsub</samp>&rsquo;</dt>
4302 <dd><p>horizontal and vertical chroma subsample values. For example for the
4303 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
4304 </p>
4305 </dd>
4306 <dt> &lsquo;<samp>in_h, ih</samp>&rsquo;</dt>
4307 <dt> &lsquo;<samp>in_w, iw</samp>&rsquo;</dt>
4308 <dd><p>The input grid cell width and height.
4309 </p>
4310 </dd>
4311 <dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
4312 <dd><p>The input sample aspect ratio.
4313 </p>
4314 </dd>
4315 <dt> &lsquo;<samp>x</samp>&rsquo;</dt>
4316 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
4317 <dd><p>The x and y coordinates of some point of grid intersection (meant to configure offset).
4318 </p>
4319 </dd>
4320 <dt> &lsquo;<samp>w</samp>&rsquo;</dt>
4321 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
4322 <dd><p>The width and height of the drawn cell.
4323 </p>
4324 </dd>
4325 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
4326 <dd><p>The thickness of the drawn cell.
4327 </p>
4328 <p>These constants allow the <var>x</var>, <var>y</var>, <var>w</var>, <var>h</var> and <var>t</var> expressions to refer to
4329 each other, so you may for example specify <code>y=x/dar</code> or <code>h=w/dar</code>.
4330 </p>
4331 </dd>
4332 </dl>
4333
4334 <a name="Examples-18"></a>
4335 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-18">9.22.1 Examples</a></h3>
4336
4337 <ul>
4338 <li>
4339 Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
4340 <table><tr><td>&nbsp;</td><td><pre class="example">drawgrid=width=100:height=100:thickness=2:color=red@0.5
4341 </pre></td></tr></table>
4342
4343 </li><li>
4344 Draw a white 3x3 grid with an opacity of 50%:
4345 <table><tr><td>&nbsp;</td><td><pre class="example">drawgrid=w=iw/3:h=ih/3:t=2:c=white@0.5
4346 </pre></td></tr></table>
4347 </li></ul>
4348
4349 <p><a name="drawtext"></a>
4350 </p><a name="drawtext-1"></a>
4351 <h2 class="section"><a href="ffmpeg-filters.html#toc-drawtext-1">9.23 drawtext</a></h2>
4352
4353 <p>Draw text string or text from specified file on top of video using the
4354 libfreetype library.
4355 </p>
4356 <p>To enable compilation of this filter you need to configure FFmpeg with
4357 <code>--enable-libfreetype</code>.
4358 </p>
4359 <a name="Syntax"></a>
4360 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Syntax">9.23.1 Syntax</a></h3>
4361
4362 <p>The description of the accepted parameters follows.
4363 </p>
4364 <dl compact="compact">
4365 <dt> &lsquo;<samp>box</samp>&rsquo;</dt>
4366 <dd><p>Used to draw a box around text using background color.
4367 Value should be either 1 (enable) or 0 (disable).
4368 The default value of <var>box</var> is 0.
4369 </p>
4370 </dd>
4371 <dt> &lsquo;<samp>boxcolor</samp>&rsquo;</dt>
4372 <dd><p>The color to be used for drawing box around text. For the syntax of this
4373 option, check the &quot;Color&quot; section in the ffmpeg-utils manual.
4374 </p>
4375 <p>The default value of <var>boxcolor</var> is &quot;white&quot;.
4376 </p>
4377 </dd>
4378 <dt> &lsquo;<samp>borderw</samp>&rsquo;</dt>
4379 <dd><p>Set the width of the border to be drawn around the text using <var>bordercolor</var>.
4380 The default value of <var>borderw</var> is 0.
4381 </p>
4382 </dd>
4383 <dt> &lsquo;<samp>bordercolor</samp>&rsquo;</dt>
4384 <dd><p>Set the color to be used for drawing border around text. For the syntax of this
4385 option, check the &quot;Color&quot; section in the ffmpeg-utils manual.
4386 </p>
4387 <p>The default value of <var>bordercolor</var> is &quot;black&quot;.
4388 </p>
4389 </dd>
4390 <dt> &lsquo;<samp>expansion</samp>&rsquo;</dt>
4391 <dd><p>Select how the <var>text</var> is expanded. Can be either <code>none</code>,
4392 <code>strftime</code> (deprecated) or
4393 <code>normal</code> (default). See the <a href="#drawtext_005fexpansion">Text expansion</a> section
4394 below for details.
4395 </p>
4396 </dd>
4397 <dt> &lsquo;<samp>fix_bounds</samp>&rsquo;</dt>
4398 <dd><p>If true, check and fix text coords to avoid clipping.
4399 </p>
4400 </dd>
4401 <dt> &lsquo;<samp>fontcolor</samp>&rsquo;</dt>
4402 <dd><p>The color to be used for drawing fonts. For the syntax of this option, check
4403 the &quot;Color&quot; section in the ffmpeg-utils manual.
4404 </p>
4405 <p>The default value of <var>fontcolor</var> is &quot;black&quot;.
4406 </p>
4407 </dd>
4408 <dt> &lsquo;<samp>fontfile</samp>&rsquo;</dt>
4409 <dd><p>The font file to be used for drawing text. Path must be included.
4410 This parameter is mandatory.
4411 </p>
4412 </dd>
4413 <dt> &lsquo;<samp>fontsize</samp>&rsquo;</dt>
4414 <dd><p>The font size to be used for drawing text.
4415 The default value of <var>fontsize</var> is 16.
4416 </p>
4417 </dd>
4418 <dt> &lsquo;<samp>ft_load_flags</samp>&rsquo;</dt>
4419 <dd><p>Flags to be used for loading the fonts.
4420 </p>
4421 <p>The flags map the corresponding flags supported by libfreetype, and are
4422 a combination of the following values:
4423 </p><dl compact="compact">
4424 <dt> <var>default</var></dt>
4425 <dt> <var>no_scale</var></dt>
4426 <dt> <var>no_hinting</var></dt>
4427 <dt> <var>render</var></dt>
4428 <dt> <var>no_bitmap</var></dt>
4429 <dt> <var>vertical_layout</var></dt>
4430 <dt> <var>force_autohint</var></dt>
4431 <dt> <var>crop_bitmap</var></dt>
4432 <dt> <var>pedantic</var></dt>
4433 <dt> <var>ignore_global_advance_width</var></dt>
4434 <dt> <var>no_recurse</var></dt>
4435 <dt> <var>ignore_transform</var></dt>
4436 <dt> <var>monochrome</var></dt>
4437 <dt> <var>linear_design</var></dt>
4438 <dt> <var>no_autohint</var></dt>
4439 </dl>
4440
4441 <p>Default value is &quot;default&quot;.
4442 </p>
4443 <p>For more information consult the documentation for the FT_LOAD_*
4444 libfreetype flags.
4445 </p>
4446 </dd>
4447 <dt> &lsquo;<samp>shadowcolor</samp>&rsquo;</dt>
4448 <dd><p>The color to be used for drawing a shadow behind the drawn text. For the
4449 syntax of this option, check the &quot;Color&quot; section in the ffmpeg-utils manual.
4450 </p>
4451 <p>The default value of <var>shadowcolor</var> is &quot;black&quot;.
4452 </p>
4453 </dd>
4454 <dt> &lsquo;<samp>shadowx</samp>&rsquo;</dt>
4455 <dt> &lsquo;<samp>shadowy</samp>&rsquo;</dt>
4456 <dd><p>The x and y offsets for the text shadow position with respect to the
4457 position of the text. They can be either positive or negative
4458 values. Default value for both is &quot;0&quot;.
4459 </p>
4460 </dd>
4461 <dt> &lsquo;<samp>start_number</samp>&rsquo;</dt>
4462 <dd><p>The starting frame number for the n/frame_num variable. The default value
4463 is &quot;0&quot;.
4464 </p>
4465 </dd>
4466 <dt> &lsquo;<samp>tabsize</samp>&rsquo;</dt>
4467 <dd><p>The size in number of spaces to use for rendering the tab.
4468 Default value is 4.
4469 </p>
4470 </dd>
4471 <dt> &lsquo;<samp>timecode</samp>&rsquo;</dt>
4472 <dd><p>Set the initial timecode representation in &quot;hh:mm:ss[:;.]ff&quot;
4473 format. It can be used with or without text parameter. <var>timecode_rate</var>
4474 option must be specified.
4475 </p>
4476 </dd>
4477 <dt> &lsquo;<samp>timecode_rate, rate, r</samp>&rsquo;</dt>
4478 <dd><p>Set the timecode frame rate (timecode only).
4479 </p>
4480 </dd>
4481 <dt> &lsquo;<samp>text</samp>&rsquo;</dt>
4482 <dd><p>The text string to be drawn. The text must be a sequence of UTF-8
4483 encoded characters.
4484 This parameter is mandatory if no file is specified with the parameter
4485 <var>textfile</var>.
4486 </p>
4487 </dd>
4488 <dt> &lsquo;<samp>textfile</samp>&rsquo;</dt>
4489 <dd><p>A text file containing text to be drawn. The text must be a sequence
4490 of UTF-8 encoded characters.
4491 </p>
4492 <p>This parameter is mandatory if no text string is specified with the
4493 parameter <var>text</var>.
4494 </p>
4495 <p>If both <var>text</var> and <var>textfile</var> are specified, an error is thrown.
4496 </p>
4497 </dd>
4498 <dt> &lsquo;<samp>reload</samp>&rsquo;</dt>
4499 <dd><p>If set to 1, the <var>textfile</var> will be reloaded before each frame.
4500 Be sure to update it atomically, or it may be read partially, or even fail.
4501 </p>
4502 </dd>
4503 <dt> &lsquo;<samp>x</samp>&rsquo;</dt>
4504 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
4505 <dd><p>The expressions which specify the offsets where text will be drawn
4506 within the video frame. They are relative to the top/left border of the
4507 output image.
4508 </p>
4509 <p>The default value of <var>x</var> and <var>y</var> is &quot;0&quot;.
4510 </p>
4511 <p>See below for the list of accepted constants and functions.
4512 </p></dd>
4513 </dl>
4514
4515 <p>The parameters for <var>x</var> and <var>y</var> are expressions containing the
4516 following constants and functions:
4517 </p>
4518 <dl compact="compact">
4519 <dt> &lsquo;<samp>dar</samp>&rsquo;</dt>
4520 <dd><p>input display aspect ratio, it is the same as (<var>w</var> / <var>h</var>) * <var>sar</var>
4521 </p>
4522 </dd>
4523 <dt> &lsquo;<samp>hsub</samp>&rsquo;</dt>
4524 <dt> &lsquo;<samp>vsub</samp>&rsquo;</dt>
4525 <dd><p>horizontal and vertical chroma subsample values. For example for the
4526 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
4527 </p>
4528 </dd>
4529 <dt> &lsquo;<samp>line_h, lh</samp>&rsquo;</dt>
4530 <dd><p>the height of each text line
4531 </p>
4532 </dd>
4533 <dt> &lsquo;<samp>main_h, h, H</samp>&rsquo;</dt>
4534 <dd><p>the input height
4535 </p>
4536 </dd>
4537 <dt> &lsquo;<samp>main_w, w, W</samp>&rsquo;</dt>
4538 <dd><p>the input width
4539 </p>
4540 </dd>
4541 <dt> &lsquo;<samp>max_glyph_a, ascent</samp>&rsquo;</dt>
4542 <dd><p>the maximum distance from the baseline to the highest/upper grid
4543 coordinate used to place a glyph outline point, for all the rendered
4544 glyphs.
4545 It is a positive value, due to the grid&rsquo;s orientation with the Y axis
4546 upwards.
4547 </p>
4548 </dd>
4549 <dt> &lsquo;<samp>max_glyph_d, descent</samp>&rsquo;</dt>
4550 <dd><p>the maximum distance from the baseline to the lowest grid coordinate
4551 used to place a glyph outline point, for all the rendered glyphs.
4552 This is a negative value, due to the grid&rsquo;s orientation, with the Y axis
4553 upwards.
4554 </p>
4555 </dd>
4556 <dt> &lsquo;<samp>max_glyph_h</samp>&rsquo;</dt>
4557 <dd><p>maximum glyph height, that is the maximum height for all the glyphs
4558 contained in the rendered text, it is equivalent to <var>ascent</var> -
4559 <var>descent</var>.
4560 </p>
4561 </dd>
4562 <dt> &lsquo;<samp>max_glyph_w</samp>&rsquo;</dt>
4563 <dd><p>maximum glyph width, that is the maximum width for all the glyphs
4564 contained in the rendered text
4565 </p>
4566 </dd>
4567 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
4568 <dd><p>the number of input frame, starting from 0
4569 </p>
4570 </dd>
4571 <dt> &lsquo;<samp>rand(min, max)</samp>&rsquo;</dt>
4572 <dd><p>return a random number included between <var>min</var> and <var>max</var>
4573 </p>
4574 </dd>
4575 <dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
4576 <dd><p>input sample aspect ratio
4577 </p>
4578 </dd>
4579 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
4580 <dd><p>timestamp expressed in seconds, NAN if the input timestamp is unknown
4581 </p>
4582 </dd>
4583 <dt> &lsquo;<samp>text_h, th</samp>&rsquo;</dt>
4584 <dd><p>the height of the rendered text
4585 </p>
4586 </dd>
4587 <dt> &lsquo;<samp>text_w, tw</samp>&rsquo;</dt>
4588 <dd><p>the width of the rendered text
4589 </p>
4590 </dd>
4591 <dt> &lsquo;<samp>x</samp>&rsquo;</dt>
4592 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
4593 <dd><p>the x and y offset coordinates where the text is drawn.
4594 </p>
4595 <p>These parameters allow the <var>x</var> and <var>y</var> expressions to refer
4596 each other, so you can for example specify <code>y=x/dar</code>.
4597 </p></dd>
4598 </dl>
4599
4600 <p>If libavfilter was built with <code>--enable-fontconfig</code>, then
4601 &lsquo;<samp>fontfile</samp>&rsquo; can be a fontconfig pattern or omitted.
4602 </p>
4603 <p><a name="drawtext_005fexpansion"></a>
4604 </p><a name="Text-expansion"></a>
4605 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Text-expansion">9.23.2 Text expansion</a></h3>
4606
4607 <p>If &lsquo;<samp>expansion</samp>&rsquo; is set to <code>strftime</code>,
4608 the filter recognizes strftime() sequences in the provided text and
4609 expands them accordingly. Check the documentation of strftime(). This
4610 feature is deprecated.
4611 </p>
4612 <p>If &lsquo;<samp>expansion</samp>&rsquo; is set to <code>none</code>, the text is printed verbatim.
4613 </p>
4614 <p>If &lsquo;<samp>expansion</samp>&rsquo; is set to <code>normal</code> (which is the default),
4615 the following expansion mechanism is used.
4616 </p>
4617 <p>The backslash character &rsquo;\&rsquo;, followed by any character, always expands to
4618 the second character.
4619 </p>
4620 <p>Sequence of the form <code>%{...}</code> are expanded. The text between the
4621 braces is a function name, possibly followed by arguments separated by &rsquo;:&rsquo;.
4622 If the arguments contain special characters or delimiters (&rsquo;:&rsquo; or &rsquo;}&rsquo;),
4623 they should be escaped.
4624 </p>
4625 <p>Note that they probably must also be escaped as the value for the
4626 &lsquo;<samp>text</samp>&rsquo; option in the filter argument string and as the filter
4627 argument in the filtergraph description, and possibly also for the shell,
4628 that makes up to four levels of escaping; using a text file avoids these
4629 problems.
4630 </p>
4631 <p>The following functions are available:
4632 </p>
4633 <dl compact="compact">
4634 <dt> <code>expr, e</code></dt>
4635 <dd><p>The expression evaluation result.
4636 </p>
4637 <p>It must take one argument specifying the expression to be evaluated,
4638 which accepts the same constants and functions as the <var>x</var> and
4639 <var>y</var> values. Note that not all constants should be used, for
4640 example the text size is not known when evaluating the expression, so
4641 the constants <var>text_w</var> and <var>text_h</var> will have an undefined
4642 value.
4643 </p>
4644 </dd>
4645 <dt> <code>gmtime</code></dt>
4646 <dd><p>The time at which the filter is running, expressed in UTC.
4647 It can accept an argument: a strftime() format string.
4648 </p>
4649 </dd>
4650 <dt> <code>localtime</code></dt>
4651 <dd><p>The time at which the filter is running, expressed in the local time zone.
4652 It can accept an argument: a strftime() format string.
4653 </p>
4654 </dd>
4655 <dt> <code>metadata</code></dt>
4656 <dd><p>Frame metadata. It must take one argument specifying metadata key.
4657 </p>
4658 </dd>
4659 <dt> <code>n, frame_num</code></dt>
4660 <dd><p>The frame number, starting from 0.
4661 </p>
4662 </dd>
4663 <dt> <code>pict_type</code></dt>
4664 <dd><p>A 1 character description of the current picture type.
4665 </p>
4666 </dd>
4667 <dt> <code>pts</code></dt>
4668 <dd><p>The timestamp of the current frame, in seconds, with microsecond accuracy.
4669 </p>
4670 </dd>
4671 </dl>
4672
4673 <a name="Examples-34"></a>
4674 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-34">9.23.3 Examples</a></h3>
4675
4676 <ul>
4677 <li>
4678 Draw &quot;Test Text&quot; with font FreeSerif, using the default values for the
4679 optional parameters.
4680
4681 <table><tr><td>&nbsp;</td><td><pre class="example">drawtext=&quot;fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'&quot;
4682 </pre></td></tr></table>
4683
4684 </li><li>
4685 Draw &rsquo;Test Text&rsquo; with font FreeSerif of size 24 at position x=100
4686 and y=50 (counting from the top-left corner of the screen), text is
4687 yellow with a red box around it. Both the text and the box have an
4688 opacity of 20%.
4689
4690 <table><tr><td>&nbsp;</td><td><pre class="example">drawtext=&quot;fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
4691           x=100: y=50: fontsize=24: fontcolor=yellow@0.2: box=1: boxcolor=red@0.2&quot;
4692 </pre></td></tr></table>
4693
4694 <p>Note that the double quotes are not necessary if spaces are not used
4695 within the parameter list.
4696 </p>
4697 </li><li>
4698 Show the text at the center of the video frame:
4699 <table><tr><td>&nbsp;</td><td><pre class="example">drawtext=&quot;fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2&quot;
4700 </pre></td></tr></table>
4701
4702 </li><li>
4703 Show a text line sliding from right to left in the last row of the video
4704 frame. The file &lsquo;<tt>LONG_LINE</tt>&rsquo; is assumed to contain a single line
4705 with no newlines.
4706 <table><tr><td>&nbsp;</td><td><pre class="example">drawtext=&quot;fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t&quot;
4707 </pre></td></tr></table>
4708
4709 </li><li>
4710 Show the content of file &lsquo;<tt>CREDITS</tt>&rsquo; off the bottom of the frame and scroll up.
4711 <table><tr><td>&nbsp;</td><td><pre class="example">drawtext=&quot;fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t&quot;
4712 </pre></td></tr></table>
4713
4714 </li><li>
4715 Draw a single green letter &quot;g&quot;, at the center of the input video.
4716 The glyph baseline is placed at half screen height.
4717 <table><tr><td>&nbsp;</td><td><pre class="example">drawtext=&quot;fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent&quot;
4718 </pre></td></tr></table>
4719
4720 </li><li>
4721 Show text for 1 second every 3 seconds:
4722 <table><tr><td>&nbsp;</td><td><pre class="example">drawtext=&quot;fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'&quot;
4723 </pre></td></tr></table>
4724
4725 </li><li>
4726 Use fontconfig to set the font. Note that the colons need to be escaped.
4727 <table><tr><td>&nbsp;</td><td><pre class="example">drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
4728 </pre></td></tr></table>
4729
4730 </li><li>
4731 Print the date of a real-time encoding (see strftime(3)):
4732 <table><tr><td>&nbsp;</td><td><pre class="example">drawtext='fontfile=FreeSans.ttf:text=%{localtime:%a %b %d %Y}'
4733 </pre></td></tr></table>
4734
4735 </li></ul>
4736
4737 <p>For more information about libfreetype, check:
4738 <a href="http://www.freetype.org/">http://www.freetype.org/</a>.
4739 </p>
4740 <p>For more information about fontconfig, check:
4741 <a href="http://freedesktop.org/software/fontconfig/fontconfig-user.html">http://freedesktop.org/software/fontconfig/fontconfig-user.html</a>.
4742 </p>
4743 <a name="edgedetect"></a>
4744 <h2 class="section"><a href="ffmpeg-filters.html#toc-edgedetect">9.24 edgedetect</a></h2>
4745
4746 <p>Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
4747 </p>
4748 <p>The filter accepts the following options:
4749 </p>
4750 <dl compact="compact">
4751 <dt> &lsquo;<samp>low</samp>&rsquo;</dt>
4752 <dt> &lsquo;<samp>high</samp>&rsquo;</dt>
4753 <dd><p>Set low and high threshold values used by the Canny thresholding
4754 algorithm.
4755 </p>
4756 <p>The high threshold selects the &quot;strong&quot; edge pixels, which are then
4757 connected through 8-connectivity with the &quot;weak&quot; edge pixels selected
4758 by the low threshold.
4759 </p>
4760 <p><var>low</var> and <var>high</var> threshold values must be chosen in the range
4761 [0,1], and <var>low</var> should be lesser or equal to <var>high</var>.
4762 </p>
4763 <p>Default value for <var>low</var> is <code>20/255</code>, and default value for <var>high</var>
4764 is <code>50/255</code>.
4765 </p></dd>
4766 </dl>
4767
4768 <p>Example:
4769 </p><table><tr><td>&nbsp;</td><td><pre class="example">edgedetect=low=0.1:high=0.4
4770 </pre></td></tr></table>
4771
4772 <a name="extractplanes"></a>
4773 <h2 class="section"><a href="ffmpeg-filters.html#toc-extractplanes">9.25 extractplanes</a></h2>
4774
4775 <p>Extract color channel components from input video stream into
4776 separate grayscale video streams.
4777 </p>
4778 <p>The filter accepts the following option:
4779 </p>
4780 <dl compact="compact">
4781 <dt> &lsquo;<samp>planes</samp>&rsquo;</dt>
4782 <dd><p>Set plane(s) to extract.
4783 </p>
4784 <p>Available values for planes are:
4785 </p><dl compact="compact">
4786 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
4787 <dt> &lsquo;<samp>u</samp>&rsquo;</dt>
4788 <dt> &lsquo;<samp>v</samp>&rsquo;</dt>
4789 <dt> &lsquo;<samp>a</samp>&rsquo;</dt>
4790 <dt> &lsquo;<samp>r</samp>&rsquo;</dt>
4791 <dt> &lsquo;<samp>g</samp>&rsquo;</dt>
4792 <dt> &lsquo;<samp>b</samp>&rsquo;</dt>
4793 </dl>
4794
4795 <p>Choosing planes not available in the input will result in an error.
4796 That means you cannot select <code>r</code>, <code>g</code>, <code>b</code> planes
4797 with <code>y</code>, <code>u</code>, <code>v</code> planes at same time.
4798 </p></dd>
4799 </dl>
4800
4801 <a name="Examples-54"></a>
4802 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-54">9.25.1 Examples</a></h3>
4803
4804 <ul>
4805 <li>
4806 Extract luma, u and v color channel component from input video frame
4807 into 3 grayscale outputs:
4808 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i video.avi -filter_complex 'extractplanes=y+u+v[y][u][v]' -map '[y]' y.avi -map '[u]' u.avi -map '[v]' v.avi
4809 </pre></td></tr></table>
4810 </li></ul>
4811
4812 <a name="elbg"></a>
4813 <h2 class="section"><a href="ffmpeg-filters.html#toc-elbg">9.26 elbg</a></h2>
4814
4815 <p>Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
4816 </p>
4817 <p>For each input image, the filter will compute the optimal mapping from
4818 the input to the output given the codebook length, that is the number
4819 of distinct output colors.
4820 </p>
4821 <p>This filter accepts the following options.
4822 </p>
4823 <dl compact="compact">
4824 <dt> &lsquo;<samp>codebook_length, l</samp>&rsquo;</dt>
4825 <dd><p>Set codebook length. The value must be a positive integer, and
4826 represents the number of distinct output colors. Default value is 256.
4827 </p>
4828 </dd>
4829 <dt> &lsquo;<samp>nb_steps, n</samp>&rsquo;</dt>
4830 <dd><p>Set the maximum number of iterations to apply for computing the optimal
4831 mapping. The higher the value the better the result and the higher the
4832 computation time. Default value is 1.
4833 </p>
4834 </dd>
4835 <dt> &lsquo;<samp>seed, s</samp>&rsquo;</dt>
4836 <dd><p>Set a random seed, must be an integer included between 0 and
4837 UINT32_MAX. If not specified, or if explicitly set to -1, the filter
4838 will try to use a good random seed on a best effort basis.
4839 </p></dd>
4840 </dl>
4841
4842 <a name="fade"></a>
4843 <h2 class="section"><a href="ffmpeg-filters.html#toc-fade">9.27 fade</a></h2>
4844
4845 <p>Apply fade-in/out effect to input video.
4846 </p>
4847 <p>This filter accepts the following options:
4848 </p>
4849 <dl compact="compact">
4850 <dt> &lsquo;<samp>type, t</samp>&rsquo;</dt>
4851 <dd><p>The effect type &ndash; can be either &quot;in&quot; for fade-in, or &quot;out&quot; for a fade-out
4852 effect.
4853 Default is <code>in</code>.
4854 </p>
4855 </dd>
4856 <dt> &lsquo;<samp>start_frame, s</samp>&rsquo;</dt>
4857 <dd><p>Specify the number of the start frame for starting to apply the fade
4858 effect. Default is 0.
4859 </p>
4860 </dd>
4861 <dt> &lsquo;<samp>nb_frames, n</samp>&rsquo;</dt>
4862 <dd><p>The number of frames for which the fade effect has to last. At the end of the
4863 fade-in effect the output video will have the same intensity as the input video,
4864 at the end of the fade-out transition the output video will be filled with the
4865 selected &lsquo;<samp>color</samp>&rsquo;.
4866 Default is 25.
4867 </p>
4868 </dd>
4869 <dt> &lsquo;<samp>alpha</samp>&rsquo;</dt>
4870 <dd><p>If set to 1, fade only alpha channel, if one exists on the input.
4871 Default value is 0.
4872 </p>
4873 </dd>
4874 <dt> &lsquo;<samp>start_time, st</samp>&rsquo;</dt>
4875 <dd><p>Specify the timestamp (in seconds) of the frame to start to apply the fade
4876 effect. If both start_frame and start_time are specified, the fade will start at
4877 whichever comes last.  Default is 0.
4878 </p>
4879 </dd>
4880 <dt> &lsquo;<samp>duration, d</samp>&rsquo;</dt>
4881 <dd><p>The number of seconds for which the fade effect has to last. At the end of the
4882 fade-in effect the output video will have the same intensity as the input video,
4883 at the end of the fade-out transition the output video will be filled with the
4884 selected &lsquo;<samp>color</samp>&rsquo;.
4885 If both duration and nb_frames are specified, duration is used. Default is 0.
4886 </p>
4887 </dd>
4888 <dt> &lsquo;<samp>color, c</samp>&rsquo;</dt>
4889 <dd><p>Specify the color of the fade. Default is &quot;black&quot;.
4890 </p></dd>
4891 </dl>
4892
4893 <a name="Examples-22"></a>
4894 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-22">9.27.1 Examples</a></h3>
4895
4896 <ul>
4897 <li>
4898 Fade in first 30 frames of video:
4899 <table><tr><td>&nbsp;</td><td><pre class="example">fade=in:0:30
4900 </pre></td></tr></table>
4901
4902 <p>The command above is equivalent to:
4903 </p><table><tr><td>&nbsp;</td><td><pre class="example">fade=t=in:s=0:n=30
4904 </pre></td></tr></table>
4905
4906 </li><li>
4907 Fade out last 45 frames of a 200-frame video:
4908 <table><tr><td>&nbsp;</td><td><pre class="example">fade=out:155:45
4909 fade=type=out:start_frame=155:nb_frames=45
4910 </pre></td></tr></table>
4911
4912 </li><li>
4913 Fade in first 25 frames and fade out last 25 frames of a 1000-frame video:
4914 <table><tr><td>&nbsp;</td><td><pre class="example">fade=in:0:25, fade=out:975:25
4915 </pre></td></tr></table>
4916
4917 </li><li>
4918 Make first 5 frames yellow, then fade in from frame 5-24:
4919 <table><tr><td>&nbsp;</td><td><pre class="example">fade=in:5:20:color=yellow
4920 </pre></td></tr></table>
4921
4922 </li><li>
4923 Fade in alpha over first 25 frames of video:
4924 <table><tr><td>&nbsp;</td><td><pre class="example">fade=in:0:25:alpha=1
4925 </pre></td></tr></table>
4926
4927 </li><li>
4928 Make first 5.5 seconds black, then fade in for 0.5 seconds:
4929 <table><tr><td>&nbsp;</td><td><pre class="example">fade=t=in:st=5.5:d=0.5
4930 </pre></td></tr></table>
4931
4932 </li></ul>
4933
4934 <a name="field"></a>
4935 <h2 class="section"><a href="ffmpeg-filters.html#toc-field">9.28 field</a></h2>
4936
4937 <p>Extract a single field from an interlaced image using stride
4938 arithmetic to avoid wasting CPU time. The output frames are marked as
4939 non-interlaced.
4940 </p>
4941 <p>The filter accepts the following options:
4942 </p>
4943 <dl compact="compact">
4944 <dt> &lsquo;<samp>type</samp>&rsquo;</dt>
4945 <dd><p>Specify whether to extract the top (if the value is <code>0</code> or
4946 <code>top</code>) or the bottom field (if the value is <code>1</code> or
4947 <code>bottom</code>).
4948 </p></dd>
4949 </dl>
4950
4951 <a name="fieldmatch"></a>
4952 <h2 class="section"><a href="ffmpeg-filters.html#toc-fieldmatch">9.29 fieldmatch</a></h2>
4953
4954 <p>Field matching filter for inverse telecine. It is meant to reconstruct the
4955 progressive frames from a telecined stream. The filter does not drop duplicated
4956 frames, so to achieve a complete inverse telecine <code>fieldmatch</code> needs to be
4957 followed by a decimation filter such as <a href="#decimate">decimate</a> in the filtergraph.
4958 </p>
4959 <p>The separation of the field matching and the decimation is notably motivated by
4960 the possibility of inserting a de-interlacing filter fallback between the two.
4961 If the source has mixed telecined and real interlaced content,
4962 <code>fieldmatch</code> will not be able to match fields for the interlaced parts.
4963 But these remaining combed frames will be marked as interlaced, and thus can be
4964 de-interlaced by a later filter such as <a href="#yadif">yadif</a> before decimation.
4965 </p>
4966 <p>In addition to the various configuration options, <code>fieldmatch</code> can take an
4967 optional second stream, activated through the &lsquo;<samp>ppsrc</samp>&rsquo; option. If
4968 enabled, the frames reconstruction will be based on the fields and frames from
4969 this second stream. This allows the first input to be pre-processed in order to
4970 help the various algorithms of the filter, while keeping the output lossless
4971 (assuming the fields are matched properly). Typically, a field-aware denoiser,
4972 or brightness/contrast adjustments can help.
4973 </p>
4974 <p>Note that this filter uses the same algorithms as TIVTC/TFM (AviSynth project)
4975 and VIVTC/VFM (VapourSynth project). The later is a light clone of TFM from
4976 which <code>fieldmatch</code> is based on. While the semantic and usage are very
4977 close, some behaviour and options names can differ.
4978 </p>
4979 <p>The filter accepts the following options:
4980 </p>
4981 <dl compact="compact">
4982 <dt> &lsquo;<samp>order</samp>&rsquo;</dt>
4983 <dd><p>Specify the assumed field order of the input stream. Available values are:
4984 </p>
4985 <dl compact="compact">
4986 <dt> &lsquo;<samp>auto</samp>&rsquo;</dt>
4987 <dd><p>Auto detect parity (use FFmpeg&rsquo;s internal parity value).
4988 </p></dd>
4989 <dt> &lsquo;<samp>bff</samp>&rsquo;</dt>
4990 <dd><p>Assume bottom field first.
4991 </p></dd>
4992 <dt> &lsquo;<samp>tff</samp>&rsquo;</dt>
4993 <dd><p>Assume top field first.
4994 </p></dd>
4995 </dl>
4996
4997 <p>Note that it is sometimes recommended not to trust the parity announced by the
4998 stream.
4999 </p>
5000 <p>Default value is <var>auto</var>.
5001 </p>
5002 </dd>
5003 <dt> &lsquo;<samp>mode</samp>&rsquo;</dt>
5004 <dd><p>Set the matching mode or strategy to use. &lsquo;<samp>pc</samp>&rsquo; mode is the safest in the
5005 sense that it won&rsquo;t risk creating jerkiness due to duplicate frames when
5006 possible, but if there are bad edits or blended fields it will end up
5007 outputting combed frames when a good match might actually exist. On the other
5008 hand, &lsquo;<samp>pcn_ub</samp>&rsquo; mode is the most risky in terms of creating jerkiness,
5009 but will almost always find a good frame if there is one. The other values are
5010 all somewhere in between &lsquo;<samp>pc</samp>&rsquo; and &lsquo;<samp>pcn_ub</samp>&rsquo; in terms of risking
5011 jerkiness and creating duplicate frames versus finding good matches in sections
5012 with bad edits, orphaned fields, blended fields, etc.
5013 </p>
5014 <p>More details about p/c/n/u/b are available in <a href="#p_002fc_002fn_002fu_002fb-meaning">p/c/n/u/b meaning</a> section.
5015 </p>
5016 <p>Available values are:
5017 </p>
5018 <dl compact="compact">
5019 <dt> &lsquo;<samp>pc</samp>&rsquo;</dt>
5020 <dd><p>2-way matching (p/c)
5021 </p></dd>
5022 <dt> &lsquo;<samp>pc_n</samp>&rsquo;</dt>
5023 <dd><p>2-way matching, and trying 3rd match if still combed (p/c + n)
5024 </p></dd>
5025 <dt> &lsquo;<samp>pc_u</samp>&rsquo;</dt>
5026 <dd><p>2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
5027 </p></dd>
5028 <dt> &lsquo;<samp>pc_n_ub</samp>&rsquo;</dt>
5029 <dd><p>2-way matching, trying 3rd match if still combed, and trying 4th/5th matches if
5030 still combed (p/c + n + u/b)
5031 </p></dd>
5032 <dt> &lsquo;<samp>pcn</samp>&rsquo;</dt>
5033 <dd><p>3-way matching (p/c/n)
5034 </p></dd>
5035 <dt> &lsquo;<samp>pcn_ub</samp>&rsquo;</dt>
5036 <dd><p>3-way matching, and trying 4th/5th matches if all 3 of the original matches are
5037 detected as combed (p/c/n + u/b)
5038 </p></dd>
5039 </dl>
5040
5041 <p>The parenthesis at the end indicate the matches that would be used for that
5042 mode assuming &lsquo;<samp>order</samp>&rsquo;=<var>tff</var> (and &lsquo;<samp>field</samp>&rsquo; on <var>auto</var> or
5043 <var>top</var>).
5044 </p>
5045 <p>In terms of speed &lsquo;<samp>pc</samp>&rsquo; mode is by far the fastest and &lsquo;<samp>pcn_ub</samp>&rsquo; is
5046 the slowest.
5047 </p>
5048 <p>Default value is <var>pc_n</var>.
5049 </p>
5050 </dd>
5051 <dt> &lsquo;<samp>ppsrc</samp>&rsquo;</dt>
5052 <dd><p>Mark the main input stream as a pre-processed input, and enable the secondary
5053 input stream as the clean source to pick the fields from. See the filter
5054 introduction for more details. It is similar to the &lsquo;<samp>clip2</samp>&rsquo; feature from
5055 VFM/TFM.
5056 </p>
5057 <p>Default value is <code>0</code> (disabled).
5058 </p>
5059 </dd>
5060 <dt> &lsquo;<samp>field</samp>&rsquo;</dt>
5061 <dd><p>Set the field to match from. It is recommended to set this to the same value as
5062 &lsquo;<samp>order</samp>&rsquo; unless you experience matching failures with that setting. In
5063 certain circumstances changing the field that is used to match from can have a
5064 large impact on matching performance. Available values are:
5065 </p>
5066 <dl compact="compact">
5067 <dt> &lsquo;<samp>auto</samp>&rsquo;</dt>
5068 <dd><p>Automatic (same value as &lsquo;<samp>order</samp>&rsquo;).
5069 </p></dd>
5070 <dt> &lsquo;<samp>bottom</samp>&rsquo;</dt>
5071 <dd><p>Match from the bottom field.
5072 </p></dd>
5073 <dt> &lsquo;<samp>top</samp>&rsquo;</dt>
5074 <dd><p>Match from the top field.
5075 </p></dd>
5076 </dl>
5077
5078 <p>Default value is <var>auto</var>.
5079 </p>
5080 </dd>
5081 <dt> &lsquo;<samp>mchroma</samp>&rsquo;</dt>
5082 <dd><p>Set whether or not chroma is included during the match comparisons. In most
5083 cases it is recommended to leave this enabled. You should set this to <code>0</code>
5084 only if your clip has bad chroma problems such as heavy rainbowing or other
5085 artifacts. Setting this to <code>0</code> could also be used to speed things up at
5086 the cost of some accuracy.
5087 </p>
5088 <p>Default value is <code>1</code>.
5089 </p>
5090 </dd>
5091 <dt> &lsquo;<samp>y0</samp>&rsquo;</dt>
5092 <dt> &lsquo;<samp>y1</samp>&rsquo;</dt>
5093 <dd><p>These define an exclusion band which excludes the lines between &lsquo;<samp>y0</samp>&rsquo; and
5094 &lsquo;<samp>y1</samp>&rsquo; from being included in the field matching decision. An exclusion
5095 band can be used to ignore subtitles, a logo, or other things that may
5096 interfere with the matching. &lsquo;<samp>y0</samp>&rsquo; sets the starting scan line and
5097 &lsquo;<samp>y1</samp>&rsquo; sets the ending line; all lines in between &lsquo;<samp>y0</samp>&rsquo; and
5098 &lsquo;<samp>y1</samp>&rsquo; (including &lsquo;<samp>y0</samp>&rsquo; and &lsquo;<samp>y1</samp>&rsquo;) will be ignored. Setting
5099 &lsquo;<samp>y0</samp>&rsquo; and &lsquo;<samp>y1</samp>&rsquo; to the same value will disable the feature.
5100 &lsquo;<samp>y0</samp>&rsquo; and &lsquo;<samp>y1</samp>&rsquo; defaults to <code>0</code>.
5101 </p>
5102 </dd>
5103 <dt> &lsquo;<samp>scthresh</samp>&rsquo;</dt>
5104 <dd><p>Set the scene change detection threshold as a percentage of maximum change on
5105 the luma plane. Good values are in the <code>[8.0, 14.0]</code> range. Scene change
5106 detection is only relevant in case &lsquo;<samp>combmatch</samp>&rsquo;=<var>sc</var>.  The range for
5107 &lsquo;<samp>scthresh</samp>&rsquo; is <code>[0.0, 100.0]</code>.
5108 </p>
5109 <p>Default value is <code>12.0</code>.
5110 </p>
5111 </dd>
5112 <dt> &lsquo;<samp>combmatch</samp>&rsquo;</dt>
5113 <dd><p>When &lsquo;<samp>combatch</samp>&rsquo; is not <var>none</var>, <code>fieldmatch</code> will take into
5114 account the combed scores of matches when deciding what match to use as the
5115 final match. Available values are:
5116 </p>
5117 <dl compact="compact">
5118 <dt> &lsquo;<samp>none</samp>&rsquo;</dt>
5119 <dd><p>No final matching based on combed scores.
5120 </p></dd>
5121 <dt> &lsquo;<samp>sc</samp>&rsquo;</dt>
5122 <dd><p>Combed scores are only used when a scene change is detected.
5123 </p></dd>
5124 <dt> &lsquo;<samp>full</samp>&rsquo;</dt>
5125 <dd><p>Use combed scores all the time.
5126 </p></dd>
5127 </dl>
5128
5129 <p>Default is <var>sc</var>.
5130 </p>
5131 </dd>
5132 <dt> &lsquo;<samp>combdbg</samp>&rsquo;</dt>
5133 <dd><p>Force <code>fieldmatch</code> to calculate the combed metrics for certain matches and
5134 print them. This setting is known as &lsquo;<samp>micout</samp>&rsquo; in TFM/VFM vocabulary.
5135 Available values are:
5136 </p>
5137 <dl compact="compact">
5138 <dt> &lsquo;<samp>none</samp>&rsquo;</dt>
5139 <dd><p>No forced calculation.
5140 </p></dd>
5141 <dt> &lsquo;<samp>pcn</samp>&rsquo;</dt>
5142 <dd><p>Force p/c/n calculations.
5143 </p></dd>
5144 <dt> &lsquo;<samp>pcnub</samp>&rsquo;</dt>
5145 <dd><p>Force p/c/n/u/b calculations.
5146 </p></dd>
5147 </dl>
5148
5149 <p>Default value is <var>none</var>.
5150 </p>
5151 </dd>
5152 <dt> &lsquo;<samp>cthresh</samp>&rsquo;</dt>
5153 <dd><p>This is the area combing threshold used for combed frame detection. This
5154 essentially controls how &quot;strong&quot; or &quot;visible&quot; combing must be to be detected.
5155 Larger values mean combing must be more visible and smaller values mean combing
5156 can be less visible or strong and still be detected. Valid settings are from
5157 <code>-1</code> (every pixel will be detected as combed) to <code>255</code> (no pixel will
5158 be detected as combed). This is basically a pixel difference value. A good
5159 range is <code>[8, 12]</code>.
5160 </p>
5161 <p>Default value is <code>9</code>.
5162 </p>
5163 </dd>
5164 <dt> &lsquo;<samp>chroma</samp>&rsquo;</dt>
5165 <dd><p>Sets whether or not chroma is considered in the combed frame decision.  Only
5166 disable this if your source has chroma problems (rainbowing, etc.) that are
5167 causing problems for the combed frame detection with chroma enabled. Actually,
5168 using &lsquo;<samp>chroma</samp>&rsquo;=<var>0</var> is usually more reliable, except for the case
5169 where there is chroma only combing in the source.
5170 </p>
5171 <p>Default value is <code>0</code>.
5172 </p>
5173 </dd>
5174 <dt> &lsquo;<samp>blockx</samp>&rsquo;</dt>
5175 <dt> &lsquo;<samp>blocky</samp>&rsquo;</dt>
5176 <dd><p>Respectively set the x-axis and y-axis size of the window used during combed
5177 frame detection. This has to do with the size of the area in which
5178 &lsquo;<samp>combpel</samp>&rsquo; pixels are required to be detected as combed for a frame to be
5179 declared combed. See the &lsquo;<samp>combpel</samp>&rsquo; parameter description for more info.
5180 Possible values are any number that is a power of 2 starting at 4 and going up
5181 to 512.
5182 </p>
5183 <p>Default value is <code>16</code>.
5184 </p>
5185 </dd>
5186 <dt> &lsquo;<samp>combpel</samp>&rsquo;</dt>
5187 <dd><p>The number of combed pixels inside any of the &lsquo;<samp>blocky</samp>&rsquo; by
5188 &lsquo;<samp>blockx</samp>&rsquo; size blocks on the frame for the frame to be detected as
5189 combed. While &lsquo;<samp>cthresh</samp>&rsquo; controls how &quot;visible&quot; the combing must be, this
5190 setting controls &quot;how much&quot; combing there must be in any localized area (a
5191 window defined by the &lsquo;<samp>blockx</samp>&rsquo; and &lsquo;<samp>blocky</samp>&rsquo; settings) on the
5192 frame. Minimum value is <code>0</code> and maximum is <code>blocky x blockx</code> (at
5193 which point no frames will ever be detected as combed). This setting is known
5194 as &lsquo;<samp>MI</samp>&rsquo; in TFM/VFM vocabulary.
5195 </p>
5196 <p>Default value is <code>80</code>.
5197 </p></dd>
5198 </dl>
5199
5200 <p><a name="p_002fc_002fn_002fu_002fb-meaning"></a>
5201 </p><a name="p_002fc_002fn_002fu_002fb-meaning-1"></a>
5202 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-p_002fc_002fn_002fu_002fb-meaning-1">9.29.1 p/c/n/u/b meaning</a></h3>
5203
5204 <a name="p_002fc_002fn"></a>
5205 <h4 class="subsubsection"><a href="ffmpeg-filters.html#toc-p_002fc_002fn">9.29.1.1 p/c/n</a></h4>
5206
5207 <p>We assume the following telecined stream:
5208 </p>
5209 <table><tr><td>&nbsp;</td><td><pre class="example">Top fields:     1 2 2 3 4
5210 Bottom fields:  1 2 3 4 4
5211 </pre></td></tr></table>
5212
5213 <p>The numbers correspond to the progressive frame the fields relate to. Here, the
5214 first two frames are progressive, the 3rd and 4th are combed, and so on.
5215 </p>
5216 <p>When <code>fieldmatch</code> is configured to run a matching from bottom
5217 (&lsquo;<samp>field</samp>&rsquo;=<var>bottom</var>) this is how this input stream get transformed:
5218 </p>
5219 <table><tr><td>&nbsp;</td><td><pre class="example">Input stream:
5220                 T     1 2 2 3 4
5221                 B     1 2 3 4 4   &lt;-- matching reference
5222
5223 Matches:              c c n n c
5224
5225 Output stream:
5226                 T     1 2 3 4 4
5227                 B     1 2 3 4 4
5228 </pre></td></tr></table>
5229
5230 <p>As a result of the field matching, we can see that some frames get duplicated.
5231 To perform a complete inverse telecine, you need to rely on a decimation filter
5232 after this operation. See for instance the <a href="#decimate">decimate</a> filter.
5233 </p>
5234 <p>The same operation now matching from top fields (&lsquo;<samp>field</samp>&rsquo;=<var>top</var>)
5235 looks like this:
5236 </p>
5237 <table><tr><td>&nbsp;</td><td><pre class="example">Input stream:
5238                 T     1 2 2 3 4   &lt;-- matching reference
5239                 B     1 2 3 4 4
5240
5241 Matches:              c c p p c
5242
5243 Output stream:
5244                 T     1 2 2 3 4
5245                 B     1 2 2 3 4
5246 </pre></td></tr></table>
5247
5248 <p>In these examples, we can see what <var>p</var>, <var>c</var> and <var>n</var> mean;
5249 basically, they refer to the frame and field of the opposite parity:
5250 </p>
5251 <ul>
5252 <li> <var>p</var> matches the field of the opposite parity in the previous frame
5253 </li><li> <var>c</var> matches the field of the opposite parity in the current frame
5254 </li><li> <var>n</var> matches the field of the opposite parity in the next frame
5255 </li></ul>
5256
5257 <a name="u_002fb"></a>
5258 <h4 class="subsubsection"><a href="ffmpeg-filters.html#toc-u_002fb">9.29.1.2 u/b</a></h4>
5259
5260 <p>The <var>u</var> and <var>b</var> matching are a bit special in the sense that they match
5261 from the opposite parity flag. In the following examples, we assume that we are
5262 currently matching the 2nd frame (Top:2, bottom:2). According to the match, a
5263 &rsquo;x&rsquo; is placed above and below each matched fields.
5264 </p>
5265 <p>With bottom matching (&lsquo;<samp>field</samp>&rsquo;=<var>bottom</var>):
5266 </p><table><tr><td>&nbsp;</td><td><pre class="example">Match:           c         p           n          b          u
5267
5268                  x       x               x        x          x
5269   Top          1 2 2     1 2 2       1 2 2      1 2 2      1 2 2
5270   Bottom       1 2 3     1 2 3       1 2 3      1 2 3      1 2 3
5271                  x         x           x        x              x
5272
5273 Output frames:
5274                  2          1          2          2          2
5275                  2          2          2          1          3
5276 </pre></td></tr></table>
5277
5278 <p>With top matching (&lsquo;<samp>field</samp>&rsquo;=<var>top</var>):
5279 </p><table><tr><td>&nbsp;</td><td><pre class="example">Match:           c         p           n          b          u
5280
5281                  x         x           x        x              x
5282   Top          1 2 2     1 2 2       1 2 2      1 2 2      1 2 2
5283   Bottom       1 2 3     1 2 3       1 2 3      1 2 3      1 2 3
5284                  x       x               x        x          x
5285
5286 Output frames:
5287                  2          2          2          1          2
5288                  2          1          3          2          2
5289 </pre></td></tr></table>
5290
5291 <a name="Examples-30"></a>
5292 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-30">9.29.2 Examples</a></h3>
5293
5294 <p>Simple IVTC of a top field first telecined stream:
5295 </p><table><tr><td>&nbsp;</td><td><pre class="example">fieldmatch=order=tff:combmatch=none, decimate
5296 </pre></td></tr></table>
5297
5298 <p>Advanced IVTC, with fallback on <a href="#yadif">yadif</a> for still combed frames:
5299 </p><table><tr><td>&nbsp;</td><td><pre class="example">fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
5300 </pre></td></tr></table>
5301
5302 <a name="fieldorder"></a>
5303 <h2 class="section"><a href="ffmpeg-filters.html#toc-fieldorder">9.30 fieldorder</a></h2>
5304
5305 <p>Transform the field order of the input video.
5306 </p>
5307 <p>This filter accepts the following options:
5308 </p>
5309 <dl compact="compact">
5310 <dt> &lsquo;<samp>order</samp>&rsquo;</dt>
5311 <dd><p>Output field order. Valid values are <var>tff</var> for top field first or <var>bff</var>
5312 for bottom field first.
5313 </p></dd>
5314 </dl>
5315
5316 <p>Default value is &lsquo;<samp>tff</samp>&rsquo;.
5317 </p>
5318 <p>Transformation is achieved by shifting the picture content up or down
5319 by one line, and filling the remaining line with appropriate picture content.
5320 This method is consistent with most broadcast field order converters.
5321 </p>
5322 <p>If the input video is not flagged as being interlaced, or it is already
5323 flagged as being of the required output field order then this filter does
5324 not alter the incoming video.
5325 </p>
5326 <p>This filter is very useful when converting to or from PAL DV material,
5327 which is bottom field first.
5328 </p>
5329 <p>For example:
5330 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.vob -vf &quot;fieldorder=bff&quot; out.dv
5331 </pre></td></tr></table>
5332
5333 <a name="fifo"></a>
5334 <h2 class="section"><a href="ffmpeg-filters.html#toc-fifo">9.31 fifo</a></h2>
5335
5336 <p>Buffer input images and send them when they are requested.
5337 </p>
5338 <p>This filter is mainly useful when auto-inserted by the libavfilter
5339 framework.
5340 </p>
5341 <p>The filter does not take parameters.
5342 </p>
5343 <p><a name="format"></a>
5344 </p><a name="format-1"></a>
5345 <h2 class="section"><a href="ffmpeg-filters.html#toc-format-1">9.32 format</a></h2>
5346
5347 <p>Convert the input video to one of the specified pixel formats.
5348 Libavfilter will try to pick one that is supported for the input to
5349 the next filter.
5350 </p>
5351 <p>This filter accepts the following parameters:
5352 </p><dl compact="compact">
5353 <dt> &lsquo;<samp>pix_fmts</samp>&rsquo;</dt>
5354 <dd><p>A &rsquo;|&rsquo;-separated list of pixel format names, for example
5355 &quot;pix_fmts=yuv420p|monow|rgb24&quot;.
5356 </p>
5357 </dd>
5358 </dl>
5359
5360 <a name="Examples-71"></a>
5361 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-71">9.32.1 Examples</a></h3>
5362
5363 <ul>
5364 <li>
5365 Convert the input video to the format <var>yuv420p</var>
5366 <table><tr><td>&nbsp;</td><td><pre class="example">format=pix_fmts=yuv420p
5367 </pre></td></tr></table>
5368
5369 <p>Convert the input video to any of the formats in the list
5370 </p><table><tr><td>&nbsp;</td><td><pre class="example">format=pix_fmts=yuv420p|yuv444p|yuv410p
5371 </pre></td></tr></table>
5372 </li></ul>
5373
5374 <p><a name="fps"></a>
5375 </p><a name="fps-1"></a>
5376 <h2 class="section"><a href="ffmpeg-filters.html#toc-fps-1">9.33 fps</a></h2>
5377
5378 <p>Convert the video to specified constant frame rate by duplicating or dropping
5379 frames as necessary.
5380 </p>
5381 <p>This filter accepts the following named parameters:
5382 </p><dl compact="compact">
5383 <dt> &lsquo;<samp>fps</samp>&rsquo;</dt>
5384 <dd><p>Desired output frame rate. The default is <code>25</code>.
5385 </p>
5386 </dd>
5387 <dt> &lsquo;<samp>round</samp>&rsquo;</dt>
5388 <dd><p>Rounding method.
5389 </p>
5390 <p>Possible values are:
5391 </p><dl compact="compact">
5392 <dt> &lsquo;<samp>zero</samp>&rsquo;</dt>
5393 <dd><p>zero round towards 0
5394 </p></dd>
5395 <dt> &lsquo;<samp>inf</samp>&rsquo;</dt>
5396 <dd><p>round away from 0
5397 </p></dd>
5398 <dt> &lsquo;<samp>down</samp>&rsquo;</dt>
5399 <dd><p>round towards -infinity
5400 </p></dd>
5401 <dt> &lsquo;<samp>up</samp>&rsquo;</dt>
5402 <dd><p>round towards +infinity
5403 </p></dd>
5404 <dt> &lsquo;<samp>near</samp>&rsquo;</dt>
5405 <dd><p>round to nearest
5406 </p></dd>
5407 </dl>
5408 <p>The default is <code>near</code>.
5409 </p>
5410 </dd>
5411 <dt> &lsquo;<samp>start_time</samp>&rsquo;</dt>
5412 <dd><p>Assume the first PTS should be the given value, in seconds. This allows for
5413 padding/trimming at the start of stream. By default, no assumption is made
5414 about the first frame&rsquo;s expected PTS, so no padding or trimming is done.
5415 For example, this could be set to 0 to pad the beginning with duplicates of
5416 the first frame if a video stream starts after the audio stream or to trim any
5417 frames with a negative PTS.
5418 </p>
5419 </dd>
5420 </dl>
5421
5422 <p>Alternatively, the options can be specified as a flat string:
5423 <var>fps</var>[:<var>round</var>].
5424 </p>
5425 <p>See also the <a href="#setpts">setpts</a> filter.
5426 </p>
5427 <a name="Examples-31"></a>
5428 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-31">9.33.1 Examples</a></h3>
5429
5430 <ul>
5431 <li>
5432 A typical usage in order to set the fps to 25:
5433 <table><tr><td>&nbsp;</td><td><pre class="example">fps=fps=25
5434 </pre></td></tr></table>
5435
5436 </li><li>
5437 Sets the fps to 24, using abbreviation and rounding method to round to nearest:
5438 <table><tr><td>&nbsp;</td><td><pre class="example">fps=fps=film:round=near
5439 </pre></td></tr></table>
5440 </li></ul>
5441
5442 <a name="framepack"></a>
5443 <h2 class="section"><a href="ffmpeg-filters.html#toc-framepack">9.34 framepack</a></h2>
5444
5445 <p>Pack two different video streams into a stereoscopic video, setting proper
5446 metadata on supported codecs. The two views should have the same size and
5447 framerate and processing will stop when the shorter video ends. Please note
5448 that you may conveniently adjust view properties with the <a href="#scale">scale</a> and
5449 <a href="#fps">fps</a> filters.
5450 </p>
5451 <p>This filter accepts the following named parameters:
5452 </p><dl compact="compact">
5453 <dt> &lsquo;<samp>format</samp>&rsquo;</dt>
5454 <dd><p>Desired packing format. Supported values are:
5455 </p>
5456 <dl compact="compact">
5457 <dt> &lsquo;<samp>sbs</samp>&rsquo;</dt>
5458 <dd><p>Views are next to each other (default).
5459 </p>
5460 </dd>
5461 <dt> &lsquo;<samp>tab</samp>&rsquo;</dt>
5462 <dd><p>Views are on top of each other.
5463 </p>
5464 </dd>
5465 <dt> &lsquo;<samp>lines</samp>&rsquo;</dt>
5466 <dd><p>Views are packed by line.
5467 </p>
5468 </dd>
5469 <dt> &lsquo;<samp>columns</samp>&rsquo;</dt>
5470 <dd><p>Views are eacked by column.
5471 </p>
5472 </dd>
5473 <dt> &lsquo;<samp>frameseq</samp>&rsquo;</dt>
5474 <dd><p>Views are temporally interleaved.
5475 </p>
5476 </dd>
5477 </dl>
5478
5479 </dd>
5480 </dl>
5481
5482 <p>Some examples follow:
5483 </p>
5484 <table><tr><td>&nbsp;</td><td><pre class="example"># Convert left and right views into a frame sequential video.
5485 ffmpeg -i LEFT -i RIGHT -filter_complex framepack=frameseq OUTPUT
5486
5487 # Convert views into a side-by-side video with the same output resolution as the input.
5488 ffmpeg -i LEFT -i RIGHT -filter_complex [0:v]scale=w=iw/2[left],[1:v]scale=w=iw/2[right],[left][right]framepack=sbs OUTPUT
5489 </pre></td></tr></table>
5490
5491 <a name="framestep"></a>
5492 <h2 class="section"><a href="ffmpeg-filters.html#toc-framestep">9.35 framestep</a></h2>
5493
5494 <p>Select one frame every N-th frame.
5495 </p>
5496 <p>This filter accepts the following option:
5497 </p><dl compact="compact">
5498 <dt> &lsquo;<samp>step</samp>&rsquo;</dt>
5499 <dd><p>Select frame after every <code>step</code> frames.
5500 Allowed values are positive integers higher than 0. Default value is <code>1</code>.
5501 </p></dd>
5502 </dl>
5503
5504 <p><a name="frei0r"></a>
5505 </p><a name="frei0r-1"></a>
5506 <h2 class="section"><a href="ffmpeg-filters.html#toc-frei0r-1">9.36 frei0r</a></h2>
5507
5508 <p>Apply a frei0r effect to the input video.
5509 </p>
5510 <p>To enable compilation of this filter you need to install the frei0r
5511 header and configure FFmpeg with <code>--enable-frei0r</code>.
5512 </p>
5513 <p>This filter accepts the following options:
5514 </p>
5515 <dl compact="compact">
5516 <dt> &lsquo;<samp>filter_name</samp>&rsquo;</dt>
5517 <dd><p>The name to the frei0r effect to load. If the environment variable
5518 <code>FREI0R_PATH</code> is defined, the frei0r effect is searched in each one of the
5519 directories specified by the colon separated list in <code>FREIOR_PATH</code>,
5520 otherwise in the standard frei0r paths, which are in this order:
5521 &lsquo;<tt>HOME/.frei0r-1/lib/</tt>&rsquo;, &lsquo;<tt>/usr/local/lib/frei0r-1/</tt>&rsquo;,
5522 &lsquo;<tt>/usr/lib/frei0r-1/</tt>&rsquo;.
5523 </p>
5524 </dd>
5525 <dt> &lsquo;<samp>filter_params</samp>&rsquo;</dt>
5526 <dd><p>A &rsquo;|&rsquo;-separated list of parameters to pass to the frei0r effect.
5527 </p>
5528 </dd>
5529 </dl>
5530
5531 <p>A frei0r effect parameter can be a boolean (whose values are specified
5532 with &quot;y&quot; and &quot;n&quot;), a double, a color (specified by the syntax
5533 <var>R</var>/<var>G</var>/<var>B</var>, (<var>R</var>, <var>G</var>, and <var>B</var> being float
5534 numbers from 0.0 to 1.0) or by a color description specified in the &quot;Color&quot;
5535 section in the ffmpeg-utils manual), a position (specified by the syntax <var>X</var>/<var>Y</var>,
5536 <var>X</var> and <var>Y</var> being float numbers) and a string.
5537 </p>
5538 <p>The number and kind of parameters depend on the loaded effect. If an
5539 effect parameter is not specified the default value is set.
5540 </p>
5541 <a name="Examples-49"></a>
5542 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-49">9.36.1 Examples</a></h3>
5543
5544 <ul>
5545 <li>
5546 Apply the distort0r effect, set the first two double parameters:
5547 <table><tr><td>&nbsp;</td><td><pre class="example">frei0r=filter_name=distort0r:filter_params=0.5|0.01
5548 </pre></td></tr></table>
5549
5550 </li><li>
5551 Apply the colordistance effect, take a color as first parameter:
5552 <table><tr><td>&nbsp;</td><td><pre class="example">frei0r=colordistance:0.2/0.3/0.4
5553 frei0r=colordistance:violet
5554 frei0r=colordistance:0x112233
5555 </pre></td></tr></table>
5556
5557 </li><li>
5558 Apply the perspective effect, specify the top left and top right image
5559 positions:
5560 <table><tr><td>&nbsp;</td><td><pre class="example">frei0r=perspective:0.2/0.2|0.8/0.2
5561 </pre></td></tr></table>
5562 </li></ul>
5563
5564 <p>For more information see:
5565 <a href="http://frei0r.dyne.org">http://frei0r.dyne.org</a>
5566 </p>
5567 <a name="geq"></a>
5568 <h2 class="section"><a href="ffmpeg-filters.html#toc-geq">9.37 geq</a></h2>
5569
5570 <p>The filter accepts the following options:
5571 </p>
5572 <dl compact="compact">
5573 <dt> &lsquo;<samp>lum_expr, lum</samp>&rsquo;</dt>
5574 <dd><p>Set the luminance expression.
5575 </p></dd>
5576 <dt> &lsquo;<samp>cb_expr, cb</samp>&rsquo;</dt>
5577 <dd><p>Set the chrominance blue expression.
5578 </p></dd>
5579 <dt> &lsquo;<samp>cr_expr, cr</samp>&rsquo;</dt>
5580 <dd><p>Set the chrominance red expression.
5581 </p></dd>
5582 <dt> &lsquo;<samp>alpha_expr, a</samp>&rsquo;</dt>
5583 <dd><p>Set the alpha expression.
5584 </p></dd>
5585 <dt> &lsquo;<samp>red_expr, r</samp>&rsquo;</dt>
5586 <dd><p>Set the red expression.
5587 </p></dd>
5588 <dt> &lsquo;<samp>green_expr, g</samp>&rsquo;</dt>
5589 <dd><p>Set the green expression.
5590 </p></dd>
5591 <dt> &lsquo;<samp>blue_expr, b</samp>&rsquo;</dt>
5592 <dd><p>Set the blue expression.
5593 </p></dd>
5594 </dl>
5595
5596 <p>The colorspace is selected according to the specified options. If one
5597 of the &lsquo;<samp>lum_expr</samp>&rsquo;, &lsquo;<samp>cb_expr</samp>&rsquo;, or &lsquo;<samp>cr_expr</samp>&rsquo;
5598 options is specified, the filter will automatically select a YCbCr
5599 colorspace. If one of the &lsquo;<samp>red_expr</samp>&rsquo;, &lsquo;<samp>green_expr</samp>&rsquo;, or
5600 &lsquo;<samp>blue_expr</samp>&rsquo; options is specified, it will select an RGB
5601 colorspace.
5602 </p>
5603 <p>If one of the chrominance expression is not defined, it falls back on the other
5604 one. If no alpha expression is specified it will evaluate to opaque value.
5605 If none of chrominance expressions are specified, they will evaluate
5606 to the luminance expression.
5607 </p>
5608 <p>The expressions can use the following variables and functions:
5609 </p>
5610 <dl compact="compact">
5611 <dt> &lsquo;<samp>N</samp>&rsquo;</dt>
5612 <dd><p>The sequential number of the filtered frame, starting from <code>0</code>.
5613 </p>
5614 </dd>
5615 <dt> &lsquo;<samp>X</samp>&rsquo;</dt>
5616 <dt> &lsquo;<samp>Y</samp>&rsquo;</dt>
5617 <dd><p>The coordinates of the current sample.
5618 </p>
5619 </dd>
5620 <dt> &lsquo;<samp>W</samp>&rsquo;</dt>
5621 <dt> &lsquo;<samp>H</samp>&rsquo;</dt>
5622 <dd><p>The width and height of the image.
5623 </p>
5624 </dd>
5625 <dt> &lsquo;<samp>SW</samp>&rsquo;</dt>
5626 <dt> &lsquo;<samp>SH</samp>&rsquo;</dt>
5627 <dd><p>Width and height scale depending on the currently filtered plane. It is the
5628 ratio between the corresponding luma plane number of pixels and the current
5629 plane ones. E.g. for YUV4:2:0 the values are <code>1,1</code> for the luma plane, and
5630 <code>0.5,0.5</code> for chroma planes.
5631 </p>
5632 </dd>
5633 <dt> &lsquo;<samp>T</samp>&rsquo;</dt>
5634 <dd><p>Time of the current frame, expressed in seconds.
5635 </p>
5636 </dd>
5637 <dt> &lsquo;<samp>p(x, y)</samp>&rsquo;</dt>
5638 <dd><p>Return the value of the pixel at location (<var>x</var>,<var>y</var>) of the current
5639 plane.
5640 </p>
5641 </dd>
5642 <dt> &lsquo;<samp>lum(x, y)</samp>&rsquo;</dt>
5643 <dd><p>Return the value of the pixel at location (<var>x</var>,<var>y</var>) of the luminance
5644 plane.
5645 </p>
5646 </dd>
5647 <dt> &lsquo;<samp>cb(x, y)</samp>&rsquo;</dt>
5648 <dd><p>Return the value of the pixel at location (<var>x</var>,<var>y</var>) of the
5649 blue-difference chroma plane. Return 0 if there is no such plane.
5650 </p>
5651 </dd>
5652 <dt> &lsquo;<samp>cr(x, y)</samp>&rsquo;</dt>
5653 <dd><p>Return the value of the pixel at location (<var>x</var>,<var>y</var>) of the
5654 red-difference chroma plane. Return 0 if there is no such plane.
5655 </p>
5656 </dd>
5657 <dt> &lsquo;<samp>r(x, y)</samp>&rsquo;</dt>
5658 <dt> &lsquo;<samp>g(x, y)</samp>&rsquo;</dt>
5659 <dt> &lsquo;<samp>b(x, y)</samp>&rsquo;</dt>
5660 <dd><p>Return the value of the pixel at location (<var>x</var>,<var>y</var>) of the
5661 red/green/blue component. Return 0 if there is no such component.
5662 </p>
5663 </dd>
5664 <dt> &lsquo;<samp>alpha(x, y)</samp>&rsquo;</dt>
5665 <dd><p>Return the value of the pixel at location (<var>x</var>,<var>y</var>) of the alpha
5666 plane. Return 0 if there is no such plane.
5667 </p></dd>
5668 </dl>
5669
5670 <p>For functions, if <var>x</var> and <var>y</var> are outside the area, the value will be
5671 automatically clipped to the closer edge.
5672 </p>
5673 <a name="Examples-29"></a>
5674 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-29">9.37.1 Examples</a></h3>
5675
5676 <ul>
5677 <li>
5678 Flip the image horizontally:
5679 <table><tr><td>&nbsp;</td><td><pre class="example">geq=p(W-X\,Y)
5680 </pre></td></tr></table>
5681
5682 </li><li>
5683 Generate a bidimensional sine wave, with angle <code>PI/3</code> and a
5684 wavelength of 100 pixels:
5685 <table><tr><td>&nbsp;</td><td><pre class="example">geq=128 + 100*sin(2*(PI/100)*(cos(PI/3)*(X-50*T) + sin(PI/3)*Y)):128:128
5686 </pre></td></tr></table>
5687
5688 </li><li>
5689 Generate a fancy enigmatic moving light:
5690 <table><tr><td>&nbsp;</td><td><pre class="example">nullsrc=s=256x256,geq=random(1)/hypot(X-cos(N*0.07)*W/2-W/2\,Y-sin(N*0.09)*H/2-H/2)^2*1000000*sin(N*0.02):128:128
5691 </pre></td></tr></table>
5692
5693 </li><li>
5694 Generate a quick emboss effect:
5695 <table><tr><td>&nbsp;</td><td><pre class="example">format=gray,geq=lum_expr='(p(X,Y)+(256-p(X-4,Y-4)))/2'
5696 </pre></td></tr></table>
5697
5698 </li><li>
5699 Modify RGB components depending on pixel position:
5700 <table><tr><td>&nbsp;</td><td><pre class="example">geq=r='X/W*r(X,Y)':g='(1-X/W)*g(X,Y)':b='(H-Y)/H*b(X,Y)'
5701 </pre></td></tr></table>
5702 </li></ul>
5703
5704 <a name="gradfun"></a>
5705 <h2 class="section"><a href="ffmpeg-filters.html#toc-gradfun">9.38 gradfun</a></h2>
5706
5707 <p>Fix the banding artifacts that are sometimes introduced into nearly flat
5708 regions by truncation to 8bit color depth.
5709 Interpolate the gradients that should go where the bands are, and
5710 dither them.
5711 </p>
5712 <p>This filter is designed for playback only.  Do not use it prior to
5713 lossy compression, because compression tends to lose the dither and
5714 bring back the bands.
5715 </p>
5716 <p>This filter accepts the following options:
5717 </p>
5718 <dl compact="compact">
5719 <dt> &lsquo;<samp>strength</samp>&rsquo;</dt>
5720 <dd><p>The maximum amount by which the filter will change any one pixel. Also the
5721 threshold for detecting nearly flat regions. Acceptable values range from .51 to
5722 64, default value is 1.2, out-of-range values will be clipped to the valid
5723 range.
5724 </p>
5725 </dd>
5726 <dt> &lsquo;<samp>radius</samp>&rsquo;</dt>
5727 <dd><p>The neighborhood to fit the gradient to. A larger radius makes for smoother
5728 gradients, but also prevents the filter from modifying the pixels near detailed
5729 regions. Acceptable values are 8-32, default value is 16, out-of-range values
5730 will be clipped to the valid range.
5731 </p>
5732 </dd>
5733 </dl>
5734
5735 <p>Alternatively, the options can be specified as a flat string:
5736 <var>strength</var>[:<var>radius</var>]
5737 </p>
5738 <a name="Examples-41"></a>
5739 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-41">9.38.1 Examples</a></h3>
5740
5741 <ul>
5742 <li>
5743 Apply the filter with a <code>3.5</code> strength and radius of <code>8</code>:
5744 <table><tr><td>&nbsp;</td><td><pre class="example">gradfun=3.5:8
5745 </pre></td></tr></table>
5746
5747 </li><li>
5748 Specify radius, omitting the strength (which will fall-back to the default
5749 value):
5750 <table><tr><td>&nbsp;</td><td><pre class="example">gradfun=radius=8
5751 </pre></td></tr></table>
5752
5753 </li></ul>
5754
5755 <p><a name="haldclut"></a>
5756 </p><a name="haldclut-1"></a>
5757 <h2 class="section"><a href="ffmpeg-filters.html#toc-haldclut-1">9.39 haldclut</a></h2>
5758
5759 <p>Apply a Hald CLUT to a video stream.
5760 </p>
5761 <p>First input is the video stream to process, and second one is the Hald CLUT.
5762 The Hald CLUT input can be a simple picture or a complete video stream.
5763 </p>
5764 <p>The filter accepts the following options:
5765 </p>
5766 <dl compact="compact">
5767 <dt> &lsquo;<samp>shortest</samp>&rsquo;</dt>
5768 <dd><p>Force termination when the shortest input terminates. Default is <code>0</code>.
5769 </p></dd>
5770 <dt> &lsquo;<samp>repeatlast</samp>&rsquo;</dt>
5771 <dd><p>Continue applying the last CLUT after the end of the stream. A value of
5772 <code>0</code> disable the filter after the last frame of the CLUT is reached.
5773 Default is <code>1</code>.
5774 </p></dd>
5775 </dl>
5776
5777 <p><code>haldclut</code> also has the same interpolation options as <a href="#lut3d">lut3d</a> (both
5778 filters share the same internals).
5779 </p>
5780 <p>More information about the Hald CLUT can be found on Eskil Steenberg&rsquo;s website
5781 (Hald CLUT author) at <a href="http://www.quelsolaar.com/technology/clut.html">http://www.quelsolaar.com/technology/clut.html</a>.
5782 </p>
5783 <a name="Workflow-examples"></a>
5784 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Workflow-examples">9.39.1 Workflow examples</a></h3>
5785
5786 <a name="Hald-CLUT-video-stream"></a>
5787 <h4 class="subsubsection"><a href="ffmpeg-filters.html#toc-Hald-CLUT-video-stream">9.39.1.1 Hald CLUT video stream</a></h4>
5788
5789 <p>Generate an identity Hald CLUT stream altered with various effects:
5790 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f lavfi -i <a href="#haldclutsrc">haldclutsrc</a>=8 -vf &quot;hue=H=2*PI*t:s=sin(2*PI*t)+1, curves=cross_process&quot; -t 10 -c:v ffv1 clut.nut
5791 </pre></td></tr></table>
5792
5793 <p>Note: make sure you use a lossless codec.
5794 </p>
5795 <p>Then use it with <code>haldclut</code> to apply it on some random stream:
5796 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f lavfi -i mandelbrot -i clut.nut -filter_complex '[0][1] haldclut' -t 20 mandelclut.mkv
5797 </pre></td></tr></table>
5798
5799 <p>The Hald CLUT will be applied to the 10 first seconds (duration of
5800 &lsquo;<tt>clut.nut</tt>&rsquo;), then the latest picture of that CLUT stream will be applied
5801 to the remaining frames of the <code>mandelbrot</code> stream.
5802 </p>
5803 <a name="Hald-CLUT-with-preview"></a>
5804 <h4 class="subsubsection"><a href="ffmpeg-filters.html#toc-Hald-CLUT-with-preview">9.39.1.2 Hald CLUT with preview</a></h4>
5805
5806 <p>A Hald CLUT is supposed to be a squared image of <code>Level*Level*Level</code> by
5807 <code>Level*Level*Level</code> pixels. For a given Hald CLUT, FFmpeg will select the
5808 biggest possible square starting at the top left of the picture. The remaining
5809 padding pixels (bottom or right) will be ignored. This area can be used to add
5810 a preview of the Hald CLUT.
5811 </p>
5812 <p>Typically, the following generated Hald CLUT will be supported by the
5813 <code>haldclut</code> filter:
5814 </p>
5815 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f lavfi -i <a href="#haldclutsrc">haldclutsrc</a>=8 -vf &quot;
5816    pad=iw+320 [padded_clut];
5817    smptebars=s=320x256, split [a][b];
5818    [padded_clut][a] overlay=W-320:h, curves=color_negative [main];
5819    [main][b] overlay=W-320&quot; -frames:v 1 clut.png
5820 </pre></td></tr></table>
5821
5822 <p>It contains the original and a preview of the effect of the CLUT: SMPTE color
5823 bars are displayed on the right-top, and below the same color bars processed by
5824 the color changes.
5825 </p>
5826 <p>Then, the effect of this Hald CLUT can be visualized with:
5827 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffplay input.mkv -vf &quot;movie=clut.png, [in] haldclut&quot;
5828 </pre></td></tr></table>
5829
5830 <a name="hflip"></a>
5831 <h2 class="section"><a href="ffmpeg-filters.html#toc-hflip">9.40 hflip</a></h2>
5832
5833 <p>Flip the input video horizontally.
5834 </p>
5835 <p>For example to horizontally flip the input video with <code>ffmpeg</code>:
5836 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -vf &quot;hflip&quot; out.avi
5837 </pre></td></tr></table>
5838
5839 <a name="histeq"></a>
5840 <h2 class="section"><a href="ffmpeg-filters.html#toc-histeq">9.41 histeq</a></h2>
5841 <p>This filter applies a global color histogram equalization on a
5842 per-frame basis.
5843 </p>
5844 <p>It can be used to correct video that has a compressed range of pixel
5845 intensities.  The filter redistributes the pixel intensities to
5846 equalize their distribution across the intensity range. It may be
5847 viewed as an &quot;automatically adjusting contrast filter&quot;. This filter is
5848 useful only for correcting degraded or poorly captured source
5849 video.
5850 </p>
5851 <p>The filter accepts the following options:
5852 </p>
5853 <dl compact="compact">
5854 <dt> &lsquo;<samp>strength</samp>&rsquo;</dt>
5855 <dd><p>Determine the amount of equalization to be applied.  As the strength
5856 is reduced, the distribution of pixel intensities more-and-more
5857 approaches that of the input frame. The value must be a float number
5858 in the range [0,1] and defaults to 0.200.
5859 </p>
5860 </dd>
5861 <dt> &lsquo;<samp>intensity</samp>&rsquo;</dt>
5862 <dd><p>Set the maximum intensity that can generated and scale the output
5863 values appropriately.  The strength should be set as desired and then
5864 the intensity can be limited if needed to avoid washing-out. The value
5865 must be a float number in the range [0,1] and defaults to 0.210.
5866 </p>
5867 </dd>
5868 <dt> &lsquo;<samp>antibanding</samp>&rsquo;</dt>
5869 <dd><p>Set the antibanding level. If enabled the filter will randomly vary
5870 the luminance of output pixels by a small amount to avoid banding of
5871 the histogram. Possible values are <code>none</code>, <code>weak</code> or
5872 <code>strong</code>. It defaults to <code>none</code>.
5873 </p></dd>
5874 </dl>
5875
5876 <a name="histogram"></a>
5877 <h2 class="section"><a href="ffmpeg-filters.html#toc-histogram">9.42 histogram</a></h2>
5878
5879 <p>Compute and draw a color distribution histogram for the input video.
5880 </p>
5881 <p>The computed histogram is a representation of the color component
5882 distribution in an image.
5883 </p>
5884 <p>The filter accepts the following options:
5885 </p>
5886 <dl compact="compact">
5887 <dt> &lsquo;<samp>mode</samp>&rsquo;</dt>
5888 <dd><p>Set histogram mode.
5889 </p>
5890 <p>It accepts the following values:
5891 </p><dl compact="compact">
5892 <dt> &lsquo;<samp>levels</samp>&rsquo;</dt>
5893 <dd><p>Standard histogram that displays the color components distribution in an
5894 image. Displays color graph for each color component. Shows distribution of
5895 the Y, U, V, A or R, G, B components, depending on input format, in the
5896 current frame. Below each graph a color component scale meter is shown.
5897 </p>
5898 </dd>
5899 <dt> &lsquo;<samp>color</samp>&rsquo;</dt>
5900 <dd><p>Displays chroma values (U/V color placement) in a two dimensional
5901 graph (which is called a vectorscope). The brighter a pixel in the
5902 vectorscope, the more pixels of the input frame correspond to that pixel
5903 (i.e., more pixels have this chroma value). The V component is displayed on
5904 the horizontal (X) axis, with the leftmost side being V = 0 and the rightmost
5905 side being V = 255. The U component is displayed on the vertical (Y) axis,
5906 with the top representing U = 0 and the bottom representing U = 255.
5907 </p>
5908 <p>The position of a white pixel in the graph corresponds to the chroma value of
5909 a pixel of the input clip. The graph can therefore be used to read the hue
5910 (color flavor) and the saturation (the dominance of the hue in the color). As
5911 the hue of a color changes, it moves around the square. At the center of the
5912 square the saturation is zero, which means that the corresponding pixel has no
5913 color. If the amount of a specific color is increased (while leaving the other
5914 colors unchanged) the saturation increases, and the indicator moves towards
5915 the edge of the square.
5916 </p>
5917 </dd>
5918 <dt> &lsquo;<samp>color2</samp>&rsquo;</dt>
5919 <dd><p>Chroma values in vectorscope, similar as <code>color</code> but actual chroma values
5920 are displayed.
5921 </p>
5922 </dd>
5923 <dt> &lsquo;<samp>waveform</samp>&rsquo;</dt>
5924 <dd><p>Per row/column color component graph. In row mode, the graph on the left side
5925 represents color component value 0 and the right side represents value = 255.
5926 In column mode, the top side represents color component value = 0 and bottom
5927 side represents value = 255.
5928 </p></dd>
5929 </dl>
5930 <p>Default value is <code>levels</code>.
5931 </p>
5932 </dd>
5933 <dt> &lsquo;<samp>level_height</samp>&rsquo;</dt>
5934 <dd><p>Set height of level in <code>levels</code>. Default value is <code>200</code>.
5935 Allowed range is [50, 2048].
5936 </p>
5937 </dd>
5938 <dt> &lsquo;<samp>scale_height</samp>&rsquo;</dt>
5939 <dd><p>Set height of color scale in <code>levels</code>. Default value is <code>12</code>.
5940 Allowed range is [0, 40].
5941 </p>
5942 </dd>
5943 <dt> &lsquo;<samp>step</samp>&rsquo;</dt>
5944 <dd><p>Set step for <code>waveform</code> mode. Smaller values are useful to find out how
5945 many values of the same luminance are distributed across input rows/columns.
5946 Default value is <code>10</code>. Allowed range is [1, 255].
5947 </p>
5948 </dd>
5949 <dt> &lsquo;<samp>waveform_mode</samp>&rsquo;</dt>
5950 <dd><p>Set mode for <code>waveform</code>. Can be either <code>row</code>, or <code>column</code>.
5951 Default is <code>row</code>.
5952 </p>
5953 </dd>
5954 <dt> &lsquo;<samp>waveform_mirror</samp>&rsquo;</dt>
5955 <dd><p>Set mirroring mode for <code>waveform</code>. <code>0</code> means unmirrored, <code>1</code>
5956 means mirrored. In mirrored mode, higher values will be represented on the left
5957 side for <code>row</code> mode and at the top for <code>column</code> mode. Default is
5958 <code>0</code> (unmirrored).
5959 </p>
5960 </dd>
5961 <dt> &lsquo;<samp>display_mode</samp>&rsquo;</dt>
5962 <dd><p>Set display mode for <code>waveform</code> and <code>levels</code>.
5963 It accepts the following values:
5964 </p><dl compact="compact">
5965 <dt> &lsquo;<samp>parade</samp>&rsquo;</dt>
5966 <dd><p>Display separate graph for the color components side by side in
5967 <code>row</code> waveform mode or one below the other in <code>column</code> waveform mode
5968 for <code>waveform</code> histogram mode. For <code>levels</code> histogram mode,
5969 per color component graphs are placed below each other.
5970 </p>
5971 <p>Using this display mode in <code>waveform</code> histogram mode makes it easy to
5972 spot color casts in the highlights and shadows of an image, by comparing the
5973 contours of the top and the bottom graphs of each waveform. Since whites,
5974 grays, and blacks are characterized by exactly equal amounts of red, green,
5975 and blue, neutral areas of the picture should display three waveforms of
5976 roughly equal width/height. If not, the correction is easy to perform by
5977 making level adjustments the three waveforms.
5978 </p>
5979 </dd>
5980 <dt> &lsquo;<samp>overlay</samp>&rsquo;</dt>
5981 <dd><p>Presents information identical to that in the <code>parade</code>, except
5982 that the graphs representing color components are superimposed directly
5983 over one another.
5984 </p>
5985 <p>This display mode in <code>waveform</code> histogram mode makes it easier to spot
5986 relative differences or similarities in overlapping areas of the color
5987 components that are supposed to be identical, such as neutral whites, grays,
5988 or blacks.
5989 </p></dd>
5990 </dl>
5991 <p>Default is <code>parade</code>.
5992 </p>
5993 </dd>
5994 <dt> &lsquo;<samp>levels_mode</samp>&rsquo;</dt>
5995 <dd><p>Set mode for <code>levels</code>. Can be either <code>linear</code>, or <code>logarithmic</code>.
5996 Default is <code>linear</code>.
5997 </p></dd>
5998 </dl>
5999
6000 <a name="Examples-52"></a>
6001 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-52">9.42.1 Examples</a></h3>
6002
6003 <ul>
6004 <li>
6005 Calculate and draw histogram:
6006 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay -i input -vf histogram
6007 </pre></td></tr></table>
6008
6009 </li></ul>
6010
6011 <p><a name="hqdn3d"></a>
6012 </p><a name="hqdn3d-1"></a>
6013 <h2 class="section"><a href="ffmpeg-filters.html#toc-hqdn3d-1">9.43 hqdn3d</a></h2>
6014
6015 <p>High precision/quality 3d denoise filter. This filter aims to reduce
6016 image noise producing smooth images and making still images really
6017 still. It should enhance compressibility.
6018 </p>
6019 <p>It accepts the following optional parameters:
6020 </p>
6021 <dl compact="compact">
6022 <dt> &lsquo;<samp>luma_spatial</samp>&rsquo;</dt>
6023 <dd><p>a non-negative float number which specifies spatial luma strength,
6024 defaults to 4.0
6025 </p>
6026 </dd>
6027 <dt> &lsquo;<samp>chroma_spatial</samp>&rsquo;</dt>
6028 <dd><p>a non-negative float number which specifies spatial chroma strength,
6029 defaults to 3.0*<var>luma_spatial</var>/4.0
6030 </p>
6031 </dd>
6032 <dt> &lsquo;<samp>luma_tmp</samp>&rsquo;</dt>
6033 <dd><p>a float number which specifies luma temporal strength, defaults to
6034 6.0*<var>luma_spatial</var>/4.0
6035 </p>
6036 </dd>
6037 <dt> &lsquo;<samp>chroma_tmp</samp>&rsquo;</dt>
6038 <dd><p>a float number which specifies chroma temporal strength, defaults to
6039 <var>luma_tmp</var>*<var>chroma_spatial</var>/<var>luma_spatial</var>
6040 </p></dd>
6041 </dl>
6042
6043 <a name="hue"></a>
6044 <h2 class="section"><a href="ffmpeg-filters.html#toc-hue">9.44 hue</a></h2>
6045
6046 <p>Modify the hue and/or the saturation of the input.
6047 </p>
6048 <p>This filter accepts the following options:
6049 </p>
6050 <dl compact="compact">
6051 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
6052 <dd><p>Specify the hue angle as a number of degrees. It accepts an expression,
6053 and defaults to &quot;0&quot;.
6054 </p>
6055 </dd>
6056 <dt> &lsquo;<samp>s</samp>&rsquo;</dt>
6057 <dd><p>Specify the saturation in the [-10,10] range. It accepts an expression and
6058 defaults to &quot;1&quot;.
6059 </p>
6060 </dd>
6061 <dt> &lsquo;<samp>H</samp>&rsquo;</dt>
6062 <dd><p>Specify the hue angle as a number of radians. It accepts an
6063 expression, and defaults to &quot;0&quot;.
6064 </p>
6065 </dd>
6066 <dt> &lsquo;<samp>b</samp>&rsquo;</dt>
6067 <dd><p>Specify the brightness in the [-10,10] range. It accepts an expression and
6068 defaults to &quot;0&quot;.
6069 </p></dd>
6070 </dl>
6071
6072 <p>&lsquo;<samp>h</samp>&rsquo; and &lsquo;<samp>H</samp>&rsquo; are mutually exclusive, and can&rsquo;t be
6073 specified at the same time.
6074 </p>
6075 <p>The &lsquo;<samp>b</samp>&rsquo;, &lsquo;<samp>h</samp>&rsquo;, &lsquo;<samp>H</samp>&rsquo; and &lsquo;<samp>s</samp>&rsquo; option values are
6076 expressions containing the following constants:
6077 </p>
6078 <dl compact="compact">
6079 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
6080 <dd><p>frame count of the input frame starting from 0
6081 </p>
6082 </dd>
6083 <dt> &lsquo;<samp>pts</samp>&rsquo;</dt>
6084 <dd><p>presentation timestamp of the input frame expressed in time base units
6085 </p>
6086 </dd>
6087 <dt> &lsquo;<samp>r</samp>&rsquo;</dt>
6088 <dd><p>frame rate of the input video, NAN if the input frame rate is unknown
6089 </p>
6090 </dd>
6091 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
6092 <dd><p>timestamp expressed in seconds, NAN if the input timestamp is unknown
6093 </p>
6094 </dd>
6095 <dt> &lsquo;<samp>tb</samp>&rsquo;</dt>
6096 <dd><p>time base of the input video
6097 </p></dd>
6098 </dl>
6099
6100 <a name="Examples-42"></a>
6101 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-42">9.44.1 Examples</a></h3>
6102
6103 <ul>
6104 <li>
6105 Set the hue to 90 degrees and the saturation to 1.0:
6106 <table><tr><td>&nbsp;</td><td><pre class="example">hue=h=90:s=1
6107 </pre></td></tr></table>
6108
6109 </li><li>
6110 Same command but expressing the hue in radians:
6111 <table><tr><td>&nbsp;</td><td><pre class="example">hue=H=PI/2:s=1
6112 </pre></td></tr></table>
6113
6114 </li><li>
6115 Rotate hue and make the saturation swing between 0
6116 and 2 over a period of 1 second:
6117 <table><tr><td>&nbsp;</td><td><pre class="example">hue=&quot;H=2*PI*t: s=sin(2*PI*t)+1&quot;
6118 </pre></td></tr></table>
6119
6120 </li><li>
6121 Apply a 3 seconds saturation fade-in effect starting at 0:
6122 <table><tr><td>&nbsp;</td><td><pre class="example">hue=&quot;s=min(t/3\,1)&quot;
6123 </pre></td></tr></table>
6124
6125 <p>The general fade-in expression can be written as:
6126 </p><table><tr><td>&nbsp;</td><td><pre class="example">hue=&quot;s=min(0\, max((t-START)/DURATION\, 1))&quot;
6127 </pre></td></tr></table>
6128
6129 </li><li>
6130 Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
6131 <table><tr><td>&nbsp;</td><td><pre class="example">hue=&quot;s=max(0\, min(1\, (8-t)/3))&quot;
6132 </pre></td></tr></table>
6133
6134 <p>The general fade-out expression can be written as:
6135 </p><table><tr><td>&nbsp;</td><td><pre class="example">hue=&quot;s=max(0\, min(1\, (START+DURATION-t)/DURATION))&quot;
6136 </pre></td></tr></table>
6137
6138 </li></ul>
6139
6140 <a name="Commands-3"></a>
6141 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Commands-3">9.44.2 Commands</a></h3>
6142
6143 <p>This filter supports the following commands:
6144 </p><dl compact="compact">
6145 <dt> &lsquo;<samp>b</samp>&rsquo;</dt>
6146 <dt> &lsquo;<samp>s</samp>&rsquo;</dt>
6147 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
6148 <dt> &lsquo;<samp>H</samp>&rsquo;</dt>
6149 <dd><p>Modify the hue and/or the saturation and/or brightness of the input video.
6150 The command accepts the same syntax of the corresponding option.
6151 </p>
6152 <p>If the specified expression is not valid, it is kept at its current
6153 value.
6154 </p></dd>
6155 </dl>
6156
6157 <a name="idet"></a>
6158 <h2 class="section"><a href="ffmpeg-filters.html#toc-idet">9.45 idet</a></h2>
6159
6160 <p>Detect video interlacing type.
6161 </p>
6162 <p>This filter tries to detect if the input is interlaced or progressive,
6163 top or bottom field first.
6164 </p>
6165 <p>The filter accepts the following options:
6166 </p>
6167 <dl compact="compact">
6168 <dt> &lsquo;<samp>intl_thres</samp>&rsquo;</dt>
6169 <dd><p>Set interlacing threshold.
6170 </p></dd>
6171 <dt> &lsquo;<samp>prog_thres</samp>&rsquo;</dt>
6172 <dd><p>Set progressive threshold.
6173 </p></dd>
6174 </dl>
6175
6176 <a name="il"></a>
6177 <h2 class="section"><a href="ffmpeg-filters.html#toc-il">9.46 il</a></h2>
6178
6179 <p>Deinterleave or interleave fields.
6180 </p>
6181 <p>This filter allows one to process interlaced images fields without
6182 deinterlacing them. Deinterleaving splits the input frame into 2
6183 fields (so called half pictures). Odd lines are moved to the top
6184 half of the output image, even lines to the bottom half.
6185 You can process (filter) them independently and then re-interleave them.
6186 </p>
6187 <p>The filter accepts the following options:
6188 </p>
6189 <dl compact="compact">
6190 <dt> &lsquo;<samp>luma_mode, l</samp>&rsquo;</dt>
6191 <dt> &lsquo;<samp>chroma_mode, c</samp>&rsquo;</dt>
6192 <dt> &lsquo;<samp>alpha_mode, a</samp>&rsquo;</dt>
6193 <dd><p>Available values for <var>luma_mode</var>, <var>chroma_mode</var> and
6194 <var>alpha_mode</var> are:
6195 </p>
6196 <dl compact="compact">
6197 <dt> &lsquo;<samp>none</samp>&rsquo;</dt>
6198 <dd><p>Do nothing.
6199 </p>
6200 </dd>
6201 <dt> &lsquo;<samp>deinterleave, d</samp>&rsquo;</dt>
6202 <dd><p>Deinterleave fields, placing one above the other.
6203 </p>
6204 </dd>
6205 <dt> &lsquo;<samp>interleave, i</samp>&rsquo;</dt>
6206 <dd><p>Interleave fields. Reverse the effect of deinterleaving.
6207 </p></dd>
6208 </dl>
6209 <p>Default value is <code>none</code>.
6210 </p>
6211 </dd>
6212 <dt> &lsquo;<samp>luma_swap, ls</samp>&rsquo;</dt>
6213 <dt> &lsquo;<samp>chroma_swap, cs</samp>&rsquo;</dt>
6214 <dt> &lsquo;<samp>alpha_swap, as</samp>&rsquo;</dt>
6215 <dd><p>Swap luma/chroma/alpha fields. Exchange even &amp; odd lines. Default value is <code>0</code>.
6216 </p></dd>
6217 </dl>
6218
6219 <a name="interlace"></a>
6220 <h2 class="section"><a href="ffmpeg-filters.html#toc-interlace">9.47 interlace</a></h2>
6221
6222 <p>Simple interlacing filter from progressive contents. This interleaves upper (or
6223 lower) lines from odd frames with lower (or upper) lines from even frames,
6224 halving the frame rate and preserving image height. A vertical lowpass filter
6225 is always applied in order to avoid twitter effects and reduce moiré patterns.
6226 </p>
6227 <table><tr><td>&nbsp;</td><td><pre class="example">   Original        Original             New Frame
6228    Frame 'j'      Frame 'j+1'             (tff)
6229   ==========      ===========       ==================
6230     Line 0  --------------------&gt;    Frame 'j' Line 0
6231     Line 1          Line 1  ----&gt;   Frame 'j+1' Line 1
6232     Line 2 ---------------------&gt;    Frame 'j' Line 2
6233     Line 3          Line 3  ----&gt;   Frame 'j+1' Line 3
6234      ...             ...                   ...
6235 New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
6236 </pre></td></tr></table>
6237
6238 <p>It accepts the following optional parameters:
6239 </p>
6240 <dl compact="compact">
6241 <dt> &lsquo;<samp>scan</samp>&rsquo;</dt>
6242 <dd><p>determines whether the interlaced frame is taken from the even (tff - default)
6243 or odd (bff) lines of the progressive frame.
6244 </p></dd>
6245 </dl>
6246
6247 <a name="kerndeint"></a>
6248 <h2 class="section"><a href="ffmpeg-filters.html#toc-kerndeint">9.48 kerndeint</a></h2>
6249
6250 <p>Deinterlace input video by applying Donald Graft&rsquo;s adaptive kernel
6251 deinterling. Work on interlaced parts of a video to produce
6252 progressive frames.
6253 </p>
6254 <p>The description of the accepted parameters follows.
6255 </p>
6256 <dl compact="compact">
6257 <dt> &lsquo;<samp>thresh</samp>&rsquo;</dt>
6258 <dd><p>Set the threshold which affects the filter&rsquo;s tolerance when
6259 determining if a pixel line must be processed. It must be an integer
6260 in the range [0,255] and defaults to 10. A value of 0 will result in
6261 applying the process on every pixels.
6262 </p>
6263 </dd>
6264 <dt> &lsquo;<samp>map</samp>&rsquo;</dt>
6265 <dd><p>Paint pixels exceeding the threshold value to white if set to 1.
6266 Default is 0.
6267 </p>
6268 </dd>
6269 <dt> &lsquo;<samp>order</samp>&rsquo;</dt>
6270 <dd><p>Set the fields order. Swap fields if set to 1, leave fields alone if
6271 0. Default is 0.
6272 </p>
6273 </dd>
6274 <dt> &lsquo;<samp>sharp</samp>&rsquo;</dt>
6275 <dd><p>Enable additional sharpening if set to 1. Default is 0.
6276 </p>
6277 </dd>
6278 <dt> &lsquo;<samp>twoway</samp>&rsquo;</dt>
6279 <dd><p>Enable twoway sharpening if set to 1. Default is 0.
6280 </p></dd>
6281 </dl>
6282
6283 <a name="Examples-26"></a>
6284 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-26">9.48.1 Examples</a></h3>
6285
6286 <ul>
6287 <li>
6288 Apply default values:
6289 <table><tr><td>&nbsp;</td><td><pre class="example">kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
6290 </pre></td></tr></table>
6291
6292 </li><li>
6293 Enable additional sharpening:
6294 <table><tr><td>&nbsp;</td><td><pre class="example">kerndeint=sharp=1
6295 </pre></td></tr></table>
6296
6297 </li><li>
6298 Paint processed pixels in white:
6299 <table><tr><td>&nbsp;</td><td><pre class="example">kerndeint=map=1
6300 </pre></td></tr></table>
6301 </li></ul>
6302
6303 <p><a name="lut3d"></a>
6304 </p><a name="lut3d-1"></a>
6305 <h2 class="section"><a href="ffmpeg-filters.html#toc-lut3d-1">9.49 lut3d</a></h2>
6306
6307 <p>Apply a 3D LUT to an input video.
6308 </p>
6309 <p>The filter accepts the following options:
6310 </p>
6311 <dl compact="compact">
6312 <dt> &lsquo;<samp>file</samp>&rsquo;</dt>
6313 <dd><p>Set the 3D LUT file name.
6314 </p>
6315 <p>Currently supported formats:
6316 </p><dl compact="compact">
6317 <dt> &lsquo;<samp>3dl</samp>&rsquo;</dt>
6318 <dd><p>AfterEffects
6319 </p></dd>
6320 <dt> &lsquo;<samp>cube</samp>&rsquo;</dt>
6321 <dd><p>Iridas
6322 </p></dd>
6323 <dt> &lsquo;<samp>dat</samp>&rsquo;</dt>
6324 <dd><p>DaVinci
6325 </p></dd>
6326 <dt> &lsquo;<samp>m3d</samp>&rsquo;</dt>
6327 <dd><p>Pandora
6328 </p></dd>
6329 </dl>
6330 </dd>
6331 <dt> &lsquo;<samp>interp</samp>&rsquo;</dt>
6332 <dd><p>Select interpolation mode.
6333 </p>
6334 <p>Available values are:
6335 </p>
6336 <dl compact="compact">
6337 <dt> &lsquo;<samp>nearest</samp>&rsquo;</dt>
6338 <dd><p>Use values from the nearest defined point.
6339 </p></dd>
6340 <dt> &lsquo;<samp>trilinear</samp>&rsquo;</dt>
6341 <dd><p>Interpolate values using the 8 points defining a cube.
6342 </p></dd>
6343 <dt> &lsquo;<samp>tetrahedral</samp>&rsquo;</dt>
6344 <dd><p>Interpolate values using a tetrahedron.
6345 </p></dd>
6346 </dl>
6347 </dd>
6348 </dl>
6349
6350 <a name="lut_002c-lutrgb_002c-lutyuv"></a>
6351 <h2 class="section"><a href="ffmpeg-filters.html#toc-lut_002c-lutrgb_002c-lutyuv">9.50 lut, lutrgb, lutyuv</a></h2>
6352
6353 <p>Compute a look-up table for binding each pixel component input value
6354 to an output value, and apply it to input video.
6355 </p>
6356 <p><var>lutyuv</var> applies a lookup table to a YUV input video, <var>lutrgb</var>
6357 to an RGB input video.
6358 </p>
6359 <p>These filters accept the following options:
6360 </p><dl compact="compact">
6361 <dt> &lsquo;<samp>c0</samp>&rsquo;</dt>
6362 <dd><p>set first pixel component expression
6363 </p></dd>
6364 <dt> &lsquo;<samp>c1</samp>&rsquo;</dt>
6365 <dd><p>set second pixel component expression
6366 </p></dd>
6367 <dt> &lsquo;<samp>c2</samp>&rsquo;</dt>
6368 <dd><p>set third pixel component expression
6369 </p></dd>
6370 <dt> &lsquo;<samp>c3</samp>&rsquo;</dt>
6371 <dd><p>set fourth pixel component expression, corresponds to the alpha component
6372 </p>
6373 </dd>
6374 <dt> &lsquo;<samp>r</samp>&rsquo;</dt>
6375 <dd><p>set red component expression
6376 </p></dd>
6377 <dt> &lsquo;<samp>g</samp>&rsquo;</dt>
6378 <dd><p>set green component expression
6379 </p></dd>
6380 <dt> &lsquo;<samp>b</samp>&rsquo;</dt>
6381 <dd><p>set blue component expression
6382 </p></dd>
6383 <dt> &lsquo;<samp>a</samp>&rsquo;</dt>
6384 <dd><p>alpha component expression
6385 </p>
6386 </dd>
6387 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
6388 <dd><p>set Y/luminance component expression
6389 </p></dd>
6390 <dt> &lsquo;<samp>u</samp>&rsquo;</dt>
6391 <dd><p>set U/Cb component expression
6392 </p></dd>
6393 <dt> &lsquo;<samp>v</samp>&rsquo;</dt>
6394 <dd><p>set V/Cr component expression
6395 </p></dd>
6396 </dl>
6397
6398 <p>Each of them specifies the expression to use for computing the lookup table for
6399 the corresponding pixel component values.
6400 </p>
6401 <p>The exact component associated to each of the <var>c*</var> options depends on the
6402 format in input.
6403 </p>
6404 <p>The <var>lut</var> filter requires either YUV or RGB pixel formats in input,
6405 <var>lutrgb</var> requires RGB pixel formats in input, and <var>lutyuv</var> requires YUV.
6406 </p>
6407 <p>The expressions can contain the following constants and functions:
6408 </p>
6409 <dl compact="compact">
6410 <dt> &lsquo;<samp>w</samp>&rsquo;</dt>
6411 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
6412 <dd><p>the input width and height
6413 </p>
6414 </dd>
6415 <dt> &lsquo;<samp>val</samp>&rsquo;</dt>
6416 <dd><p>input value for the pixel component
6417 </p>
6418 </dd>
6419 <dt> &lsquo;<samp>clipval</samp>&rsquo;</dt>
6420 <dd><p>the input value clipped in the <var>minval</var>-<var>maxval</var> range
6421 </p>
6422 </dd>
6423 <dt> &lsquo;<samp>maxval</samp>&rsquo;</dt>
6424 <dd><p>maximum value for the pixel component
6425 </p>
6426 </dd>
6427 <dt> &lsquo;<samp>minval</samp>&rsquo;</dt>
6428 <dd><p>minimum value for the pixel component
6429 </p>
6430 </dd>
6431 <dt> &lsquo;<samp>negval</samp>&rsquo;</dt>
6432 <dd><p>the negated value for the pixel component value clipped in the
6433 <var>minval</var>-<var>maxval</var> range , it corresponds to the expression
6434 &quot;maxval-clipval+minval&quot;
6435 </p>
6436 </dd>
6437 <dt> &lsquo;<samp>clip(val)</samp>&rsquo;</dt>
6438 <dd><p>the computed value in <var>val</var> clipped in the
6439 <var>minval</var>-<var>maxval</var> range
6440 </p>
6441 </dd>
6442 <dt> &lsquo;<samp>gammaval(gamma)</samp>&rsquo;</dt>
6443 <dd><p>the computed gamma correction value of the pixel component value
6444 clipped in the <var>minval</var>-<var>maxval</var> range, corresponds to the
6445 expression
6446 &quot;pow((clipval-minval)/(maxval-minval)\,<var>gamma</var>)*(maxval-minval)+minval&quot;
6447 </p>
6448 </dd>
6449 </dl>
6450
6451 <p>All expressions default to &quot;val&quot;.
6452 </p>
6453 <a name="Examples-4"></a>
6454 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-4">9.50.1 Examples</a></h3>
6455
6456 <ul>
6457 <li>
6458 Negate input video:
6459 <table><tr><td>&nbsp;</td><td><pre class="example">lutrgb=&quot;r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val&quot;
6460 lutyuv=&quot;y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val&quot;
6461 </pre></td></tr></table>
6462
6463 <p>The above is the same as:
6464 </p><table><tr><td>&nbsp;</td><td><pre class="example">lutrgb=&quot;r=negval:g=negval:b=negval&quot;
6465 lutyuv=&quot;y=negval:u=negval:v=negval&quot;
6466 </pre></td></tr></table>
6467
6468 </li><li>
6469 Negate luminance:
6470 <table><tr><td>&nbsp;</td><td><pre class="example">lutyuv=y=negval
6471 </pre></td></tr></table>
6472
6473 </li><li>
6474 Remove chroma components, turns the video into a graytone image:
6475 <table><tr><td>&nbsp;</td><td><pre class="example">lutyuv=&quot;u=128:v=128&quot;
6476 </pre></td></tr></table>
6477
6478 </li><li>
6479 Apply a luma burning effect:
6480 <table><tr><td>&nbsp;</td><td><pre class="example">lutyuv=&quot;y=2*val&quot;
6481 </pre></td></tr></table>
6482
6483 </li><li>
6484 Remove green and blue components:
6485 <table><tr><td>&nbsp;</td><td><pre class="example">lutrgb=&quot;g=0:b=0&quot;
6486 </pre></td></tr></table>
6487
6488 </li><li>
6489 Set a constant alpha channel value on input:
6490 <table><tr><td>&nbsp;</td><td><pre class="example">format=rgba,lutrgb=a=&quot;maxval-minval/2&quot;
6491 </pre></td></tr></table>
6492
6493 </li><li>
6494 Correct luminance gamma by a 0.5 factor:
6495 <table><tr><td>&nbsp;</td><td><pre class="example">lutyuv=y=gammaval(0.5)
6496 </pre></td></tr></table>
6497
6498 </li><li>
6499 Discard least significant bits of luma:
6500 <table><tr><td>&nbsp;</td><td><pre class="example">lutyuv=y='bitand(val, 128+64+32)'
6501 </pre></td></tr></table>
6502 </li></ul>
6503
6504 <a name="mergeplanes"></a>
6505 <h2 class="section"><a href="ffmpeg-filters.html#toc-mergeplanes">9.51 mergeplanes</a></h2>
6506
6507 <p>Merge color channel components from several video streams.
6508 </p>
6509 <p>The filter accepts up to 4 input streams, and merge selected input
6510 planes to the output video.
6511 </p>
6512 <p>This filter accepts the following options:
6513 </p><dl compact="compact">
6514 <dt> &lsquo;<samp>mapping</samp>&rsquo;</dt>
6515 <dd><p>Set input to output plane mapping. Default is <code>0</code>.
6516 </p>
6517 <p>The mappings is specified as a bitmap. It should be specified as a
6518 hexadecimal number in the form 0xAa[Bb[Cc[Dd]]]. &rsquo;Aa&rsquo; describes the
6519 mapping for the first plane of the output stream. &rsquo;A&rsquo; sets the number of
6520 the input stream to use (from 0 to 3), and &rsquo;a&rsquo; the plane number of the
6521 corresponding input to use (from 0 to 3). The rest of the mappings is
6522 similar, &rsquo;Bb&rsquo; describes the mapping for the output stream second
6523 plane, &rsquo;Cc&rsquo; describes the mapping for the output stream third plane and
6524 &rsquo;Dd&rsquo; describes the mapping for the output stream fourth plane.
6525 </p>
6526 </dd>
6527 <dt> &lsquo;<samp>format</samp>&rsquo;</dt>
6528 <dd><p>Set output pixel format. Default is <code>yuva444p</code>.
6529 </p></dd>
6530 </dl>
6531
6532 <a name="Examples-56"></a>
6533 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-56">9.51.1 Examples</a></h3>
6534
6535 <ul>
6536 <li>
6537 Merge three gray video streams of same width and height into single video stream:
6538 <table><tr><td>&nbsp;</td><td><pre class="example">[a0][a1][a2]mergeplanes=0x001020:yuv444p
6539 </pre></td></tr></table>
6540
6541 </li><li>
6542 Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
6543 <table><tr><td>&nbsp;</td><td><pre class="example">[a0][a1]mergeplanes=0x00010210:yuva444p
6544 </pre></td></tr></table>
6545
6546 </li><li>
6547 Swap Y and A plane in yuva444p stream:
6548 <table><tr><td>&nbsp;</td><td><pre class="example">format=yuva444p,mergeplanes=0x03010200:yuva444p
6549 </pre></td></tr></table>
6550
6551 </li><li>
6552 Swap U and V plane in yuv420p stream:
6553 <table><tr><td>&nbsp;</td><td><pre class="example">format=yuv420p,mergeplanes=0x000201:yuv420p
6554 </pre></td></tr></table>
6555
6556 </li><li>
6557 Cast a rgb24 clip to yuv444p:
6558 <table><tr><td>&nbsp;</td><td><pre class="example">format=rgb24,mergeplanes=0x000102:yuv444p
6559 </pre></td></tr></table>
6560 </li></ul>
6561
6562 <a name="mcdeint"></a>
6563 <h2 class="section"><a href="ffmpeg-filters.html#toc-mcdeint">9.52 mcdeint</a></h2>
6564
6565 <p>Apply motion-compensation deinterlacing.
6566 </p>
6567 <p>It needs one field per frame as input and must thus be used together
6568 with yadif=1/3 or equivalent.
6569 </p>
6570 <p>This filter accepts the following options:
6571 </p><dl compact="compact">
6572 <dt> &lsquo;<samp>mode</samp>&rsquo;</dt>
6573 <dd><p>Set the deinterlacing mode.
6574 </p>
6575 <p>It accepts one of the following values:
6576 </p><dl compact="compact">
6577 <dt> &lsquo;<samp>fast</samp>&rsquo;</dt>
6578 <dt> &lsquo;<samp>medium</samp>&rsquo;</dt>
6579 <dt> &lsquo;<samp>slow</samp>&rsquo;</dt>
6580 <dd><p>use iterative motion estimation
6581 </p></dd>
6582 <dt> &lsquo;<samp>extra_slow</samp>&rsquo;</dt>
6583 <dd><p>like &lsquo;<samp>slow</samp>&rsquo;, but use multiple reference frames.
6584 </p></dd>
6585 </dl>
6586 <p>Default value is &lsquo;<samp>fast</samp>&rsquo;.
6587 </p>
6588 </dd>
6589 <dt> &lsquo;<samp>parity</samp>&rsquo;</dt>
6590 <dd><p>Set the picture field parity assumed for the input video. It must be
6591 one of the following values:
6592 </p>
6593 <dl compact="compact">
6594 <dt> &lsquo;<samp>0, tff</samp>&rsquo;</dt>
6595 <dd><p>assume top field first
6596 </p></dd>
6597 <dt> &lsquo;<samp>1, bff</samp>&rsquo;</dt>
6598 <dd><p>assume bottom field first
6599 </p></dd>
6600 </dl>
6601
6602 <p>Default value is &lsquo;<samp>bff</samp>&rsquo;.
6603 </p>
6604 </dd>
6605 <dt> &lsquo;<samp>qp</samp>&rsquo;</dt>
6606 <dd><p>Set per-block quantization parameter (QP) used by the internal
6607 encoder.
6608 </p>
6609 <p>Higher values should result in a smoother motion vector field but less
6610 optimal individual vectors. Default value is 1.
6611 </p></dd>
6612 </dl>
6613
6614 <a name="mp"></a>
6615 <h2 class="section"><a href="ffmpeg-filters.html#toc-mp">9.53 mp</a></h2>
6616
6617 <p>Apply an MPlayer filter to the input video.
6618 </p>
6619 <p>This filter provides a wrapper around some of the filters of
6620 MPlayer/MEncoder.
6621 </p>
6622 <p>This wrapper is considered experimental. Some of the wrapped filters
6623 may not work properly and we may drop support for them, as they will
6624 be implemented natively into FFmpeg. Thus you should avoid
6625 depending on them when writing portable scripts.
6626 </p>
6627 <p>The filter accepts the parameters:
6628 <var>filter_name</var>[:=]<var>filter_params</var>
6629 </p>
6630 <p><var>filter_name</var> is the name of a supported MPlayer filter,
6631 <var>filter_params</var> is a string containing the parameters accepted by
6632 the named filter.
6633 </p>
6634 <p>The list of the currently supported filters follows:
6635 </p><dl compact="compact">
6636 <dt> <var>eq2</var></dt>
6637 <dt> <var>eq</var></dt>
6638 <dt> <var>fspp</var></dt>
6639 <dt> <var>ilpack</var></dt>
6640 <dt> <var>pp7</var></dt>
6641 <dt> <var>softpulldown</var></dt>
6642 <dt> <var>uspp</var></dt>
6643 </dl>
6644
6645 <p>The parameter syntax and behavior for the listed filters are the same
6646 of the corresponding MPlayer filters. For detailed instructions check
6647 the &quot;VIDEO FILTERS&quot; section in the MPlayer manual.
6648 </p>
6649 <a name="Examples-50"></a>
6650 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-50">9.53.1 Examples</a></h3>
6651
6652 <ul>
6653 <li>
6654 Adjust gamma, brightness, contrast:
6655 <table><tr><td>&nbsp;</td><td><pre class="example">mp=eq2=1.0:2:0.5
6656 </pre></td></tr></table>
6657 </li></ul>
6658
6659 <p>See also mplayer(1), <a href="http://www.mplayerhq.hu/">http://www.mplayerhq.hu/</a>.
6660 </p>
6661 <a name="mpdecimate"></a>
6662 <h2 class="section"><a href="ffmpeg-filters.html#toc-mpdecimate">9.54 mpdecimate</a></h2>
6663
6664 <p>Drop frames that do not differ greatly from the previous frame in
6665 order to reduce frame rate.
6666 </p>
6667 <p>The main use of this filter is for very-low-bitrate encoding
6668 (e.g. streaming over dialup modem), but it could in theory be used for
6669 fixing movies that were inverse-telecined incorrectly.
6670 </p>
6671 <p>A description of the accepted options follows.
6672 </p>
6673 <dl compact="compact">
6674 <dt> &lsquo;<samp>max</samp>&rsquo;</dt>
6675 <dd><p>Set the maximum number of consecutive frames which can be dropped (if
6676 positive), or the minimum interval between dropped frames (if
6677 negative). If the value is 0, the frame is dropped unregarding the
6678 number of previous sequentially dropped frames.
6679 </p>
6680 <p>Default value is 0.
6681 </p>
6682 </dd>
6683 <dt> &lsquo;<samp>hi</samp>&rsquo;</dt>
6684 <dt> &lsquo;<samp>lo</samp>&rsquo;</dt>
6685 <dt> &lsquo;<samp>frac</samp>&rsquo;</dt>
6686 <dd><p>Set the dropping threshold values.
6687 </p>
6688 <p>Values for &lsquo;<samp>hi</samp>&rsquo; and &lsquo;<samp>lo</samp>&rsquo; are for 8x8 pixel blocks and
6689 represent actual pixel value differences, so a threshold of 64
6690 corresponds to 1 unit of difference for each pixel, or the same spread
6691 out differently over the block.
6692 </p>
6693 <p>A frame is a candidate for dropping if no 8x8 blocks differ by more
6694 than a threshold of &lsquo;<samp>hi</samp>&rsquo;, and if no more than &lsquo;<samp>frac</samp>&rsquo; blocks (1
6695 meaning the whole image) differ by more than a threshold of &lsquo;<samp>lo</samp>&rsquo;.
6696 </p>
6697 <p>Default value for &lsquo;<samp>hi</samp>&rsquo; is 64*12, default value for &lsquo;<samp>lo</samp>&rsquo; is
6698 64*5, and default value for &lsquo;<samp>frac</samp>&rsquo; is 0.33.
6699 </p></dd>
6700 </dl>
6701
6702
6703 <a name="negate"></a>
6704 <h2 class="section"><a href="ffmpeg-filters.html#toc-negate">9.55 negate</a></h2>
6705
6706 <p>Negate input video.
6707 </p>
6708 <p>This filter accepts an integer in input, if non-zero it negates the
6709 alpha component (if available). The default value in input is 0.
6710 </p>
6711 <a name="noformat"></a>
6712 <h2 class="section"><a href="ffmpeg-filters.html#toc-noformat">9.56 noformat</a></h2>
6713
6714 <p>Force libavfilter not to use any of the specified pixel formats for the
6715 input to the next filter.
6716 </p>
6717 <p>This filter accepts the following parameters:
6718 </p><dl compact="compact">
6719 <dt> &lsquo;<samp>pix_fmts</samp>&rsquo;</dt>
6720 <dd><p>A &rsquo;|&rsquo;-separated list of pixel format names, for example
6721 &quot;pix_fmts=yuv420p|monow|rgb24&quot;.
6722 </p>
6723 </dd>
6724 </dl>
6725
6726 <a name="Examples-25"></a>
6727 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-25">9.56.1 Examples</a></h3>
6728
6729 <ul>
6730 <li>
6731 Force libavfilter to use a format different from <var>yuv420p</var> for the
6732 input to the vflip filter:
6733 <table><tr><td>&nbsp;</td><td><pre class="example">noformat=pix_fmts=yuv420p,vflip
6734 </pre></td></tr></table>
6735
6736 </li><li>
6737 Convert the input video to any of the formats not contained in the list:
6738 <table><tr><td>&nbsp;</td><td><pre class="example">noformat=yuv420p|yuv444p|yuv410p
6739 </pre></td></tr></table>
6740 </li></ul>
6741
6742 <a name="noise"></a>
6743 <h2 class="section"><a href="ffmpeg-filters.html#toc-noise">9.57 noise</a></h2>
6744
6745 <p>Add noise on video input frame.
6746 </p>
6747 <p>The filter accepts the following options:
6748 </p>
6749 <dl compact="compact">
6750 <dt> &lsquo;<samp>all_seed</samp>&rsquo;</dt>
6751 <dt> &lsquo;<samp>c0_seed</samp>&rsquo;</dt>
6752 <dt> &lsquo;<samp>c1_seed</samp>&rsquo;</dt>
6753 <dt> &lsquo;<samp>c2_seed</samp>&rsquo;</dt>
6754 <dt> &lsquo;<samp>c3_seed</samp>&rsquo;</dt>
6755 <dd><p>Set noise seed for specific pixel component or all pixel components in case
6756 of <var>all_seed</var>. Default value is <code>123457</code>.
6757 </p>
6758 </dd>
6759 <dt> &lsquo;<samp>all_strength, alls</samp>&rsquo;</dt>
6760 <dt> &lsquo;<samp>c0_strength, c0s</samp>&rsquo;</dt>
6761 <dt> &lsquo;<samp>c1_strength, c1s</samp>&rsquo;</dt>
6762 <dt> &lsquo;<samp>c2_strength, c2s</samp>&rsquo;</dt>
6763 <dt> &lsquo;<samp>c3_strength, c3s</samp>&rsquo;</dt>
6764 <dd><p>Set noise strength for specific pixel component or all pixel components in case
6765 <var>all_strength</var>. Default value is <code>0</code>. Allowed range is [0, 100].
6766 </p>
6767 </dd>
6768 <dt> &lsquo;<samp>all_flags, allf</samp>&rsquo;</dt>
6769 <dt> &lsquo;<samp>c0_flags, c0f</samp>&rsquo;</dt>
6770 <dt> &lsquo;<samp>c1_flags, c1f</samp>&rsquo;</dt>
6771 <dt> &lsquo;<samp>c2_flags, c2f</samp>&rsquo;</dt>
6772 <dt> &lsquo;<samp>c3_flags, c3f</samp>&rsquo;</dt>
6773 <dd><p>Set pixel component flags or set flags for all components if <var>all_flags</var>.
6774 Available values for component flags are:
6775 </p><dl compact="compact">
6776 <dt> &lsquo;<samp>a</samp>&rsquo;</dt>
6777 <dd><p>averaged temporal noise (smoother)
6778 </p></dd>
6779 <dt> &lsquo;<samp>p</samp>&rsquo;</dt>
6780 <dd><p>mix random noise with a (semi)regular pattern
6781 </p></dd>
6782 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
6783 <dd><p>temporal noise (noise pattern changes between frames)
6784 </p></dd>
6785 <dt> &lsquo;<samp>u</samp>&rsquo;</dt>
6786 <dd><p>uniform noise (gaussian otherwise)
6787 </p></dd>
6788 </dl>
6789 </dd>
6790 </dl>
6791
6792 <a name="Examples-53"></a>
6793 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-53">9.57.1 Examples</a></h3>
6794
6795 <p>Add temporal and uniform noise to input video:
6796 </p><table><tr><td>&nbsp;</td><td><pre class="example">noise=alls=20:allf=t+u
6797 </pre></td></tr></table>
6798
6799 <a name="null"></a>
6800 <h2 class="section"><a href="ffmpeg-filters.html#toc-null">9.58 null</a></h2>
6801
6802 <p>Pass the video source unchanged to the output.
6803 </p>
6804 <a name="ocv"></a>
6805 <h2 class="section"><a href="ffmpeg-filters.html#toc-ocv">9.59 ocv</a></h2>
6806
6807 <p>Apply video transform using libopencv.
6808 </p>
6809 <p>To enable this filter install libopencv library and headers and
6810 configure FFmpeg with <code>--enable-libopencv</code>.
6811 </p>
6812 <p>This filter accepts the following parameters:
6813 </p>
6814 <dl compact="compact">
6815 <dt> &lsquo;<samp>filter_name</samp>&rsquo;</dt>
6816 <dd><p>The name of the libopencv filter to apply.
6817 </p>
6818 </dd>
6819 <dt> &lsquo;<samp>filter_params</samp>&rsquo;</dt>
6820 <dd><p>The parameters to pass to the libopencv filter. If not specified the default
6821 values are assumed.
6822 </p>
6823 </dd>
6824 </dl>
6825
6826 <p>Refer to the official libopencv documentation for more precise
6827 information:
6828 <a href="http://opencv.willowgarage.com/documentation/c/image_filtering.html">http://opencv.willowgarage.com/documentation/c/image_filtering.html</a>
6829 </p>
6830 <p>Follows the list of supported libopencv filters.
6831 </p>
6832 <p><a name="dilate"></a>
6833 </p><a name="dilate-1"></a>
6834 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-dilate-1">9.59.1 dilate</a></h3>
6835
6836 <p>Dilate an image by using a specific structuring element.
6837 This filter corresponds to the libopencv function <code>cvDilate</code>.
6838 </p>
6839 <p>It accepts the parameters: <var>struct_el</var>|<var>nb_iterations</var>.
6840 </p>
6841 <p><var>struct_el</var> represents a structuring element, and has the syntax:
6842 <var>cols</var>x<var>rows</var>+<var>anchor_x</var>x<var>anchor_y</var>/<var>shape</var>
6843 </p>
6844 <p><var>cols</var> and <var>rows</var> represent the number of columns and rows of
6845 the structuring element, <var>anchor_x</var> and <var>anchor_y</var> the anchor
6846 point, and <var>shape</var> the shape for the structuring element, and
6847 can be one of the values &quot;rect&quot;, &quot;cross&quot;, &quot;ellipse&quot;, &quot;custom&quot;.
6848 </p>
6849 <p>If the value for <var>shape</var> is &quot;custom&quot;, it must be followed by a
6850 string of the form &quot;=<var>filename</var>&quot;. The file with name
6851 <var>filename</var> is assumed to represent a binary image, with each
6852 printable character corresponding to a bright pixel. When a custom
6853 <var>shape</var> is used, <var>cols</var> and <var>rows</var> are ignored, the number
6854 or columns and rows of the read file are assumed instead.
6855 </p>
6856 <p>The default value for <var>struct_el</var> is &quot;3x3+0x0/rect&quot;.
6857 </p>
6858 <p><var>nb_iterations</var> specifies the number of times the transform is
6859 applied to the image, and defaults to 1.
6860 </p>
6861 <p>Follow some example:
6862 </p><table><tr><td>&nbsp;</td><td><pre class="example"># use the default values
6863 ocv=dilate
6864
6865 # dilate using a structuring element with a 5x5 cross, iterate two times
6866 ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
6867
6868 # read the shape from the file diamond.shape, iterate two times
6869 # the file diamond.shape may contain a pattern of characters like this:
6870 #   *
6871 #  ***
6872 # *****
6873 #  ***
6874 #   *
6875 # the specified cols and rows are ignored (but not the anchor point coordinates)
6876 ocv=dilate:0x0+2x2/custom=diamond.shape|2
6877 </pre></td></tr></table>
6878
6879 <a name="erode"></a>
6880 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-erode">9.59.2 erode</a></h3>
6881
6882 <p>Erode an image by using a specific structuring element.
6883 This filter corresponds to the libopencv function <code>cvErode</code>.
6884 </p>
6885 <p>The filter accepts the parameters: <var>struct_el</var>:<var>nb_iterations</var>,
6886 with the same syntax and semantics as the <a href="#dilate">dilate</a> filter.
6887 </p>
6888 <a name="smooth"></a>
6889 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-smooth">9.59.3 smooth</a></h3>
6890
6891 <p>Smooth the input video.
6892 </p>
6893 <p>The filter takes the following parameters:
6894 <var>type</var>|<var>param1</var>|<var>param2</var>|<var>param3</var>|<var>param4</var>.
6895 </p>
6896 <p><var>type</var> is the type of smooth filter to apply, and can be one of
6897 the following values: &quot;blur&quot;, &quot;blur_no_scale&quot;, &quot;median&quot;, &quot;gaussian&quot;,
6898 &quot;bilateral&quot;. The default value is &quot;gaussian&quot;.
6899 </p>
6900 <p><var>param1</var>, <var>param2</var>, <var>param3</var>, and <var>param4</var> are
6901 parameters whose meanings depend on smooth type. <var>param1</var> and
6902 <var>param2</var> accept integer positive values or 0, <var>param3</var> and
6903 <var>param4</var> accept float values.
6904 </p>
6905 <p>The default value for <var>param1</var> is 3, the default value for the
6906 other parameters is 0.
6907 </p>
6908 <p>These parameters correspond to the parameters assigned to the
6909 libopencv function <code>cvSmooth</code>.
6910 </p>
6911 <p><a name="overlay"></a>
6912 </p><a name="overlay-1"></a>
6913 <h2 class="section"><a href="ffmpeg-filters.html#toc-overlay-1">9.60 overlay</a></h2>
6914
6915 <p>Overlay one video on top of another.
6916 </p>
6917 <p>It takes two inputs and one output, the first input is the &quot;main&quot;
6918 video on which the second input is overlayed.
6919 </p>
6920 <p>This filter accepts the following parameters:
6921 </p>
6922 <p>A description of the accepted options follows.
6923 </p>
6924 <dl compact="compact">
6925 <dt> &lsquo;<samp>x</samp>&rsquo;</dt>
6926 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
6927 <dd><p>Set the expression for the x and y coordinates of the overlayed video
6928 on the main video. Default value is &quot;0&quot; for both expressions. In case
6929 the expression is invalid, it is set to a huge value (meaning that the
6930 overlay will not be displayed within the output visible area).
6931 </p>
6932 </dd>
6933 <dt> &lsquo;<samp>eof_action</samp>&rsquo;</dt>
6934 <dd><p>The action to take when EOF is encountered on the secondary input, accepts one
6935 of the following values:
6936 </p>
6937 <dl compact="compact">
6938 <dt> &lsquo;<samp>repeat</samp>&rsquo;</dt>
6939 <dd><p>repeat the last frame (the default)
6940 </p></dd>
6941 <dt> &lsquo;<samp>endall</samp>&rsquo;</dt>
6942 <dd><p>end both streams
6943 </p></dd>
6944 <dt> &lsquo;<samp>pass</samp>&rsquo;</dt>
6945 <dd><p>pass through the main input
6946 </p></dd>
6947 </dl>
6948
6949 </dd>
6950 <dt> &lsquo;<samp>eval</samp>&rsquo;</dt>
6951 <dd><p>Set when the expressions for &lsquo;<samp>x</samp>&rsquo;, and &lsquo;<samp>y</samp>&rsquo; are evaluated.
6952 </p>
6953 <p>It accepts the following values:
6954 </p><dl compact="compact">
6955 <dt> &lsquo;<samp>init</samp>&rsquo;</dt>
6956 <dd><p>only evaluate expressions once during the filter initialization or
6957 when a command is processed
6958 </p>
6959 </dd>
6960 <dt> &lsquo;<samp>frame</samp>&rsquo;</dt>
6961 <dd><p>evaluate expressions for each incoming frame
6962 </p></dd>
6963 </dl>
6964
6965 <p>Default value is &lsquo;<samp>frame</samp>&rsquo;.
6966 </p>
6967 </dd>
6968 <dt> &lsquo;<samp>shortest</samp>&rsquo;</dt>
6969 <dd><p>If set to 1, force the output to terminate when the shortest input
6970 terminates. Default value is 0.
6971 </p>
6972 </dd>
6973 <dt> &lsquo;<samp>format</samp>&rsquo;</dt>
6974 <dd><p>Set the format for the output video.
6975 </p>
6976 <p>It accepts the following values:
6977 </p><dl compact="compact">
6978 <dt> &lsquo;<samp>yuv420</samp>&rsquo;</dt>
6979 <dd><p>force YUV420 output
6980 </p>
6981 </dd>
6982 <dt> &lsquo;<samp>yuv422</samp>&rsquo;</dt>
6983 <dd><p>force YUV422 output
6984 </p>
6985 </dd>
6986 <dt> &lsquo;<samp>yuv444</samp>&rsquo;</dt>
6987 <dd><p>force YUV444 output
6988 </p>
6989 </dd>
6990 <dt> &lsquo;<samp>rgb</samp>&rsquo;</dt>
6991 <dd><p>force RGB output
6992 </p></dd>
6993 </dl>
6994
6995 <p>Default value is &lsquo;<samp>yuv420</samp>&rsquo;.
6996 </p>
6997 </dd>
6998 <dt> &lsquo;<samp>rgb <em>(deprecated)</em></samp>&rsquo;</dt>
6999 <dd><p>If set to 1, force the filter to accept inputs in the RGB
7000 color space. Default value is 0. This option is deprecated, use
7001 &lsquo;<samp>format</samp>&rsquo; instead.
7002 </p>
7003 </dd>
7004 <dt> &lsquo;<samp>repeatlast</samp>&rsquo;</dt>
7005 <dd><p>If set to 1, force the filter to draw the last overlay frame over the
7006 main input until the end of the stream. A value of 0 disables this
7007 behavior. Default value is 1.
7008 </p></dd>
7009 </dl>
7010
7011 <p>The &lsquo;<samp>x</samp>&rsquo;, and &lsquo;<samp>y</samp>&rsquo; expressions can contain the following
7012 parameters.
7013 </p>
7014 <dl compact="compact">
7015 <dt> &lsquo;<samp>main_w, W</samp>&rsquo;</dt>
7016 <dt> &lsquo;<samp>main_h, H</samp>&rsquo;</dt>
7017 <dd><p>main input width and height
7018 </p>
7019 </dd>
7020 <dt> &lsquo;<samp>overlay_w, w</samp>&rsquo;</dt>
7021 <dt> &lsquo;<samp>overlay_h, h</samp>&rsquo;</dt>
7022 <dd><p>overlay input width and height
7023 </p>
7024 </dd>
7025 <dt> &lsquo;<samp>x</samp>&rsquo;</dt>
7026 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
7027 <dd><p>the computed values for <var>x</var> and <var>y</var>. They are evaluated for
7028 each new frame.
7029 </p>
7030 </dd>
7031 <dt> &lsquo;<samp>hsub</samp>&rsquo;</dt>
7032 <dt> &lsquo;<samp>vsub</samp>&rsquo;</dt>
7033 <dd><p>horizontal and vertical chroma subsample values of the output
7034 format. For example for the pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and
7035 <var>vsub</var> is 1.
7036 </p>
7037 </dd>
7038 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
7039 <dd><p>the number of input frame, starting from 0
7040 </p>
7041 </dd>
7042 <dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
7043 <dd><p>the position in the file of the input frame, NAN if unknown
7044 </p>
7045 </dd>
7046 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
7047 <dd><p>timestamp expressed in seconds, NAN if the input timestamp is unknown
7048 </p>
7049 </dd>
7050 </dl>
7051
7052 <p>Note that the <var>n</var>, <var>pos</var>, <var>t</var> variables are available only
7053 when evaluation is done <em>per frame</em>, and will evaluate to NAN
7054 when &lsquo;<samp>eval</samp>&rsquo; is set to &lsquo;<samp>init</samp>&rsquo;.
7055 </p>
7056 <p>Be aware that frames are taken from each input video in timestamp
7057 order, hence, if their initial timestamps differ, it is a good idea
7058 to pass the two inputs through a <var>setpts=PTS-STARTPTS</var> filter to
7059 have them begin in the same zero timestamp, as it does the example for
7060 the <var>movie</var> filter.
7061 </p>
7062 <p>You can chain together more overlays but you should test the
7063 efficiency of such approach.
7064 </p>
7065 <a name="Commands-2"></a>
7066 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Commands-2">9.60.1 Commands</a></h3>
7067
7068 <p>This filter supports the following commands:
7069 </p><dl compact="compact">
7070 <dt> &lsquo;<samp>x</samp>&rsquo;</dt>
7071 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
7072 <dd><p>Modify the x and y of the overlay input.
7073 The command accepts the same syntax of the corresponding option.
7074 </p>
7075 <p>If the specified expression is not valid, it is kept at its current
7076 value.
7077 </p></dd>
7078 </dl>
7079
7080 <a name="Examples-33"></a>
7081 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-33">9.60.2 Examples</a></h3>
7082
7083 <ul>
7084 <li>
7085 Draw the overlay at 10 pixels from the bottom right corner of the main
7086 video:
7087 <table><tr><td>&nbsp;</td><td><pre class="example">overlay=main_w-overlay_w-10:main_h-overlay_h-10
7088 </pre></td></tr></table>
7089
7090 <p>Using named options the example above becomes:
7091 </p><table><tr><td>&nbsp;</td><td><pre class="example">overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
7092 </pre></td></tr></table>
7093
7094 </li><li>
7095 Insert a transparent PNG logo in the bottom left corner of the input,
7096 using the <code>ffmpeg</code> tool with the <code>-filter_complex</code> option:
7097 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i input -i logo -filter_complex 'overlay=10:main_h-overlay_h-10' output
7098 </pre></td></tr></table>
7099
7100 </li><li>
7101 Insert 2 different transparent PNG logos (second logo on bottom
7102 right corner) using the <code>ffmpeg</code> tool:
7103 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i input -i logo1 -i logo2 -filter_complex 'overlay=x=10:y=H-h-10,overlay=x=W-w-10:y=H-h-10' output
7104 </pre></td></tr></table>
7105
7106 </li><li>
7107 Add a transparent color layer on top of the main video, <code>WxH</code>
7108 must specify the size of the main input to the overlay filter:
7109 <table><tr><td>&nbsp;</td><td><pre class="example">color=color=red@.3:size=WxH [over]; [in][over] overlay [out]
7110 </pre></td></tr></table>
7111
7112 </li><li>
7113 Play an original video and a filtered version (here with the deshake
7114 filter) side by side using the <code>ffplay</code> tool:
7115 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay input.avi -vf 'split[a][b]; [a]pad=iw*2:ih[src]; [b]deshake[filt]; [src][filt]overlay=w'
7116 </pre></td></tr></table>
7117
7118 <p>The above command is the same as:
7119 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffplay input.avi -vf 'split[b], pad=iw*2[src], [b]deshake, [src]overlay=w'
7120 </pre></td></tr></table>
7121
7122 </li><li>
7123 Make a sliding overlay appearing from the left to the right top part of the
7124 screen starting since time 2:
7125 <table><tr><td>&nbsp;</td><td><pre class="example">overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
7126 </pre></td></tr></table>
7127
7128 </li><li>
7129 Compose output by putting two input videos side to side:
7130 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i left.avi -i right.avi -filter_complex &quot;
7131 nullsrc=size=200x100 [background];
7132 [0:v] setpts=PTS-STARTPTS, scale=100x100 [left];
7133 [1:v] setpts=PTS-STARTPTS, scale=100x100 [right];
7134 [background][left]       overlay=shortest=1       [background+left];
7135 [background+left][right] overlay=shortest=1:x=100 [left+right]
7136 &quot;
7137 </pre></td></tr></table>
7138
7139 </li><li>
7140 mask 10-20 seconds of a video by applying the delogo filter to a section
7141 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i test.avi -codec:v:0 wmv2 -ar 11025 -b:v 9000k
7142 -vf '[in]split[split_main][split_delogo];[split_delogo]trim=start=360:end=371,delogo=0:0:640:480[delogoed];[split_main][delogoed]overlay=eof_action=pass[out]'
7143 masked.avi
7144 </pre></td></tr></table>
7145
7146 </li><li>
7147 Chain several overlays in cascade:
7148 <table><tr><td>&nbsp;</td><td><pre class="example">nullsrc=s=200x200 [bg];
7149 testsrc=s=100x100, split=4 [in0][in1][in2][in3];
7150 [in0] lutrgb=r=0, [bg]   overlay=0:0     [mid0];
7151 [in1] lutrgb=g=0, [mid0] overlay=100:0   [mid1];
7152 [in2] lutrgb=b=0, [mid1] overlay=0:100   [mid2];
7153 [in3] null,       [mid2] overlay=100:100 [out0]
7154 </pre></td></tr></table>
7155
7156 </li></ul>
7157
7158 <a name="owdenoise"></a>
7159 <h2 class="section"><a href="ffmpeg-filters.html#toc-owdenoise">9.61 owdenoise</a></h2>
7160
7161 <p>Apply Overcomplete Wavelet denoiser.
7162 </p>
7163 <p>The filter accepts the following options:
7164 </p>
7165 <dl compact="compact">
7166 <dt> &lsquo;<samp>depth</samp>&rsquo;</dt>
7167 <dd><p>Set depth.
7168 </p>
7169 <p>Larger depth values will denoise lower frequency components more, but
7170 slow down filtering.
7171 </p>
7172 <p>Must be an int in the range 8-16, default is <code>8</code>.
7173 </p>
7174 </dd>
7175 <dt> &lsquo;<samp>luma_strength, ls</samp>&rsquo;</dt>
7176 <dd><p>Set luma strength.
7177 </p>
7178 <p>Must be a double value in the range 0-1000, default is <code>1.0</code>.
7179 </p>
7180 </dd>
7181 <dt> &lsquo;<samp>chroma_strength, cs</samp>&rsquo;</dt>
7182 <dd><p>Set chroma strength.
7183 </p>
7184 <p>Must be a double value in the range 0-1000, default is <code>1.0</code>.
7185 </p></dd>
7186 </dl>
7187
7188 <a name="pad"></a>
7189 <h2 class="section"><a href="ffmpeg-filters.html#toc-pad">9.62 pad</a></h2>
7190
7191 <p>Add paddings to the input image, and place the original input at the
7192 given coordinates <var>x</var>, <var>y</var>.
7193 </p>
7194 <p>This filter accepts the following parameters:
7195 </p>
7196 <dl compact="compact">
7197 <dt> &lsquo;<samp>width, w</samp>&rsquo;</dt>
7198 <dt> &lsquo;<samp>height, h</samp>&rsquo;</dt>
7199 <dd><p>Specify an expression for the size of the output image with the
7200 paddings added. If the value for <var>width</var> or <var>height</var> is 0, the
7201 corresponding input size is used for the output.
7202 </p>
7203 <p>The <var>width</var> expression can reference the value set by the
7204 <var>height</var> expression, and vice versa.
7205 </p>
7206 <p>The default value of <var>width</var> and <var>height</var> is 0.
7207 </p>
7208 </dd>
7209 <dt> &lsquo;<samp>x</samp>&rsquo;</dt>
7210 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
7211 <dd><p>Specify an expression for the offsets where to place the input image
7212 in the padded area with respect to the top/left border of the output
7213 image.
7214 </p>
7215 <p>The <var>x</var> expression can reference the value set by the <var>y</var>
7216 expression, and vice versa.
7217 </p>
7218 <p>The default value of <var>x</var> and <var>y</var> is 0.
7219 </p>
7220 </dd>
7221 <dt> &lsquo;<samp>color</samp>&rsquo;</dt>
7222 <dd><p>Specify the color of the padded area. For the syntax of this option,
7223 check the &quot;Color&quot; section in the ffmpeg-utils manual.
7224 </p>
7225 <p>The default value of <var>color</var> is &quot;black&quot;.
7226 </p></dd>
7227 </dl>
7228
7229 <p>The value for the <var>width</var>, <var>height</var>, <var>x</var>, and <var>y</var>
7230 options are expressions containing the following constants:
7231 </p>
7232 <dl compact="compact">
7233 <dt> &lsquo;<samp>in_w</samp>&rsquo;</dt>
7234 <dt> &lsquo;<samp>in_h</samp>&rsquo;</dt>
7235 <dd><p>the input video width and height
7236 </p>
7237 </dd>
7238 <dt> &lsquo;<samp>iw</samp>&rsquo;</dt>
7239 <dt> &lsquo;<samp>ih</samp>&rsquo;</dt>
7240 <dd><p>same as <var>in_w</var> and <var>in_h</var>
7241 </p>
7242 </dd>
7243 <dt> &lsquo;<samp>out_w</samp>&rsquo;</dt>
7244 <dt> &lsquo;<samp>out_h</samp>&rsquo;</dt>
7245 <dd><p>the output width and height, that is the size of the padded area as
7246 specified by the <var>width</var> and <var>height</var> expressions
7247 </p>
7248 </dd>
7249 <dt> &lsquo;<samp>ow</samp>&rsquo;</dt>
7250 <dt> &lsquo;<samp>oh</samp>&rsquo;</dt>
7251 <dd><p>same as <var>out_w</var> and <var>out_h</var>
7252 </p>
7253 </dd>
7254 <dt> &lsquo;<samp>x</samp>&rsquo;</dt>
7255 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
7256 <dd><p>x and y offsets as specified by the <var>x</var> and <var>y</var>
7257 expressions, or NAN if not yet specified
7258 </p>
7259 </dd>
7260 <dt> &lsquo;<samp>a</samp>&rsquo;</dt>
7261 <dd><p>same as <var>iw</var> / <var>ih</var>
7262 </p>
7263 </dd>
7264 <dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
7265 <dd><p>input sample aspect ratio
7266 </p>
7267 </dd>
7268 <dt> &lsquo;<samp>dar</samp>&rsquo;</dt>
7269 <dd><p>input display aspect ratio, it is the same as (<var>iw</var> / <var>ih</var>) * <var>sar</var>
7270 </p>
7271 </dd>
7272 <dt> &lsquo;<samp>hsub</samp>&rsquo;</dt>
7273 <dt> &lsquo;<samp>vsub</samp>&rsquo;</dt>
7274 <dd><p>horizontal and vertical chroma subsample values. For example for the
7275 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
7276 </p></dd>
7277 </dl>
7278
7279 <a name="Examples-39"></a>
7280 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-39">9.62.1 Examples</a></h3>
7281
7282 <ul>
7283 <li>
7284 Add paddings with color &quot;violet&quot; to the input video. Output video
7285 size is 640x480, the top-left corner of the input video is placed at
7286 column 0, row 40:
7287 <table><tr><td>&nbsp;</td><td><pre class="example">pad=640:480:0:40:violet
7288 </pre></td></tr></table>
7289
7290 <p>The example above is equivalent to the following command:
7291 </p><table><tr><td>&nbsp;</td><td><pre class="example">pad=width=640:height=480:x=0:y=40:color=violet
7292 </pre></td></tr></table>
7293
7294 </li><li>
7295 Pad the input to get an output with dimensions increased by 3/2,
7296 and put the input video at the center of the padded area:
7297 <table><tr><td>&nbsp;</td><td><pre class="example">pad=&quot;3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2&quot;
7298 </pre></td></tr></table>
7299
7300 </li><li>
7301 Pad the input to get a squared output with size equal to the maximum
7302 value between the input width and height, and put the input video at
7303 the center of the padded area:
7304 <table><tr><td>&nbsp;</td><td><pre class="example">pad=&quot;max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2&quot;
7305 </pre></td></tr></table>
7306
7307 </li><li>
7308 Pad the input to get a final w/h ratio of 16:9:
7309 <table><tr><td>&nbsp;</td><td><pre class="example">pad=&quot;ih*16/9:ih:(ow-iw)/2:(oh-ih)/2&quot;
7310 </pre></td></tr></table>
7311
7312 </li><li>
7313 In case of anamorphic video, in order to set the output display aspect
7314 correctly, it is necessary to use <var>sar</var> in the expression,
7315 according to the relation:
7316 <table><tr><td>&nbsp;</td><td><pre class="example">(ih * X / ih) * sar = output_dar
7317 X = output_dar / sar
7318 </pre></td></tr></table>
7319
7320 <p>Thus the previous example needs to be modified to:
7321 </p><table><tr><td>&nbsp;</td><td><pre class="example">pad=&quot;ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2&quot;
7322 </pre></td></tr></table>
7323
7324 </li><li>
7325 Double output size and put the input video in the bottom-right
7326 corner of the output padded area:
7327 <table><tr><td>&nbsp;</td><td><pre class="example">pad=&quot;2*iw:2*ih:ow-iw:oh-ih&quot;
7328 </pre></td></tr></table>
7329 </li></ul>
7330
7331 <a name="perspective"></a>
7332 <h2 class="section"><a href="ffmpeg-filters.html#toc-perspective">9.63 perspective</a></h2>
7333
7334 <p>Correct perspective of video not recorded perpendicular to the screen.
7335 </p>
7336 <p>A description of the accepted parameters follows.
7337 </p>
7338 <dl compact="compact">
7339 <dt> &lsquo;<samp>x0</samp>&rsquo;</dt>
7340 <dt> &lsquo;<samp>y0</samp>&rsquo;</dt>
7341 <dt> &lsquo;<samp>x1</samp>&rsquo;</dt>
7342 <dt> &lsquo;<samp>y1</samp>&rsquo;</dt>
7343 <dt> &lsquo;<samp>x2</samp>&rsquo;</dt>
7344 <dt> &lsquo;<samp>y2</samp>&rsquo;</dt>
7345 <dt> &lsquo;<samp>x3</samp>&rsquo;</dt>
7346 <dt> &lsquo;<samp>y3</samp>&rsquo;</dt>
7347 <dd><p>Set coordinates expression for top left, top right, bottom left and bottom right corners.
7348 Default values are <code>0:0:W:0:0:H:W:H</code> with which perspective will remain unchanged.
7349 </p>
7350 <p>The expressions can use the following variables:
7351 </p>
7352 <dl compact="compact">
7353 <dt> &lsquo;<samp>W</samp>&rsquo;</dt>
7354 <dt> &lsquo;<samp>H</samp>&rsquo;</dt>
7355 <dd><p>the width and height of video frame.
7356 </p></dd>
7357 </dl>
7358
7359 </dd>
7360 <dt> &lsquo;<samp>interpolation</samp>&rsquo;</dt>
7361 <dd><p>Set interpolation for perspective correction.
7362 </p>
7363 <p>It accepts the following values:
7364 </p><dl compact="compact">
7365 <dt> &lsquo;<samp>linear</samp>&rsquo;</dt>
7366 <dt> &lsquo;<samp>cubic</samp>&rsquo;</dt>
7367 </dl>
7368
7369 <p>Default value is &lsquo;<samp>linear</samp>&rsquo;.
7370 </p></dd>
7371 </dl>
7372
7373 <a name="phase"></a>
7374 <h2 class="section"><a href="ffmpeg-filters.html#toc-phase">9.64 phase</a></h2>
7375
7376 <p>Delay interlaced video by one field time so that the field order changes.
7377 </p>
7378 <p>The intended use is to fix PAL movies that have been captured with the
7379 opposite field order to the film-to-video transfer.
7380 </p>
7381 <p>A description of the accepted parameters follows.
7382 </p>
7383 <dl compact="compact">
7384 <dt> &lsquo;<samp>mode</samp>&rsquo;</dt>
7385 <dd><p>Set phase mode.
7386 </p>
7387 <p>It accepts the following values:
7388 </p><dl compact="compact">
7389 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
7390 <dd><p>Capture field order top-first, transfer bottom-first.
7391 Filter will delay the bottom field.
7392 </p>
7393 </dd>
7394 <dt> &lsquo;<samp>b</samp>&rsquo;</dt>
7395 <dd><p>Capture field order bottom-first, transfer top-first.
7396 Filter will delay the top field.
7397 </p>
7398 </dd>
7399 <dt> &lsquo;<samp>p</samp>&rsquo;</dt>
7400 <dd><p>Capture and transfer with the same field order. This mode only exists
7401 for the documentation of the other options to refer to, but if you
7402 actually select it, the filter will faithfully do nothing.
7403 </p>
7404 </dd>
7405 <dt> &lsquo;<samp>a</samp>&rsquo;</dt>
7406 <dd><p>Capture field order determined automatically by field flags, transfer
7407 opposite.
7408 Filter selects among &lsquo;<samp>t</samp>&rsquo; and &lsquo;<samp>b</samp>&rsquo; modes on a frame by frame
7409 basis using field flags. If no field information is available,
7410 then this works just like &lsquo;<samp>u</samp>&rsquo;.
7411 </p>
7412 </dd>
7413 <dt> &lsquo;<samp>u</samp>&rsquo;</dt>
7414 <dd><p>Capture unknown or varying, transfer opposite.
7415 Filter selects among &lsquo;<samp>t</samp>&rsquo; and &lsquo;<samp>b</samp>&rsquo; on a frame by frame basis by
7416 analyzing the images and selecting the alternative that produces best
7417 match between the fields.
7418 </p>
7419 </dd>
7420 <dt> &lsquo;<samp>T</samp>&rsquo;</dt>
7421 <dd><p>Capture top-first, transfer unknown or varying.
7422 Filter selects among &lsquo;<samp>t</samp>&rsquo; and &lsquo;<samp>p</samp>&rsquo; using image analysis.
7423 </p>
7424 </dd>
7425 <dt> &lsquo;<samp>B</samp>&rsquo;</dt>
7426 <dd><p>Capture bottom-first, transfer unknown or varying.
7427 Filter selects among &lsquo;<samp>b</samp>&rsquo; and &lsquo;<samp>p</samp>&rsquo; using image analysis.
7428 </p>
7429 </dd>
7430 <dt> &lsquo;<samp>A</samp>&rsquo;</dt>
7431 <dd><p>Capture determined by field flags, transfer unknown or varying.
7432 Filter selects among &lsquo;<samp>t</samp>&rsquo;, &lsquo;<samp>b</samp>&rsquo; and &lsquo;<samp>p</samp>&rsquo; using field flags and
7433 image analysis. If no field information is available, then this works just
7434 like &lsquo;<samp>U</samp>&rsquo;. This is the default mode.
7435 </p>
7436 </dd>
7437 <dt> &lsquo;<samp>U</samp>&rsquo;</dt>
7438 <dd><p>Both capture and transfer unknown or varying.
7439 Filter selects among &lsquo;<samp>t</samp>&rsquo;, &lsquo;<samp>b</samp>&rsquo; and &lsquo;<samp>p</samp>&rsquo; using image analysis only.
7440 </p></dd>
7441 </dl>
7442 </dd>
7443 </dl>
7444
7445 <a name="pixdesctest"></a>
7446 <h2 class="section"><a href="ffmpeg-filters.html#toc-pixdesctest">9.65 pixdesctest</a></h2>
7447
7448 <p>Pixel format descriptor test filter, mainly useful for internal
7449 testing. The output video should be equal to the input video.
7450 </p>
7451 <p>For example:
7452 </p><table><tr><td>&nbsp;</td><td><pre class="example">format=monow, pixdesctest
7453 </pre></td></tr></table>
7454
7455 <p>can be used to test the monowhite pixel format descriptor definition.
7456 </p>
7457 <a name="pp"></a>
7458 <h2 class="section"><a href="ffmpeg-filters.html#toc-pp">9.66 pp</a></h2>
7459
7460 <p>Enable the specified chain of postprocessing subfilters using libpostproc. This
7461 library should be automatically selected with a GPL build (<code>--enable-gpl</code>).
7462 Subfilters must be separated by &rsquo;/&rsquo; and can be disabled by prepending a &rsquo;-&rsquo;.
7463 Each subfilter and some options have a short and a long name that can be used
7464 interchangeably, i.e. dr/dering are the same.
7465 </p>
7466 <p>The filters accept the following options:
7467 </p>
7468 <dl compact="compact">
7469 <dt> &lsquo;<samp>subfilters</samp>&rsquo;</dt>
7470 <dd><p>Set postprocessing subfilters string.
7471 </p></dd>
7472 </dl>
7473
7474 <p>All subfilters share common options to determine their scope:
7475 </p>
7476 <dl compact="compact">
7477 <dt> &lsquo;<samp>a/autoq</samp>&rsquo;</dt>
7478 <dd><p>Honor the quality commands for this subfilter.
7479 </p>
7480 </dd>
7481 <dt> &lsquo;<samp>c/chrom</samp>&rsquo;</dt>
7482 <dd><p>Do chrominance filtering, too (default).
7483 </p>
7484 </dd>
7485 <dt> &lsquo;<samp>y/nochrom</samp>&rsquo;</dt>
7486 <dd><p>Do luminance filtering only (no chrominance).
7487 </p>
7488 </dd>
7489 <dt> &lsquo;<samp>n/noluma</samp>&rsquo;</dt>
7490 <dd><p>Do chrominance filtering only (no luminance).
7491 </p></dd>
7492 </dl>
7493
7494 <p>These options can be appended after the subfilter name, separated by a &rsquo;|&rsquo;.
7495 </p>
7496 <p>Available subfilters are:
7497 </p>
7498 <dl compact="compact">
7499 <dt> &lsquo;<samp>hb/hdeblock[|difference[|flatness]]</samp>&rsquo;</dt>
7500 <dd><p>Horizontal deblocking filter
7501 </p><dl compact="compact">
7502 <dt> &lsquo;<samp>difference</samp>&rsquo;</dt>
7503 <dd><p>Difference factor where higher values mean more deblocking (default: <code>32</code>).
7504 </p></dd>
7505 <dt> &lsquo;<samp>flatness</samp>&rsquo;</dt>
7506 <dd><p>Flatness threshold where lower values mean more deblocking (default: <code>39</code>).
7507 </p></dd>
7508 </dl>
7509
7510 </dd>
7511 <dt> &lsquo;<samp>vb/vdeblock[|difference[|flatness]]</samp>&rsquo;</dt>
7512 <dd><p>Vertical deblocking filter
7513 </p><dl compact="compact">
7514 <dt> &lsquo;<samp>difference</samp>&rsquo;</dt>
7515 <dd><p>Difference factor where higher values mean more deblocking (default: <code>32</code>).
7516 </p></dd>
7517 <dt> &lsquo;<samp>flatness</samp>&rsquo;</dt>
7518 <dd><p>Flatness threshold where lower values mean more deblocking (default: <code>39</code>).
7519 </p></dd>
7520 </dl>
7521
7522 </dd>
7523 <dt> &lsquo;<samp>ha/hadeblock[|difference[|flatness]]</samp>&rsquo;</dt>
7524 <dd><p>Accurate horizontal deblocking filter
7525 </p><dl compact="compact">
7526 <dt> &lsquo;<samp>difference</samp>&rsquo;</dt>
7527 <dd><p>Difference factor where higher values mean more deblocking (default: <code>32</code>).
7528 </p></dd>
7529 <dt> &lsquo;<samp>flatness</samp>&rsquo;</dt>
7530 <dd><p>Flatness threshold where lower values mean more deblocking (default: <code>39</code>).
7531 </p></dd>
7532 </dl>
7533
7534 </dd>
7535 <dt> &lsquo;<samp>va/vadeblock[|difference[|flatness]]</samp>&rsquo;</dt>
7536 <dd><p>Accurate vertical deblocking filter
7537 </p><dl compact="compact">
7538 <dt> &lsquo;<samp>difference</samp>&rsquo;</dt>
7539 <dd><p>Difference factor where higher values mean more deblocking (default: <code>32</code>).
7540 </p></dd>
7541 <dt> &lsquo;<samp>flatness</samp>&rsquo;</dt>
7542 <dd><p>Flatness threshold where lower values mean more deblocking (default: <code>39</code>).
7543 </p></dd>
7544 </dl>
7545 </dd>
7546 </dl>
7547
7548 <p>The horizontal and vertical deblocking filters share the difference and
7549 flatness values so you cannot set different horizontal and vertical
7550 thresholds.
7551 </p>
7552 <dl compact="compact">
7553 <dt> &lsquo;<samp>h1/x1hdeblock</samp>&rsquo;</dt>
7554 <dd><p>Experimental horizontal deblocking filter
7555 </p>
7556 </dd>
7557 <dt> &lsquo;<samp>v1/x1vdeblock</samp>&rsquo;</dt>
7558 <dd><p>Experimental vertical deblocking filter
7559 </p>
7560 </dd>
7561 <dt> &lsquo;<samp>dr/dering</samp>&rsquo;</dt>
7562 <dd><p>Deringing filter
7563 </p>
7564 </dd>
7565 <dt> &lsquo;<samp>tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer</samp>&rsquo;</dt>
7566 <dd><dl compact="compact">
7567 <dt> &lsquo;<samp>threshold1</samp>&rsquo;</dt>
7568 <dd><p>larger -&gt; stronger filtering
7569 </p></dd>
7570 <dt> &lsquo;<samp>threshold2</samp>&rsquo;</dt>
7571 <dd><p>larger -&gt; stronger filtering
7572 </p></dd>
7573 <dt> &lsquo;<samp>threshold3</samp>&rsquo;</dt>
7574 <dd><p>larger -&gt; stronger filtering
7575 </p></dd>
7576 </dl>
7577
7578 </dd>
7579 <dt> &lsquo;<samp>al/autolevels[:f/fullyrange], automatic brightness / contrast correction</samp>&rsquo;</dt>
7580 <dd><dl compact="compact">
7581 <dt> &lsquo;<samp>f/fullyrange</samp>&rsquo;</dt>
7582 <dd><p>Stretch luminance to <code>0-255</code>.
7583 </p></dd>
7584 </dl>
7585
7586 </dd>
7587 <dt> &lsquo;<samp>lb/linblenddeint</samp>&rsquo;</dt>
7588 <dd><p>Linear blend deinterlacing filter that deinterlaces the given block by
7589 filtering all lines with a <code>(1 2 1)</code> filter.
7590 </p>
7591 </dd>
7592 <dt> &lsquo;<samp>li/linipoldeint</samp>&rsquo;</dt>
7593 <dd><p>Linear interpolating deinterlacing filter that deinterlaces the given block by
7594 linearly interpolating every second line.
7595 </p>
7596 </dd>
7597 <dt> &lsquo;<samp>ci/cubicipoldeint</samp>&rsquo;</dt>
7598 <dd><p>Cubic interpolating deinterlacing filter deinterlaces the given block by
7599 cubically interpolating every second line.
7600 </p>
7601 </dd>
7602 <dt> &lsquo;<samp>md/mediandeint</samp>&rsquo;</dt>
7603 <dd><p>Median deinterlacing filter that deinterlaces the given block by applying a
7604 median filter to every second line.
7605 </p>
7606 </dd>
7607 <dt> &lsquo;<samp>fd/ffmpegdeint</samp>&rsquo;</dt>
7608 <dd><p>FFmpeg deinterlacing filter that deinterlaces the given block by filtering every
7609 second line with a <code>(-1 4 2 4 -1)</code> filter.
7610 </p>
7611 </dd>
7612 <dt> &lsquo;<samp>l5/lowpass5</samp>&rsquo;</dt>
7613 <dd><p>Vertically applied FIR lowpass deinterlacing filter that deinterlaces the given
7614 block by filtering all lines with a <code>(-1 2 6 2 -1)</code> filter.
7615 </p>
7616 </dd>
7617 <dt> &lsquo;<samp>fq/forceQuant[|quantizer]</samp>&rsquo;</dt>
7618 <dd><p>Overrides the quantizer table from the input with the constant quantizer you
7619 specify.
7620 </p><dl compact="compact">
7621 <dt> &lsquo;<samp>quantizer</samp>&rsquo;</dt>
7622 <dd><p>Quantizer to use
7623 </p></dd>
7624 </dl>
7625
7626 </dd>
7627 <dt> &lsquo;<samp>de/default</samp>&rsquo;</dt>
7628 <dd><p>Default pp filter combination (<code>hb|a,vb|a,dr|a</code>)
7629 </p>
7630 </dd>
7631 <dt> &lsquo;<samp>fa/fast</samp>&rsquo;</dt>
7632 <dd><p>Fast pp filter combination (<code>h1|a,v1|a,dr|a</code>)
7633 </p>
7634 </dd>
7635 <dt> &lsquo;<samp>ac</samp>&rsquo;</dt>
7636 <dd><p>High quality pp filter combination (<code>ha|a|128|7,va|a,dr|a</code>)
7637 </p></dd>
7638 </dl>
7639
7640 <a name="Examples-43"></a>
7641 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-43">9.66.1 Examples</a></h3>
7642
7643 <ul>
7644 <li>
7645 Apply horizontal and vertical deblocking, deringing and automatic
7646 brightness/contrast:
7647 <table><tr><td>&nbsp;</td><td><pre class="example">pp=hb/vb/dr/al
7648 </pre></td></tr></table>
7649
7650 </li><li>
7651 Apply default filters without brightness/contrast correction:
7652 <table><tr><td>&nbsp;</td><td><pre class="example">pp=de/-al
7653 </pre></td></tr></table>
7654
7655 </li><li>
7656 Apply default filters and temporal denoiser:
7657 <table><tr><td>&nbsp;</td><td><pre class="example">pp=default/tmpnoise|1|2|3
7658 </pre></td></tr></table>
7659
7660 </li><li>
7661 Apply deblocking on luminance only, and switch vertical deblocking on or off
7662 automatically depending on available CPU time:
7663 <table><tr><td>&nbsp;</td><td><pre class="example">pp=hb|y/vb|a
7664 </pre></td></tr></table>
7665 </li></ul>
7666
7667 <a name="psnr"></a>
7668 <h2 class="section"><a href="ffmpeg-filters.html#toc-psnr">9.67 psnr</a></h2>
7669
7670 <p>Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
7671 Ratio) between two input videos.
7672 </p>
7673 <p>This filter takes in input two input videos, the first input is
7674 considered the &quot;main&quot; source and is passed unchanged to the
7675 output. The second input is used as a &quot;reference&quot; video for computing
7676 the PSNR.
7677 </p>
7678 <p>Both video inputs must have the same resolution and pixel format for
7679 this filter to work correctly. Also it assumes that both inputs
7680 have the same number of frames, which are compared one by one.
7681 </p>
7682 <p>The obtained average PSNR is printed through the logging system.
7683 </p>
7684 <p>The filter stores the accumulated MSE (mean squared error) of each
7685 frame, and at the end of the processing it is averaged across all frames
7686 equally, and the following formula is applied to obtain the PSNR:
7687 </p>
7688 <table><tr><td>&nbsp;</td><td><pre class="example">PSNR = 10*log10(MAX^2/MSE)
7689 </pre></td></tr></table>
7690
7691 <p>Where MAX is the average of the maximum values of each component of the
7692 image.
7693 </p>
7694 <p>The description of the accepted parameters follows.
7695 </p>
7696 <dl compact="compact">
7697 <dt> &lsquo;<samp>stats_file, f</samp>&rsquo;</dt>
7698 <dd><p>If specified the filter will use the named file to save the PSNR of
7699 each individual frame.
7700 </p></dd>
7701 </dl>
7702
7703 <p>The file printed if <var>stats_file</var> is selected, contains a sequence of
7704 key/value pairs of the form <var>key</var>:<var>value</var> for each compared
7705 couple of frames.
7706 </p>
7707 <p>A description of each shown parameter follows:
7708 </p>
7709 <dl compact="compact">
7710 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
7711 <dd><p>sequential number of the input frame, starting from 1
7712 </p>
7713 </dd>
7714 <dt> &lsquo;<samp>mse_avg</samp>&rsquo;</dt>
7715 <dd><p>Mean Square Error pixel-by-pixel average difference of the compared
7716 frames, averaged over all the image components.
7717 </p>
7718 </dd>
7719 <dt> &lsquo;<samp>mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a</samp>&rsquo;</dt>
7720 <dd><p>Mean Square Error pixel-by-pixel average difference of the compared
7721 frames for the component specified by the suffix.
7722 </p>
7723 </dd>
7724 <dt> &lsquo;<samp>psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a</samp>&rsquo;</dt>
7725 <dd><p>Peak Signal to Noise ratio of the compared frames for the component
7726 specified by the suffix.
7727 </p></dd>
7728 </dl>
7729
7730 <p>For example:
7731 </p><table><tr><td>&nbsp;</td><td><pre class="example">movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
7732 [main][ref] psnr=&quot;stats_file=stats.log&quot; [out]
7733 </pre></td></tr></table>
7734
7735 <p>On this example the input file being processed is compared with the
7736 reference file &lsquo;<tt>ref_movie.mpg</tt>&rsquo;. The PSNR of each individual frame
7737 is stored in &lsquo;<tt>stats.log</tt>&rsquo;.
7738 </p>
7739 <p><a name="pullup"></a>
7740 </p><a name="pullup-1"></a>
7741 <h2 class="section"><a href="ffmpeg-filters.html#toc-pullup-1">9.68 pullup</a></h2>
7742
7743 <p>Pulldown reversal (inverse telecine) filter, capable of handling mixed
7744 hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
7745 content.
7746 </p>
7747 <p>The pullup filter is designed to take advantage of future context in making
7748 its decisions. This filter is stateless in the sense that it does not lock
7749 onto a pattern to follow, but it instead looks forward to the following
7750 fields in order to identify matches and rebuild progressive frames.
7751 </p>
7752 <p>To produce content with an even framerate, insert the fps filter after
7753 pullup, use <code>fps=24000/1001</code> if the input frame rate is 29.97fps,
7754 <code>fps=24</code> for 30fps and the (rare) telecined 25fps input.
7755 </p>
7756 <p>The filter accepts the following options:
7757 </p>
7758 <dl compact="compact">
7759 <dt> &lsquo;<samp>jl</samp>&rsquo;</dt>
7760 <dt> &lsquo;<samp>jr</samp>&rsquo;</dt>
7761 <dt> &lsquo;<samp>jt</samp>&rsquo;</dt>
7762 <dt> &lsquo;<samp>jb</samp>&rsquo;</dt>
7763 <dd><p>These options set the amount of &quot;junk&quot; to ignore at the left, right, top, and
7764 bottom of the image, respectively. Left and right are in units of 8 pixels,
7765 while top and bottom are in units of 2 lines.
7766 The default is 8 pixels on each side.
7767 </p>
7768 </dd>
7769 <dt> &lsquo;<samp>sb</samp>&rsquo;</dt>
7770 <dd><p>Set the strict breaks. Setting this option to 1 will reduce the chances of
7771 filter generating an occasional mismatched frame, but it may also cause an
7772 excessive number of frames to be dropped during high motion sequences.
7773 Conversely, setting it to -1 will make filter match fields more easily.
7774 This may help processing of video where there is slight blurring between
7775 the fields, but may also cause there to be interlaced frames in the output.
7776 Default value is <code>0</code>.
7777 </p>
7778 </dd>
7779 <dt> &lsquo;<samp>mp</samp>&rsquo;</dt>
7780 <dd><p>Set the metric plane to use. It accepts the following values:
7781 </p><dl compact="compact">
7782 <dt> &lsquo;<samp>l</samp>&rsquo;</dt>
7783 <dd><p>Use luma plane.
7784 </p>
7785 </dd>
7786 <dt> &lsquo;<samp>u</samp>&rsquo;</dt>
7787 <dd><p>Use chroma blue plane.
7788 </p>
7789 </dd>
7790 <dt> &lsquo;<samp>v</samp>&rsquo;</dt>
7791 <dd><p>Use chroma red plane.
7792 </p></dd>
7793 </dl>
7794
7795 <p>This option may be set to use chroma plane instead of the default luma plane
7796 for doing filter&rsquo;s computations. This may improve accuracy on very clean
7797 source material, but more likely will decrease accuracy, especially if there
7798 is chroma noise (rainbow effect) or any grayscale video.
7799 The main purpose of setting &lsquo;<samp>mp</samp>&rsquo; to a chroma plane is to reduce CPU
7800 load and make pullup usable in realtime on slow machines.
7801 </p></dd>
7802 </dl>
7803
7804 <p>For best results (without duplicated frames in the output file) it is
7805 necessary to change the output frame rate. For example, to inverse
7806 telecine NTSC input:
7807 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i input -vf pullup -r 24000/1001 ...
7808 </pre></td></tr></table>
7809
7810 <a name="removelogo"></a>
7811 <h2 class="section"><a href="ffmpeg-filters.html#toc-removelogo">9.69 removelogo</a></h2>
7812
7813 <p>Suppress a TV station logo, using an image file to determine which
7814 pixels comprise the logo. It works by filling in the pixels that
7815 comprise the logo with neighboring pixels.
7816 </p>
7817 <p>The filter accepts the following options:
7818 </p>
7819 <dl compact="compact">
7820 <dt> &lsquo;<samp>filename, f</samp>&rsquo;</dt>
7821 <dd><p>Set the filter bitmap file, which can be any image format supported by
7822 libavformat. The width and height of the image file must match those of the
7823 video stream being processed.
7824 </p></dd>
7825 </dl>
7826
7827 <p>Pixels in the provided bitmap image with a value of zero are not
7828 considered part of the logo, non-zero pixels are considered part of
7829 the logo. If you use white (255) for the logo and black (0) for the
7830 rest, you will be safe. For making the filter bitmap, it is
7831 recommended to take a screen capture of a black frame with the logo
7832 visible, and then using a threshold filter followed by the erode
7833 filter once or twice.
7834 </p>
7835 <p>If needed, little splotches can be fixed manually. Remember that if
7836 logo pixels are not covered, the filter quality will be much
7837 reduced. Marking too many pixels as part of the logo does not hurt as
7838 much, but it will increase the amount of blurring needed to cover over
7839 the image and will destroy more information than necessary, and extra
7840 pixels will slow things down on a large logo.
7841 </p>
7842 <a name="rotate"></a>
7843 <h2 class="section"><a href="ffmpeg-filters.html#toc-rotate">9.70 rotate</a></h2>
7844
7845 <p>Rotate video by an arbitrary angle expressed in radians.
7846 </p>
7847 <p>The filter accepts the following options:
7848 </p>
7849 <p>A description of the optional parameters follows.
7850 </p><dl compact="compact">
7851 <dt> &lsquo;<samp>angle, a</samp>&rsquo;</dt>
7852 <dd><p>Set an expression for the angle by which to rotate the input video
7853 clockwise, expressed as a number of radians. A negative value will
7854 result in a counter-clockwise rotation. By default it is set to &quot;0&quot;.
7855 </p>
7856 <p>This expression is evaluated for each frame.
7857 </p>
7858 </dd>
7859 <dt> &lsquo;<samp>out_w, ow</samp>&rsquo;</dt>
7860 <dd><p>Set the output width expression, default value is &quot;iw&quot;.
7861 This expression is evaluated just once during configuration.
7862 </p>
7863 </dd>
7864 <dt> &lsquo;<samp>out_h, oh</samp>&rsquo;</dt>
7865 <dd><p>Set the output height expression, default value is &quot;ih&quot;.
7866 This expression is evaluated just once during configuration.
7867 </p>
7868 </dd>
7869 <dt> &lsquo;<samp>bilinear</samp>&rsquo;</dt>
7870 <dd><p>Enable bilinear interpolation if set to 1, a value of 0 disables
7871 it. Default value is 1.
7872 </p>
7873 </dd>
7874 <dt> &lsquo;<samp>fillcolor, c</samp>&rsquo;</dt>
7875 <dd><p>Set the color used to fill the output area not covered by the rotated
7876 image. For the generalsyntax of this option, check the &quot;Color&quot; section in the
7877 ffmpeg-utils manual. If the special value &quot;none&quot; is selected then no
7878 background is printed (useful for example if the background is never shown).
7879 </p>
7880 <p>Default value is &quot;black&quot;.
7881 </p></dd>
7882 </dl>
7883
7884 <p>The expressions for the angle and the output size can contain the
7885 following constants and functions:
7886 </p>
7887 <dl compact="compact">
7888 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
7889 <dd><p>sequential number of the input frame, starting from 0. It is always NAN
7890 before the first frame is filtered.
7891 </p>
7892 </dd>
7893 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
7894 <dd><p>time in seconds of the input frame, it is set to 0 when the filter is
7895 configured. It is always NAN before the first frame is filtered.
7896 </p>
7897 </dd>
7898 <dt> &lsquo;<samp>hsub</samp>&rsquo;</dt>
7899 <dt> &lsquo;<samp>vsub</samp>&rsquo;</dt>
7900 <dd><p>horizontal and vertical chroma subsample values. For example for the
7901 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
7902 </p>
7903 </dd>
7904 <dt> &lsquo;<samp>in_w, iw</samp>&rsquo;</dt>
7905 <dt> &lsquo;<samp>in_h, ih</samp>&rsquo;</dt>
7906 <dd><p>the input video width and height
7907 </p>
7908 </dd>
7909 <dt> &lsquo;<samp>out_w, ow</samp>&rsquo;</dt>
7910 <dt> &lsquo;<samp>out_h, oh</samp>&rsquo;</dt>
7911 <dd><p>the output width and height, that is the size of the padded area as
7912 specified by the <var>width</var> and <var>height</var> expressions
7913 </p>
7914 </dd>
7915 <dt> &lsquo;<samp>rotw(a)</samp>&rsquo;</dt>
7916 <dt> &lsquo;<samp>roth(a)</samp>&rsquo;</dt>
7917 <dd><p>the minimal width/height required for completely containing the input
7918 video rotated by <var>a</var> radians.
7919 </p>
7920 <p>These are only available when computing the &lsquo;<samp>out_w</samp>&rsquo; and
7921 &lsquo;<samp>out_h</samp>&rsquo; expressions.
7922 </p></dd>
7923 </dl>
7924
7925 <a name="Examples-62"></a>
7926 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-62">9.70.1 Examples</a></h3>
7927
7928 <ul>
7929 <li>
7930 Rotate the input by PI/6 radians clockwise:
7931 <table><tr><td>&nbsp;</td><td><pre class="example">rotate=PI/6
7932 </pre></td></tr></table>
7933
7934 </li><li>
7935 Rotate the input by PI/6 radians counter-clockwise:
7936 <table><tr><td>&nbsp;</td><td><pre class="example">rotate=-PI/6
7937 </pre></td></tr></table>
7938
7939 </li><li>
7940 Rotate the input by 45 degrees clockwise:
7941 <table><tr><td>&nbsp;</td><td><pre class="example">rotate=45*PI/180
7942 </pre></td></tr></table>
7943
7944 </li><li>
7945 Apply a constant rotation with period T, starting from an angle of PI/3:
7946 <table><tr><td>&nbsp;</td><td><pre class="example">rotate=PI/3+2*PI*t/T
7947 </pre></td></tr></table>
7948
7949 </li><li>
7950 Make the input video rotation oscillating with a period of T
7951 seconds and an amplitude of A radians:
7952 <table><tr><td>&nbsp;</td><td><pre class="example">rotate=A*sin(2*PI/T*t)
7953 </pre></td></tr></table>
7954
7955 </li><li>
7956 Rotate the video, output size is chosen so that the whole rotating
7957 input video is always completely contained in the output:
7958 <table><tr><td>&nbsp;</td><td><pre class="example">rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
7959 </pre></td></tr></table>
7960
7961 </li><li>
7962 Rotate the video, reduce the output size so that no background is ever
7963 shown:
7964 <table><tr><td>&nbsp;</td><td><pre class="example">rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
7965 </pre></td></tr></table>
7966 </li></ul>
7967
7968 <a name="Commands-4"></a>
7969 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Commands-4">9.70.2 Commands</a></h3>
7970
7971 <p>The filter supports the following commands:
7972 </p>
7973 <dl compact="compact">
7974 <dt> &lsquo;<samp>a, angle</samp>&rsquo;</dt>
7975 <dd><p>Set the angle expression.
7976 The command accepts the same syntax of the corresponding option.
7977 </p>
7978 <p>If the specified expression is not valid, it is kept at its current
7979 value.
7980 </p></dd>
7981 </dl>
7982
7983 <a name="sab"></a>
7984 <h2 class="section"><a href="ffmpeg-filters.html#toc-sab">9.71 sab</a></h2>
7985
7986 <p>Apply Shape Adaptive Blur.
7987 </p>
7988 <p>The filter accepts the following options:
7989 </p>
7990 <dl compact="compact">
7991 <dt> &lsquo;<samp>luma_radius, lr</samp>&rsquo;</dt>
7992 <dd><p>Set luma blur filter strength, must be a value in range 0.1-4.0, default
7993 value is 1.0. A greater value will result in a more blurred image, and
7994 in slower processing.
7995 </p>
7996 </dd>
7997 <dt> &lsquo;<samp>luma_pre_filter_radius, lpfr</samp>&rsquo;</dt>
7998 <dd><p>Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
7999 value is 1.0.
8000 </p>
8001 </dd>
8002 <dt> &lsquo;<samp>luma_strength, ls</samp>&rsquo;</dt>
8003 <dd><p>Set luma maximum difference between pixels to still be considered, must
8004 be a value in the 0.1-100.0 range, default value is 1.0.
8005 </p>
8006 </dd>
8007 <dt> &lsquo;<samp>chroma_radius, cr</samp>&rsquo;</dt>
8008 <dd><p>Set chroma blur filter strength, must be a value in range 0.1-4.0. A
8009 greater value will result in a more blurred image, and in slower
8010 processing.
8011 </p>
8012 </dd>
8013 <dt> &lsquo;<samp>chroma_pre_filter_radius, cpfr</samp>&rsquo;</dt>
8014 <dd><p>Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
8015 </p>
8016 </dd>
8017 <dt> &lsquo;<samp>chroma_strength, cs</samp>&rsquo;</dt>
8018 <dd><p>Set chroma maximum difference between pixels to still be considered,
8019 must be a value in the 0.1-100.0 range.
8020 </p></dd>
8021 </dl>
8022
8023 <p>Each chroma option value, if not explicitly specified, is set to the
8024 corresponding luma option value.
8025 </p>
8026 <p><a name="scale"></a>
8027 </p><a name="scale-1"></a>
8028 <h2 class="section"><a href="ffmpeg-filters.html#toc-scale-1">9.72 scale</a></h2>
8029
8030 <p>Scale (resize) the input video, using the libswscale library.
8031 </p>
8032 <p>The scale filter forces the output display aspect ratio to be the same
8033 of the input, by changing the output sample aspect ratio.
8034 </p>
8035 <p>If the input image format is different from the format requested by
8036 the next filter, the scale filter will convert the input to the
8037 requested format.
8038 </p>
8039 <a name="Options-1"></a>
8040 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Options-1">9.72.1 Options</a></h3>
8041 <p>The filter accepts the following options, or any of the options
8042 supported by the libswscale scaler.
8043 </p>
8044 <p>See <a href="ffmpeg-scaler.html#scaler_005foptions">(ffmpeg-scaler)scaler_options</a> for
8045 the complete list of scaler options.
8046 </p>
8047 <dl compact="compact">
8048 <dt> &lsquo;<samp>width, w</samp>&rsquo;</dt>
8049 <dt> &lsquo;<samp>height, h</samp>&rsquo;</dt>
8050 <dd><p>Set the output video dimension expression. Default value is the input
8051 dimension.
8052 </p>
8053 <p>If the value is 0, the input width is used for the output.
8054 </p>
8055 <p>If one of the values is -1, the scale filter will use a value that
8056 maintains the aspect ratio of the input image, calculated from the
8057 other specified dimension. If both of them are -1, the input size is
8058 used
8059 </p>
8060 <p>If one of the values is -n with n &gt; 1, the scale filter will also use a value
8061 that maintains the aspect ratio of the input image, calculated from the other
8062 specified dimension. After that it will, however, make sure that the calculated
8063 dimension is divisible by n and adjust the value if necessary.
8064 </p>
8065 <p>See below for the list of accepted constants for use in the dimension
8066 expression.
8067 </p>
8068 </dd>
8069 <dt> &lsquo;<samp>interl</samp>&rsquo;</dt>
8070 <dd><p>Set the interlacing mode. It accepts the following values:
8071 </p>
8072 <dl compact="compact">
8073 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
8074 <dd><p>Force interlaced aware scaling.
8075 </p>
8076 </dd>
8077 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
8078 <dd><p>Do not apply interlaced scaling.
8079 </p>
8080 </dd>
8081 <dt> &lsquo;<samp>-1</samp>&rsquo;</dt>
8082 <dd><p>Select interlaced aware scaling depending on whether the source frames
8083 are flagged as interlaced or not.
8084 </p></dd>
8085 </dl>
8086
8087 <p>Default value is &lsquo;<samp>0</samp>&rsquo;.
8088 </p>
8089 </dd>
8090 <dt> &lsquo;<samp>flags</samp>&rsquo;</dt>
8091 <dd><p>Set libswscale scaling flags. See
8092 <a href="ffmpeg-scaler.html#sws_005fflags">(ffmpeg-scaler)sws_flags</a> for the
8093 complete list of values. If not explicitly specified the filter applies
8094 the default flags.
8095 </p>
8096 </dd>
8097 <dt> &lsquo;<samp>size, s</samp>&rsquo;</dt>
8098 <dd><p>Set the video size. For the syntax of this option, check the &quot;Video size&quot;
8099 section in the ffmpeg-utils manual.
8100 </p>
8101 </dd>
8102 <dt> &lsquo;<samp>in_color_matrix</samp>&rsquo;</dt>
8103 <dt> &lsquo;<samp>out_color_matrix</samp>&rsquo;</dt>
8104 <dd><p>Set in/output YCbCr color space type.
8105 </p>
8106 <p>This allows the autodetected value to be overridden as well as allows forcing
8107 a specific value used for the output and encoder.
8108 </p>
8109 <p>If not specified, the color space type depends on the pixel format.
8110 </p>
8111 <p>Possible values:
8112 </p>
8113 <dl compact="compact">
8114 <dt> &lsquo;<samp>auto</samp>&rsquo;</dt>
8115 <dd><p>Choose automatically.
8116 </p>
8117 </dd>
8118 <dt> &lsquo;<samp>bt709</samp>&rsquo;</dt>
8119 <dd><p>Format conforming to International Telecommunication Union (ITU)
8120 Recommendation BT.709.
8121 </p>
8122 </dd>
8123 <dt> &lsquo;<samp>fcc</samp>&rsquo;</dt>
8124 <dd><p>Set color space conforming to the United States Federal Communications
8125 Commission (FCC) Code of Federal Regulations (CFR) Title 47 (2003) 73.682 (a).
8126 </p>
8127 </dd>
8128 <dt> &lsquo;<samp>bt601</samp>&rsquo;</dt>
8129 <dd><p>Set color space conforming to:
8130 </p>
8131 <ul>
8132 <li>
8133 ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
8134
8135 </li><li>
8136 ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
8137
8138 </li><li>
8139 Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
8140
8141 </li></ul>
8142
8143 </dd>
8144 <dt> &lsquo;<samp>smpte240m</samp>&rsquo;</dt>
8145 <dd><p>Set color space conforming to SMPTE ST 240:1999.
8146 </p></dd>
8147 </dl>
8148
8149 </dd>
8150 <dt> &lsquo;<samp>in_range</samp>&rsquo;</dt>
8151 <dt> &lsquo;<samp>out_range</samp>&rsquo;</dt>
8152 <dd><p>Set in/output YCbCr sample range.
8153 </p>
8154 <p>This allows the autodetected value to be overridden as well as allows forcing
8155 a specific value used for the output and encoder. If not specified, the
8156 range depends on the pixel format. Possible values:
8157 </p>
8158 <dl compact="compact">
8159 <dt> &lsquo;<samp>auto</samp>&rsquo;</dt>
8160 <dd><p>Choose automatically.
8161 </p>
8162 </dd>
8163 <dt> &lsquo;<samp>jpeg/full/pc</samp>&rsquo;</dt>
8164 <dd><p>Set full range (0-255 in case of 8-bit luma).
8165 </p>
8166 </dd>
8167 <dt> &lsquo;<samp>mpeg/tv</samp>&rsquo;</dt>
8168 <dd><p>Set &quot;MPEG&quot; range (16-235 in case of 8-bit luma).
8169 </p></dd>
8170 </dl>
8171
8172 </dd>
8173 <dt> &lsquo;<samp>force_original_aspect_ratio</samp>&rsquo;</dt>
8174 <dd><p>Enable decreasing or increasing output video width or height if necessary to
8175 keep the original aspect ratio. Possible values:
8176 </p>
8177 <dl compact="compact">
8178 <dt> &lsquo;<samp>disable</samp>&rsquo;</dt>
8179 <dd><p>Scale the video as specified and disable this feature.
8180 </p>
8181 </dd>
8182 <dt> &lsquo;<samp>decrease</samp>&rsquo;</dt>
8183 <dd><p>The output video dimensions will automatically be decreased if needed.
8184 </p>
8185 </dd>
8186 <dt> &lsquo;<samp>increase</samp>&rsquo;</dt>
8187 <dd><p>The output video dimensions will automatically be increased if needed.
8188 </p>
8189 </dd>
8190 </dl>
8191
8192 <p>One useful instance of this option is that when you know a specific device&rsquo;s
8193 maximum allowed resolution, you can use this to limit the output video to
8194 that, while retaining the aspect ratio. For example, device A allows
8195 1280x720 playback, and your video is 1920x800. Using this option (set it to
8196 decrease) and specifying 1280x720 to the command line makes the output
8197 1280x533.
8198 </p>
8199 <p>Please note that this is a different thing than specifying -1 for &lsquo;<samp>w</samp>&rsquo;
8200 or &lsquo;<samp>h</samp>&rsquo;, you still need to specify the output resolution for this option
8201 to work.
8202 </p>
8203 </dd>
8204 </dl>
8205
8206 <p>The values of the &lsquo;<samp>w</samp>&rsquo; and &lsquo;<samp>h</samp>&rsquo; options are expressions
8207 containing the following constants:
8208 </p>
8209 <dl compact="compact">
8210 <dt> <var>in_w</var></dt>
8211 <dt> <var>in_h</var></dt>
8212 <dd><p>the input width and height
8213 </p>
8214 </dd>
8215 <dt> <var>iw</var></dt>
8216 <dt> <var>ih</var></dt>
8217 <dd><p>same as <var>in_w</var> and <var>in_h</var>
8218 </p>
8219 </dd>
8220 <dt> <var>out_w</var></dt>
8221 <dt> <var>out_h</var></dt>
8222 <dd><p>the output (scaled) width and height
8223 </p>
8224 </dd>
8225 <dt> <var>ow</var></dt>
8226 <dt> <var>oh</var></dt>
8227 <dd><p>same as <var>out_w</var> and <var>out_h</var>
8228 </p>
8229 </dd>
8230 <dt> <var>a</var></dt>
8231 <dd><p>same as <var>iw</var> / <var>ih</var>
8232 </p>
8233 </dd>
8234 <dt> <var>sar</var></dt>
8235 <dd><p>input sample aspect ratio
8236 </p>
8237 </dd>
8238 <dt> <var>dar</var></dt>
8239 <dd><p>input display aspect ratio. Calculated from <code>(iw / ih) * sar</code>.
8240 </p>
8241 </dd>
8242 <dt> <var>hsub</var></dt>
8243 <dt> <var>vsub</var></dt>
8244 <dd><p>horizontal and vertical input chroma subsample values. For example for the
8245 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
8246 </p>
8247 </dd>
8248 <dt> <var>ohsub</var></dt>
8249 <dt> <var>ovsub</var></dt>
8250 <dd><p>horizontal and vertical output chroma subsample values. For example for the
8251 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
8252 </p></dd>
8253 </dl>
8254
8255 <a name="Examples-24"></a>
8256 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-24">9.72.2 Examples</a></h3>
8257
8258 <ul>
8259 <li>
8260 Scale the input video to a size of 200x100:
8261 <table><tr><td>&nbsp;</td><td><pre class="example">scale=w=200:h=100
8262 </pre></td></tr></table>
8263
8264 <p>This is equivalent to:
8265 </p><table><tr><td>&nbsp;</td><td><pre class="example">scale=200:100
8266 </pre></td></tr></table>
8267
8268 <p>or:
8269 </p><table><tr><td>&nbsp;</td><td><pre class="example">scale=200x100
8270 </pre></td></tr></table>
8271
8272 </li><li>
8273 Specify a size abbreviation for the output size:
8274 <table><tr><td>&nbsp;</td><td><pre class="example">scale=qcif
8275 </pre></td></tr></table>
8276
8277 <p>which can also be written as:
8278 </p><table><tr><td>&nbsp;</td><td><pre class="example">scale=size=qcif
8279 </pre></td></tr></table>
8280
8281 </li><li>
8282 Scale the input to 2x:
8283 <table><tr><td>&nbsp;</td><td><pre class="example">scale=w=2*iw:h=2*ih
8284 </pre></td></tr></table>
8285
8286 </li><li>
8287 The above is the same as:
8288 <table><tr><td>&nbsp;</td><td><pre class="example">scale=2*in_w:2*in_h
8289 </pre></td></tr></table>
8290
8291 </li><li>
8292 Scale the input to 2x with forced interlaced scaling:
8293 <table><tr><td>&nbsp;</td><td><pre class="example">scale=2*iw:2*ih:interl=1
8294 </pre></td></tr></table>
8295
8296 </li><li>
8297 Scale the input to half size:
8298 <table><tr><td>&nbsp;</td><td><pre class="example">scale=w=iw/2:h=ih/2
8299 </pre></td></tr></table>
8300
8301 </li><li>
8302 Increase the width, and set the height to the same size:
8303 <table><tr><td>&nbsp;</td><td><pre class="example">scale=3/2*iw:ow
8304 </pre></td></tr></table>
8305
8306 </li><li>
8307 Seek for Greek harmony:
8308 <table><tr><td>&nbsp;</td><td><pre class="example">scale=iw:1/PHI*iw
8309 scale=ih*PHI:ih
8310 </pre></td></tr></table>
8311
8312 </li><li>
8313 Increase the height, and set the width to 3/2 of the height:
8314 <table><tr><td>&nbsp;</td><td><pre class="example">scale=w=3/2*oh:h=3/5*ih
8315 </pre></td></tr></table>
8316
8317 </li><li>
8318 Increase the size, but make the size a multiple of the chroma
8319 subsample values:
8320 <table><tr><td>&nbsp;</td><td><pre class="example">scale=&quot;trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub&quot;
8321 </pre></td></tr></table>
8322
8323 </li><li>
8324 Increase the width to a maximum of 500 pixels, keep the same input
8325 aspect ratio:
8326 <table><tr><td>&nbsp;</td><td><pre class="example">scale=w='min(500\, iw*3/2):h=-1'
8327 </pre></td></tr></table>
8328 </li></ul>
8329
8330 <a name="separatefields"></a>
8331 <h2 class="section"><a href="ffmpeg-filters.html#toc-separatefields">9.73 separatefields</a></h2>
8332
8333 <p>The <code>separatefields</code> takes a frame-based video input and splits
8334 each frame into its components fields, producing a new half height clip
8335 with twice the frame rate and twice the frame count.
8336 </p>
8337 <p>This filter use field-dominance information in frame to decide which
8338 of each pair of fields to place first in the output.
8339 If it gets it wrong use <a href="#setfield">setfield</a> filter before <code>separatefields</code> filter.
8340 </p>
8341 <a name="setdar_002c-setsar"></a>
8342 <h2 class="section"><a href="ffmpeg-filters.html#toc-setdar_002c-setsar">9.74 setdar, setsar</a></h2>
8343
8344 <p>The <code>setdar</code> filter sets the Display Aspect Ratio for the filter
8345 output video.
8346 </p>
8347 <p>This is done by changing the specified Sample (aka Pixel) Aspect
8348 Ratio, according to the following equation:
8349 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>DAR</var> = <var>HORIZONTAL_RESOLUTION</var> / <var>VERTICAL_RESOLUTION</var> * <var>SAR</var>
8350 </pre></td></tr></table>
8351
8352 <p>Keep in mind that the <code>setdar</code> filter does not modify the pixel
8353 dimensions of the video frame. Also the display aspect ratio set by
8354 this filter may be changed by later filters in the filterchain,
8355 e.g. in case of scaling or if another &quot;setdar&quot; or a &quot;setsar&quot; filter is
8356 applied.
8357 </p>
8358 <p>The <code>setsar</code> filter sets the Sample (aka Pixel) Aspect Ratio for
8359 the filter output video.
8360 </p>
8361 <p>Note that as a consequence of the application of this filter, the
8362 output display aspect ratio will change according to the equation
8363 above.
8364 </p>
8365 <p>Keep in mind that the sample aspect ratio set by the <code>setsar</code>
8366 filter may be changed by later filters in the filterchain, e.g. if
8367 another &quot;setsar&quot; or a &quot;setdar&quot; filter is applied.
8368 </p>
8369 <p>The filters accept the following options:
8370 </p>
8371 <dl compact="compact">
8372 <dt> &lsquo;<samp>r, ratio, dar (<code>setdar</code> only), sar (<code>setsar</code> only)</samp>&rsquo;</dt>
8373 <dd><p>Set the aspect ratio used by the filter.
8374 </p>
8375 <p>The parameter can be a floating point number string, an expression, or
8376 a string of the form <var>num</var>:<var>den</var>, where <var>num</var> and
8377 <var>den</var> are the numerator and denominator of the aspect ratio. If
8378 the parameter is not specified, it is assumed the value &quot;0&quot;.
8379 In case the form &quot;<var>num</var>:<var>den</var>&quot; is used, the <code>:</code> character
8380 should be escaped.
8381 </p>
8382 </dd>
8383 <dt> &lsquo;<samp>max</samp>&rsquo;</dt>
8384 <dd><p>Set the maximum integer value to use for expressing numerator and
8385 denominator when reducing the expressed aspect ratio to a rational.
8386 Default value is <code>100</code>.
8387 </p>
8388 </dd>
8389 </dl>
8390
8391 <p>The parameter <var>sar</var> is an expression containing
8392 the following constants:
8393 </p>
8394 <dl compact="compact">
8395 <dt> &lsquo;<samp>E, PI, PHI</samp>&rsquo;</dt>
8396 <dd><p>the corresponding mathematical approximated values for e
8397 (euler number), pi (greek PI), phi (golden ratio)
8398 </p>
8399 </dd>
8400 <dt> &lsquo;<samp>w, h</samp>&rsquo;</dt>
8401 <dd><p>the input width and height
8402 </p>
8403 </dd>
8404 <dt> &lsquo;<samp>a</samp>&rsquo;</dt>
8405 <dd><p>same as <var>w</var> / <var>h</var>
8406 </p>
8407 </dd>
8408 <dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
8409 <dd><p>input sample aspect ratio
8410 </p>
8411 </dd>
8412 <dt> &lsquo;<samp>dar</samp>&rsquo;</dt>
8413 <dd><p>input display aspect ratio, it is the same as (<var>w</var> / <var>h</var>) * <var>sar</var>
8414 </p>
8415 </dd>
8416 <dt> &lsquo;<samp>hsub, vsub</samp>&rsquo;</dt>
8417 <dd><p>horizontal and vertical chroma subsample values. For example for the
8418 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
8419 </p></dd>
8420 </dl>
8421
8422 <a name="Examples-66"></a>
8423 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-66">9.74.1 Examples</a></h3>
8424
8425 <ul>
8426 <li>
8427 To change the display aspect ratio to 16:9, specify one of the following:
8428 <table><tr><td>&nbsp;</td><td><pre class="example">setdar=dar=1.77777
8429 setdar=dar=16/9
8430 setdar=dar=1.77777
8431 </pre></td></tr></table>
8432
8433 </li><li>
8434 To change the sample aspect ratio to 10:11, specify:
8435 <table><tr><td>&nbsp;</td><td><pre class="example">setsar=sar=10/11
8436 </pre></td></tr></table>
8437
8438 </li><li>
8439 To set a display aspect ratio of 16:9, and specify a maximum integer value of
8440 1000 in the aspect ratio reduction, use the command:
8441 <table><tr><td>&nbsp;</td><td><pre class="example">setdar=ratio=16/9:max=1000
8442 </pre></td></tr></table>
8443
8444 </li></ul>
8445
8446 <p><a name="setfield"></a>
8447 </p><a name="setfield-1"></a>
8448 <h2 class="section"><a href="ffmpeg-filters.html#toc-setfield-1">9.75 setfield</a></h2>
8449
8450 <p>Force field for the output video frame.
8451 </p>
8452 <p>The <code>setfield</code> filter marks the interlace type field for the
8453 output frames. It does not change the input frame, but only sets the
8454 corresponding property, which affects how the frame is treated by
8455 following filters (e.g. <code>fieldorder</code> or <code>yadif</code>).
8456 </p>
8457 <p>The filter accepts the following options:
8458 </p>
8459 <dl compact="compact">
8460 <dt> &lsquo;<samp>mode</samp>&rsquo;</dt>
8461 <dd><p>Available values are:
8462 </p>
8463 <dl compact="compact">
8464 <dt> &lsquo;<samp>auto</samp>&rsquo;</dt>
8465 <dd><p>Keep the same field property.
8466 </p>
8467 </dd>
8468 <dt> &lsquo;<samp>bff</samp>&rsquo;</dt>
8469 <dd><p>Mark the frame as bottom-field-first.
8470 </p>
8471 </dd>
8472 <dt> &lsquo;<samp>tff</samp>&rsquo;</dt>
8473 <dd><p>Mark the frame as top-field-first.
8474 </p>
8475 </dd>
8476 <dt> &lsquo;<samp>prog</samp>&rsquo;</dt>
8477 <dd><p>Mark the frame as progressive.
8478 </p></dd>
8479 </dl>
8480 </dd>
8481 </dl>
8482
8483 <a name="showinfo"></a>
8484 <h2 class="section"><a href="ffmpeg-filters.html#toc-showinfo">9.76 showinfo</a></h2>
8485
8486 <p>Show a line containing various information for each input video frame.
8487 The input video is not modified.
8488 </p>
8489 <p>The shown line contains a sequence of key/value pairs of the form
8490 <var>key</var>:<var>value</var>.
8491 </p>
8492 <p>A description of each shown parameter follows:
8493 </p>
8494 <dl compact="compact">
8495 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
8496 <dd><p>sequential number of the input frame, starting from 0
8497 </p>
8498 </dd>
8499 <dt> &lsquo;<samp>pts</samp>&rsquo;</dt>
8500 <dd><p>Presentation TimeStamp of the input frame, expressed as a number of
8501 time base units. The time base unit depends on the filter input pad.
8502 </p>
8503 </dd>
8504 <dt> &lsquo;<samp>pts_time</samp>&rsquo;</dt>
8505 <dd><p>Presentation TimeStamp of the input frame, expressed as a number of
8506 seconds
8507 </p>
8508 </dd>
8509 <dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
8510 <dd><p>position of the frame in the input stream, -1 if this information in
8511 unavailable and/or meaningless (for example in case of synthetic video)
8512 </p>
8513 </dd>
8514 <dt> &lsquo;<samp>fmt</samp>&rsquo;</dt>
8515 <dd><p>pixel format name
8516 </p>
8517 </dd>
8518 <dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
8519 <dd><p>sample aspect ratio of the input frame, expressed in the form
8520 <var>num</var>/<var>den</var>
8521 </p>
8522 </dd>
8523 <dt> &lsquo;<samp>s</samp>&rsquo;</dt>
8524 <dd><p>size of the input frame. For the syntax of this option, check the &quot;Video size&quot;
8525 section in the ffmpeg-utils manual.
8526 </p>
8527 </dd>
8528 <dt> &lsquo;<samp>i</samp>&rsquo;</dt>
8529 <dd><p>interlaced mode (&quot;P&quot; for &quot;progressive&quot;, &quot;T&quot; for top field first, &quot;B&quot;
8530 for bottom field first)
8531 </p>
8532 </dd>
8533 <dt> &lsquo;<samp>iskey</samp>&rsquo;</dt>
8534 <dd><p>1 if the frame is a key frame, 0 otherwise
8535 </p>
8536 </dd>
8537 <dt> &lsquo;<samp>type</samp>&rsquo;</dt>
8538 <dd><p>picture type of the input frame (&quot;I&quot; for an I-frame, &quot;P&quot; for a
8539 P-frame, &quot;B&quot; for a B-frame, &quot;?&quot; for unknown type).
8540 Check also the documentation of the <code>AVPictureType</code> enum and of
8541 the <code>av_get_picture_type_char</code> function defined in
8542 &lsquo;<tt>libavutil/avutil.h</tt>&rsquo;.
8543 </p>
8544 </dd>
8545 <dt> &lsquo;<samp>checksum</samp>&rsquo;</dt>
8546 <dd><p>Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame
8547 </p>
8548 </dd>
8549 <dt> &lsquo;<samp>plane_checksum</samp>&rsquo;</dt>
8550 <dd><p>Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
8551 expressed in the form &quot;[<var>c0</var> <var>c1</var> <var>c2</var> <var>c3</var>]&quot;
8552 </p></dd>
8553 </dl>
8554
8555 <p><a name="smartblur"></a>
8556 </p><a name="smartblur-1"></a>
8557 <h2 class="section"><a href="ffmpeg-filters.html#toc-smartblur-1">9.77 smartblur</a></h2>
8558
8559 <p>Blur the input video without impacting the outlines.
8560 </p>
8561 <p>The filter accepts the following options:
8562 </p>
8563 <dl compact="compact">
8564 <dt> &lsquo;<samp>luma_radius, lr</samp>&rsquo;</dt>
8565 <dd><p>Set the luma radius. The option value must be a float number in
8566 the range [0.1,5.0] that specifies the variance of the gaussian filter
8567 used to blur the image (slower if larger). Default value is 1.0.
8568 </p>
8569 </dd>
8570 <dt> &lsquo;<samp>luma_strength, ls</samp>&rsquo;</dt>
8571 <dd><p>Set the luma strength. The option value must be a float number
8572 in the range [-1.0,1.0] that configures the blurring. A value included
8573 in [0.0,1.0] will blur the image whereas a value included in
8574 [-1.0,0.0] will sharpen the image. Default value is 1.0.
8575 </p>
8576 </dd>
8577 <dt> &lsquo;<samp>luma_threshold, lt</samp>&rsquo;</dt>
8578 <dd><p>Set the luma threshold used as a coefficient to determine
8579 whether a pixel should be blurred or not. The option value must be an
8580 integer in the range [-30,30]. A value of 0 will filter all the image,
8581 a value included in [0,30] will filter flat areas and a value included
8582 in [-30,0] will filter edges. Default value is 0.
8583 </p>
8584 </dd>
8585 <dt> &lsquo;<samp>chroma_radius, cr</samp>&rsquo;</dt>
8586 <dd><p>Set the chroma radius. The option value must be a float number in
8587 the range [0.1,5.0] that specifies the variance of the gaussian filter
8588 used to blur the image (slower if larger). Default value is 1.0.
8589 </p>
8590 </dd>
8591 <dt> &lsquo;<samp>chroma_strength, cs</samp>&rsquo;</dt>
8592 <dd><p>Set the chroma strength. The option value must be a float number
8593 in the range [-1.0,1.0] that configures the blurring. A value included
8594 in [0.0,1.0] will blur the image whereas a value included in
8595 [-1.0,0.0] will sharpen the image. Default value is 1.0.
8596 </p>
8597 </dd>
8598 <dt> &lsquo;<samp>chroma_threshold, ct</samp>&rsquo;</dt>
8599 <dd><p>Set the chroma threshold used as a coefficient to determine
8600 whether a pixel should be blurred or not. The option value must be an
8601 integer in the range [-30,30]. A value of 0 will filter all the image,
8602 a value included in [0,30] will filter flat areas and a value included
8603 in [-30,0] will filter edges. Default value is 0.
8604 </p></dd>
8605 </dl>
8606
8607 <p>If a chroma option is not explicitly set, the corresponding luma value
8608 is set.
8609 </p>
8610 <a name="stereo3d"></a>
8611 <h2 class="section"><a href="ffmpeg-filters.html#toc-stereo3d">9.78 stereo3d</a></h2>
8612
8613 <p>Convert between different stereoscopic image formats.
8614 </p>
8615 <p>The filters accept the following options:
8616 </p>
8617 <dl compact="compact">
8618 <dt> &lsquo;<samp>in</samp>&rsquo;</dt>
8619 <dd><p>Set stereoscopic image format of input.
8620 </p>
8621 <p>Available values for input image formats are:
8622 </p><dl compact="compact">
8623 <dt> &lsquo;<samp>sbsl</samp>&rsquo;</dt>
8624 <dd><p>side by side parallel (left eye left, right eye right)
8625 </p>
8626 </dd>
8627 <dt> &lsquo;<samp>sbsr</samp>&rsquo;</dt>
8628 <dd><p>side by side crosseye (right eye left, left eye right)
8629 </p>
8630 </dd>
8631 <dt> &lsquo;<samp>sbs2l</samp>&rsquo;</dt>
8632 <dd><p>side by side parallel with half width resolution
8633 (left eye left, right eye right)
8634 </p>
8635 </dd>
8636 <dt> &lsquo;<samp>sbs2r</samp>&rsquo;</dt>
8637 <dd><p>side by side crosseye with half width resolution
8638 (right eye left, left eye right)
8639 </p>
8640 </dd>
8641 <dt> &lsquo;<samp>abl</samp>&rsquo;</dt>
8642 <dd><p>above-below (left eye above, right eye below)
8643 </p>
8644 </dd>
8645 <dt> &lsquo;<samp>abr</samp>&rsquo;</dt>
8646 <dd><p>above-below (right eye above, left eye below)
8647 </p>
8648 </dd>
8649 <dt> &lsquo;<samp>ab2l</samp>&rsquo;</dt>
8650 <dd><p>above-below with half height resolution
8651 (left eye above, right eye below)
8652 </p>
8653 </dd>
8654 <dt> &lsquo;<samp>ab2r</samp>&rsquo;</dt>
8655 <dd><p>above-below with half height resolution
8656 (right eye above, left eye below)
8657 </p>
8658 </dd>
8659 <dt> &lsquo;<samp>al</samp>&rsquo;</dt>
8660 <dd><p>alternating frames (left eye first, right eye second)
8661 </p>
8662 </dd>
8663 <dt> &lsquo;<samp>ar</samp>&rsquo;</dt>
8664 <dd><p>alternating frames (right eye first, left eye second)
8665 </p>
8666 <p>Default value is &lsquo;<samp>sbsl</samp>&rsquo;.
8667 </p></dd>
8668 </dl>
8669
8670 </dd>
8671 <dt> &lsquo;<samp>out</samp>&rsquo;</dt>
8672 <dd><p>Set stereoscopic image format of output.
8673 </p>
8674 <p>Available values for output image formats are all the input formats as well as:
8675 </p><dl compact="compact">
8676 <dt> &lsquo;<samp>arbg</samp>&rsquo;</dt>
8677 <dd><p>anaglyph red/blue gray
8678 (red filter on left eye, blue filter on right eye)
8679 </p>
8680 </dd>
8681 <dt> &lsquo;<samp>argg</samp>&rsquo;</dt>
8682 <dd><p>anaglyph red/green gray
8683 (red filter on left eye, green filter on right eye)
8684 </p>
8685 </dd>
8686 <dt> &lsquo;<samp>arcg</samp>&rsquo;</dt>
8687 <dd><p>anaglyph red/cyan gray
8688 (red filter on left eye, cyan filter on right eye)
8689 </p>
8690 </dd>
8691 <dt> &lsquo;<samp>arch</samp>&rsquo;</dt>
8692 <dd><p>anaglyph red/cyan half colored
8693 (red filter on left eye, cyan filter on right eye)
8694 </p>
8695 </dd>
8696 <dt> &lsquo;<samp>arcc</samp>&rsquo;</dt>
8697 <dd><p>anaglyph red/cyan color
8698 (red filter on left eye, cyan filter on right eye)
8699 </p>
8700 </dd>
8701 <dt> &lsquo;<samp>arcd</samp>&rsquo;</dt>
8702 <dd><p>anaglyph red/cyan color optimized with the least squares projection of dubois
8703 (red filter on left eye, cyan filter on right eye)
8704 </p>
8705 </dd>
8706 <dt> &lsquo;<samp>agmg</samp>&rsquo;</dt>
8707 <dd><p>anaglyph green/magenta gray
8708 (green filter on left eye, magenta filter on right eye)
8709 </p>
8710 </dd>
8711 <dt> &lsquo;<samp>agmh</samp>&rsquo;</dt>
8712 <dd><p>anaglyph green/magenta half colored
8713 (green filter on left eye, magenta filter on right eye)
8714 </p>
8715 </dd>
8716 <dt> &lsquo;<samp>agmc</samp>&rsquo;</dt>
8717 <dd><p>anaglyph green/magenta colored
8718 (green filter on left eye, magenta filter on right eye)
8719 </p>
8720 </dd>
8721 <dt> &lsquo;<samp>agmd</samp>&rsquo;</dt>
8722 <dd><p>anaglyph green/magenta color optimized with the least squares projection of dubois
8723 (green filter on left eye, magenta filter on right eye)
8724 </p>
8725 </dd>
8726 <dt> &lsquo;<samp>aybg</samp>&rsquo;</dt>
8727 <dd><p>anaglyph yellow/blue gray
8728 (yellow filter on left eye, blue filter on right eye)
8729 </p>
8730 </dd>
8731 <dt> &lsquo;<samp>aybh</samp>&rsquo;</dt>
8732 <dd><p>anaglyph yellow/blue half colored
8733 (yellow filter on left eye, blue filter on right eye)
8734 </p>
8735 </dd>
8736 <dt> &lsquo;<samp>aybc</samp>&rsquo;</dt>
8737 <dd><p>anaglyph yellow/blue colored
8738 (yellow filter on left eye, blue filter on right eye)
8739 </p>
8740 </dd>
8741 <dt> &lsquo;<samp>aybd</samp>&rsquo;</dt>
8742 <dd><p>anaglyph yellow/blue color optimized with the least squares projection of dubois
8743 (yellow filter on left eye, blue filter on right eye)
8744 </p>
8745 </dd>
8746 <dt> &lsquo;<samp>irl</samp>&rsquo;</dt>
8747 <dd><p>interleaved rows (left eye has top row, right eye starts on next row)
8748 </p>
8749 </dd>
8750 <dt> &lsquo;<samp>irr</samp>&rsquo;</dt>
8751 <dd><p>interleaved rows (right eye has top row, left eye starts on next row)
8752 </p>
8753 </dd>
8754 <dt> &lsquo;<samp>ml</samp>&rsquo;</dt>
8755 <dd><p>mono output (left eye only)
8756 </p>
8757 </dd>
8758 <dt> &lsquo;<samp>mr</samp>&rsquo;</dt>
8759 <dd><p>mono output (right eye only)
8760 </p></dd>
8761 </dl>
8762
8763 <p>Default value is &lsquo;<samp>arcd</samp>&rsquo;.
8764 </p></dd>
8765 </dl>
8766
8767 <a name="Examples-16"></a>
8768 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-16">9.78.1 Examples</a></h3>
8769
8770 <ul>
8771 <li>
8772 Convert input video from side by side parallel to anaglyph yellow/blue dubois:
8773 <table><tr><td>&nbsp;</td><td><pre class="example">stereo3d=sbsl:aybd
8774 </pre></td></tr></table>
8775
8776 </li><li>
8777 Convert input video from above bellow (left eye above, right eye below) to side by side crosseye.
8778 <table><tr><td>&nbsp;</td><td><pre class="example">stereo3d=abl:sbsr
8779 </pre></td></tr></table>
8780 </li></ul>
8781
8782 <a name="spp"></a>
8783 <h2 class="section"><a href="ffmpeg-filters.html#toc-spp">9.79 spp</a></h2>
8784
8785 <p>Apply a simple postprocessing filter that compresses and decompresses the image
8786 at several (or - in the case of &lsquo;<samp>quality</samp>&rsquo; level <code>6</code> - all) shifts
8787 and average the results.
8788 </p>
8789 <p>The filter accepts the following options:
8790 </p>
8791 <dl compact="compact">
8792 <dt> &lsquo;<samp>quality</samp>&rsquo;</dt>
8793 <dd><p>Set quality. This option defines the number of levels for averaging. It accepts
8794 an integer in the range 0-6. If set to <code>0</code>, the filter will have no
8795 effect. A value of <code>6</code> means the higher quality. For each increment of
8796 that value the speed drops by a factor of approximately 2.  Default value is
8797 <code>3</code>.
8798 </p>
8799 </dd>
8800 <dt> &lsquo;<samp>qp</samp>&rsquo;</dt>
8801 <dd><p>Force a constant quantization parameter. If not set, the filter will use the QP
8802 from the video stream (if available).
8803 </p>
8804 </dd>
8805 <dt> &lsquo;<samp>mode</samp>&rsquo;</dt>
8806 <dd><p>Set thresholding mode. Available modes are:
8807 </p>
8808 <dl compact="compact">
8809 <dt> &lsquo;<samp>hard</samp>&rsquo;</dt>
8810 <dd><p>Set hard thresholding (default).
8811 </p></dd>
8812 <dt> &lsquo;<samp>soft</samp>&rsquo;</dt>
8813 <dd><p>Set soft thresholding (better de-ringing effect, but likely blurrier).
8814 </p></dd>
8815 </dl>
8816
8817 </dd>
8818 <dt> &lsquo;<samp>use_bframe_qp</samp>&rsquo;</dt>
8819 <dd><p>Enable the use of the QP from the B-Frames if set to <code>1</code>. Using this
8820 option may cause flicker since the B-Frames have often larger QP. Default is
8821 <code>0</code> (not enabled).
8822 </p></dd>
8823 </dl>
8824
8825 <p><a name="subtitles"></a>
8826 </p><a name="subtitles-1"></a>
8827 <h2 class="section"><a href="ffmpeg-filters.html#toc-subtitles-1">9.80 subtitles</a></h2>
8828
8829 <p>Draw subtitles on top of input video using the libass library.
8830 </p>
8831 <p>To enable compilation of this filter you need to configure FFmpeg with
8832 <code>--enable-libass</code>. This filter also requires a build with libavcodec and
8833 libavformat to convert the passed subtitles file to ASS (Advanced Substation
8834 Alpha) subtitles format.
8835 </p>
8836 <p>The filter accepts the following options:
8837 </p>
8838 <dl compact="compact">
8839 <dt> &lsquo;<samp>filename, f</samp>&rsquo;</dt>
8840 <dd><p>Set the filename of the subtitle file to read. It must be specified.
8841 </p>
8842 </dd>
8843 <dt> &lsquo;<samp>original_size</samp>&rsquo;</dt>
8844 <dd><p>Specify the size of the original video, the video for which the ASS file
8845 was composed. For the syntax of this option, check the &quot;Video size&quot; section in
8846 the ffmpeg-utils manual. Due to a misdesign in ASS aspect ratio arithmetic,
8847 this is necessary to correctly scale the fonts if the aspect ratio has been
8848 changed.
8849 </p>
8850 </dd>
8851 <dt> &lsquo;<samp>charenc</samp>&rsquo;</dt>
8852 <dd><p>Set subtitles input character encoding. <code>subtitles</code> filter only. Only
8853 useful if not UTF-8.
8854 </p></dd>
8855 </dl>
8856
8857 <p>If the first key is not specified, it is assumed that the first value
8858 specifies the &lsquo;<samp>filename</samp>&rsquo;.
8859 </p>
8860 <p>For example, to render the file &lsquo;<tt>sub.srt</tt>&rsquo; on top of the input
8861 video, use the command:
8862 </p><table><tr><td>&nbsp;</td><td><pre class="example">subtitles=sub.srt
8863 </pre></td></tr></table>
8864
8865 <p>which is equivalent to:
8866 </p><table><tr><td>&nbsp;</td><td><pre class="example">subtitles=filename=sub.srt
8867 </pre></td></tr></table>
8868
8869 <a name="super2xsai"></a>
8870 <h2 class="section"><a href="ffmpeg-filters.html#toc-super2xsai">9.81 super2xsai</a></h2>
8871
8872 <p>Scale the input by 2x and smooth using the Super2xSaI (Scale and
8873 Interpolate) pixel art scaling algorithm.
8874 </p>
8875 <p>Useful for enlarging pixel art images without reducing sharpness.
8876 </p>
8877 <a name="swapuv"></a>
8878 <h2 class="section"><a href="ffmpeg-filters.html#toc-swapuv">9.82 swapuv</a></h2>
8879 <p>Swap U &amp; V plane.
8880 </p>
8881 <a name="telecine"></a>
8882 <h2 class="section"><a href="ffmpeg-filters.html#toc-telecine">9.83 telecine</a></h2>
8883
8884 <p>Apply telecine process to the video.
8885 </p>
8886 <p>This filter accepts the following options:
8887 </p>
8888 <dl compact="compact">
8889 <dt> &lsquo;<samp>first_field</samp>&rsquo;</dt>
8890 <dd><dl compact="compact">
8891 <dt> &lsquo;<samp>top, t</samp>&rsquo;</dt>
8892 <dd><p>top field first
8893 </p></dd>
8894 <dt> &lsquo;<samp>bottom, b</samp>&rsquo;</dt>
8895 <dd><p>bottom field first
8896 The default value is <code>top</code>.
8897 </p></dd>
8898 </dl>
8899
8900 </dd>
8901 <dt> &lsquo;<samp>pattern</samp>&rsquo;</dt>
8902 <dd><p>A string of numbers representing the pulldown pattern you wish to apply.
8903 The default value is <code>23</code>.
8904 </p></dd>
8905 </dl>
8906
8907 <table><tr><td>&nbsp;</td><td><pre class="example">Some typical patterns:
8908
8909 NTSC output (30i):
8910 27.5p: 32222
8911 24p: 23 (classic)
8912 24p: 2332 (preferred)
8913 20p: 33
8914 18p: 334
8915 16p: 3444
8916
8917 PAL output (25i):
8918 27.5p: 12222
8919 24p: 222222222223 (&quot;Euro pulldown&quot;)
8920 16.67p: 33
8921 16p: 33333334
8922 </pre></td></tr></table>
8923
8924 <a name="thumbnail"></a>
8925 <h2 class="section"><a href="ffmpeg-filters.html#toc-thumbnail">9.84 thumbnail</a></h2>
8926 <p>Select the most representative frame in a given sequence of consecutive frames.
8927 </p>
8928 <p>The filter accepts the following options:
8929 </p>
8930 <dl compact="compact">
8931 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
8932 <dd><p>Set the frames batch size to analyze; in a set of <var>n</var> frames, the filter
8933 will pick one of them, and then handle the next batch of <var>n</var> frames until
8934 the end. Default is <code>100</code>.
8935 </p></dd>
8936 </dl>
8937
8938 <p>Since the filter keeps track of the whole frames sequence, a bigger <var>n</var>
8939 value will result in a higher memory usage, so a high value is not recommended.
8940 </p>
8941 <a name="Examples-51"></a>
8942 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-51">9.84.1 Examples</a></h3>
8943
8944 <ul>
8945 <li>
8946 Extract one picture each 50 frames:
8947 <table><tr><td>&nbsp;</td><td><pre class="example">thumbnail=50
8948 </pre></td></tr></table>
8949
8950 </li><li>
8951 Complete example of a thumbnail creation with <code>ffmpeg</code>:
8952 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
8953 </pre></td></tr></table>
8954 </li></ul>
8955
8956 <a name="tile"></a>
8957 <h2 class="section"><a href="ffmpeg-filters.html#toc-tile">9.85 tile</a></h2>
8958
8959 <p>Tile several successive frames together.
8960 </p>
8961 <p>The filter accepts the following options:
8962 </p>
8963 <dl compact="compact">
8964 <dt> &lsquo;<samp>layout</samp>&rsquo;</dt>
8965 <dd><p>Set the grid size (i.e. the number of lines and columns). For the syntax of
8966 this option, check the &quot;Video size&quot; section in the ffmpeg-utils manual.
8967 </p>
8968 </dd>
8969 <dt> &lsquo;<samp>nb_frames</samp>&rsquo;</dt>
8970 <dd><p>Set the maximum number of frames to render in the given area. It must be less
8971 than or equal to <var>w</var>x<var>h</var>. The default value is <code>0</code>, meaning all
8972 the area will be used.
8973 </p>
8974 </dd>
8975 <dt> &lsquo;<samp>margin</samp>&rsquo;</dt>
8976 <dd><p>Set the outer border margin in pixels.
8977 </p>
8978 </dd>
8979 <dt> &lsquo;<samp>padding</samp>&rsquo;</dt>
8980 <dd><p>Set the inner border thickness (i.e. the number of pixels between frames). For
8981 more advanced padding options (such as having different values for the edges),
8982 refer to the pad video filter.
8983 </p>
8984 </dd>
8985 <dt> &lsquo;<samp>color</samp>&rsquo;</dt>
8986 <dd><p>Specify the color of the unused areaFor the syntax of this option, check the
8987 &quot;Color&quot; section in the ffmpeg-utils manual. The default value of <var>color</var>
8988 is &quot;black&quot;.
8989 </p></dd>
8990 </dl>
8991
8992 <a name="Examples-2"></a>
8993 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-2">9.85.1 Examples</a></h3>
8994
8995 <ul>
8996 <li>
8997 Produce 8x8 PNG tiles of all keyframes (&lsquo;<samp>-skip_frame nokey</samp>&rsquo;) in a movie:
8998 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -skip_frame nokey -i file.avi -vf 'scale=128:72,tile=8x8' -an -vsync 0 keyframes%03d.png
8999 </pre></td></tr></table>
9000 <p>The &lsquo;<samp>-vsync 0</samp>&rsquo; is necessary to prevent <code>ffmpeg</code> from
9001 duplicating each output frame to accommodate the originally detected frame
9002 rate.
9003 </p>
9004 </li><li>
9005 Display <code>5</code> pictures in an area of <code>3x2</code> frames,
9006 with <code>7</code> pixels between them, and <code>2</code> pixels of initial margin, using
9007 mixed flat and named options:
9008 <table><tr><td>&nbsp;</td><td><pre class="example">tile=3x2:nb_frames=5:padding=7:margin=2
9009 </pre></td></tr></table>
9010 </li></ul>
9011
9012 <a name="tinterlace"></a>
9013 <h2 class="section"><a href="ffmpeg-filters.html#toc-tinterlace">9.86 tinterlace</a></h2>
9014
9015 <p>Perform various types of temporal field interlacing.
9016 </p>
9017 <p>Frames are counted starting from 1, so the first input frame is
9018 considered odd.
9019 </p>
9020 <p>The filter accepts the following options:
9021 </p>
9022 <dl compact="compact">
9023 <dt> &lsquo;<samp>mode</samp>&rsquo;</dt>
9024 <dd><p>Specify the mode of the interlacing. This option can also be specified
9025 as a value alone. See below for a list of values for this option.
9026 </p>
9027 <p>Available values are:
9028 </p>
9029 <dl compact="compact">
9030 <dt> &lsquo;<samp>merge, 0</samp>&rsquo;</dt>
9031 <dd><p>Move odd frames into the upper field, even into the lower field,
9032 generating a double height frame at half frame rate.
9033 </p>
9034 </dd>
9035 <dt> &lsquo;<samp>drop_odd, 1</samp>&rsquo;</dt>
9036 <dd><p>Only output even frames, odd frames are dropped, generating a frame with
9037 unchanged height at half frame rate.
9038 </p>
9039 </dd>
9040 <dt> &lsquo;<samp>drop_even, 2</samp>&rsquo;</dt>
9041 <dd><p>Only output odd frames, even frames are dropped, generating a frame with
9042 unchanged height at half frame rate.
9043 </p>
9044 </dd>
9045 <dt> &lsquo;<samp>pad, 3</samp>&rsquo;</dt>
9046 <dd><p>Expand each frame to full height, but pad alternate lines with black,
9047 generating a frame with double height at the same input frame rate.
9048 </p>
9049 </dd>
9050 <dt> &lsquo;<samp>interleave_top, 4</samp>&rsquo;</dt>
9051 <dd><p>Interleave the upper field from odd frames with the lower field from
9052 even frames, generating a frame with unchanged height at half frame rate.
9053 </p>
9054 </dd>
9055 <dt> &lsquo;<samp>interleave_bottom, 5</samp>&rsquo;</dt>
9056 <dd><p>Interleave the lower field from odd frames with the upper field from
9057 even frames, generating a frame with unchanged height at half frame rate.
9058 </p>
9059 </dd>
9060 <dt> &lsquo;<samp>interlacex2, 6</samp>&rsquo;</dt>
9061 <dd><p>Double frame rate with unchanged height. Frames are inserted each
9062 containing the second temporal field from the previous input frame and
9063 the first temporal field from the next input frame. This mode relies on
9064 the top_field_first flag. Useful for interlaced video displays with no
9065 field synchronisation.
9066 </p></dd>
9067 </dl>
9068
9069 <p>Numeric values are deprecated but are accepted for backward
9070 compatibility reasons.
9071 </p>
9072 <p>Default mode is <code>merge</code>.
9073 </p>
9074 </dd>
9075 <dt> &lsquo;<samp>flags</samp>&rsquo;</dt>
9076 <dd><p>Specify flags influencing the filter process.
9077 </p>
9078 <p>Available value for <var>flags</var> is:
9079 </p>
9080 <dl compact="compact">
9081 <dt> &lsquo;<samp>low_pass_filter, vlfp</samp>&rsquo;</dt>
9082 <dd><p>Enable vertical low-pass filtering in the filter.
9083 Vertical low-pass filtering is required when creating an interlaced
9084 destination from a progressive source which contains high-frequency
9085 vertical detail. Filtering will reduce interlace &rsquo;twitter&rsquo; and Moire
9086 patterning.
9087 </p>
9088 <p>Vertical low-pass filtering can only be enabled for &lsquo;<samp>mode</samp>&rsquo;
9089 <var>interleave_top</var> and <var>interleave_bottom</var>.
9090 </p>
9091 </dd>
9092 </dl>
9093 </dd>
9094 </dl>
9095
9096 <a name="transpose"></a>
9097 <h2 class="section"><a href="ffmpeg-filters.html#toc-transpose">9.87 transpose</a></h2>
9098
9099 <p>Transpose rows with columns in the input video and optionally flip it.
9100 </p>
9101 <p>This filter accepts the following options:
9102 </p>
9103 <dl compact="compact">
9104 <dt> &lsquo;<samp>dir</samp>&rsquo;</dt>
9105 <dd><p>Specify the transposition direction.
9106 </p>
9107 <p>Can assume the following values:
9108 </p><dl compact="compact">
9109 <dt> &lsquo;<samp>0, 4, cclock_flip</samp>&rsquo;</dt>
9110 <dd><p>Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
9111 </p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     L.l
9112 . . -&gt;  . .
9113 l.r     R.r
9114 </pre></td></tr></table>
9115
9116 </dd>
9117 <dt> &lsquo;<samp>1, 5, clock</samp>&rsquo;</dt>
9118 <dd><p>Rotate by 90 degrees clockwise, that is:
9119 </p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     l.L
9120 . . -&gt;  . .
9121 l.r     r.R
9122 </pre></td></tr></table>
9123
9124 </dd>
9125 <dt> &lsquo;<samp>2, 6, cclock</samp>&rsquo;</dt>
9126 <dd><p>Rotate by 90 degrees counterclockwise, that is:
9127 </p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     R.r
9128 . . -&gt;  . .
9129 l.r     L.l
9130 </pre></td></tr></table>
9131
9132 </dd>
9133 <dt> &lsquo;<samp>3, 7, clock_flip</samp>&rsquo;</dt>
9134 <dd><p>Rotate by 90 degrees clockwise and vertically flip, that is:
9135 </p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     r.R
9136 . . -&gt;  . .
9137 l.r     l.L
9138 </pre></td></tr></table>
9139 </dd>
9140 </dl>
9141
9142 <p>For values between 4-7, the transposition is only done if the input
9143 video geometry is portrait and not landscape. These values are
9144 deprecated, the <code>passthrough</code> option should be used instead.
9145 </p>
9146 <p>Numerical values are deprecated, and should be dropped in favor of
9147 symbolic constants.
9148 </p>
9149 </dd>
9150 <dt> &lsquo;<samp>passthrough</samp>&rsquo;</dt>
9151 <dd><p>Do not apply the transposition if the input geometry matches the one
9152 specified by the specified value. It accepts the following values:
9153 </p><dl compact="compact">
9154 <dt> &lsquo;<samp>none</samp>&rsquo;</dt>
9155 <dd><p>Always apply transposition.
9156 </p></dd>
9157 <dt> &lsquo;<samp>portrait</samp>&rsquo;</dt>
9158 <dd><p>Preserve portrait geometry (when <var>height</var> &gt;= <var>width</var>).
9159 </p></dd>
9160 <dt> &lsquo;<samp>landscape</samp>&rsquo;</dt>
9161 <dd><p>Preserve landscape geometry (when <var>width</var> &gt;= <var>height</var>).
9162 </p></dd>
9163 </dl>
9164
9165 <p>Default value is <code>none</code>.
9166 </p></dd>
9167 </dl>
9168
9169 <p>For example to rotate by 90 degrees clockwise and preserve portrait
9170 layout:
9171 </p><table><tr><td>&nbsp;</td><td><pre class="example">transpose=dir=1:passthrough=portrait
9172 </pre></td></tr></table>
9173
9174 <p>The command above can also be specified as:
9175 </p><table><tr><td>&nbsp;</td><td><pre class="example">transpose=1:portrait
9176 </pre></td></tr></table>
9177
9178 <a name="trim"></a>
9179 <h2 class="section"><a href="ffmpeg-filters.html#toc-trim">9.88 trim</a></h2>
9180 <p>Trim the input so that the output contains one continuous subpart of the input.
9181 </p>
9182 <p>This filter accepts the following options:
9183 </p><dl compact="compact">
9184 <dt> &lsquo;<samp>start</samp>&rsquo;</dt>
9185 <dd><p>Specify time of the start of the kept section, i.e. the frame with the
9186 timestamp <var>start</var> will be the first frame in the output.
9187 </p>
9188 </dd>
9189 <dt> &lsquo;<samp>end</samp>&rsquo;</dt>
9190 <dd><p>Specify time of the first frame that will be dropped, i.e. the frame
9191 immediately preceding the one with the timestamp <var>end</var> will be the last
9192 frame in the output.
9193 </p>
9194 </dd>
9195 <dt> &lsquo;<samp>start_pts</samp>&rsquo;</dt>
9196 <dd><p>Same as <var>start</var>, except this option sets the start timestamp in timebase
9197 units instead of seconds.
9198 </p>
9199 </dd>
9200 <dt> &lsquo;<samp>end_pts</samp>&rsquo;</dt>
9201 <dd><p>Same as <var>end</var>, except this option sets the end timestamp in timebase units
9202 instead of seconds.
9203 </p>
9204 </dd>
9205 <dt> &lsquo;<samp>duration</samp>&rsquo;</dt>
9206 <dd><p>Specify maximum duration of the output.
9207 </p>
9208 </dd>
9209 <dt> &lsquo;<samp>start_frame</samp>&rsquo;</dt>
9210 <dd><p>Number of the first frame that should be passed to output.
9211 </p>
9212 </dd>
9213 <dt> &lsquo;<samp>end_frame</samp>&rsquo;</dt>
9214 <dd><p>Number of the first frame that should be dropped.
9215 </p></dd>
9216 </dl>
9217
9218 <p>&lsquo;<samp>start</samp>&rsquo;, &lsquo;<samp>end</samp>&rsquo;, &lsquo;<samp>duration</samp>&rsquo; are expressed as time
9219 duration specifications, check the &quot;Time duration&quot; section in the
9220 ffmpeg-utils manual.
9221 </p>
9222 <p>Note that the first two sets of the start/end options and the &lsquo;<samp>duration</samp>&rsquo;
9223 option look at the frame timestamp, while the _frame variants simply count the
9224 frames that pass through the filter. Also note that this filter does not modify
9225 the timestamps. If you wish that the output timestamps start at zero, insert a
9226 setpts filter after the trim filter.
9227 </p>
9228 <p>If multiple start or end options are set, this filter tries to be greedy and
9229 keep all the frames that match at least one of the specified constraints. To keep
9230 only the part that matches all the constraints at once, chain multiple trim
9231 filters.
9232 </p>
9233 <p>The defaults are such that all the input is kept. So it is possible to set e.g.
9234 just the end values to keep everything before the specified time.
9235 </p>
9236 <p>Examples:
9237 </p><ul>
9238 <li>
9239 drop everything except the second minute of input
9240 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -vf trim=60:120
9241 </pre></td></tr></table>
9242
9243 </li><li>
9244 keep only the first second
9245 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -vf trim=duration=1
9246 </pre></td></tr></table>
9247
9248 </li></ul>
9249
9250
9251 <a name="unsharp"></a>
9252 <h2 class="section"><a href="ffmpeg-filters.html#toc-unsharp">9.89 unsharp</a></h2>
9253
9254 <p>Sharpen or blur the input video.
9255 </p>
9256 <p>It accepts the following parameters:
9257 </p>
9258 <dl compact="compact">
9259 <dt> &lsquo;<samp>luma_msize_x, lx</samp>&rsquo;</dt>
9260 <dd><p>Set the luma matrix horizontal size. It must be an odd integer between
9261 3 and 63, default value is 5.
9262 </p>
9263 </dd>
9264 <dt> &lsquo;<samp>luma_msize_y, ly</samp>&rsquo;</dt>
9265 <dd><p>Set the luma matrix vertical size. It must be an odd integer between 3
9266 and 63, default value is 5.
9267 </p>
9268 </dd>
9269 <dt> &lsquo;<samp>luma_amount, la</samp>&rsquo;</dt>
9270 <dd><p>Set the luma effect strength. It can be a float number, reasonable
9271 values lay between -1.5 and 1.5.
9272 </p>
9273 <p>Negative values will blur the input video, while positive values will
9274 sharpen it, a value of zero will disable the effect.
9275 </p>
9276 <p>Default value is 1.0.
9277 </p>
9278 </dd>
9279 <dt> &lsquo;<samp>chroma_msize_x, cx</samp>&rsquo;</dt>
9280 <dd><p>Set the chroma matrix horizontal size. It must be an odd integer
9281 between 3 and 63, default value is 5.
9282 </p>
9283 </dd>
9284 <dt> &lsquo;<samp>chroma_msize_y, cy</samp>&rsquo;</dt>
9285 <dd><p>Set the chroma matrix vertical size. It must be an odd integer
9286 between 3 and 63, default value is 5.
9287 </p>
9288 </dd>
9289 <dt> &lsquo;<samp>chroma_amount, ca</samp>&rsquo;</dt>
9290 <dd><p>Set the chroma effect strength. It can be a float number, reasonable
9291 values lay between -1.5 and 1.5.
9292 </p>
9293 <p>Negative values will blur the input video, while positive values will
9294 sharpen it, a value of zero will disable the effect.
9295 </p>
9296 <p>Default value is 0.0.
9297 </p>
9298 </dd>
9299 <dt> &lsquo;<samp>opencl</samp>&rsquo;</dt>
9300 <dd><p>If set to 1, specify using OpenCL capabilities, only available if
9301 FFmpeg was configured with <code>--enable-opencl</code>. Default value is 0.
9302 </p>
9303 </dd>
9304 </dl>
9305
9306 <p>All parameters are optional and default to the equivalent of the
9307 string &rsquo;5:5:1.0:5:5:0.0&rsquo;.
9308 </p>
9309 <a name="Examples-19"></a>
9310 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-19">9.89.1 Examples</a></h3>
9311
9312 <ul>
9313 <li>
9314 Apply strong luma sharpen effect:
9315 <table><tr><td>&nbsp;</td><td><pre class="example">unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
9316 </pre></td></tr></table>
9317
9318 </li><li>
9319 Apply strong blur of both luma and chroma parameters:
9320 <table><tr><td>&nbsp;</td><td><pre class="example">unsharp=7:7:-2:7:7:-2
9321 </pre></td></tr></table>
9322 </li></ul>
9323
9324 <p><a name="vidstabdetect"></a>
9325 </p><a name="vidstabdetect-1"></a>
9326 <h2 class="section"><a href="ffmpeg-filters.html#toc-vidstabdetect-1">9.90 vidstabdetect</a></h2>
9327
9328 <p>Analyze video stabilization/deshaking. Perform pass 1 of 2, see
9329 <a href="#vidstabtransform">vidstabtransform</a> for pass 2.
9330 </p>
9331 <p>This filter generates a file with relative translation and rotation
9332 transform information about subsequent frames, which is then used by
9333 the <a href="#vidstabtransform">vidstabtransform</a> filter.
9334 </p>
9335 <p>To enable compilation of this filter you need to configure FFmpeg with
9336 <code>--enable-libvidstab</code>.
9337 </p>
9338 <p>This filter accepts the following options:
9339 </p>
9340 <dl compact="compact">
9341 <dt> &lsquo;<samp>result</samp>&rsquo;</dt>
9342 <dd><p>Set the path to the file used to write the transforms information.
9343 Default value is &lsquo;<tt>transforms.trf</tt>&rsquo;.
9344 </p>
9345 </dd>
9346 <dt> &lsquo;<samp>shakiness</samp>&rsquo;</dt>
9347 <dd><p>Set how shaky the video is and how quick the camera is. It accepts an
9348 integer in the range 1-10, a value of 1 means little shakiness, a
9349 value of 10 means strong shakiness. Default value is 5.
9350 </p>
9351 </dd>
9352 <dt> &lsquo;<samp>accuracy</samp>&rsquo;</dt>
9353 <dd><p>Set the accuracy of the detection process. It must be a value in the
9354 range 1-15. A value of 1 means low accuracy, a value of 15 means high
9355 accuracy. Default value is 15.
9356 </p>
9357 </dd>
9358 <dt> &lsquo;<samp>stepsize</samp>&rsquo;</dt>
9359 <dd><p>Set stepsize of the search process. The region around minimum is
9360 scanned with 1 pixel resolution. Default value is 6.
9361 </p>
9362 </dd>
9363 <dt> &lsquo;<samp>mincontrast</samp>&rsquo;</dt>
9364 <dd><p>Set minimum contrast. Below this value a local measurement field is
9365 discarded. Must be a floating point value in the range 0-1. Default
9366 value is 0.3.
9367 </p>
9368 </dd>
9369 <dt> &lsquo;<samp>tripod</samp>&rsquo;</dt>
9370 <dd><p>Set reference frame number for tripod mode.
9371 </p>
9372 <p>If enabled, the motion of the frames is compared to a reference frame
9373 in the filtered stream, identified by the specified number. The idea
9374 is to compensate all movements in a more-or-less static scene and keep
9375 the camera view absolutely still.
9376 </p>
9377 <p>If set to 0, it is disabled. The frames are counted starting from 1.
9378 </p>
9379 </dd>
9380 <dt> &lsquo;<samp>show</samp>&rsquo;</dt>
9381 <dd><p>Show fields and transforms in the resulting frames. It accepts an
9382 integer in the range 0-2. Default value is 0, which disables any
9383 visualization.
9384 </p></dd>
9385 </dl>
9386
9387 <a name="Examples-59"></a>
9388 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-59">9.90.1 Examples</a></h3>
9389
9390 <ul>
9391 <li>
9392 Use default values:
9393 <table><tr><td>&nbsp;</td><td><pre class="example">vidstabdetect
9394 </pre></td></tr></table>
9395
9396 </li><li>
9397 Analyze strongly shaky movie and put the results in file
9398 &lsquo;<tt>mytransforms.trf</tt>&rsquo;:
9399 <table><tr><td>&nbsp;</td><td><pre class="example">vidstabdetect=shakiness=10:accuracy=15:result=&quot;mytransforms.trf&quot;
9400 </pre></td></tr></table>
9401
9402 </li><li>
9403 Visualize the result of internal transformations in the resulting
9404 video:
9405 <table><tr><td>&nbsp;</td><td><pre class="example">vidstabdetect=show=1
9406 </pre></td></tr></table>
9407
9408 </li><li>
9409 Analyze a video with medium shakiness using <code>ffmpeg</code>:
9410 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
9411 </pre></td></tr></table>
9412 </li></ul>
9413
9414 <p><a name="vidstabtransform"></a>
9415 </p><a name="vidstabtransform-1"></a>
9416 <h2 class="section"><a href="ffmpeg-filters.html#toc-vidstabtransform-1">9.91 vidstabtransform</a></h2>
9417
9418 <p>Video stabilization/deshaking: pass 2 of 2,
9419 see <a href="#vidstabdetect">vidstabdetect</a> for pass 1.
9420 </p>
9421 <p>Read a file with transform information for each frame and
9422 apply/compensate them. Together with the <a href="#vidstabdetect">vidstabdetect</a>
9423 filter this can be used to deshake videos. See also
9424 <a href="http://public.hronopik.de/vid.stab">http://public.hronopik.de/vid.stab</a>. It is important to also use
9425 the unsharp filter, see below.
9426 </p>
9427 <p>To enable compilation of this filter you need to configure FFmpeg with
9428 <code>--enable-libvidstab</code>.
9429 </p>
9430 <a name="Options"></a>
9431 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Options">9.91.1 Options</a></h3>
9432
9433 <dl compact="compact">
9434 <dt> &lsquo;<samp>input</samp>&rsquo;</dt>
9435 <dd><p>Set path to the file used to read the transforms. Default value is
9436 &lsquo;<tt>transforms.trf</tt>&rsquo;).
9437 </p>
9438 </dd>
9439 <dt> &lsquo;<samp>smoothing</samp>&rsquo;</dt>
9440 <dd><p>Set the number of frames (value*2 + 1) used for lowpass filtering the
9441 camera movements. Default value is 10.
9442 </p>
9443 <p>For example a number of 10 means that 21 frames are used (10 in the
9444 past and 10 in the future) to smoothen the motion in the video. A
9445 larger values leads to a smoother video, but limits the acceleration
9446 of the camera (pan/tilt movements). 0 is a special case where a
9447 static camera is simulated.
9448 </p>
9449 </dd>
9450 <dt> &lsquo;<samp>optalgo</samp>&rsquo;</dt>
9451 <dd><p>Set the camera path optimization algorithm.
9452 </p>
9453 <p>Accepted values are:
9454 </p><dl compact="compact">
9455 <dt> &lsquo;<samp>gauss</samp>&rsquo;</dt>
9456 <dd><p>gaussian kernel low-pass filter on camera motion (default)
9457 </p></dd>
9458 <dt> &lsquo;<samp>avg</samp>&rsquo;</dt>
9459 <dd><p>averaging on transformations
9460 </p></dd>
9461 </dl>
9462
9463 </dd>
9464 <dt> &lsquo;<samp>maxshift</samp>&rsquo;</dt>
9465 <dd><p>Set maximal number of pixels to translate frames. Default value is -1,
9466 meaning no limit.
9467 </p>
9468 </dd>
9469 <dt> &lsquo;<samp>maxangle</samp>&rsquo;</dt>
9470 <dd><p>Set maximal angle in radians (degree*PI/180) to rotate frames. Default
9471 value is -1, meaning no limit.
9472 </p>
9473 </dd>
9474 <dt> &lsquo;<samp>crop</samp>&rsquo;</dt>
9475 <dd><p>Specify how to deal with borders that may be visible due to movement
9476 compensation.
9477 </p>
9478 <p>Available values are:
9479 </p><dl compact="compact">
9480 <dt> &lsquo;<samp>keep</samp>&rsquo;</dt>
9481 <dd><p>keep image information from previous frame (default)
9482 </p></dd>
9483 <dt> &lsquo;<samp>black</samp>&rsquo;</dt>
9484 <dd><p>fill the border black
9485 </p></dd>
9486 </dl>
9487
9488 </dd>
9489 <dt> &lsquo;<samp>invert</samp>&rsquo;</dt>
9490 <dd><p>Invert transforms if set to 1. Default value is 0.
9491 </p>
9492 </dd>
9493 <dt> &lsquo;<samp>relative</samp>&rsquo;</dt>
9494 <dd><p>Consider transforms as relative to previsou frame if set to 1,
9495 absolute if set to 0. Default value is 0.
9496 </p>
9497 </dd>
9498 <dt> &lsquo;<samp>zoom</samp>&rsquo;</dt>
9499 <dd><p>Set percentage to zoom. A positive value will result in a zoom-in
9500 effect, a negative value in a zoom-out effect. Default value is 0 (no
9501 zoom).
9502 </p>
9503 </dd>
9504 <dt> &lsquo;<samp>optzoom</samp>&rsquo;</dt>
9505 <dd><p>Set optimal zooming to avoid borders.
9506 </p>
9507 <p>Accepted values are:
9508 </p><dl compact="compact">
9509 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
9510 <dd><p>disabled
9511 </p></dd>
9512 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
9513 <dd><p>optimal static zoom value is determined (only very strong movements
9514 will lead to visible borders) (default)
9515 </p></dd>
9516 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
9517 <dd><p>optimal adaptive zoom value is determined (no borders will be
9518 visible), see &lsquo;<samp>zoomspeed</samp>&rsquo;
9519 </p></dd>
9520 </dl>
9521
9522 <p>Note that the value given at zoom is added to the one calculated here.
9523 </p>
9524 </dd>
9525 <dt> &lsquo;<samp>zoomspeed</samp>&rsquo;</dt>
9526 <dd><p>Set percent to zoom maximally each frame (enabled when
9527 &lsquo;<samp>optzoom</samp>&rsquo; is set to 2). Range is from 0 to 5, default value is
9528 0.25.
9529 </p>
9530 </dd>
9531 <dt> &lsquo;<samp>interpol</samp>&rsquo;</dt>
9532 <dd><p>Specify type of interpolation.
9533 </p>
9534 <p>Available values are:
9535 </p><dl compact="compact">
9536 <dt> &lsquo;<samp>no</samp>&rsquo;</dt>
9537 <dd><p>no interpolation
9538 </p></dd>
9539 <dt> &lsquo;<samp>linear</samp>&rsquo;</dt>
9540 <dd><p>linear only horizontal
9541 </p></dd>
9542 <dt> &lsquo;<samp>bilinear</samp>&rsquo;</dt>
9543 <dd><p>linear in both directions (default)
9544 </p></dd>
9545 <dt> &lsquo;<samp>bicubic</samp>&rsquo;</dt>
9546 <dd><p>cubic in both directions (slow)
9547 </p></dd>
9548 </dl>
9549
9550 </dd>
9551 <dt> &lsquo;<samp>tripod</samp>&rsquo;</dt>
9552 <dd><p>Enable virtual tripod mode if set to 1, which is equivalent to
9553 <code>relative=0:smoothing=0</code>. Default value is 0.
9554 </p>
9555 <p>Use also <code>tripod</code> option of <a href="#vidstabdetect">vidstabdetect</a>.
9556 </p>
9557 </dd>
9558 <dt> &lsquo;<samp>debug</samp>&rsquo;</dt>
9559 <dd><p>Increase log verbosity if set to 1. Also the detected global motions
9560 are written to the temporary file &lsquo;<tt>global_motions.trf</tt>&rsquo;. Default
9561 value is 0.
9562 </p></dd>
9563 </dl>
9564
9565 <a name="Examples-13"></a>
9566 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-13">9.91.2 Examples</a></h3>
9567
9568 <ul>
9569 <li>
9570 Use <code>ffmpeg</code> for a typical stabilization with default values:
9571 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i inp.mpeg -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 inp_stabilized.mpeg
9572 </pre></td></tr></table>
9573
9574 <p>Note the use of the unsharp filter which is always recommended.
9575 </p>
9576 </li><li>
9577 Zoom in a bit more and load transform data from a given file:
9578 <table><tr><td>&nbsp;</td><td><pre class="example">vidstabtransform=zoom=5:input=&quot;mytransforms.trf&quot;
9579 </pre></td></tr></table>
9580
9581 </li><li>
9582 Smoothen the video even more:
9583 <table><tr><td>&nbsp;</td><td><pre class="example">vidstabtransform=smoothing=30
9584 </pre></td></tr></table>
9585 </li></ul>
9586
9587 <a name="vflip"></a>
9588 <h2 class="section"><a href="ffmpeg-filters.html#toc-vflip">9.92 vflip</a></h2>
9589
9590 <p>Flip the input video vertically.
9591 </p>
9592 <p>For example, to vertically flip a video with <code>ffmpeg</code>:
9593 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -vf &quot;vflip&quot; out.avi
9594 </pre></td></tr></table>
9595
9596 <a name="vignette"></a>
9597 <h2 class="section"><a href="ffmpeg-filters.html#toc-vignette">9.93 vignette</a></h2>
9598
9599 <p>Make or reverse a natural vignetting effect.
9600 </p>
9601 <p>The filter accepts the following options:
9602 </p>
9603 <dl compact="compact">
9604 <dt> &lsquo;<samp>angle, a</samp>&rsquo;</dt>
9605 <dd><p>Set lens angle expression as a number of radians.
9606 </p>
9607 <p>The value is clipped in the <code>[0,PI/2]</code> range.
9608 </p>
9609 <p>Default value: <code>&quot;PI/5&quot;</code>
9610 </p>
9611 </dd>
9612 <dt> &lsquo;<samp>x0</samp>&rsquo;</dt>
9613 <dt> &lsquo;<samp>y0</samp>&rsquo;</dt>
9614 <dd><p>Set center coordinates expressions. Respectively <code>&quot;w/2&quot;</code> and <code>&quot;h/2&quot;</code>
9615 by default.
9616 </p>
9617 </dd>
9618 <dt> &lsquo;<samp>mode</samp>&rsquo;</dt>
9619 <dd><p>Set forward/backward mode.
9620 </p>
9621 <p>Available modes are:
9622 </p><dl compact="compact">
9623 <dt> &lsquo;<samp>forward</samp>&rsquo;</dt>
9624 <dd><p>The larger the distance from the central point, the darker the image becomes.
9625 </p>
9626 </dd>
9627 <dt> &lsquo;<samp>backward</samp>&rsquo;</dt>
9628 <dd><p>The larger the distance from the central point, the brighter the image becomes.
9629 This can be used to reverse a vignette effect, though there is no automatic
9630 detection to extract the lens &lsquo;<samp>angle</samp>&rsquo; and other settings (yet). It can
9631 also be used to create a burning effect.
9632 </p></dd>
9633 </dl>
9634
9635 <p>Default value is &lsquo;<samp>forward</samp>&rsquo;.
9636 </p>
9637 </dd>
9638 <dt> &lsquo;<samp>eval</samp>&rsquo;</dt>
9639 <dd><p>Set evaluation mode for the expressions (&lsquo;<samp>angle</samp>&rsquo;, &lsquo;<samp>x0</samp>&rsquo;, &lsquo;<samp>y0</samp>&rsquo;).
9640 </p>
9641 <p>It accepts the following values:
9642 </p><dl compact="compact">
9643 <dt> &lsquo;<samp>init</samp>&rsquo;</dt>
9644 <dd><p>Evaluate expressions only once during the filter initialization.
9645 </p>
9646 </dd>
9647 <dt> &lsquo;<samp>frame</samp>&rsquo;</dt>
9648 <dd><p>Evaluate expressions for each incoming frame. This is way slower than the
9649 &lsquo;<samp>init</samp>&rsquo; mode since it requires all the scalers to be re-computed, but it
9650 allows advanced dynamic expressions.
9651 </p></dd>
9652 </dl>
9653
9654 <p>Default value is &lsquo;<samp>init</samp>&rsquo;.
9655 </p>
9656 </dd>
9657 <dt> &lsquo;<samp>dither</samp>&rsquo;</dt>
9658 <dd><p>Set dithering to reduce the circular banding effects. Default is <code>1</code>
9659 (enabled).
9660 </p>
9661 </dd>
9662 <dt> &lsquo;<samp>aspect</samp>&rsquo;</dt>
9663 <dd><p>Set vignette aspect. This setting allows one to adjust the shape of the vignette.
9664 Setting this value to the SAR of the input will make a rectangular vignetting
9665 following the dimensions of the video.
9666 </p>
9667 <p>Default is <code>1/1</code>.
9668 </p></dd>
9669 </dl>
9670
9671 <a name="Expressions"></a>
9672 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Expressions">9.93.1 Expressions</a></h3>
9673
9674 <p>The &lsquo;<samp>alpha</samp>&rsquo;, &lsquo;<samp>x0</samp>&rsquo; and &lsquo;<samp>y0</samp>&rsquo; expressions can contain the
9675 following parameters.
9676 </p>
9677 <dl compact="compact">
9678 <dt> &lsquo;<samp>w</samp>&rsquo;</dt>
9679 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
9680 <dd><p>input width and height
9681 </p>
9682 </dd>
9683 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
9684 <dd><p>the number of input frame, starting from 0
9685 </p>
9686 </dd>
9687 <dt> &lsquo;<samp>pts</samp>&rsquo;</dt>
9688 <dd><p>the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
9689 <var>TB</var> units, NAN if undefined
9690 </p>
9691 </dd>
9692 <dt> &lsquo;<samp>r</samp>&rsquo;</dt>
9693 <dd><p>frame rate of the input video, NAN if the input frame rate is unknown
9694 </p>
9695 </dd>
9696 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
9697 <dd><p>the PTS (Presentation TimeStamp) of the filtered video frame,
9698 expressed in seconds, NAN if undefined
9699 </p>
9700 </dd>
9701 <dt> &lsquo;<samp>tb</samp>&rsquo;</dt>
9702 <dd><p>time base of the input video
9703 </p></dd>
9704 </dl>
9705
9706
9707 <a name="Examples-48"></a>
9708 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-48">9.93.2 Examples</a></h3>
9709
9710 <ul>
9711 <li>
9712 Apply simple strong vignetting effect:
9713 <table><tr><td>&nbsp;</td><td><pre class="example">vignette=PI/4
9714 </pre></td></tr></table>
9715
9716 </li><li>
9717 Make a flickering vignetting:
9718 <table><tr><td>&nbsp;</td><td><pre class="example">vignette='PI/4+random(1)*PI/50':eval=frame
9719 </pre></td></tr></table>
9720
9721 </li></ul>
9722
9723 <a name="w3fdif"></a>
9724 <h2 class="section"><a href="ffmpeg-filters.html#toc-w3fdif">9.94 w3fdif</a></h2>
9725
9726 <p>Deinterlace the input video (&quot;w3fdif&quot; stands for &quot;Weston 3 Field
9727 Deinterlacing Filter&quot;).
9728 </p>
9729 <p>Based on the process described by Martin Weston for BBC R&amp;D, and
9730 implemented based on the de-interlace algorithm written by Jim
9731 Easterbrook for BBC R&amp;D, the Weston 3 field deinterlacing filter
9732 uses filter coefficients calculated by BBC R&amp;D.
9733 </p>
9734 <p>There are two sets of filter coefficients, so called &quot;simple&quot;:
9735 and &quot;complex&quot;. Which set of filter coefficients is used can
9736 be set by passing an optional parameter:
9737 </p>
9738 <dl compact="compact">
9739 <dt> &lsquo;<samp>filter</samp>&rsquo;</dt>
9740 <dd><p>Set the interlacing filter coefficients. Accepts one of the following values:
9741 </p>
9742 <dl compact="compact">
9743 <dt> &lsquo;<samp>simple</samp>&rsquo;</dt>
9744 <dd><p>Simple filter coefficient set.
9745 </p></dd>
9746 <dt> &lsquo;<samp>complex</samp>&rsquo;</dt>
9747 <dd><p>More-complex filter coefficient set.
9748 </p></dd>
9749 </dl>
9750 <p>Default value is &lsquo;<samp>complex</samp>&rsquo;.
9751 </p>
9752 </dd>
9753 <dt> &lsquo;<samp>deint</samp>&rsquo;</dt>
9754 <dd><p>Specify which frames to deinterlace. Accept one of the following values:
9755 </p>
9756 <dl compact="compact">
9757 <dt> &lsquo;<samp>all</samp>&rsquo;</dt>
9758 <dd><p>Deinterlace all frames,
9759 </p></dd>
9760 <dt> &lsquo;<samp>interlaced</samp>&rsquo;</dt>
9761 <dd><p>Only deinterlace frames marked as interlaced.
9762 </p></dd>
9763 </dl>
9764
9765 <p>Default value is &lsquo;<samp>all</samp>&rsquo;.
9766 </p></dd>
9767 </dl>
9768
9769 <p><a name="yadif"></a>
9770 </p><a name="yadif-1"></a>
9771 <h2 class="section"><a href="ffmpeg-filters.html#toc-yadif-1">9.95 yadif</a></h2>
9772
9773 <p>Deinterlace the input video (&quot;yadif&quot; means &quot;yet another deinterlacing
9774 filter&quot;).
9775 </p>
9776 <p>This filter accepts the following options:
9777 </p>
9778
9779 <dl compact="compact">
9780 <dt> &lsquo;<samp>mode</samp>&rsquo;</dt>
9781 <dd><p>The interlacing mode to adopt, accepts one of the following values:
9782 </p>
9783 <dl compact="compact">
9784 <dt> &lsquo;<samp>0, send_frame</samp>&rsquo;</dt>
9785 <dd><p>output 1 frame for each frame
9786 </p></dd>
9787 <dt> &lsquo;<samp>1, send_field</samp>&rsquo;</dt>
9788 <dd><p>output 1 frame for each field
9789 </p></dd>
9790 <dt> &lsquo;<samp>2, send_frame_nospatial</samp>&rsquo;</dt>
9791 <dd><p>like <code>send_frame</code> but skip spatial interlacing check
9792 </p></dd>
9793 <dt> &lsquo;<samp>3, send_field_nospatial</samp>&rsquo;</dt>
9794 <dd><p>like <code>send_field</code> but skip spatial interlacing check
9795 </p></dd>
9796 </dl>
9797
9798 <p>Default value is <code>send_frame</code>.
9799 </p>
9800 </dd>
9801 <dt> &lsquo;<samp>parity</samp>&rsquo;</dt>
9802 <dd><p>The picture field parity assumed for the input interlaced video, accepts one of
9803 the following values:
9804 </p>
9805 <dl compact="compact">
9806 <dt> &lsquo;<samp>0, tff</samp>&rsquo;</dt>
9807 <dd><p>assume top field first
9808 </p></dd>
9809 <dt> &lsquo;<samp>1, bff</samp>&rsquo;</dt>
9810 <dd><p>assume bottom field first
9811 </p></dd>
9812 <dt> &lsquo;<samp>-1, auto</samp>&rsquo;</dt>
9813 <dd><p>enable automatic detection
9814 </p></dd>
9815 </dl>
9816
9817 <p>Default value is <code>auto</code>.
9818 If interlacing is unknown or decoder does not export this information,
9819 top field first will be assumed.
9820 </p>
9821 </dd>
9822 <dt> &lsquo;<samp>deint</samp>&rsquo;</dt>
9823 <dd><p>Specify which frames to deinterlace. Accept one of the following
9824 values:
9825 </p>
9826 <dl compact="compact">
9827 <dt> &lsquo;<samp>0, all</samp>&rsquo;</dt>
9828 <dd><p>deinterlace all frames
9829 </p></dd>
9830 <dt> &lsquo;<samp>1, interlaced</samp>&rsquo;</dt>
9831 <dd><p>only deinterlace frames marked as interlaced
9832 </p></dd>
9833 </dl>
9834
9835 <p>Default value is <code>all</code>.
9836 </p></dd>
9837 </dl>
9838
9839
9840 <a name="Video-Sources"></a>
9841 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Video-Sources">10. Video Sources</a></h1>
9842
9843 <p>Below is a description of the currently available video sources.
9844 </p>
9845 <a name="buffer"></a>
9846 <h2 class="section"><a href="ffmpeg-filters.html#toc-buffer">10.1 buffer</a></h2>
9847
9848 <p>Buffer video frames, and make them available to the filter chain.
9849 </p>
9850 <p>This source is mainly intended for a programmatic use, in particular
9851 through the interface defined in &lsquo;<tt>libavfilter/vsrc_buffer.h</tt>&rsquo;.
9852 </p>
9853 <p>This source accepts the following options:
9854 </p>
9855 <dl compact="compact">
9856 <dt> &lsquo;<samp>video_size</samp>&rsquo;</dt>
9857 <dd><p>Specify the size (width and height) of the buffered video frames. For the
9858 syntax of this option, check the &quot;Video size&quot; section in the ffmpeg-utils
9859 manual.
9860 </p>
9861 </dd>
9862 <dt> &lsquo;<samp>width</samp>&rsquo;</dt>
9863 <dd><p>Input video width.
9864 </p>
9865 </dd>
9866 <dt> &lsquo;<samp>height</samp>&rsquo;</dt>
9867 <dd><p>Input video height.
9868 </p>
9869 </dd>
9870 <dt> &lsquo;<samp>pix_fmt</samp>&rsquo;</dt>
9871 <dd><p>A string representing the pixel format of the buffered video frames.
9872 It may be a number corresponding to a pixel format, or a pixel format
9873 name.
9874 </p>
9875 </dd>
9876 <dt> &lsquo;<samp>time_base</samp>&rsquo;</dt>
9877 <dd><p>Specify the timebase assumed by the timestamps of the buffered frames.
9878 </p>
9879 </dd>
9880 <dt> &lsquo;<samp>frame_rate</samp>&rsquo;</dt>
9881 <dd><p>Specify the frame rate expected for the video stream.
9882 </p>
9883 </dd>
9884 <dt> &lsquo;<samp>pixel_aspect, sar</samp>&rsquo;</dt>
9885 <dd><p>Specify the sample aspect ratio assumed by the video frames.
9886 </p>
9887 </dd>
9888 <dt> &lsquo;<samp>sws_param</samp>&rsquo;</dt>
9889 <dd><p>Specify the optional parameters to be used for the scale filter which
9890 is automatically inserted when an input change is detected in the
9891 input size or format.
9892 </p></dd>
9893 </dl>
9894
9895 <p>For example:
9896 </p><table><tr><td>&nbsp;</td><td><pre class="example">buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
9897 </pre></td></tr></table>
9898
9899 <p>will instruct the source to accept video frames with size 320x240 and
9900 with format &quot;yuv410p&quot;, assuming 1/24 as the timestamps timebase and
9901 square pixels (1:1 sample aspect ratio).
9902 Since the pixel format with name &quot;yuv410p&quot; corresponds to the number 6
9903 (check the enum AVPixelFormat definition in &lsquo;<tt>libavutil/pixfmt.h</tt>&rsquo;),
9904 this example corresponds to:
9905 </p><table><tr><td>&nbsp;</td><td><pre class="example">buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
9906 </pre></td></tr></table>
9907
9908 <p>Alternatively, the options can be specified as a flat string, but this
9909 syntax is deprecated:
9910 </p>
9911 <p><var>width</var>:<var>height</var>:<var>pix_fmt</var>:<var>time_base.num</var>:<var>time_base.den</var>:<var>pixel_aspect.num</var>:<var>pixel_aspect.den</var>[:<var>sws_param</var>]
9912 </p>
9913 <a name="cellauto"></a>
9914 <h2 class="section"><a href="ffmpeg-filters.html#toc-cellauto">10.2 cellauto</a></h2>
9915
9916 <p>Create a pattern generated by an elementary cellular automaton.
9917 </p>
9918 <p>The initial state of the cellular automaton can be defined through the
9919 &lsquo;<samp>filename</samp>&rsquo;, and &lsquo;<samp>pattern</samp>&rsquo; options. If such options are
9920 not specified an initial state is created randomly.
9921 </p>
9922 <p>At each new frame a new row in the video is filled with the result of
9923 the cellular automaton next generation. The behavior when the whole
9924 frame is filled is defined by the &lsquo;<samp>scroll</samp>&rsquo; option.
9925 </p>
9926 <p>This source accepts the following options:
9927 </p>
9928 <dl compact="compact">
9929 <dt> &lsquo;<samp>filename, f</samp>&rsquo;</dt>
9930 <dd><p>Read the initial cellular automaton state, i.e. the starting row, from
9931 the specified file.
9932 In the file, each non-whitespace character is considered an alive
9933 cell, a newline will terminate the row, and further characters in the
9934 file will be ignored.
9935 </p>
9936 </dd>
9937 <dt> &lsquo;<samp>pattern, p</samp>&rsquo;</dt>
9938 <dd><p>Read the initial cellular automaton state, i.e. the starting row, from
9939 the specified string.
9940 </p>
9941 <p>Each non-whitespace character in the string is considered an alive
9942 cell, a newline will terminate the row, and further characters in the
9943 string will be ignored.
9944 </p>
9945 </dd>
9946 <dt> &lsquo;<samp>rate, r</samp>&rsquo;</dt>
9947 <dd><p>Set the video rate, that is the number of frames generated per second.
9948 Default is 25.
9949 </p>
9950 </dd>
9951 <dt> &lsquo;<samp>random_fill_ratio, ratio</samp>&rsquo;</dt>
9952 <dd><p>Set the random fill ratio for the initial cellular automaton row. It
9953 is a floating point number value ranging from 0 to 1, defaults to
9954 1/PHI.
9955 </p>
9956 <p>This option is ignored when a file or a pattern is specified.
9957 </p>
9958 </dd>
9959 <dt> &lsquo;<samp>random_seed, seed</samp>&rsquo;</dt>
9960 <dd><p>Set the seed for filling randomly the initial row, must be an integer
9961 included between 0 and UINT32_MAX. If not specified, or if explicitly
9962 set to -1, the filter will try to use a good random seed on a best
9963 effort basis.
9964 </p>
9965 </dd>
9966 <dt> &lsquo;<samp>rule</samp>&rsquo;</dt>
9967 <dd><p>Set the cellular automaton rule, it is a number ranging from 0 to 255.
9968 Default value is 110.
9969 </p>
9970 </dd>
9971 <dt> &lsquo;<samp>size, s</samp>&rsquo;</dt>
9972 <dd><p>Set the size of the output video. For the syntax of this option, check
9973 the &quot;Video size&quot; section in the ffmpeg-utils manual.
9974 </p>
9975 <p>If &lsquo;<samp>filename</samp>&rsquo; or &lsquo;<samp>pattern</samp>&rsquo; is specified, the size is set
9976 by default to the width of the specified initial state row, and the
9977 height is set to <var>width</var> * PHI.
9978 </p>
9979 <p>If &lsquo;<samp>size</samp>&rsquo; is set, it must contain the width of the specified
9980 pattern string, and the specified pattern will be centered in the
9981 larger row.
9982 </p>
9983 <p>If a filename or a pattern string is not specified, the size value
9984 defaults to &quot;320x518&quot; (used for a randomly generated initial state).
9985 </p>
9986 </dd>
9987 <dt> &lsquo;<samp>scroll</samp>&rsquo;</dt>
9988 <dd><p>If set to 1, scroll the output upward when all the rows in the output
9989 have been already filled. If set to 0, the new generated row will be
9990 written over the top row just after the bottom row is filled.
9991 Defaults to 1.
9992 </p>
9993 </dd>
9994 <dt> &lsquo;<samp>start_full, full</samp>&rsquo;</dt>
9995 <dd><p>If set to 1, completely fill the output with generated rows before
9996 outputting the first frame.
9997 This is the default behavior, for disabling set the value to 0.
9998 </p>
9999 </dd>
10000 <dt> &lsquo;<samp>stitch</samp>&rsquo;</dt>
10001 <dd><p>If set to 1, stitch the left and right row edges together.
10002 This is the default behavior, for disabling set the value to 0.
10003 </p></dd>
10004 </dl>
10005
10006 <a name="Examples-36"></a>
10007 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-36">10.2.1 Examples</a></h3>
10008
10009 <ul>
10010 <li>
10011 Read the initial state from &lsquo;<tt>pattern</tt>&rsquo;, and specify an output of
10012 size 200x400.
10013 <table><tr><td>&nbsp;</td><td><pre class="example">cellauto=f=pattern:s=200x400
10014 </pre></td></tr></table>
10015
10016 </li><li>
10017 Generate a random initial row with a width of 200 cells, with a fill
10018 ratio of 2/3:
10019 <table><tr><td>&nbsp;</td><td><pre class="example">cellauto=ratio=2/3:s=200x200
10020 </pre></td></tr></table>
10021
10022 </li><li>
10023 Create a pattern generated by rule 18 starting by a single alive cell
10024 centered on an initial row with width 100:
10025 <table><tr><td>&nbsp;</td><td><pre class="example">cellauto=p=@:s=100x400:full=0:rule=18
10026 </pre></td></tr></table>
10027
10028 </li><li>
10029 Specify a more elaborated initial pattern:
10030 <table><tr><td>&nbsp;</td><td><pre class="example">cellauto=p='@@ @ @@':s=100x400:full=0:rule=18
10031 </pre></td></tr></table>
10032
10033 </li></ul>
10034
10035 <a name="mandelbrot"></a>
10036 <h2 class="section"><a href="ffmpeg-filters.html#toc-mandelbrot">10.3 mandelbrot</a></h2>
10037
10038 <p>Generate a Mandelbrot set fractal, and progressively zoom towards the
10039 point specified with <var>start_x</var> and <var>start_y</var>.
10040 </p>
10041 <p>This source accepts the following options:
10042 </p>
10043 <dl compact="compact">
10044 <dt> &lsquo;<samp>end_pts</samp>&rsquo;</dt>
10045 <dd><p>Set the terminal pts value. Default value is 400.
10046 </p>
10047 </dd>
10048 <dt> &lsquo;<samp>end_scale</samp>&rsquo;</dt>
10049 <dd><p>Set the terminal scale value.
10050 Must be a floating point value. Default value is 0.3.
10051 </p>
10052 </dd>
10053 <dt> &lsquo;<samp>inner</samp>&rsquo;</dt>
10054 <dd><p>Set the inner coloring mode, that is the algorithm used to draw the
10055 Mandelbrot fractal internal region.
10056 </p>
10057 <p>It shall assume one of the following values:
10058 </p><dl compact="compact">
10059 <dt> &lsquo;<samp>black</samp>&rsquo;</dt>
10060 <dd><p>Set black mode.
10061 </p></dd>
10062 <dt> &lsquo;<samp>convergence</samp>&rsquo;</dt>
10063 <dd><p>Show time until convergence.
10064 </p></dd>
10065 <dt> &lsquo;<samp>mincol</samp>&rsquo;</dt>
10066 <dd><p>Set color based on point closest to the origin of the iterations.
10067 </p></dd>
10068 <dt> &lsquo;<samp>period</samp>&rsquo;</dt>
10069 <dd><p>Set period mode.
10070 </p></dd>
10071 </dl>
10072
10073 <p>Default value is <var>mincol</var>.
10074 </p>
10075 </dd>
10076 <dt> &lsquo;<samp>bailout</samp>&rsquo;</dt>
10077 <dd><p>Set the bailout value. Default value is 10.0.
10078 </p>
10079 </dd>
10080 <dt> &lsquo;<samp>maxiter</samp>&rsquo;</dt>
10081 <dd><p>Set the maximum of iterations performed by the rendering
10082 algorithm. Default value is 7189.
10083 </p>
10084 </dd>
10085 <dt> &lsquo;<samp>outer</samp>&rsquo;</dt>
10086 <dd><p>Set outer coloring mode.
10087 It shall assume one of following values:
10088 </p><dl compact="compact">
10089 <dt> &lsquo;<samp>iteration_count</samp>&rsquo;</dt>
10090 <dd><p>Set iteration cound mode.
10091 </p></dd>
10092 <dt> &lsquo;<samp>normalized_iteration_count</samp>&rsquo;</dt>
10093 <dd><p>set normalized iteration count mode.
10094 </p></dd>
10095 </dl>
10096 <p>Default value is <var>normalized_iteration_count</var>.
10097 </p>
10098 </dd>
10099 <dt> &lsquo;<samp>rate, r</samp>&rsquo;</dt>
10100 <dd><p>Set frame rate, expressed as number of frames per second. Default
10101 value is &quot;25&quot;.
10102 </p>
10103 </dd>
10104 <dt> &lsquo;<samp>size, s</samp>&rsquo;</dt>
10105 <dd><p>Set frame size. For the syntax of this option, check the &quot;Video
10106 size&quot; section in the ffmpeg-utils manual. Default value is &quot;640x480&quot;.
10107 </p>
10108 </dd>
10109 <dt> &lsquo;<samp>start_scale</samp>&rsquo;</dt>
10110 <dd><p>Set the initial scale value. Default value is 3.0.
10111 </p>
10112 </dd>
10113 <dt> &lsquo;<samp>start_x</samp>&rsquo;</dt>
10114 <dd><p>Set the initial x position. Must be a floating point value between
10115 -100 and 100. Default value is -0.743643887037158704752191506114774.
10116 </p>
10117 </dd>
10118 <dt> &lsquo;<samp>start_y</samp>&rsquo;</dt>
10119 <dd><p>Set the initial y position. Must be a floating point value between
10120 -100 and 100. Default value is -0.131825904205311970493132056385139.
10121 </p></dd>
10122 </dl>
10123
10124 <a name="mptestsrc"></a>
10125 <h2 class="section"><a href="ffmpeg-filters.html#toc-mptestsrc">10.4 mptestsrc</a></h2>
10126
10127 <p>Generate various test patterns, as generated by the MPlayer test filter.
10128 </p>
10129 <p>The size of the generated video is fixed, and is 256x256.
10130 This source is useful in particular for testing encoding features.
10131 </p>
10132 <p>This source accepts the following options:
10133 </p>
10134 <dl compact="compact">
10135 <dt> &lsquo;<samp>rate, r</samp>&rsquo;</dt>
10136 <dd><p>Specify the frame rate of the sourced video, as the number of frames
10137 generated per second. It has to be a string in the format
10138 <var>frame_rate_num</var>/<var>frame_rate_den</var>, an integer number, a float
10139 number or a valid video frame rate abbreviation. The default value is
10140 &quot;25&quot;.
10141 </p>
10142 </dd>
10143 <dt> &lsquo;<samp>duration, d</samp>&rsquo;</dt>
10144 <dd><p>Set the video duration of the sourced video. The accepted syntax is:
10145 </p><table><tr><td>&nbsp;</td><td><pre class="example">[-]HH:MM:SS[.m...]
10146 [-]S+[.m...]
10147 </pre></td></tr></table>
10148 <p>See also the function <code>av_parse_time()</code>.
10149 </p>
10150 <p>If not specified, or the expressed duration is negative, the video is
10151 supposed to be generated forever.
10152 </p>
10153 </dd>
10154 <dt> &lsquo;<samp>test, t</samp>&rsquo;</dt>
10155 <dd>
10156 <p>Set the number or the name of the test to perform. Supported tests are:
10157 </p><dl compact="compact">
10158 <dt> &lsquo;<samp>dc_luma</samp>&rsquo;</dt>
10159 <dt> &lsquo;<samp>dc_chroma</samp>&rsquo;</dt>
10160 <dt> &lsquo;<samp>freq_luma</samp>&rsquo;</dt>
10161 <dt> &lsquo;<samp>freq_chroma</samp>&rsquo;</dt>
10162 <dt> &lsquo;<samp>amp_luma</samp>&rsquo;</dt>
10163 <dt> &lsquo;<samp>amp_chroma</samp>&rsquo;</dt>
10164 <dt> &lsquo;<samp>cbp</samp>&rsquo;</dt>
10165 <dt> &lsquo;<samp>mv</samp>&rsquo;</dt>
10166 <dt> &lsquo;<samp>ring1</samp>&rsquo;</dt>
10167 <dt> &lsquo;<samp>ring2</samp>&rsquo;</dt>
10168 <dt> &lsquo;<samp>all</samp>&rsquo;</dt>
10169 </dl>
10170
10171 <p>Default value is &quot;all&quot;, which will cycle through the list of all tests.
10172 </p></dd>
10173 </dl>
10174
10175 <p>For example the following:
10176 </p><table><tr><td>&nbsp;</td><td><pre class="example">testsrc=t=dc_luma
10177 </pre></td></tr></table>
10178
10179 <p>will generate a &quot;dc_luma&quot; test pattern.
10180 </p>
10181 <a name="frei0r_005fsrc"></a>
10182 <h2 class="section"><a href="ffmpeg-filters.html#toc-frei0r_005fsrc">10.5 frei0r_src</a></h2>
10183
10184 <p>Provide a frei0r source.
10185 </p>
10186 <p>To enable compilation of this filter you need to install the frei0r
10187 header and configure FFmpeg with <code>--enable-frei0r</code>.
10188 </p>
10189 <p>This source accepts the following options:
10190 </p>
10191 <dl compact="compact">
10192 <dt> &lsquo;<samp>size</samp>&rsquo;</dt>
10193 <dd><p>The size of the video to generate. For the syntax of this option, check the
10194 &quot;Video size&quot; section in the ffmpeg-utils manual.
10195 </p>
10196 </dd>
10197 <dt> &lsquo;<samp>framerate</samp>&rsquo;</dt>
10198 <dd><p>Framerate of the generated video, may be a string of the form
10199 <var>num</var>/<var>den</var> or a frame rate abbreviation.
10200 </p>
10201 </dd>
10202 <dt> &lsquo;<samp>filter_name</samp>&rsquo;</dt>
10203 <dd><p>The name to the frei0r source to load. For more information regarding frei0r and
10204 how to set the parameters read the section <a href="#frei0r">frei0r</a> in the description of
10205 the video filters.
10206 </p>
10207 </dd>
10208 <dt> &lsquo;<samp>filter_params</samp>&rsquo;</dt>
10209 <dd><p>A &rsquo;|&rsquo;-separated list of parameters to pass to the frei0r source.
10210 </p>
10211 </dd>
10212 </dl>
10213
10214 <p>For example, to generate a frei0r partik0l source with size 200x200
10215 and frame rate 10 which is overlayed on the overlay filter main input:
10216 </p><table><tr><td>&nbsp;</td><td><pre class="example">frei0r_src=size=200x200:framerate=10:filter_name=partik0l:filter_params=1234 [overlay]; [in][overlay] overlay
10217 </pre></td></tr></table>
10218
10219 <a name="life"></a>
10220 <h2 class="section"><a href="ffmpeg-filters.html#toc-life">10.6 life</a></h2>
10221
10222 <p>Generate a life pattern.
10223 </p>
10224 <p>This source is based on a generalization of John Conway&rsquo;s life game.
10225 </p>
10226 <p>The sourced input represents a life grid, each pixel represents a cell
10227 which can be in one of two possible states, alive or dead. Every cell
10228 interacts with its eight neighbours, which are the cells that are
10229 horizontally, vertically, or diagonally adjacent.
10230 </p>
10231 <p>At each interaction the grid evolves according to the adopted rule,
10232 which specifies the number of neighbor alive cells which will make a
10233 cell stay alive or born. The &lsquo;<samp>rule</samp>&rsquo; option allows one to specify
10234 the rule to adopt.
10235 </p>
10236 <p>This source accepts the following options:
10237 </p>
10238 <dl compact="compact">
10239 <dt> &lsquo;<samp>filename, f</samp>&rsquo;</dt>
10240 <dd><p>Set the file from which to read the initial grid state. In the file,
10241 each non-whitespace character is considered an alive cell, and newline
10242 is used to delimit the end of each row.
10243 </p>
10244 <p>If this option is not specified, the initial grid is generated
10245 randomly.
10246 </p>
10247 </dd>
10248 <dt> &lsquo;<samp>rate, r</samp>&rsquo;</dt>
10249 <dd><p>Set the video rate, that is the number of frames generated per second.
10250 Default is 25.
10251 </p>
10252 </dd>
10253 <dt> &lsquo;<samp>random_fill_ratio, ratio</samp>&rsquo;</dt>
10254 <dd><p>Set the random fill ratio for the initial random grid. It is a
10255 floating point number value ranging from 0 to 1, defaults to 1/PHI.
10256 It is ignored when a file is specified.
10257 </p>
10258 </dd>
10259 <dt> &lsquo;<samp>random_seed, seed</samp>&rsquo;</dt>
10260 <dd><p>Set the seed for filling the initial random grid, must be an integer
10261 included between 0 and UINT32_MAX. If not specified, or if explicitly
10262 set to -1, the filter will try to use a good random seed on a best
10263 effort basis.
10264 </p>
10265 </dd>
10266 <dt> &lsquo;<samp>rule</samp>&rsquo;</dt>
10267 <dd><p>Set the life rule.
10268 </p>
10269 <p>A rule can be specified with a code of the kind &quot;S<var>NS</var>/B<var>NB</var>&quot;,
10270 where <var>NS</var> and <var>NB</var> are sequences of numbers in the range 0-8,
10271 <var>NS</var> specifies the number of alive neighbor cells which make a
10272 live cell stay alive, and <var>NB</var> the number of alive neighbor cells
10273 which make a dead cell to become alive (i.e. to &quot;born&quot;).
10274 &quot;s&quot; and &quot;b&quot; can be used in place of &quot;S&quot; and &quot;B&quot;, respectively.
10275 </p>
10276 <p>Alternatively a rule can be specified by an 18-bits integer. The 9
10277 high order bits are used to encode the next cell state if it is alive
10278 for each number of neighbor alive cells, the low order bits specify
10279 the rule for &quot;borning&quot; new cells. Higher order bits encode for an
10280 higher number of neighbor cells.
10281 For example the number 6153 = <code>(12&lt;&lt;9)+9</code> specifies a stay alive
10282 rule of 12 and a born rule of 9, which corresponds to &quot;S23/B03&quot;.
10283 </p>
10284 <p>Default value is &quot;S23/B3&quot;, which is the original Conway&rsquo;s game of life
10285 rule, and will keep a cell alive if it has 2 or 3 neighbor alive
10286 cells, and will born a new cell if there are three alive cells around
10287 a dead cell.
10288 </p>
10289 </dd>
10290 <dt> &lsquo;<samp>size, s</samp>&rsquo;</dt>
10291 <dd><p>Set the size of the output video. For the syntax of this option, check the
10292 &quot;Video size&quot; section in the ffmpeg-utils manual.
10293 </p>
10294 <p>If &lsquo;<samp>filename</samp>&rsquo; is specified, the size is set by default to the
10295 same size of the input file. If &lsquo;<samp>size</samp>&rsquo; is set, it must contain
10296 the size specified in the input file, and the initial grid defined in
10297 that file is centered in the larger resulting area.
10298 </p>
10299 <p>If a filename is not specified, the size value defaults to &quot;320x240&quot;
10300 (used for a randomly generated initial grid).
10301 </p>
10302 </dd>
10303 <dt> &lsquo;<samp>stitch</samp>&rsquo;</dt>
10304 <dd><p>If set to 1, stitch the left and right grid edges together, and the
10305 top and bottom edges also. Defaults to 1.
10306 </p>
10307 </dd>
10308 <dt> &lsquo;<samp>mold</samp>&rsquo;</dt>
10309 <dd><p>Set cell mold speed. If set, a dead cell will go from &lsquo;<samp>death_color</samp>&rsquo; to
10310 &lsquo;<samp>mold_color</samp>&rsquo; with a step of &lsquo;<samp>mold</samp>&rsquo;. &lsquo;<samp>mold</samp>&rsquo; can have a
10311 value from 0 to 255.
10312 </p>
10313 </dd>
10314 <dt> &lsquo;<samp>life_color</samp>&rsquo;</dt>
10315 <dd><p>Set the color of living (or new born) cells.
10316 </p>
10317 </dd>
10318 <dt> &lsquo;<samp>death_color</samp>&rsquo;</dt>
10319 <dd><p>Set the color of dead cells. If &lsquo;<samp>mold</samp>&rsquo; is set, this is the first color
10320 used to represent a dead cell.
10321 </p>
10322 </dd>
10323 <dt> &lsquo;<samp>mold_color</samp>&rsquo;</dt>
10324 <dd><p>Set mold color, for definitely dead and moldy cells.
10325 </p>
10326 <p>For the syntax of these 3 color options, check the &quot;Color&quot; section in the
10327 ffmpeg-utils manual.
10328 </p></dd>
10329 </dl>
10330
10331 <a name="Examples-11"></a>
10332 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-11">10.6.1 Examples</a></h3>
10333
10334 <ul>
10335 <li>
10336 Read a grid from &lsquo;<tt>pattern</tt>&rsquo;, and center it on a grid of size
10337 300x300 pixels:
10338 <table><tr><td>&nbsp;</td><td><pre class="example">life=f=pattern:s=300x300
10339 </pre></td></tr></table>
10340
10341 </li><li>
10342 Generate a random grid of size 200x200, with a fill ratio of 2/3:
10343 <table><tr><td>&nbsp;</td><td><pre class="example">life=ratio=2/3:s=200x200
10344 </pre></td></tr></table>
10345
10346 </li><li>
10347 Specify a custom rule for evolving a randomly generated grid:
10348 <table><tr><td>&nbsp;</td><td><pre class="example">life=rule=S14/B34
10349 </pre></td></tr></table>
10350
10351 </li><li>
10352 Full example with slow death effect (mold) using <code>ffplay</code>:
10353 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay -f lavfi life=s=300x200:mold=10:r=60:ratio=0.1:death_color=#C83232:life_color=#00ff00,scale=1200:800:flags=16
10354 </pre></td></tr></table>
10355 </li></ul>
10356
10357 <p><a name="color"></a>
10358 <a name="haldclutsrc"></a>
10359 <a name="nullsrc"></a>
10360 <a name="rgbtestsrc"></a>
10361 <a name="smptebars"></a>
10362 <a name="smptehdbars"></a>
10363 <a name="testsrc"></a>
10364 </p><a name="color_002c-haldclutsrc_002c-nullsrc_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc"></a>
10365 <h2 class="section"><a href="ffmpeg-filters.html#toc-color_002c-haldclutsrc_002c-nullsrc_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc">10.7 color, haldclutsrc, nullsrc, rgbtestsrc, smptebars, smptehdbars, testsrc</a></h2>
10366
10367 <p>The <code>color</code> source provides an uniformly colored input.
10368 </p>
10369 <p>The <code>haldclutsrc</code> source provides an identity Hald CLUT. See also
10370 <a href="#haldclut">haldclut</a> filter.
10371 </p>
10372 <p>The <code>nullsrc</code> source returns unprocessed video frames. It is
10373 mainly useful to be employed in analysis / debugging tools, or as the
10374 source for filters which ignore the input data.
10375 </p>
10376 <p>The <code>rgbtestsrc</code> source generates an RGB test pattern useful for
10377 detecting RGB vs BGR issues. You should see a red, green and blue
10378 stripe from top to bottom.
10379 </p>
10380 <p>The <code>smptebars</code> source generates a color bars pattern, based on
10381 the SMPTE Engineering Guideline EG 1-1990.
10382 </p>
10383 <p>The <code>smptehdbars</code> source generates a color bars pattern, based on
10384 the SMPTE RP 219-2002.
10385 </p>
10386 <p>The <code>testsrc</code> source generates a test video pattern, showing a
10387 color pattern, a scrolling gradient and a timestamp. This is mainly
10388 intended for testing purposes.
10389 </p>
10390 <p>The sources accept the following options:
10391 </p>
10392 <dl compact="compact">
10393 <dt> &lsquo;<samp>color, c</samp>&rsquo;</dt>
10394 <dd><p>Specify the color of the source, only available in the <code>color</code>
10395 source. For the syntax of this option, check the &quot;Color&quot; section in the
10396 ffmpeg-utils manual.
10397 </p>
10398 </dd>
10399 <dt> &lsquo;<samp>level</samp>&rsquo;</dt>
10400 <dd><p>Specify the level of the Hald CLUT, only available in the <code>haldclutsrc</code>
10401 source. A level of <code>N</code> generates a picture of <code>N*N*N</code> by <code>N*N*N</code>
10402 pixels to be used as identity matrix for 3D lookup tables. Each component is
10403 coded on a <code>1/(N*N)</code> scale.
10404 </p>
10405 </dd>
10406 <dt> &lsquo;<samp>size, s</samp>&rsquo;</dt>
10407 <dd><p>Specify the size of the sourced video. For the syntax of this option, check the
10408 &quot;Video size&quot; section in the ffmpeg-utils manual. The default value is
10409 &quot;320x240&quot;.
10410 </p>
10411 <p>This option is not available with the <code>haldclutsrc</code> filter.
10412 </p>
10413 </dd>
10414 <dt> &lsquo;<samp>rate, r</samp>&rsquo;</dt>
10415 <dd><p>Specify the frame rate of the sourced video, as the number of frames
10416 generated per second. It has to be a string in the format
10417 <var>frame_rate_num</var>/<var>frame_rate_den</var>, an integer number, a float
10418 number or a valid video frame rate abbreviation. The default value is
10419 &quot;25&quot;.
10420 </p>
10421 </dd>
10422 <dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
10423 <dd><p>Set the sample aspect ratio of the sourced video.
10424 </p>
10425 </dd>
10426 <dt> &lsquo;<samp>duration, d</samp>&rsquo;</dt>
10427 <dd><p>Set the video duration of the sourced video. The accepted syntax is:
10428 </p><table><tr><td>&nbsp;</td><td><pre class="example">[-]HH[:MM[:SS[.m...]]]
10429 [-]S+[.m...]
10430 </pre></td></tr></table>
10431 <p>See also the function <code>av_parse_time()</code>.
10432 </p>
10433 <p>If not specified, or the expressed duration is negative, the video is
10434 supposed to be generated forever.
10435 </p>
10436 </dd>
10437 <dt> &lsquo;<samp>decimals, n</samp>&rsquo;</dt>
10438 <dd><p>Set the number of decimals to show in the timestamp, only available in the
10439 <code>testsrc</code> source.
10440 </p>
10441 <p>The displayed timestamp value will correspond to the original
10442 timestamp value multiplied by the power of 10 of the specified
10443 value. Default value is 0.
10444 </p></dd>
10445 </dl>
10446
10447 <p>For example the following:
10448 </p><table><tr><td>&nbsp;</td><td><pre class="example">testsrc=duration=5.3:size=qcif:rate=10
10449 </pre></td></tr></table>
10450
10451 <p>will generate a video with a duration of 5.3 seconds, with size
10452 176x144 and a frame rate of 10 frames per second.
10453 </p>
10454 <p>The following graph description will generate a red source
10455 with an opacity of 0.2, with size &quot;qcif&quot; and a frame rate of 10
10456 frames per second.
10457 </p><table><tr><td>&nbsp;</td><td><pre class="example">color=c=red@0.2:s=qcif:r=10
10458 </pre></td></tr></table>
10459
10460 <p>If the input content is to be ignored, <code>nullsrc</code> can be used. The
10461 following command generates noise in the luminance plane by employing
10462 the <code>geq</code> filter:
10463 </p><table><tr><td>&nbsp;</td><td><pre class="example">nullsrc=s=256x256, geq=random(1)*255:128:128
10464 </pre></td></tr></table>
10465
10466 <a name="Commands-1"></a>
10467 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Commands-1">10.7.1 Commands</a></h3>
10468
10469 <p>The <code>color</code> source supports the following commands:
10470 </p>
10471 <dl compact="compact">
10472 <dt> &lsquo;<samp>c, color</samp>&rsquo;</dt>
10473 <dd><p>Set the color of the created image. Accepts the same syntax of the
10474 corresponding &lsquo;<samp>color</samp>&rsquo; option.
10475 </p></dd>
10476 </dl>
10477
10478
10479 <a name="Video-Sinks"></a>
10480 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Video-Sinks">11. Video Sinks</a></h1>
10481
10482 <p>Below is a description of the currently available video sinks.
10483 </p>
10484 <a name="buffersink"></a>
10485 <h2 class="section"><a href="ffmpeg-filters.html#toc-buffersink">11.1 buffersink</a></h2>
10486
10487 <p>Buffer video frames, and make them available to the end of the filter
10488 graph.
10489 </p>
10490 <p>This sink is mainly intended for a programmatic use, in particular
10491 through the interface defined in &lsquo;<tt>libavfilter/buffersink.h</tt>&rsquo;
10492 or the options system.
10493 </p>
10494 <p>It accepts a pointer to an AVBufferSinkContext structure, which
10495 defines the incoming buffers&rsquo; formats, to be passed as the opaque
10496 parameter to <code>avfilter_init_filter</code> for initialization.
10497 </p>
10498 <a name="nullsink"></a>
10499 <h2 class="section"><a href="ffmpeg-filters.html#toc-nullsink">11.2 nullsink</a></h2>
10500
10501 <p>Null video sink, do absolutely nothing with the input video. It is
10502 mainly useful as a template and to be employed in analysis / debugging
10503 tools.
10504 </p>
10505
10506 <a name="Multimedia-Filters"></a>
10507 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Multimedia-Filters">12. Multimedia Filters</a></h1>
10508
10509 <p>Below is a description of the currently available multimedia filters.
10510 </p>
10511 <a name="avectorscope"></a>
10512 <h2 class="section"><a href="ffmpeg-filters.html#toc-avectorscope">12.1 avectorscope</a></h2>
10513
10514 <p>Convert input audio to a video output, representing the audio vector
10515 scope.
10516 </p>
10517 <p>The filter is used to measure the difference between channels of stereo
10518 audio stream. A monoaural signal, consisting of identical left and right
10519 signal, results in straight vertical line. Any stereo separation is visible
10520 as a deviation from this line, creating a Lissajous figure.
10521 If the straight (or deviation from it) but horizontal line appears this
10522 indicates that the left and right channels are out of phase.
10523 </p>
10524 <p>The filter accepts the following options:
10525 </p>
10526 <dl compact="compact">
10527 <dt> &lsquo;<samp>mode, m</samp>&rsquo;</dt>
10528 <dd><p>Set the vectorscope mode.
10529 </p>
10530 <p>Available values are:
10531 </p><dl compact="compact">
10532 <dt> &lsquo;<samp>lissajous</samp>&rsquo;</dt>
10533 <dd><p>Lissajous rotated by 45 degrees.
10534 </p>
10535 </dd>
10536 <dt> &lsquo;<samp>lissajous_xy</samp>&rsquo;</dt>
10537 <dd><p>Same as above but not rotated.
10538 </p></dd>
10539 </dl>
10540
10541 <p>Default value is &lsquo;<samp>lissajous</samp>&rsquo;.
10542 </p>
10543 </dd>
10544 <dt> &lsquo;<samp>size, s</samp>&rsquo;</dt>
10545 <dd><p>Set the video size for the output. For the syntax of this option, check the &quot;Video size&quot;
10546 section in the ffmpeg-utils manual. Default value is <code>400x400</code>.
10547 </p>
10548 </dd>
10549 <dt> &lsquo;<samp>rate, r</samp>&rsquo;</dt>
10550 <dd><p>Set the output frame rate. Default value is <code>25</code>.
10551 </p>
10552 </dd>
10553 <dt> &lsquo;<samp>rc</samp>&rsquo;</dt>
10554 <dt> &lsquo;<samp>gc</samp>&rsquo;</dt>
10555 <dt> &lsquo;<samp>bc</samp>&rsquo;</dt>
10556 <dd><p>Specify the red, green and blue contrast. Default values are <code>40</code>, <code>160</code> and <code>80</code>.
10557 Allowed range is <code>[0, 255]</code>.
10558 </p>
10559 </dd>
10560 <dt> &lsquo;<samp>rf</samp>&rsquo;</dt>
10561 <dt> &lsquo;<samp>gf</samp>&rsquo;</dt>
10562 <dt> &lsquo;<samp>bf</samp>&rsquo;</dt>
10563 <dd><p>Specify the red, green and blue fade. Default values are <code>15</code>, <code>10</code> and <code>5</code>.
10564 Allowed range is <code>[0, 255]</code>.
10565 </p>
10566 </dd>
10567 <dt> &lsquo;<samp>zoom</samp>&rsquo;</dt>
10568 <dd><p>Set the zoom factor. Default value is <code>1</code>. Allowed range is <code>[1, 10]</code>.
10569 </p></dd>
10570 </dl>
10571
10572 <a name="Examples-57"></a>
10573 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-57">12.1.1 Examples</a></h3>
10574
10575 <ul>
10576 <li>
10577 Complete example using <code>ffplay</code>:
10578 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
10579              [a] avectorscope=zoom=1.3:rc=2:gc=200:bc=10:rf=1:gf=8:bf=7 [out0]'
10580 </pre></td></tr></table>
10581 </li></ul>
10582
10583 <a name="concat"></a>
10584 <h2 class="section"><a href="ffmpeg-filters.html#toc-concat">12.2 concat</a></h2>
10585
10586 <p>Concatenate audio and video streams, joining them together one after the
10587 other.
10588 </p>
10589 <p>The filter works on segments of synchronized video and audio streams. All
10590 segments must have the same number of streams of each type, and that will
10591 also be the number of streams at output.
10592 </p>
10593 <p>The filter accepts the following options:
10594 </p>
10595 <dl compact="compact">
10596 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
10597 <dd><p>Set the number of segments. Default is 2.
10598 </p>
10599 </dd>
10600 <dt> &lsquo;<samp>v</samp>&rsquo;</dt>
10601 <dd><p>Set the number of output video streams, that is also the number of video
10602 streams in each segment. Default is 1.
10603 </p>
10604 </dd>
10605 <dt> &lsquo;<samp>a</samp>&rsquo;</dt>
10606 <dd><p>Set the number of output audio streams, that is also the number of video
10607 streams in each segment. Default is 0.
10608 </p>
10609 </dd>
10610 <dt> &lsquo;<samp>unsafe</samp>&rsquo;</dt>
10611 <dd><p>Activate unsafe mode: do not fail if segments have a different format.
10612 </p>
10613 </dd>
10614 </dl>
10615
10616 <p>The filter has <var>v</var>+<var>a</var> outputs: first <var>v</var> video outputs, then
10617 <var>a</var> audio outputs.
10618 </p>
10619 <p>There are <var>n</var>x(<var>v</var>+<var>a</var>) inputs: first the inputs for the first
10620 segment, in the same order as the outputs, then the inputs for the second
10621 segment, etc.
10622 </p>
10623 <p>Related streams do not always have exactly the same duration, for various
10624 reasons including codec frame size or sloppy authoring. For that reason,
10625 related synchronized streams (e.g. a video and its audio track) should be
10626 concatenated at once. The concat filter will use the duration of the longest
10627 stream in each segment (except the last one), and if necessary pad shorter
10628 audio streams with silence.
10629 </p>
10630 <p>For this filter to work correctly, all segments must start at timestamp 0.
10631 </p>
10632 <p>All corresponding streams must have the same parameters in all segments; the
10633 filtering system will automatically select a common pixel format for video
10634 streams, and a common sample format, sample rate and channel layout for
10635 audio streams, but other settings, such as resolution, must be converted
10636 explicitly by the user.
10637 </p>
10638 <p>Different frame rates are acceptable but will result in variable frame rate
10639 at output; be sure to configure the output file to handle it.
10640 </p>
10641 <a name="Examples-10"></a>
10642 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-10">12.2.1 Examples</a></h3>
10643
10644 <ul>
10645 <li>
10646 Concatenate an opening, an episode and an ending, all in bilingual version
10647 (video in stream 0, audio in streams 1 and 2):
10648 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i opening.mkv -i episode.mkv -i ending.mkv -filter_complex \
10649   '[0:0] [0:1] [0:2] [1:0] [1:1] [1:2] [2:0] [2:1] [2:2]
10650    concat=n=3:v=1:a=2 [v] [a1] [a2]' \
10651   -map '[v]' -map '[a1]' -map '[a2]' output.mkv
10652 </pre></td></tr></table>
10653
10654 </li><li>
10655 Concatenate two parts, handling audio and video separately, using the
10656 (a)movie sources, and adjusting the resolution:
10657 <table><tr><td>&nbsp;</td><td><pre class="example">movie=part1.mp4, scale=512:288 [v1] ; amovie=part1.mp4 [a1] ;
10658 movie=part2.mp4, scale=512:288 [v2] ; amovie=part2.mp4 [a2] ;
10659 [v1] [v2] concat [outv] ; [a1] [a2] concat=v=0:a=1 [outa]
10660 </pre></td></tr></table>
10661 <p>Note that a desync will happen at the stitch if the audio and video streams
10662 do not have exactly the same duration in the first file.
10663 </p>
10664 </li></ul>
10665
10666 <a name="ebur128"></a>
10667 <h2 class="section"><a href="ffmpeg-filters.html#toc-ebur128">12.3 ebur128</a></h2>
10668
10669 <p>EBU R128 scanner filter. This filter takes an audio stream as input and outputs
10670 it unchanged. By default, it logs a message at a frequency of 10Hz with the
10671 Momentary loudness (identified by <code>M</code>), Short-term loudness (<code>S</code>),
10672 Integrated loudness (<code>I</code>) and Loudness Range (<code>LRA</code>).
10673 </p>
10674 <p>The filter also has a video output (see the <var>video</var> option) with a real
10675 time graph to observe the loudness evolution. The graphic contains the logged
10676 message mentioned above, so it is not printed anymore when this option is set,
10677 unless the verbose logging is set. The main graphing area contains the
10678 short-term loudness (3 seconds of analysis), and the gauge on the right is for
10679 the momentary loudness (400 milliseconds).
10680 </p>
10681 <p>More information about the Loudness Recommendation EBU R128 on
10682 <a href="http://tech.ebu.ch/loudness">http://tech.ebu.ch/loudness</a>.
10683 </p>
10684 <p>The filter accepts the following options:
10685 </p>
10686 <dl compact="compact">
10687 <dt> &lsquo;<samp>video</samp>&rsquo;</dt>
10688 <dd><p>Activate the video output. The audio stream is passed unchanged whether this
10689 option is set or no. The video stream will be the first output stream if
10690 activated. Default is <code>0</code>.
10691 </p>
10692 </dd>
10693 <dt> &lsquo;<samp>size</samp>&rsquo;</dt>
10694 <dd><p>Set the video size. This option is for video only. For the syntax of this
10695 option, check the &quot;Video size&quot; section in the ffmpeg-utils manual. Default
10696 and minimum resolution is <code>640x480</code>.
10697 </p>
10698 </dd>
10699 <dt> &lsquo;<samp>meter</samp>&rsquo;</dt>
10700 <dd><p>Set the EBU scale meter. Default is <code>9</code>. Common values are <code>9</code> and
10701 <code>18</code>, respectively for EBU scale meter +9 and EBU scale meter +18. Any
10702 other integer value between this range is allowed.
10703 </p>
10704 </dd>
10705 <dt> &lsquo;<samp>metadata</samp>&rsquo;</dt>
10706 <dd><p>Set metadata injection. If set to <code>1</code>, the audio input will be segmented
10707 into 100ms output frames, each of them containing various loudness information
10708 in metadata.  All the metadata keys are prefixed with <code>lavfi.r128.</code>.
10709 </p>
10710 <p>Default is <code>0</code>.
10711 </p>
10712 </dd>
10713 <dt> &lsquo;<samp>framelog</samp>&rsquo;</dt>
10714 <dd><p>Force the frame logging level.
10715 </p>
10716 <p>Available values are:
10717 </p><dl compact="compact">
10718 <dt> &lsquo;<samp>info</samp>&rsquo;</dt>
10719 <dd><p>information logging level
10720 </p></dd>
10721 <dt> &lsquo;<samp>verbose</samp>&rsquo;</dt>
10722 <dd><p>verbose logging level
10723 </p></dd>
10724 </dl>
10725
10726 <p>By default, the logging level is set to <var>info</var>. If the &lsquo;<samp>video</samp>&rsquo; or
10727 the &lsquo;<samp>metadata</samp>&rsquo; options are set, it switches to <var>verbose</var>.
10728 </p>
10729 </dd>
10730 <dt> &lsquo;<samp>peak</samp>&rsquo;</dt>
10731 <dd><p>Set peak mode(s).
10732 </p>
10733 <p>Available modes can be cumulated (the option is a <code>flag</code> type). Possible
10734 values are:
10735 </p><dl compact="compact">
10736 <dt> &lsquo;<samp>none</samp>&rsquo;</dt>
10737 <dd><p>Disable any peak mode (default).
10738 </p></dd>
10739 <dt> &lsquo;<samp>sample</samp>&rsquo;</dt>
10740 <dd><p>Enable sample-peak mode.
10741 </p>
10742 <p>Simple peak mode looking for the higher sample value. It logs a message
10743 for sample-peak (identified by <code>SPK</code>).
10744 </p></dd>
10745 <dt> &lsquo;<samp>true</samp>&rsquo;</dt>
10746 <dd><p>Enable true-peak mode.
10747 </p>
10748 <p>If enabled, the peak lookup is done on an over-sampled version of the input
10749 stream for better peak accuracy. It logs a message for true-peak.
10750 (identified by <code>TPK</code>) and true-peak per frame (identified by <code>FTPK</code>).
10751 This mode requires a build with <code>libswresample</code>.
10752 </p></dd>
10753 </dl>
10754
10755 </dd>
10756 </dl>
10757
10758 <a name="Examples-6"></a>
10759 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-6">12.3.1 Examples</a></h3>
10760
10761 <ul>
10762 <li>
10763 Real-time graph using <code>ffplay</code>, with a EBU scale meter +18:
10764 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay -f lavfi -i &quot;amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]&quot;
10765 </pre></td></tr></table>
10766
10767 </li><li>
10768 Run an analysis with <code>ffmpeg</code>:
10769 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
10770 </pre></td></tr></table>
10771 </li></ul>
10772
10773 <a name="interleave_002c-ainterleave"></a>
10774 <h2 class="section"><a href="ffmpeg-filters.html#toc-interleave_002c-ainterleave">12.4 interleave, ainterleave</a></h2>
10775
10776 <p>Temporally interleave frames from several inputs.
10777 </p>
10778 <p><code>interleave</code> works with video inputs, <code>ainterleave</code> with audio.
10779 </p>
10780 <p>These filters read frames from several inputs and send the oldest
10781 queued frame to the output.
10782 </p>
10783 <p>Input streams must have a well defined, monotonically increasing frame
10784 timestamp values.
10785 </p>
10786 <p>In order to submit one frame to output, these filters need to enqueue
10787 at least one frame for each input, so they cannot work in case one
10788 input is not yet terminated and will not receive incoming frames.
10789 </p>
10790 <p>For example consider the case when one input is a <code>select</code> filter
10791 which always drop input frames. The <code>interleave</code> filter will keep
10792 reading from that input, but it will never be able to send new frames
10793 to output until the input will send an end-of-stream signal.
10794 </p>
10795 <p>Also, depending on inputs synchronization, the filters will drop
10796 frames in case one input receives more frames than the other ones, and
10797 the queue is already filled.
10798 </p>
10799 <p>These filters accept the following options:
10800 </p>
10801 <dl compact="compact">
10802 <dt> &lsquo;<samp>nb_inputs, n</samp>&rsquo;</dt>
10803 <dd><p>Set the number of different inputs, it is 2 by default.
10804 </p></dd>
10805 </dl>
10806
10807 <a name="Examples-60"></a>
10808 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-60">12.4.1 Examples</a></h3>
10809
10810 <ul>
10811 <li>
10812 Interleave frames belonging to different streams using <code>ffmpeg</code>:
10813 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex &quot;[0:v][1:v] interleave&quot; out.avi
10814 </pre></td></tr></table>
10815
10816 </li><li>
10817 Add flickering blur effect:
10818 <table><tr><td>&nbsp;</td><td><pre class="example">select='if(gt(random(0), 0.2), 1, 2)':n=2 [tmp], boxblur=2:2, [tmp] interleave
10819 </pre></td></tr></table>
10820 </li></ul>
10821
10822 <a name="perms_002c-aperms"></a>
10823 <h2 class="section"><a href="ffmpeg-filters.html#toc-perms_002c-aperms">12.5 perms, aperms</a></h2>
10824
10825 <p>Set read/write permissions for the output frames.
10826 </p>
10827 <p>These filters are mainly aimed at developers to test direct path in the
10828 following filter in the filtergraph.
10829 </p>
10830 <p>The filters accept the following options:
10831 </p>
10832 <dl compact="compact">
10833 <dt> &lsquo;<samp>mode</samp>&rsquo;</dt>
10834 <dd><p>Select the permissions mode.
10835 </p>
10836 <p>It accepts the following values:
10837 </p><dl compact="compact">
10838 <dt> &lsquo;<samp>none</samp>&rsquo;</dt>
10839 <dd><p>Do nothing. This is the default.
10840 </p></dd>
10841 <dt> &lsquo;<samp>ro</samp>&rsquo;</dt>
10842 <dd><p>Set all the output frames read-only.
10843 </p></dd>
10844 <dt> &lsquo;<samp>rw</samp>&rsquo;</dt>
10845 <dd><p>Set all the output frames directly writable.
10846 </p></dd>
10847 <dt> &lsquo;<samp>toggle</samp>&rsquo;</dt>
10848 <dd><p>Make the frame read-only if writable, and writable if read-only.
10849 </p></dd>
10850 <dt> &lsquo;<samp>random</samp>&rsquo;</dt>
10851 <dd><p>Set each output frame read-only or writable randomly.
10852 </p></dd>
10853 </dl>
10854
10855 </dd>
10856 <dt> &lsquo;<samp>seed</samp>&rsquo;</dt>
10857 <dd><p>Set the seed for the <var>random</var> mode, must be an integer included between
10858 <code>0</code> and <code>UINT32_MAX</code>. If not specified, or if explicitly set to
10859 <code>-1</code>, the filter will try to use a good random seed on a best effort
10860 basis.
10861 </p></dd>
10862 </dl>
10863
10864 <p>Note: in case of auto-inserted filter between the permission filter and the
10865 following one, the permission might not be received as expected in that
10866 following filter. Inserting a <a href="#format">format</a> or <a href="#aformat">aformat</a> filter before the
10867 perms/aperms filter can avoid this problem.
10868 </p>
10869 <a name="select_002c-aselect"></a>
10870 <h2 class="section"><a href="ffmpeg-filters.html#toc-select_002c-aselect">12.6 select, aselect</a></h2>
10871
10872 <p>Select frames to pass in output.
10873 </p>
10874 <p>This filter accepts the following options:
10875 </p>
10876 <dl compact="compact">
10877 <dt> &lsquo;<samp>expr, e</samp>&rsquo;</dt>
10878 <dd><p>Set expression, which is evaluated for each input frame.
10879 </p>
10880 <p>If the expression is evaluated to zero, the frame is discarded.
10881 </p>
10882 <p>If the evaluation result is negative or NaN, the frame is sent to the
10883 first output; otherwise it is sent to the output with index
10884 <code>ceil(val)-1</code>, assuming that the input index starts from 0.
10885 </p>
10886 <p>For example a value of <code>1.2</code> corresponds to the output with index
10887 <code>ceil(1.2)-1 = 2-1 = 1</code>, that is the second output.
10888 </p>
10889 </dd>
10890 <dt> &lsquo;<samp>outputs, n</samp>&rsquo;</dt>
10891 <dd><p>Set the number of outputs. The output to which to send the selected
10892 frame is based on the result of the evaluation. Default value is 1.
10893 </p></dd>
10894 </dl>
10895
10896 <p>The expression can contain the following constants:
10897 </p>
10898 <dl compact="compact">
10899 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
10900 <dd><p>the sequential number of the filtered frame, starting from 0
10901 </p>
10902 </dd>
10903 <dt> &lsquo;<samp>selected_n</samp>&rsquo;</dt>
10904 <dd><p>the sequential number of the selected frame, starting from 0
10905 </p>
10906 </dd>
10907 <dt> &lsquo;<samp>prev_selected_n</samp>&rsquo;</dt>
10908 <dd><p>the sequential number of the last selected frame, NAN if undefined
10909 </p>
10910 </dd>
10911 <dt> &lsquo;<samp>TB</samp>&rsquo;</dt>
10912 <dd><p>timebase of the input timestamps
10913 </p>
10914 </dd>
10915 <dt> &lsquo;<samp>pts</samp>&rsquo;</dt>
10916 <dd><p>the PTS (Presentation TimeStamp) of the filtered video frame,
10917 expressed in <var>TB</var> units, NAN if undefined
10918 </p>
10919 </dd>
10920 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
10921 <dd><p>the PTS (Presentation TimeStamp) of the filtered video frame,
10922 expressed in seconds, NAN if undefined
10923 </p>
10924 </dd>
10925 <dt> &lsquo;<samp>prev_pts</samp>&rsquo;</dt>
10926 <dd><p>the PTS of the previously filtered video frame, NAN if undefined
10927 </p>
10928 </dd>
10929 <dt> &lsquo;<samp>prev_selected_pts</samp>&rsquo;</dt>
10930 <dd><p>the PTS of the last previously filtered video frame, NAN if undefined
10931 </p>
10932 </dd>
10933 <dt> &lsquo;<samp>prev_selected_t</samp>&rsquo;</dt>
10934 <dd><p>the PTS of the last previously selected video frame, NAN if undefined
10935 </p>
10936 </dd>
10937 <dt> &lsquo;<samp>start_pts</samp>&rsquo;</dt>
10938 <dd><p>the PTS of the first video frame in the video, NAN if undefined
10939 </p>
10940 </dd>
10941 <dt> &lsquo;<samp>start_t</samp>&rsquo;</dt>
10942 <dd><p>the time of the first video frame in the video, NAN if undefined
10943 </p>
10944 </dd>
10945 <dt> &lsquo;<samp>pict_type <em>(video only)</em></samp>&rsquo;</dt>
10946 <dd><p>the type of the filtered frame, can assume one of the following
10947 values:
10948 </p><dl compact="compact">
10949 <dt> &lsquo;<samp>I</samp>&rsquo;</dt>
10950 <dt> &lsquo;<samp>P</samp>&rsquo;</dt>
10951 <dt> &lsquo;<samp>B</samp>&rsquo;</dt>
10952 <dt> &lsquo;<samp>S</samp>&rsquo;</dt>
10953 <dt> &lsquo;<samp>SI</samp>&rsquo;</dt>
10954 <dt> &lsquo;<samp>SP</samp>&rsquo;</dt>
10955 <dt> &lsquo;<samp>BI</samp>&rsquo;</dt>
10956 </dl>
10957
10958 </dd>
10959 <dt> &lsquo;<samp>interlace_type <em>(video only)</em></samp>&rsquo;</dt>
10960 <dd><p>the frame interlace type, can assume one of the following values:
10961 </p><dl compact="compact">
10962 <dt> &lsquo;<samp>PROGRESSIVE</samp>&rsquo;</dt>
10963 <dd><p>the frame is progressive (not interlaced)
10964 </p></dd>
10965 <dt> &lsquo;<samp>TOPFIRST</samp>&rsquo;</dt>
10966 <dd><p>the frame is top-field-first
10967 </p></dd>
10968 <dt> &lsquo;<samp>BOTTOMFIRST</samp>&rsquo;</dt>
10969 <dd><p>the frame is bottom-field-first
10970 </p></dd>
10971 </dl>
10972
10973 </dd>
10974 <dt> &lsquo;<samp>consumed_sample_n <em>(audio only)</em></samp>&rsquo;</dt>
10975 <dd><p>the number of selected samples before the current frame
10976 </p>
10977 </dd>
10978 <dt> &lsquo;<samp>samples_n <em>(audio only)</em></samp>&rsquo;</dt>
10979 <dd><p>the number of samples in the current frame
10980 </p>
10981 </dd>
10982 <dt> &lsquo;<samp>sample_rate <em>(audio only)</em></samp>&rsquo;</dt>
10983 <dd><p>the input sample rate
10984 </p>
10985 </dd>
10986 <dt> &lsquo;<samp>key</samp>&rsquo;</dt>
10987 <dd><p>1 if the filtered frame is a key-frame, 0 otherwise
10988 </p>
10989 </dd>
10990 <dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
10991 <dd><p>the position in the file of the filtered frame, -1 if the information
10992 is not available (e.g. for synthetic video)
10993 </p>
10994 </dd>
10995 <dt> &lsquo;<samp>scene <em>(video only)</em></samp>&rsquo;</dt>
10996 <dd><p>value between 0 and 1 to indicate a new scene; a low value reflects a low
10997 probability for the current frame to introduce a new scene, while a higher
10998 value means the current frame is more likely to be one (see the example below)
10999 </p>
11000 </dd>
11001 </dl>
11002
11003 <p>The default value of the select expression is &quot;1&quot;.
11004 </p>
11005 <a name="Examples-40"></a>
11006 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-40">12.6.1 Examples</a></h3>
11007
11008 <ul>
11009 <li>
11010 Select all frames in input:
11011 <table><tr><td>&nbsp;</td><td><pre class="example">select
11012 </pre></td></tr></table>
11013
11014 <p>The example above is the same as:
11015 </p><table><tr><td>&nbsp;</td><td><pre class="example">select=1
11016 </pre></td></tr></table>
11017
11018 </li><li>
11019 Skip all frames:
11020 <table><tr><td>&nbsp;</td><td><pre class="example">select=0
11021 </pre></td></tr></table>
11022
11023 </li><li>
11024 Select only I-frames:
11025 <table><tr><td>&nbsp;</td><td><pre class="example">select='eq(pict_type\,I)'
11026 </pre></td></tr></table>
11027
11028 </li><li>
11029 Select one frame every 100:
11030 <table><tr><td>&nbsp;</td><td><pre class="example">select='not(mod(n\,100))'
11031 </pre></td></tr></table>
11032
11033 </li><li>
11034 Select only frames contained in the 10-20 time interval:
11035 <table><tr><td>&nbsp;</td><td><pre class="example">select=between(t\,10\,20)
11036 </pre></td></tr></table>
11037
11038 </li><li>
11039 Select only I frames contained in the 10-20 time interval:
11040 <table><tr><td>&nbsp;</td><td><pre class="example">select=between(t\,10\,20)*eq(pict_type\,I)
11041 </pre></td></tr></table>
11042
11043 </li><li>
11044 Select frames with a minimum distance of 10 seconds:
11045 <table><tr><td>&nbsp;</td><td><pre class="example">select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
11046 </pre></td></tr></table>
11047
11048 </li><li>
11049 Use aselect to select only audio frames with samples number &gt; 100:
11050 <table><tr><td>&nbsp;</td><td><pre class="example">aselect='gt(samples_n\,100)'
11051 </pre></td></tr></table>
11052
11053 </li><li>
11054 Create a mosaic of the first scenes:
11055 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
11056 </pre></td></tr></table>
11057
11058 <p>Comparing <var>scene</var> against a value between 0.3 and 0.5 is generally a sane
11059 choice.
11060 </p>
11061 </li><li>
11062 Send even and odd frames to separate outputs, and compose them:
11063 <table><tr><td>&nbsp;</td><td><pre class="example">select=n=2:e='mod(n, 2)+1' [odd][even]; [odd] pad=h=2*ih [tmp]; [tmp][even] overlay=y=h
11064 </pre></td></tr></table>
11065 </li></ul>
11066
11067 <a name="sendcmd_002c-asendcmd"></a>
11068 <h2 class="section"><a href="ffmpeg-filters.html#toc-sendcmd_002c-asendcmd">12.7 sendcmd, asendcmd</a></h2>
11069
11070 <p>Send commands to filters in the filtergraph.
11071 </p>
11072 <p>These filters read commands to be sent to other filters in the
11073 filtergraph.
11074 </p>
11075 <p><code>sendcmd</code> must be inserted between two video filters,
11076 <code>asendcmd</code> must be inserted between two audio filters, but apart
11077 from that they act the same way.
11078 </p>
11079 <p>The specification of commands can be provided in the filter arguments
11080 with the <var>commands</var> option, or in a file specified by the
11081 <var>filename</var> option.
11082 </p>
11083 <p>These filters accept the following options:
11084 </p><dl compact="compact">
11085 <dt> &lsquo;<samp>commands, c</samp>&rsquo;</dt>
11086 <dd><p>Set the commands to be read and sent to the other filters.
11087 </p></dd>
11088 <dt> &lsquo;<samp>filename, f</samp>&rsquo;</dt>
11089 <dd><p>Set the filename of the commands to be read and sent to the other
11090 filters.
11091 </p></dd>
11092 </dl>
11093
11094 <a name="Commands-syntax"></a>
11095 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Commands-syntax">12.7.1 Commands syntax</a></h3>
11096
11097 <p>A commands description consists of a sequence of interval
11098 specifications, comprising a list of commands to be executed when a
11099 particular event related to that interval occurs. The occurring event
11100 is typically the current frame time entering or leaving a given time
11101 interval.
11102 </p>
11103 <p>An interval is specified by the following syntax:
11104 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>START</var>[-<var>END</var>] <var>COMMANDS</var>;
11105 </pre></td></tr></table>
11106
11107 <p>The time interval is specified by the <var>START</var> and <var>END</var> times.
11108 <var>END</var> is optional and defaults to the maximum time.
11109 </p>
11110 <p>The current frame time is considered within the specified interval if
11111 it is included in the interval [<var>START</var>, <var>END</var>), that is when
11112 the time is greater or equal to <var>START</var> and is lesser than
11113 <var>END</var>.
11114 </p>
11115 <p><var>COMMANDS</var> consists of a sequence of one or more command
11116 specifications, separated by &quot;,&quot;, relating to that interval.  The
11117 syntax of a command specification is given by:
11118 </p><table><tr><td>&nbsp;</td><td><pre class="example">[<var>FLAGS</var>] <var>TARGET</var> <var>COMMAND</var> <var>ARG</var>
11119 </pre></td></tr></table>
11120
11121 <p><var>FLAGS</var> is optional and specifies the type of events relating to
11122 the time interval which enable sending the specified command, and must
11123 be a non-null sequence of identifier flags separated by &quot;+&quot; or &quot;|&quot; and
11124 enclosed between &quot;[&quot; and &quot;]&quot;.
11125 </p>
11126 <p>The following flags are recognized:
11127 </p><dl compact="compact">
11128 <dt> &lsquo;<samp>enter</samp>&rsquo;</dt>
11129 <dd><p>The command is sent when the current frame timestamp enters the
11130 specified interval. In other words, the command is sent when the
11131 previous frame timestamp was not in the given interval, and the
11132 current is.
11133 </p>
11134 </dd>
11135 <dt> &lsquo;<samp>leave</samp>&rsquo;</dt>
11136 <dd><p>The command is sent when the current frame timestamp leaves the
11137 specified interval. In other words, the command is sent when the
11138 previous frame timestamp was in the given interval, and the
11139 current is not.
11140 </p></dd>
11141 </dl>
11142
11143 <p>If <var>FLAGS</var> is not specified, a default value of <code>[enter]</code> is
11144 assumed.
11145 </p>
11146 <p><var>TARGET</var> specifies the target of the command, usually the name of
11147 the filter class or a specific filter instance name.
11148 </p>
11149 <p><var>COMMAND</var> specifies the name of the command for the target filter.
11150 </p>
11151 <p><var>ARG</var> is optional and specifies the optional list of argument for
11152 the given <var>COMMAND</var>.
11153 </p>
11154 <p>Between one interval specification and another, whitespaces, or
11155 sequences of characters starting with <code>#</code> until the end of line,
11156 are ignored and can be used to annotate comments.
11157 </p>
11158 <p>A simplified BNF description of the commands specification syntax
11159 follows:
11160 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>COMMAND_FLAG</var>  ::= &quot;enter&quot; | &quot;leave&quot;
11161 <var>COMMAND_FLAGS</var> ::= <var>COMMAND_FLAG</var> [(+|&quot;|&quot;)<var>COMMAND_FLAG</var>]
11162 <var>COMMAND</var>       ::= [&quot;[&quot; <var>COMMAND_FLAGS</var> &quot;]&quot;] <var>TARGET</var> <var>COMMAND</var> [<var>ARG</var>]
11163 <var>COMMANDS</var>      ::= <var>COMMAND</var> [,<var>COMMANDS</var>]
11164 <var>INTERVAL</var>      ::= <var>START</var>[-<var>END</var>] <var>COMMANDS</var>
11165 <var>INTERVALS</var>     ::= <var>INTERVAL</var>[;<var>INTERVALS</var>]
11166 </pre></td></tr></table>
11167
11168 <a name="Examples-7"></a>
11169 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-7">12.7.2 Examples</a></h3>
11170
11171 <ul>
11172 <li>
11173 Specify audio tempo change at second 4:
11174 <table><tr><td>&nbsp;</td><td><pre class="example">asendcmd=c='4.0 atempo tempo 1.5',atempo
11175 </pre></td></tr></table>
11176
11177 </li><li>
11178 Specify a list of drawtext and hue commands in a file.
11179 <table><tr><td>&nbsp;</td><td><pre class="example"># show text in the interval 5-10
11180 5.0-10.0 [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=hello world',
11181          [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=';
11182
11183 # desaturate the image in the interval 15-20
11184 15.0-20.0 [enter] hue s 0,
11185           [enter] drawtext reinit 'fontfile=FreeSerif.ttf:text=nocolor',
11186           [leave] hue s 1,
11187           [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
11188
11189 # apply an exponential saturation fade-out effect, starting from time 25
11190 25 [enter] hue s exp(25-t)
11191 </pre></td></tr></table>
11192
11193 <p>A filtergraph allowing to read and process the above command list
11194 stored in a file &lsquo;<tt>test.cmd</tt>&rsquo;, can be specified with:
11195 </p><table><tr><td>&nbsp;</td><td><pre class="example">sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
11196 </pre></td></tr></table>
11197 </li></ul>
11198
11199 <p><a name="setpts"></a>
11200 </p><a name="setpts_002c-asetpts"></a>
11201 <h2 class="section"><a href="ffmpeg-filters.html#toc-setpts_002c-asetpts">12.8 setpts, asetpts</a></h2>
11202
11203 <p>Change the PTS (presentation timestamp) of the input frames.
11204 </p>
11205 <p><code>setpts</code> works on video frames, <code>asetpts</code> on audio frames.
11206 </p>
11207 <p>This filter accepts the following options:
11208 </p>
11209 <dl compact="compact">
11210 <dt> &lsquo;<samp>expr</samp>&rsquo;</dt>
11211 <dd><p>The expression which is evaluated for each frame to construct its timestamp.
11212 </p>
11213 </dd>
11214 </dl>
11215
11216 <p>The expression is evaluated through the eval API and can contain the following
11217 constants:
11218 </p>
11219 <dl compact="compact">
11220 <dt> &lsquo;<samp>FRAME_RATE</samp>&rsquo;</dt>
11221 <dd><p>frame rate, only defined for constant frame-rate video
11222 </p>
11223 </dd>
11224 <dt> &lsquo;<samp>PTS</samp>&rsquo;</dt>
11225 <dd><p>the presentation timestamp in input
11226 </p>
11227 </dd>
11228 <dt> &lsquo;<samp>N</samp>&rsquo;</dt>
11229 <dd><p>the count of the input frame for video or the number of consumed samples,
11230 not including the current frame for audio, starting from 0.
11231 </p>
11232 </dd>
11233 <dt> &lsquo;<samp>NB_CONSUMED_SAMPLES</samp>&rsquo;</dt>
11234 <dd><p>the number of consumed samples, not including the current frame (only
11235 audio)
11236 </p>
11237 </dd>
11238 <dt> &lsquo;<samp>NB_SAMPLES, S</samp>&rsquo;</dt>
11239 <dd><p>the number of samples in the current frame (only audio)
11240 </p>
11241 </dd>
11242 <dt> &lsquo;<samp>SAMPLE_RATE, SR</samp>&rsquo;</dt>
11243 <dd><p>audio sample rate
11244 </p>
11245 </dd>
11246 <dt> &lsquo;<samp>STARTPTS</samp>&rsquo;</dt>
11247 <dd><p>the PTS of the first frame
11248 </p>
11249 </dd>
11250 <dt> &lsquo;<samp>STARTT</samp>&rsquo;</dt>
11251 <dd><p>the time in seconds of the first frame
11252 </p>
11253 </dd>
11254 <dt> &lsquo;<samp>INTERLACED</samp>&rsquo;</dt>
11255 <dd><p>tell if the current frame is interlaced
11256 </p>
11257 </dd>
11258 <dt> &lsquo;<samp>T</samp>&rsquo;</dt>
11259 <dd><p>the time in seconds of the current frame
11260 </p>
11261 </dd>
11262 <dt> &lsquo;<samp>POS</samp>&rsquo;</dt>
11263 <dd><p>original position in the file of the frame, or undefined if undefined
11264 for the current frame
11265 </p>
11266 </dd>
11267 <dt> &lsquo;<samp>PREV_INPTS</samp>&rsquo;</dt>
11268 <dd><p>previous input PTS
11269 </p>
11270 </dd>
11271 <dt> &lsquo;<samp>PREV_INT</samp>&rsquo;</dt>
11272 <dd><p>previous input time in seconds
11273 </p>
11274 </dd>
11275 <dt> &lsquo;<samp>PREV_OUTPTS</samp>&rsquo;</dt>
11276 <dd><p>previous output PTS
11277 </p>
11278 </dd>
11279 <dt> &lsquo;<samp>PREV_OUTT</samp>&rsquo;</dt>
11280 <dd><p>previous output time in seconds
11281 </p>
11282 </dd>
11283 <dt> &lsquo;<samp>RTCTIME</samp>&rsquo;</dt>
11284 <dd><p>wallclock (RTC) time in microseconds. This is deprecated, use time(0)
11285 instead.
11286 </p>
11287 </dd>
11288 <dt> &lsquo;<samp>RTCSTART</samp>&rsquo;</dt>
11289 <dd><p>wallclock (RTC) time at the start of the movie in microseconds
11290 </p>
11291 </dd>
11292 <dt> &lsquo;<samp>TB</samp>&rsquo;</dt>
11293 <dd><p>timebase of the input timestamps
11294 </p>
11295 </dd>
11296 </dl>
11297
11298 <a name="Examples"></a>
11299 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples">12.8.1 Examples</a></h3>
11300
11301 <ul>
11302 <li>
11303 Start counting PTS from zero
11304 <table><tr><td>&nbsp;</td><td><pre class="example">setpts=PTS-STARTPTS
11305 </pre></td></tr></table>
11306
11307 </li><li>
11308 Apply fast motion effect:
11309 <table><tr><td>&nbsp;</td><td><pre class="example">setpts=0.5*PTS
11310 </pre></td></tr></table>
11311
11312 </li><li>
11313 Apply slow motion effect:
11314 <table><tr><td>&nbsp;</td><td><pre class="example">setpts=2.0*PTS
11315 </pre></td></tr></table>
11316
11317 </li><li>
11318 Set fixed rate of 25 frames per second:
11319 <table><tr><td>&nbsp;</td><td><pre class="example">setpts=N/(25*TB)
11320 </pre></td></tr></table>
11321
11322 </li><li>
11323 Set fixed rate 25 fps with some jitter:
11324 <table><tr><td>&nbsp;</td><td><pre class="example">setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
11325 </pre></td></tr></table>
11326
11327 </li><li>
11328 Apply an offset of 10 seconds to the input PTS:
11329 <table><tr><td>&nbsp;</td><td><pre class="example">setpts=PTS+10/TB
11330 </pre></td></tr></table>
11331
11332 </li><li>
11333 Generate timestamps from a &quot;live source&quot; and rebase onto the current timebase:
11334 <table><tr><td>&nbsp;</td><td><pre class="example">setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
11335 </pre></td></tr></table>
11336
11337 </li><li>
11338 Generate timestamps by counting samples:
11339 <table><tr><td>&nbsp;</td><td><pre class="example">asetpts=N/SR/TB
11340 </pre></td></tr></table>
11341
11342 </li></ul>
11343
11344 <a name="settb_002c-asettb"></a>
11345 <h2 class="section"><a href="ffmpeg-filters.html#toc-settb_002c-asettb">12.9 settb, asettb</a></h2>
11346
11347 <p>Set the timebase to use for the output frames timestamps.
11348 It is mainly useful for testing timebase configuration.
11349 </p>
11350 <p>This filter accepts the following options:
11351 </p>
11352 <dl compact="compact">
11353 <dt> &lsquo;<samp>expr, tb</samp>&rsquo;</dt>
11354 <dd><p>The expression which is evaluated into the output timebase.
11355 </p>
11356 </dd>
11357 </dl>
11358
11359 <p>The value for &lsquo;<samp>tb</samp>&rsquo; is an arithmetic expression representing a
11360 rational. The expression can contain the constants &quot;AVTB&quot; (the default
11361 timebase), &quot;intb&quot; (the input timebase) and &quot;sr&quot; (the sample rate,
11362 audio only). Default value is &quot;intb&quot;.
11363 </p>
11364 <a name="Examples-67"></a>
11365 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-67">12.9.1 Examples</a></h3>
11366
11367 <ul>
11368 <li>
11369 Set the timebase to 1/25:
11370 <table><tr><td>&nbsp;</td><td><pre class="example">settb=expr=1/25
11371 </pre></td></tr></table>
11372
11373 </li><li>
11374 Set the timebase to 1/10:
11375 <table><tr><td>&nbsp;</td><td><pre class="example">settb=expr=0.1
11376 </pre></td></tr></table>
11377
11378 </li><li>
11379 Set the timebase to 1001/1000:
11380 <table><tr><td>&nbsp;</td><td><pre class="example">settb=1+0.001
11381 </pre></td></tr></table>
11382
11383 </li><li>
11384 Set the timebase to 2*intb:
11385 <table><tr><td>&nbsp;</td><td><pre class="example">settb=2*intb
11386 </pre></td></tr></table>
11387
11388 </li><li>
11389 Set the default timebase value:
11390 <table><tr><td>&nbsp;</td><td><pre class="example">settb=AVTB
11391 </pre></td></tr></table>
11392 </li></ul>
11393
11394 <a name="showspectrum"></a>
11395 <h2 class="section"><a href="ffmpeg-filters.html#toc-showspectrum">12.10 showspectrum</a></h2>
11396
11397 <p>Convert input audio to a video output, representing the audio frequency
11398 spectrum.
11399 </p>
11400 <p>The filter accepts the following options:
11401 </p>
11402 <dl compact="compact">
11403 <dt> &lsquo;<samp>size, s</samp>&rsquo;</dt>
11404 <dd><p>Specify the video size for the output. For the syntax of this option, check
11405 the &quot;Video size&quot; section in the ffmpeg-utils manual. Default value is
11406 <code>640x512</code>.
11407 </p>
11408 </dd>
11409 <dt> &lsquo;<samp>slide</samp>&rsquo;</dt>
11410 <dd><p>Specify if the spectrum should slide along the window. Default value is
11411 <code>0</code>.
11412 </p>
11413 </dd>
11414 <dt> &lsquo;<samp>mode</samp>&rsquo;</dt>
11415 <dd><p>Specify display mode.
11416 </p>
11417 <p>It accepts the following values:
11418 </p><dl compact="compact">
11419 <dt> &lsquo;<samp>combined</samp>&rsquo;</dt>
11420 <dd><p>all channels are displayed in the same row
11421 </p></dd>
11422 <dt> &lsquo;<samp>separate</samp>&rsquo;</dt>
11423 <dd><p>all channels are displayed in separate rows
11424 </p></dd>
11425 </dl>
11426
11427 <p>Default value is &lsquo;<samp>combined</samp>&rsquo;.
11428 </p>
11429 </dd>
11430 <dt> &lsquo;<samp>color</samp>&rsquo;</dt>
11431 <dd><p>Specify display color mode.
11432 </p>
11433 <p>It accepts the following values:
11434 </p><dl compact="compact">
11435 <dt> &lsquo;<samp>channel</samp>&rsquo;</dt>
11436 <dd><p>each channel is displayed in a separate color
11437 </p></dd>
11438 <dt> &lsquo;<samp>intensity</samp>&rsquo;</dt>
11439 <dd><p>each channel is is displayed using the same color scheme
11440 </p></dd>
11441 </dl>
11442
11443 <p>Default value is &lsquo;<samp>channel</samp>&rsquo;.
11444 </p>
11445 </dd>
11446 <dt> &lsquo;<samp>scale</samp>&rsquo;</dt>
11447 <dd><p>Specify scale used for calculating intensity color values.
11448 </p>
11449 <p>It accepts the following values:
11450 </p><dl compact="compact">
11451 <dt> &lsquo;<samp>lin</samp>&rsquo;</dt>
11452 <dd><p>linear
11453 </p></dd>
11454 <dt> &lsquo;<samp>sqrt</samp>&rsquo;</dt>
11455 <dd><p>square root, default
11456 </p></dd>
11457 <dt> &lsquo;<samp>cbrt</samp>&rsquo;</dt>
11458 <dd><p>cubic root
11459 </p></dd>
11460 <dt> &lsquo;<samp>log</samp>&rsquo;</dt>
11461 <dd><p>logarithmic
11462 </p></dd>
11463 </dl>
11464
11465 <p>Default value is &lsquo;<samp>sqrt</samp>&rsquo;.
11466 </p>
11467 </dd>
11468 <dt> &lsquo;<samp>saturation</samp>&rsquo;</dt>
11469 <dd><p>Set saturation modifier for displayed colors. Negative values provide
11470 alternative color scheme. <code>0</code> is no saturation at all.
11471 Saturation must be in [-10.0, 10.0] range.
11472 Default value is <code>1</code>.
11473 </p>
11474 </dd>
11475 <dt> &lsquo;<samp>win_func</samp>&rsquo;</dt>
11476 <dd><p>Set window function.
11477 </p>
11478 <p>It accepts the following values:
11479 </p><dl compact="compact">
11480 <dt> &lsquo;<samp>none</samp>&rsquo;</dt>
11481 <dd><p>No samples pre-processing (do not expect this to be faster)
11482 </p></dd>
11483 <dt> &lsquo;<samp>hann</samp>&rsquo;</dt>
11484 <dd><p>Hann window
11485 </p></dd>
11486 <dt> &lsquo;<samp>hamming</samp>&rsquo;</dt>
11487 <dd><p>Hamming window
11488 </p></dd>
11489 <dt> &lsquo;<samp>blackman</samp>&rsquo;</dt>
11490 <dd><p>Blackman window
11491 </p></dd>
11492 </dl>
11493
11494 <p>Default value is <code>hann</code>.
11495 </p></dd>
11496 </dl>
11497
11498 <p>The usage is very similar to the showwaves filter; see the examples in that
11499 section.
11500 </p>
11501 <a name="Examples-68"></a>
11502 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-68">12.10.1 Examples</a></h3>
11503
11504 <ul>
11505 <li>
11506 Large window with logarithmic color scaling:
11507 <table><tr><td>&nbsp;</td><td><pre class="example">showspectrum=s=1280x480:scale=log
11508 </pre></td></tr></table>
11509
11510 </li><li>
11511 Complete example for a colored and sliding spectrum per channel using <code>ffplay</code>:
11512 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
11513              [a] showspectrum=mode=separate:color=intensity:slide=1:scale=cbrt [out0]'
11514 </pre></td></tr></table>
11515 </li></ul>
11516
11517 <a name="showwaves"></a>
11518 <h2 class="section"><a href="ffmpeg-filters.html#toc-showwaves">12.11 showwaves</a></h2>
11519
11520 <p>Convert input audio to a video output, representing the samples waves.
11521 </p>
11522 <p>The filter accepts the following options:
11523 </p>
11524 <dl compact="compact">
11525 <dt> &lsquo;<samp>size, s</samp>&rsquo;</dt>
11526 <dd><p>Specify the video size for the output. For the syntax of this option, check
11527 the &quot;Video size&quot; section in the ffmpeg-utils manual. Default value
11528 is &quot;600x240&quot;.
11529 </p>
11530 </dd>
11531 <dt> &lsquo;<samp>mode</samp>&rsquo;</dt>
11532 <dd><p>Set display mode.
11533 </p>
11534 <p>Available values are:
11535 </p><dl compact="compact">
11536 <dt> &lsquo;<samp>point</samp>&rsquo;</dt>
11537 <dd><p>Draw a point for each sample.
11538 </p>
11539 </dd>
11540 <dt> &lsquo;<samp>line</samp>&rsquo;</dt>
11541 <dd><p>Draw a vertical line for each sample.
11542 </p></dd>
11543 </dl>
11544
11545 <p>Default value is <code>point</code>.
11546 </p>
11547 </dd>
11548 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
11549 <dd><p>Set the number of samples which are printed on the same column. A
11550 larger value will decrease the frame rate. Must be a positive
11551 integer. This option can be set only if the value for <var>rate</var>
11552 is not explicitly specified.
11553 </p>
11554 </dd>
11555 <dt> &lsquo;<samp>rate, r</samp>&rsquo;</dt>
11556 <dd><p>Set the (approximate) output frame rate. This is done by setting the
11557 option <var>n</var>. Default value is &quot;25&quot;.
11558 </p>
11559 </dd>
11560 </dl>
11561
11562 <a name="Examples-47"></a>
11563 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-47">12.11.1 Examples</a></h3>
11564
11565 <ul>
11566 <li>
11567 Output the input file audio and the corresponding video representation
11568 at the same time:
11569 <table><tr><td>&nbsp;</td><td><pre class="example">amovie=a.mp3,asplit[out0],showwaves[out1]
11570 </pre></td></tr></table>
11571
11572 </li><li>
11573 Create a synthetic signal and show it with showwaves, forcing a
11574 frame rate of 30 frames per second:
11575 <table><tr><td>&nbsp;</td><td><pre class="example">aevalsrc=sin(1*2*PI*t)*sin(880*2*PI*t):cos(2*PI*200*t),asplit[out0],showwaves=r=30[out1]
11576 </pre></td></tr></table>
11577 </li></ul>
11578
11579 <a name="split_002c-asplit"></a>
11580 <h2 class="section"><a href="ffmpeg-filters.html#toc-split_002c-asplit">12.12 split, asplit</a></h2>
11581
11582 <p>Split input into several identical outputs.
11583 </p>
11584 <p><code>asplit</code> works with audio input, <code>split</code> with video.
11585 </p>
11586 <p>The filter accepts a single parameter which specifies the number of outputs. If
11587 unspecified, it defaults to 2.
11588 </p>
11589 <a name="Examples-63"></a>
11590 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-63">12.12.1 Examples</a></h3>
11591
11592 <ul>
11593 <li>
11594 Create two separate outputs from the same input:
11595 <table><tr><td>&nbsp;</td><td><pre class="example">[in] split [out0][out1]
11596 </pre></td></tr></table>
11597
11598 </li><li>
11599 To create 3 or more outputs, you need to specify the number of
11600 outputs, like in:
11601 <table><tr><td>&nbsp;</td><td><pre class="example">[in] asplit=3 [out0][out1][out2]
11602 </pre></td></tr></table>
11603
11604 </li><li>
11605 Create two separate outputs from the same input, one cropped and
11606 one padded:
11607 <table><tr><td>&nbsp;</td><td><pre class="example">[in] split [splitout1][splitout2];
11608 [splitout1] crop=100:100:0:0    [cropout];
11609 [splitout2] pad=200:200:100:100 [padout];
11610 </pre></td></tr></table>
11611
11612 </li><li>
11613 Create 5 copies of the input audio with <code>ffmpeg</code>:
11614 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
11615 </pre></td></tr></table>
11616 </li></ul>
11617
11618 <a name="zmq_002c-azmq"></a>
11619 <h2 class="section"><a href="ffmpeg-filters.html#toc-zmq_002c-azmq">12.13 zmq, azmq</a></h2>
11620
11621 <p>Receive commands sent through a libzmq client, and forward them to
11622 filters in the filtergraph.
11623 </p>
11624 <p><code>zmq</code> and <code>azmq</code> work as a pass-through filters. <code>zmq</code>
11625 must be inserted between two video filters, <code>azmq</code> between two
11626 audio filters.
11627 </p>
11628 <p>To enable these filters you need to install the libzmq library and
11629 headers and configure FFmpeg with <code>--enable-libzmq</code>.
11630 </p>
11631 <p>For more information about libzmq see:
11632 <a href="http://www.zeromq.org/">http://www.zeromq.org/</a>
11633 </p>
11634 <p>The <code>zmq</code> and <code>azmq</code> filters work as a libzmq server, which
11635 receives messages sent through a network interface defined by the
11636 &lsquo;<samp>bind_address</samp>&rsquo; option.
11637 </p>
11638 <p>The received message must be in the form:
11639 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>TARGET</var> <var>COMMAND</var> [<var>ARG</var>]
11640 </pre></td></tr></table>
11641
11642 <p><var>TARGET</var> specifies the target of the command, usually the name of
11643 the filter class or a specific filter instance name.
11644 </p>
11645 <p><var>COMMAND</var> specifies the name of the command for the target filter.
11646 </p>
11647 <p><var>ARG</var> is optional and specifies the optional argument list for the
11648 given <var>COMMAND</var>.
11649 </p>
11650 <p>Upon reception, the message is processed and the corresponding command
11651 is injected into the filtergraph. Depending on the result, the filter
11652 will send a reply to the client, adopting the format:
11653 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>ERROR_CODE</var> <var>ERROR_REASON</var>
11654 <var>MESSAGE</var>
11655 </pre></td></tr></table>
11656
11657 <p><var>MESSAGE</var> is optional.
11658 </p>
11659 <a name="Examples-61"></a>
11660 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-61">12.13.1 Examples</a></h3>
11661
11662 <p>Look at &lsquo;<tt>tools/zmqsend</tt>&rsquo; for an example of a zmq client which can
11663 be used to send commands processed by these filters.
11664 </p>
11665 <p>Consider the following filtergraph generated by <code>ffplay</code>
11666 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffplay -dumpgraph 1 -f lavfi &quot;
11667 color=s=100x100:c=red  [l];
11668 color=s=100x100:c=blue [r];
11669 nullsrc=s=200x100, zmq [bg];
11670 [bg][l]   overlay      [bg+l];
11671 [bg+l][r] overlay=x=100 &quot;
11672 </pre></td></tr></table>
11673
11674 <p>To change the color of the left side of the video, the following
11675 command can be used:
11676 </p><table><tr><td>&nbsp;</td><td><pre class="example">echo Parsed_color_0 c yellow | tools/zmqsend
11677 </pre></td></tr></table>
11678
11679 <p>To change the right side:
11680 </p><table><tr><td>&nbsp;</td><td><pre class="example">echo Parsed_color_1 c pink | tools/zmqsend
11681 </pre></td></tr></table>
11682
11683
11684 <a name="Multimedia-Sources"></a>
11685 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Multimedia-Sources">13. Multimedia Sources</a></h1>
11686
11687 <p>Below is a description of the currently available multimedia sources.
11688 </p>
11689 <a name="amovie"></a>
11690 <h2 class="section"><a href="ffmpeg-filters.html#toc-amovie">13.1 amovie</a></h2>
11691
11692 <p>This is the same as <a href="#movie">movie</a> source, except it selects an audio
11693 stream by default.
11694 </p>
11695 <p><a name="movie"></a>
11696 </p><a name="movie-1"></a>
11697 <h2 class="section"><a href="ffmpeg-filters.html#toc-movie-1">13.2 movie</a></h2>
11698
11699 <p>Read audio and/or video stream(s) from a movie container.
11700 </p>
11701 <p>This filter accepts the following options:
11702 </p>
11703 <dl compact="compact">
11704 <dt> &lsquo;<samp>filename</samp>&rsquo;</dt>
11705 <dd><p>The name of the resource to read (not necessarily a file but also a device or a
11706 stream accessed through some protocol).
11707 </p>
11708 </dd>
11709 <dt> &lsquo;<samp>format_name, f</samp>&rsquo;</dt>
11710 <dd><p>Specifies the format assumed for the movie to read, and can be either
11711 the name of a container or an input device. If not specified the
11712 format is guessed from <var>movie_name</var> or by probing.
11713 </p>
11714 </dd>
11715 <dt> &lsquo;<samp>seek_point, sp</samp>&rsquo;</dt>
11716 <dd><p>Specifies the seek point in seconds, the frames will be output
11717 starting from this seek point, the parameter is evaluated with
11718 <code>av_strtod</code> so the numerical value may be suffixed by an IS
11719 postfix. Default value is &quot;0&quot;.
11720 </p>
11721 </dd>
11722 <dt> &lsquo;<samp>streams, s</samp>&rsquo;</dt>
11723 <dd><p>Specifies the streams to read. Several streams can be specified,
11724 separated by &quot;+&quot;. The source will then have as many outputs, in the
11725 same order. The syntax is explained in the &ldquo;Stream specifiers&rdquo;
11726 section in the ffmpeg manual. Two special names, &quot;dv&quot; and &quot;da&quot; specify
11727 respectively the default (best suited) video and audio stream. Default
11728 is &quot;dv&quot;, or &quot;da&quot; if the filter is called as &quot;amovie&quot;.
11729 </p>
11730 </dd>
11731 <dt> &lsquo;<samp>stream_index, si</samp>&rsquo;</dt>
11732 <dd><p>Specifies the index of the video stream to read. If the value is -1,
11733 the best suited video stream will be automatically selected. Default
11734 value is &quot;-1&quot;. Deprecated. If the filter is called &quot;amovie&quot;, it will select
11735 audio instead of video.
11736 </p>
11737 </dd>
11738 <dt> &lsquo;<samp>loop</samp>&rsquo;</dt>
11739 <dd><p>Specifies how many times to read the stream in sequence.
11740 If the value is less than 1, the stream will be read again and again.
11741 Default value is &quot;1&quot;.
11742 </p>
11743 <p>Note that when the movie is looped the source timestamps are not
11744 changed, so it will generate non monotonically increasing timestamps.
11745 </p></dd>
11746 </dl>
11747
11748 <p>This filter allows one to overlay a second video on top of main input of
11749 a filtergraph as shown in this graph:
11750 </p><table><tr><td>&nbsp;</td><td><pre class="example">input -----------&gt; deltapts0 --&gt; overlay --&gt; output
11751                                     ^
11752                                     |
11753 movie --&gt; scale--&gt; deltapts1 -------+
11754 </pre></td></tr></table>
11755
11756 <a name="Examples-69"></a>
11757 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-69">13.2.1 Examples</a></h3>
11758
11759 <ul>
11760 <li>
11761 Skip 3.2 seconds from the start of the avi file in.avi, and overlay it
11762 on top of the input labelled as &quot;in&quot;:
11763 <table><tr><td>&nbsp;</td><td><pre class="example">movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [over];
11764 [in] setpts=PTS-STARTPTS [main];
11765 [main][over] overlay=16:16 [out]
11766 </pre></td></tr></table>
11767
11768 </li><li>
11769 Read from a video4linux2 device, and overlay it on top of the input
11770 labelled as &quot;in&quot;:
11771 <table><tr><td>&nbsp;</td><td><pre class="example">movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [over];
11772 [in] setpts=PTS-STARTPTS [main];
11773 [main][over] overlay=16:16 [out]
11774 </pre></td></tr></table>
11775
11776 </li><li>
11777 Read the first video stream and the audio stream with id 0x81 from
11778 dvd.vob; the video is connected to the pad named &quot;video&quot; and the audio is
11779 connected to the pad named &quot;audio&quot;:
11780 <table><tr><td>&nbsp;</td><td><pre class="example">movie=dvd.vob:s=v:0+#0x81 [video] [audio]
11781 </pre></td></tr></table>
11782 </li></ul>
11783
11784
11785 <a name="See-Also"></a>
11786 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-See-Also">14. See Also</a></h1>
11787
11788 <p><a href="ffmpeg.html">ffmpeg</a>, <a href="ffplay.html">ffplay</a>, <a href="ffprobe.html">ffprobe</a>, <a href="ffserver.html">ffserver</a>,
11789 <a href="libavfilter.html">libavfilter</a>
11790 </p>
11791
11792 <a name="Authors"></a>
11793 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Authors">15. Authors</a></h1>
11794
11795 <p>The FFmpeg developers.
11796 </p>
11797 <p>For details about the authorship, see the Git history of the project
11798 (git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
11799 <code>git log</code> in the FFmpeg source directory, or browsing the
11800 online repository at <a href="http://source.ffmpeg.org">http://source.ffmpeg.org</a>.
11801 </p>
11802 <p>Maintainers for the specific components are listed in the file
11803 &lsquo;<tt>MAINTAINERS</tt>&rsquo; in the source code tree.
11804 </p>
11805
11806 <footer class="footer pagination-right">
11807 <span class="label label-info">This document was generated by <em>Kyle Schwarz</em> on <em>June 19, 2014</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.</span></footer></div></div></body>