3 <!-- Created on June 19, 2014 by texi2html 1.82 -->
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>
10 Maintained by: Many creative people.
11 Send bugs and suggestions to <texi2html-bug@nongnu.org>
15 <title>FFmpeg documentation : FFmpeg Filters </title>
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" />
23 <link rel="icon" href="favicon.png" type="image/png" />
29 <a name="SEC_Top"></a>
30 <h1 class="settitle">FFmpeg Filters Documentation</h1>
32 <a name="SEC_Contents"></a>
33 <h1>Table of Contents</h1>
34 <div class="contents">
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>
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>
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>
48 <li><a name="toc-aconvert" href="#aconvert">6.1 aconvert</a>
50 <li><a name="toc-Examples-37" href="#Examples-37">6.1.1 Examples</a></li>
52 <li><a name="toc-adelay" href="#adelay">6.2 adelay</a>
54 <li><a name="toc-Examples-32" href="#Examples-32">6.2.1 Examples</a></li>
56 <li><a name="toc-aecho" href="#aecho">6.3 aecho</a>
58 <li><a name="toc-Examples-20" href="#Examples-20">6.3.1 Examples</a></li>
60 <li><a name="toc-aeval" href="#aeval">6.4 aeval</a>
62 <li><a name="toc-Examples-64" href="#Examples-64">6.4.1 Examples</a></li>
64 <li><a name="toc-afade" href="#afade">6.5 afade</a>
66 <li><a name="toc-Examples-28" href="#Examples-28">6.5.1 Examples</a></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>
72 <li><a name="toc-Examples-38" href="#Examples-38">6.8.1 Examples</a></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>
80 <li><a name="toc-Examples-5" href="#Examples-5">6.13.1 Examples</a></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>
88 <li><a name="toc-Examples-45" href="#Examples-45">6.18.1 Examples</a></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>
93 <li><a name="toc-Examples-23" href="#Examples-23">6.20.1 Examples</a></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>
104 <li><a name="toc-Examples-65" href="#Examples-65">6.28.1 Examples</a></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>
109 <li><a name="toc-Examples-14" href="#Examples-14">6.30.1 Examples</a></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>
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>
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>
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>
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>
128 <li><a name="toc-Examples-3" href="#Examples-3">6.38.1 Examples</a></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>
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>
136 <li><a name="toc-volumedetect" href="#volumedetect">6.41 volumedetect</a>
138 <li><a name="toc-Examples-17" href="#Examples-17">6.41.1 Examples</a></li>
142 <li><a name="toc-Audio-Sources" href="#Audio-Sources">7. Audio Sources</a>
144 <li><a name="toc-abuffer" href="#abuffer">7.1 abuffer</a>
146 <li><a name="toc-Examples-44" href="#Examples-44">7.1.1 Examples</a></li>
148 <li><a name="toc-aevalsrc" href="#aevalsrc">7.2 aevalsrc</a>
150 <li><a name="toc-Examples-9" href="#Examples-9">7.2.1 Examples</a></li>
152 <li><a name="toc-anullsrc" href="#anullsrc">7.3 anullsrc</a>
154 <li><a name="toc-Examples-72" href="#Examples-72">7.3.1 Examples</a></li>
156 <li><a name="toc-flite" href="#flite">7.4 flite</a>
158 <li><a name="toc-Examples-74" href="#Examples-74">7.4.1 Examples</a></li>
160 <li><a name="toc-sine" href="#sine">7.5 sine</a>
162 <li><a name="toc-Examples-58" href="#Examples-58">7.5.1 Examples</a></li>
166 <li><a name="toc-Audio-Sinks" href="#Audio-Sinks">8. Audio Sinks</a>
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>
171 <li><a name="toc-Video-Filters" href="#Video-Filters">9. Video Filters</a>
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>
181 <li><a name="toc-Examples-73" href="#Examples-73">9.7.1 Examples</a></li>
183 <li><a name="toc-boxblur" href="#boxblur">9.8 boxblur</a>
185 <li><a name="toc-Examples-15" href="#Examples-15">9.8.1 Examples</a></li>
187 <li><a name="toc-colorbalance" href="#colorbalance">9.9 colorbalance</a>
189 <li><a name="toc-Examples-21" href="#Examples-21">9.9.1 Examples</a></li>
191 <li><a name="toc-colorchannelmixer" href="#colorchannelmixer">9.10 colorchannelmixer</a>
193 <li><a name="toc-Examples-12" href="#Examples-12">9.10.1 Examples</a></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>
199 <li><a name="toc-Examples-8" href="#Examples-8">9.13.1 Examples</a></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>
204 <li><a name="toc-Examples-1" href="#Examples-1">9.15.1 Examples</a></li>
206 <li><a name="toc-dctdnoiz" href="#dctdnoiz">9.16 dctdnoiz</a>
208 <li><a name="toc-Examples-70" href="#Examples-70">9.16.1 Examples</a></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>
214 <li><a name="toc-Examples-27" href="#Examples-27">9.19.1 Examples</a></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>
219 <li><a name="toc-Examples-46" href="#Examples-46">9.21.1 Examples</a></li>
221 <li><a name="toc-drawgrid" href="#drawgrid">9.22 drawgrid</a>
223 <li><a name="toc-Examples-18" href="#Examples-18">9.22.1 Examples</a></li>
225 <li><a name="toc-drawtext-1" href="#drawtext-1">9.23 drawtext</a>
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>
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>
234 <li><a name="toc-Examples-54" href="#Examples-54">9.25.1 Examples</a></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>
239 <li><a name="toc-Examples-22" href="#Examples-22">9.27.1 Examples</a></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>
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>
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>
249 <li><a name="toc-Examples-30" href="#Examples-30">9.29.2 Examples</a></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>
255 <li><a name="toc-Examples-71" href="#Examples-71">9.32.1 Examples</a></li>
257 <li><a name="toc-fps-1" href="#fps-1">9.33 fps</a>
259 <li><a name="toc-Examples-31" href="#Examples-31">9.33.1 Examples</a></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>
265 <li><a name="toc-Examples-49" href="#Examples-49">9.36.1 Examples</a></li>
267 <li><a name="toc-geq" href="#geq">9.37 geq</a>
269 <li><a name="toc-Examples-29" href="#Examples-29">9.37.1 Examples</a></li>
271 <li><a name="toc-gradfun" href="#gradfun">9.38 gradfun</a>
273 <li><a name="toc-Examples-41" href="#Examples-41">9.38.1 Examples</a></li>
275 <li><a name="toc-haldclut-1" href="#haldclut-1">9.39 haldclut</a>
277 <li><a name="toc-Workflow-examples" href="#Workflow-examples">9.39.1 Workflow examples</a>
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>
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>
288 <li><a name="toc-Examples-52" href="#Examples-52">9.42.1 Examples</a></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>
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>
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>
301 <li><a name="toc-Examples-26" href="#Examples-26">9.48.1 Examples</a></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>
306 <li><a name="toc-Examples-4" href="#Examples-4">9.50.1 Examples</a></li>
308 <li><a name="toc-mergeplanes" href="#mergeplanes">9.51 mergeplanes</a>
310 <li><a name="toc-Examples-56" href="#Examples-56">9.51.1 Examples</a></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>
315 <li><a name="toc-Examples-50" href="#Examples-50">9.53.1 Examples</a></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>
321 <li><a name="toc-Examples-25" href="#Examples-25">9.56.1 Examples</a></li>
323 <li><a name="toc-noise" href="#noise">9.57 noise</a>
325 <li><a name="toc-Examples-53" href="#Examples-53">9.57.1 Examples</a></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>
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>
334 <li><a name="toc-overlay-1" href="#overlay-1">9.60 overlay</a>
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>
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>
342 <li><a name="toc-Examples-39" href="#Examples-39">9.62.1 Examples</a></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>
349 <li><a name="toc-Examples-43" href="#Examples-43">9.66.1 Examples</a></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>
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>
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>
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>
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>
368 <li><a name="toc-Examples-66" href="#Examples-66">9.74.1 Examples</a></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>
375 <li><a name="toc-Examples-16" href="#Examples-16">9.78.1 Examples</a></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>
384 <li><a name="toc-Examples-51" href="#Examples-51">9.84.1 Examples</a></li>
386 <li><a name="toc-tile" href="#tile">9.85 tile</a>
388 <li><a name="toc-Examples-2" href="#Examples-2">9.85.1 Examples</a></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>
395 <li><a name="toc-Examples-19" href="#Examples-19">9.89.1 Examples</a></li>
397 <li><a name="toc-vidstabdetect-1" href="#vidstabdetect-1">9.90 vidstabdetect</a>
399 <li><a name="toc-Examples-59" href="#Examples-59">9.90.1 Examples</a></li>
401 <li><a name="toc-vidstabtransform-1" href="#vidstabtransform-1">9.91 vidstabtransform</a>
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>
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>
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>
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>
415 <li><a name="toc-Video-Sources" href="#Video-Sources">10. Video Sources</a>
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>
420 <li><a name="toc-Examples-36" href="#Examples-36">10.2.1 Examples</a></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>
427 <li><a name="toc-Examples-11" href="#Examples-11">10.6.1 Examples</a></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>
431 <li><a name="toc-Commands-1" href="#Commands-1">10.7.1 Commands</a></li>
435 <li><a name="toc-Video-Sinks" href="#Video-Sinks">11. Video Sinks</a>
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>
440 <li><a name="toc-Multimedia-Filters" href="#Multimedia-Filters">12. Multimedia Filters</a>
442 <li><a name="toc-avectorscope" href="#avectorscope">12.1 avectorscope</a>
444 <li><a name="toc-Examples-57" href="#Examples-57">12.1.1 Examples</a></li>
446 <li><a name="toc-concat" href="#concat">12.2 concat</a>
448 <li><a name="toc-Examples-10" href="#Examples-10">12.2.1 Examples</a></li>
450 <li><a name="toc-ebur128" href="#ebur128">12.3 ebur128</a>
452 <li><a name="toc-Examples-6" href="#Examples-6">12.3.1 Examples</a></li>
454 <li><a name="toc-interleave_002c-ainterleave" href="#interleave_002c-ainterleave">12.4 interleave, ainterleave</a>
456 <li><a name="toc-Examples-60" href="#Examples-60">12.4.1 Examples</a></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>
461 <li><a name="toc-Examples-40" href="#Examples-40">12.6.1 Examples</a></li>
463 <li><a name="toc-sendcmd_002c-asendcmd" href="#sendcmd_002c-asendcmd">12.7 sendcmd, asendcmd</a>
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>
468 <li><a name="toc-setpts_002c-asetpts" href="#setpts_002c-asetpts">12.8 setpts, asetpts</a>
470 <li><a name="toc-Examples" href="#Examples">12.8.1 Examples</a></li>
472 <li><a name="toc-settb_002c-asettb" href="#settb_002c-asettb">12.9 settb, asettb</a>
474 <li><a name="toc-Examples-67" href="#Examples-67">12.9.1 Examples</a></li>
476 <li><a name="toc-showspectrum" href="#showspectrum">12.10 showspectrum</a>
478 <li><a name="toc-Examples-68" href="#Examples-68">12.10.1 Examples</a></li>
480 <li><a name="toc-showwaves" href="#showwaves">12.11 showwaves</a>
482 <li><a name="toc-Examples-47" href="#Examples-47">12.11.1 Examples</a></li>
484 <li><a name="toc-split_002c-asplit" href="#split_002c-asplit">12.12 split, asplit</a>
486 <li><a name="toc-Examples-63" href="#Examples-63">12.12.1 Examples</a></li>
488 <li><a name="toc-zmq_002c-azmq" href="#zmq_002c-azmq">12.13 zmq, azmq</a>
490 <li><a name="toc-Examples-61" href="#Examples-61">12.13.1 Examples</a></li>
494 <li><a name="toc-Multimedia-Sources" href="#Multimedia-Sources">13. Multimedia Sources</a>
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>
499 <li><a name="toc-Examples-69" href="#Examples-69">13.2.1 Examples</a></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>
508 <a name="Description"></a>
509 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Description">1. Description</a></h1>
511 <p>This document describes filters, sources, and sinks provided by the
515 <a name="Filtering-Introduction"></a>
516 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Filtering-Introduction">2. Filtering Introduction</a></h1>
518 <p>Filtering in FFmpeg is enabled through the libavfilter library.
520 <p>In libavfilter, a filter can have multiple inputs and multiple
522 To illustrate the sorts of things that are possible, we consider the
523 following filtergraph.
525 <table><tr><td> </td><td><pre class="example"> [main]
526 input --> split ---------------------> overlay --> output
529 +-----> crop --> vflip -------+
530 </pre></td></tr></table>
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:
537 <table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -vf "split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2" OUTPUT
538 </pre></td></tr></table>
540 <p>The result will be that in output the top half of the video is mirrored
541 onto the bottom half.
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>.
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.
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
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
567 <a name="graph2dot"></a>
568 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-graph2dot">3. graph2dot</a></h1>
570 <p>The ‘<tt>graph2dot</tt>’ program included in the FFmpeg ‘<tt>tools</tt>’
571 directory can be used to parse a filtergraph description and issue a
572 corresponding textual representation in the dot language.
574 <p>Invoke the command:
575 </p><table><tr><td> </td><td><pre class="example">graph2dot -h
576 </pre></td></tr></table>
578 <p>to see how to use ‘<tt>graph2dot</tt>’.
580 <p>You can then pass the dot description to the ‘<tt>dot</tt>’ program (from
581 the graphviz suite of programs) and obtain a graphical representation
584 <p>For example the sequence of commands:
585 </p><table><tr><td> </td><td><pre class="example">echo <var>GRAPH_DESCRIPTION</var> | \
586 tools/graph2dot -o graph.tmp && \
587 dot -Tpng graph.tmp -o graph.png && \
589 </pre></td></tr></table>
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> </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> </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.
604 <a name="Filtergraph-description"></a>
605 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Filtergraph-description">4. Filtergraph description</a></h1>
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.
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.
617 <p>A filter with no input pads is called a "source", a filter with no
618 output pads is called a "sink".
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>
624 <p>A filtergraph can be represented using a textual representation, which is
625 recognized by the ‘<samp>-filter</samp>’/‘<samp>-vf</samp>’ and ‘<samp>-filter_complex</samp>’
626 options in <code>ffmpeg</code> and ‘<samp>-vf</samp>’ in <code>ffplay</code>, and by the
627 <code>avfilter_graph_parse()</code>/<code>avfilter_graph_parse2()</code> function defined in
628 ‘<tt>libavfilter/avfilter.h</tt>’.
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 ","-separated filter descriptions.
634 <p>A filtergraph consists of a sequence of filterchains. A sequence of
635 filterchains is represented by a list of ";"-separated filterchain
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>]
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 "=<var>arguments</var>".
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:
651 A ’:’-separated list of <var>key=value</var> pairs.
654 A ’:’-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 – ‘<samp>type</samp>’, ‘<samp>start_frame</samp>’ and
657 ‘<samp>nb_frames</samp>’. Then the parameter list <var>in:0:30</var> means that the value
658 <var>in</var> is assigned to the option ‘<samp>type</samp>’, <var>0</var> to
659 ‘<samp>start_frame</samp>’ and <var>30</var> to ‘<samp>nb_frames</samp>’.
662 A ’:’-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.
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
673 <p>The list of arguments can be quoted using the character "’" as initial
674 and ending mark, and the character ’\’ 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 "[]=;,") is encountered.
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.
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
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> </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 "L1", the first input pad of overlay is labelled "L2", and the second
699 output pad of split is linked to the second input pad of overlay,
700 which are both unlabelled.
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.
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.
712 <p>Follows a BNF description for the filtergraph syntax:
713 </p><table><tr><td> </td><td><pre class="example"><var>NAME</var> ::= sequence of alphanumeric characters and '_'
714 <var>LINKLABEL</var> ::= "[" <var>NAME</var> "]"
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> ["=" <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>
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>
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.
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>.
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.
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.
741 <p>For example, consider the following string to be embedded in
742 the <a href="#drawtext">drawtext</a> filter description ‘<samp>text</samp>’ value:
743 </p><table><tr><td> </td><td><pre class="example">this is a 'string': may contain one, or more, special characters
744 </pre></td></tr></table>
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> </td><td><pre class="example">text=this is a \'string\'\: may contain one, or more, special characters
749 </pre></td></tr></table>
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> </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).
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> </td><td><pre class="example">-vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
765 </pre></td></tr></table>
767 <a name="Timeline-editing"></a>
768 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Timeline-editing">5. Timeline editing</a></h1>
770 <p>Some filters support a generic ‘<samp>enable</samp>’ 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.
776 <p>The expression accepts the following values:
777 </p><dl compact="compact">
778 <dt> ‘<samp>t</samp>’</dt>
779 <dd><p>timestamp expressed in seconds, NAN if the input timestamp is unknown
782 <dt> ‘<samp>n</samp>’</dt>
783 <dd><p>sequential number of the input frame, starting from 0
786 <dt> ‘<samp>pos</samp>’</dt>
787 <dd><p>the position in the file of the input frame, NAN if unknown
791 <p>Additionally, these filters support an ‘<samp>enable</samp>’ command that can be used
792 to re-define the expression.
794 <p>Like any other filtering option, the ‘<samp>enable</samp>’ option follows the same
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> </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>
804 <a name="Audio-Filters"></a>
805 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Audio-Filters">6. Audio Filters</a></h1>
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
812 <p>Below is a description of the currently available audio filters.
814 <a name="aconvert"></a>
815 <h2 class="section"><a href="ffmpeg-filters.html#toc-aconvert">6.1 aconvert</a></h2>
817 <p>Convert the input audio format to the specified formats.
819 <p><em>This filter is deprecated. Use <a href="#aformat">aformat</a> instead.</em>
821 <p>The filter accepts a string of the form:
822 "<var>sample_format</var>:<var>channel_layout</var>".
824 <p><var>sample_format</var> specifies the sample format, and can be a string or the
825 corresponding numeric value defined in ‘<tt>libavutil/samplefmt.h</tt>’. Use ’p’
826 suffix for a planar sample format.
828 <p><var>channel_layout</var> specifies the channel layout, and can be a string
829 or the corresponding number value defined in ‘<tt>libavutil/channel_layout.h</tt>’.
831 <p>The special parameter "auto", signifies that the filter will
832 automatically select the output format depending on the output filter.
834 <a name="Examples-37"></a>
835 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-37">6.1.1 Examples</a></h3>
839 Convert input to float, planar, stereo:
840 <table><tr><td> </td><td><pre class="example">aconvert=fltp:stereo
841 </pre></td></tr></table>
844 Convert input to unsigned 8-bit, automatically select out channel layout:
845 <table><tr><td> </td><td><pre class="example">aconvert=u8:auto
846 </pre></td></tr></table>
849 <a name="adelay"></a>
850 <h2 class="section"><a href="ffmpeg-filters.html#toc-adelay">6.2 adelay</a></h2>
852 <p>Delay one or more audio channels.
854 <p>Samples in delayed channel are filled with silence.
856 <p>The filter accepts the following option:
858 <dl compact="compact">
859 <dt> ‘<samp>delays</samp>’</dt>
860 <dd><p>Set list of delays in milliseconds for each channel separated by ’|’.
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.
867 <a name="Examples-32"></a>
868 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-32">6.2.1 Examples</a></h3>
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> </td><td><pre class="example">adelay=1500|0|500
875 </pre></td></tr></table>
879 <h2 class="section"><a href="ffmpeg-filters.html#toc-aecho">6.3 aecho</a></h2>
881 <p>Apply echoing to the input audio.
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.
891 <p>A description of the accepted parameters follows.
893 <dl compact="compact">
894 <dt> ‘<samp>in_gain</samp>’</dt>
895 <dd><p>Set input gain of reflected signal. Default is <code>0.6</code>.
898 <dt> ‘<samp>out_gain</samp>’</dt>
899 <dd><p>Set output gain of reflected signal. Default is <code>0.3</code>.
902 <dt> ‘<samp>delays</samp>’</dt>
903 <dd><p>Set list of time intervals in milliseconds between original signal and reflections
904 separated by ’|’. Allowed range for each <code>delay</code> is <code>(0 - 90000.0]</code>.
905 Default is <code>1000</code>.
908 <dt> ‘<samp>decays</samp>’</dt>
909 <dd><p>Set list of loudnesses of reflected signals separated by ’|’.
910 Allowed range for each <code>decay</code> is <code>(0 - 1.0]</code>.
911 Default is <code>0.5</code>.
915 <a name="Examples-20"></a>
916 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-20">6.3.1 Examples</a></h3>
920 Make it sound as if there are twice as many instruments as are actually playing:
921 <table><tr><td> </td><td><pre class="example">aecho=0.8:0.88:60:0.4
922 </pre></td></tr></table>
925 If delay is very short, then it sound like a (metallic) robot playing music:
926 <table><tr><td> </td><td><pre class="example">aecho=0.8:0.88:6:0.4
927 </pre></td></tr></table>
930 A longer delay will sound like an open air concert in the mountains:
931 <table><tr><td> </td><td><pre class="example">aecho=0.8:0.9:1000:0.3
932 </pre></td></tr></table>
935 Same as above but with one more mountain:
936 <table><tr><td> </td><td><pre class="example">aecho=0.8:0.9:1000|1800:0.3|0.25
937 </pre></td></tr></table>
941 <h2 class="section"><a href="ffmpeg-filters.html#toc-aeval">6.4 aeval</a></h2>
943 <p>Modify an audio signal according to the specified expressions.
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.
948 <p>This filter accepts the following options:
950 <dl compact="compact">
951 <dt> ‘<samp>exprs</samp>’</dt>
952 <dd><p>Set the ’|’-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
958 <dt> ‘<samp>channel_layout, c</samp>’</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 ‘<samp>same</samp>’, it will
961 use by default the same input channel layout.
965 <p>Each expression in <var>exprs</var> can contain the following constants and functions:
967 <dl compact="compact">
968 <dt> ‘<samp>ch</samp>’</dt>
969 <dd><p>channel number of the current expression
972 <dt> ‘<samp>n</samp>’</dt>
973 <dd><p>number of the evaluated sample, starting from 0
976 <dt> ‘<samp>s</samp>’</dt>
980 <dt> ‘<samp>t</samp>’</dt>
981 <dd><p>time of the evaluated sample expressed in seconds
984 <dt> ‘<samp>nb_in_channels</samp>’</dt>
985 <dt> ‘<samp>nb_out_channels</samp>’</dt>
986 <dd><p>input and output number of channels
989 <dt> ‘<samp>val(CH)</samp>’</dt>
990 <dd><p>the value of input channel with number <var>CH</var>
994 <p>Note: this filter is slow. For faster processing you should use a
997 <a name="Examples-64"></a>
998 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-64">6.4.1 Examples</a></h3>
1003 <table><tr><td> </td><td><pre class="example">aeval=val(ch)/2:c=same
1004 </pre></td></tr></table>
1007 Invert phase of the second channel:
1008 <table><tr><td> </td><td><pre class="example">eval=val(0)|-val(1)
1009 </pre></td></tr></table>
1012 <a name="afade"></a>
1013 <h2 class="section"><a href="ffmpeg-filters.html#toc-afade">6.5 afade</a></h2>
1015 <p>Apply fade-in/out effect to input audio.
1017 <p>A description of the accepted parameters follows.
1019 <dl compact="compact">
1020 <dt> ‘<samp>type, t</samp>’</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>.
1025 <dt> ‘<samp>start_sample, ss</samp>’</dt>
1026 <dd><p>Specify the number of the start sample for starting to apply the fade
1027 effect. Default is 0.
1030 <dt> ‘<samp>nb_samples, ns</samp>’</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.
1037 <dt> ‘<samp>start_time, st</samp>’</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> </td><td><pre class="example">[-]HH[:MM[:SS[.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.
1047 <dt> ‘<samp>duration, d</samp>’</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> </td><td><pre class="example">[-]HH[:MM[:SS[.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.
1060 <dt> ‘<samp>curve</samp>’</dt>
1061 <dd><p>Set curve for fade transition.
1063 <p>It accepts the following values:
1064 </p><dl compact="compact">
1065 <dt> ‘<samp>tri</samp>’</dt>
1066 <dd><p>select triangular, linear slope (default)
1068 <dt> ‘<samp>qsin</samp>’</dt>
1069 <dd><p>select quarter of sine wave
1071 <dt> ‘<samp>hsin</samp>’</dt>
1072 <dd><p>select half of sine wave
1074 <dt> ‘<samp>esin</samp>’</dt>
1075 <dd><p>select exponential sine wave
1077 <dt> ‘<samp>log</samp>’</dt>
1078 <dd><p>select logarithmic
1080 <dt> ‘<samp>par</samp>’</dt>
1081 <dd><p>select inverted parabola
1083 <dt> ‘<samp>qua</samp>’</dt>
1084 <dd><p>select quadratic
1086 <dt> ‘<samp>cub</samp>’</dt>
1089 <dt> ‘<samp>squ</samp>’</dt>
1090 <dd><p>select square root
1092 <dt> ‘<samp>cbr</samp>’</dt>
1093 <dd><p>select cubic root
1099 <a name="Examples-28"></a>
1100 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-28">6.5.1 Examples</a></h3>
1104 Fade in first 15 seconds of audio:
1105 <table><tr><td> </td><td><pre class="example">afade=t=in:ss=0:d=15
1106 </pre></td></tr></table>
1109 Fade out last 25 seconds of a 900 seconds audio:
1110 <table><tr><td> </td><td><pre class="example">afade=t=out:st=875:d=25
1111 </pre></td></tr></table>
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>
1118 <p>Set output format constraints for the input audio. The framework will
1119 negotiate the most appropriate format to minimize conversions.
1121 <p>The filter accepts the following named parameters:
1122 </p><dl compact="compact">
1123 <dt> ‘<samp>sample_fmts</samp>’</dt>
1124 <dd><p>A ’|’-separated list of requested sample formats.
1127 <dt> ‘<samp>sample_rates</samp>’</dt>
1128 <dd><p>A ’|’-separated list of requested sample rates.
1131 <dt> ‘<samp>channel_layouts</samp>’</dt>
1132 <dd><p>A ’|’-separated list of requested channel layouts.
1134 <p>See <a href="ffmpeg-utils.html#channel-layout-syntax">(ffmpeg-utils)channel layout syntax</a>
1135 for the required syntax.
1139 <p>If a parameter is omitted, all values are allowed.
1141 <p>For example to force the output to either unsigned 8-bit or signed 16-bit stereo:
1142 </p><table><tr><td> </td><td><pre class="example">aformat=sample_fmts=u8|s16:channel_layouts=stereo
1143 </pre></td></tr></table>
1145 <a name="allpass"></a>
1146 <h2 class="section"><a href="ffmpeg-filters.html#toc-allpass">6.7 allpass</a></h2>
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’s frequency to phase relationship
1151 without changing its frequency to amplitude relationship.
1153 <p>The filter accepts the following options:
1155 <dl compact="compact">
1156 <dt> ‘<samp>frequency, f</samp>’</dt>
1157 <dd><p>Set frequency in Hz.
1160 <dt> ‘<samp>width_type</samp>’</dt>
1161 <dd><p>Set method to specify band-width of filter.
1162 </p><dl compact="compact">
1163 <dt> ‘<samp>h</samp>’</dt>
1166 <dt> ‘<samp>q</samp>’</dt>
1169 <dt> ‘<samp>o</samp>’</dt>
1172 <dt> ‘<samp>s</samp>’</dt>
1178 <dt> ‘<samp>width, w</samp>’</dt>
1179 <dd><p>Specify the band-width of a filter in width_type units.
1183 <a name="amerge"></a>
1184 <h2 class="section"><a href="ffmpeg-filters.html#toc-amerge">6.8 amerge</a></h2>
1186 <p>Merge two or more audio streams into a single multi-channel stream.
1188 <p>The filter accepts the following options:
1190 <dl compact="compact">
1191 <dt> ‘<samp>inputs</samp>’</dt>
1192 <dd><p>Set the number of inputs. Default is 2.
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
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).
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.
1214 <p>All inputs must have the same sample rate, and format.
1216 <p>If inputs do not have the same duration, the output will stop with the
1219 <a name="Examples-38"></a>
1220 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-38">6.8.1 Examples</a></h3>
1224 Merge two mono files into a stereo stream:
1225 <table><tr><td> </td><td><pre class="example">amovie=left.wav [l] ; amovie=right.mp3 [r] ; [l] [r] amerge
1226 </pre></td></tr></table>
1229 Multiple merges assuming 1 video stream and 6 audio streams in ‘<tt>input.mkv</tt>’:
1230 <table><tr><td> </td><td><pre class="example">ffmpeg -i input.mkv -filter_complex "[0:1][0:2][0:3][0:4][0:5][0:6] amerge=inputs=6" -c:a pcm_s16le output.mkv
1231 </pre></td></tr></table>
1235 <h2 class="section"><a href="ffmpeg-filters.html#toc-amix">6.9 amix</a></h2>
1237 <p>Mixes multiple audio inputs into a single output.
1240 </p><table><tr><td> </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.
1245 <p>The filter accepts the following named parameters:
1246 </p><dl compact="compact">
1247 <dt> ‘<samp>inputs</samp>’</dt>
1248 <dd><p>Number of inputs. If unspecified, it defaults to 2.
1251 <dt> ‘<samp>duration</samp>’</dt>
1252 <dd><p>How to determine the end-of-stream.
1253 </p><dl compact="compact">
1254 <dt> ‘<samp>longest</samp>’</dt>
1255 <dd><p>Duration of longest input. (default)
1258 <dt> ‘<samp>shortest</samp>’</dt>
1259 <dd><p>Duration of shortest input.
1262 <dt> ‘<samp>first</samp>’</dt>
1263 <dd><p>Duration of first input.
1269 <dt> ‘<samp>dropout_transition</samp>’</dt>
1270 <dd><p>Transition time, in seconds, for volume renormalization when an input
1271 stream ends. The default value is 2 seconds.
1276 <a name="anull"></a>
1277 <h2 class="section"><a href="ffmpeg-filters.html#toc-anull">6.10 anull</a></h2>
1279 <p>Pass the audio source unchanged to the output.
1282 <h2 class="section"><a href="ffmpeg-filters.html#toc-apad">6.11 apad</a></h2>
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.
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.
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.
1294 <p>A description of the accepted parameters follows.
1296 <dl compact="compact">
1297 <dt> ‘<samp>in_gain</samp>’</dt>
1298 <dd><p>Set input gain. Default is 0.4.
1301 <dt> ‘<samp>out_gain</samp>’</dt>
1302 <dd><p>Set output gain. Default is 0.74
1305 <dt> ‘<samp>delay</samp>’</dt>
1306 <dd><p>Set delay in milliseconds. Default is 3.0.
1309 <dt> ‘<samp>decay</samp>’</dt>
1310 <dd><p>Set decay. Default is 0.4.
1313 <dt> ‘<samp>speed</samp>’</dt>
1314 <dd><p>Set modulation speed in Hz. Default is 0.5.
1317 <dt> ‘<samp>type</samp>’</dt>
1318 <dd><p>Set modulation type. Default is triangular.
1320 <p>It accepts the following values:
1321 </p><dl compact="compact">
1322 <dt> ‘<samp>triangular, t</samp>’</dt>
1323 <dt> ‘<samp>sinusoidal, s</samp>’</dt>
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>
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.
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.
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 ":". See the
1344 ffmpeg-resampler manual for the complete list of supported options.
1346 <a name="Examples-5"></a>
1347 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-5">6.13.1 Examples</a></h3>
1351 Resample the input audio to 44100Hz:
1352 <table><tr><td> </td><td><pre class="example">aresample=44100
1353 </pre></td></tr></table>
1356 Stretch/squeeze samples to the given timestamps, with a maximum of 1000
1357 samples per second compensation:
1358 <table><tr><td> </td><td><pre class="example">aresample=async=1000
1359 </pre></td></tr></table>
1362 <a name="asetnsamples"></a>
1363 <h2 class="section"><a href="ffmpeg-filters.html#toc-asetnsamples">6.14 asetnsamples</a></h2>
1365 <p>Set the number of samples per each output audio frame.
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
1371 <p>The filter accepts the following options:
1373 <dl compact="compact">
1374 <dt> ‘<samp>nb_out_samples, n</samp>’</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.
1380 <dt> ‘<samp>pad, p</samp>’</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.
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> </td><td><pre class="example">asetnsamples=n=1234:p=0
1390 </pre></td></tr></table>
1392 <a name="asetrate"></a>
1393 <h2 class="section"><a href="ffmpeg-filters.html#toc-asetrate">6.15 asetrate</a></h2>
1395 <p>Set the sample rate without altering the PCM data.
1396 This will result in a change of speed and pitch.
1398 <p>The filter accepts the following options:
1400 <dl compact="compact">
1401 <dt> ‘<samp>sample_rate, r</samp>’</dt>
1402 <dd><p>Set the output sample rate. Default is 44100 Hz.
1406 <a name="ashowinfo"></a>
1407 <h2 class="section"><a href="ffmpeg-filters.html#toc-ashowinfo">6.16 ashowinfo</a></h2>
1409 <p>Show a line containing various information for each input audio frame.
1410 The input audio is not modified.
1412 <p>The shown line contains a sequence of key/value pairs of the form
1413 <var>key</var>:<var>value</var>.
1415 <p>A description of each shown parameter follows:
1417 <dl compact="compact">
1418 <dt> ‘<samp>n</samp>’</dt>
1419 <dd><p>sequential number of the input frame, starting from 0
1422 <dt> ‘<samp>pts</samp>’</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>.
1427 <dt> ‘<samp>pts_time</samp>’</dt>
1428 <dd><p>presentation timestamp of the input frame in seconds
1431 <dt> ‘<samp>pos</samp>’</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)
1436 <dt> ‘<samp>fmt</samp>’</dt>
1437 <dd><p>sample format
1440 <dt> ‘<samp>chlayout</samp>’</dt>
1441 <dd><p>channel layout
1444 <dt> ‘<samp>rate</samp>’</dt>
1445 <dd><p>sample rate for the audio frame
1448 <dt> ‘<samp>nb_samples</samp>’</dt>
1449 <dd><p>number of samples (per channel) in the frame
1452 <dt> ‘<samp>checksum</samp>’</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.
1457 <dt> ‘<samp>plane_checksums</samp>’</dt>
1458 <dd><p>A list of Adler-32 checksums for each data plane.
1462 <a name="astats"></a>
1463 <h2 class="section"><a href="ffmpeg-filters.html#toc-astats">6.17 astats</a></h2>
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.
1469 <p>The filter accepts the following option:
1470 </p><dl compact="compact">
1471 <dt> ‘<samp>length</samp>’</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>.
1477 <p>A description of each shown parameter follows:
1479 <dl compact="compact">
1480 <dt> ‘<samp>DC offset</samp>’</dt>
1481 <dd><p>Mean amplitude displacement from zero.
1484 <dt> ‘<samp>Min level</samp>’</dt>
1485 <dd><p>Minimal sample level.
1488 <dt> ‘<samp>Max level</samp>’</dt>
1489 <dd><p>Maximal sample level.
1492 <dt> ‘<samp>Peak level dB</samp>’</dt>
1493 <dt> ‘<samp>RMS level dB</samp>’</dt>
1494 <dd><p>Standard peak and RMS level measured in dBFS.
1497 <dt> ‘<samp>RMS peak dB</samp>’</dt>
1498 <dt> ‘<samp>RMS trough dB</samp>’</dt>
1499 <dd><p>Peak and trough values for RMS level measured over a short window.
1502 <dt> ‘<samp>Crest factor</samp>’</dt>
1503 <dd><p>Standard ratio of peak to RMS level (note: not in dB).
1506 <dt> ‘<samp>Flat factor</samp>’</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>).
1511 <dt> ‘<samp>Peak count</samp>’</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>.
1517 <a name="astreamsync"></a>
1518 <h2 class="section"><a href="ffmpeg-filters.html#toc-astreamsync">6.18 astreamsync</a></h2>
1520 <p>Forward two audio streams and control the order the buffers are forwarded.
1522 <p>The filter accepts the following options:
1524 <dl compact="compact">
1525 <dt> ‘<samp>expr, e</samp>’</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:
1531 <dl compact="compact">
1532 <dt> <var>b1 b2</var></dt>
1533 <dd><p>number of buffers forwarded so far on each stream
1535 <dt> <var>s1 s2</var></dt>
1536 <dd><p>number of samples forwarded so far on each stream
1538 <dt> <var>t1 t2</var></dt>
1539 <dd><p>current timestamp of each stream
1543 <p>The default value is <code>t1-t2</code>, which means to always forward the stream
1544 that has a smaller timestamp.
1548 <a name="Examples-45"></a>
1549 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-45">6.18.1 Examples</a></h3>
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> </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] ;
1556 </pre></td></tr></table>
1558 <a name="asyncts"></a>
1559 <h2 class="section"><a href="ffmpeg-filters.html#toc-asyncts">6.19 asyncts</a></h2>
1561 <p>Synchronize audio data with timestamps by squeezing/stretching it and/or
1562 dropping samples/adding silence when needed.
1564 <p>This filter is not built by default, please use <a href="#aresample">aresample</a> to do squeezing/stretching.
1566 <p>The filter accepts the following named parameters:
1567 </p><dl compact="compact">
1568 <dt> ‘<samp>compensate</samp>’</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.
1573 <dt> ‘<samp>min_delta</samp>’</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.
1579 <dt> ‘<samp>max_comp</samp>’</dt>
1580 <dd><p>Maximum compensation in samples per second. Relevant only with compensate=1.
1584 <dt> ‘<samp>first_pts</samp>’</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’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.
1595 <a name="atempo"></a>
1596 <h2 class="section"><a href="ffmpeg-filters.html#toc-atempo">6.20 atempo</a></h2>
1598 <p>Adjust audio tempo.
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.
1604 <a name="Examples-23"></a>
1605 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-23">6.20.1 Examples</a></h3>
1609 Slow down audio to 80% tempo:
1610 <table><tr><td> </td><td><pre class="example">atempo=0.8
1611 </pre></td></tr></table>
1614 To speed up audio to 125% tempo:
1615 <table><tr><td> </td><td><pre class="example">atempo=1.25
1616 </pre></td></tr></table>
1619 <a name="atrim"></a>
1620 <h2 class="section"><a href="ffmpeg-filters.html#toc-atrim">6.21 atrim</a></h2>
1622 <p>Trim the input so that the output contains one continuous subpart of the input.
1624 <p>This filter accepts the following options:
1625 </p><dl compact="compact">
1626 <dt> ‘<samp>start</samp>’</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.
1631 <dt> ‘<samp>end</samp>’</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.
1637 <dt> ‘<samp>start_pts</samp>’</dt>
1638 <dd><p>Same as <var>start</var>, except this option sets the start timestamp in samples
1642 <dt> ‘<samp>end_pts</samp>’</dt>
1643 <dd><p>Same as <var>end</var>, except this option sets the end timestamp in samples instead
1647 <dt> ‘<samp>duration</samp>’</dt>
1648 <dd><p>Specify maximum duration of the output.
1651 <dt> ‘<samp>start_sample</samp>’</dt>
1652 <dd><p>Number of the first sample that should be passed to output.
1655 <dt> ‘<samp>end_sample</samp>’</dt>
1656 <dd><p>Number of the first sample that should be dropped.
1660 <p>‘<samp>start</samp>’, ‘<samp>end</samp>’, ‘<samp>duration</samp>’ are expressed as time
1661 duration specifications, check the "Time duration" section in the
1662 ffmpeg-utils manual.
1664 <p>Note that the first two sets of the start/end options and the ‘<samp>duration</samp>’
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
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
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.
1683 drop everything except the second minute of input
1684 <table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -af atrim=60:120
1685 </pre></td></tr></table>
1688 keep only the first 1000 samples
1689 <table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -af atrim=end_sample=1000
1690 </pre></td></tr></table>
1694 <a name="bandpass"></a>
1695 <h2 class="section"><a href="ffmpeg-filters.html#toc-bandpass">6.22 bandpass</a></h2>
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).
1703 <p>The filter accepts the following options:
1705 <dl compact="compact">
1706 <dt> ‘<samp>frequency, f</samp>’</dt>
1707 <dd><p>Set the filter’s central frequency. Default is <code>3000</code>.
1710 <dt> ‘<samp>csg</samp>’</dt>
1711 <dd><p>Constant skirt gain if set to 1. Defaults to 0.
1714 <dt> ‘<samp>width_type</samp>’</dt>
1715 <dd><p>Set method to specify band-width of filter.
1716 </p><dl compact="compact">
1717 <dt> ‘<samp>h</samp>’</dt>
1720 <dt> ‘<samp>q</samp>’</dt>
1723 <dt> ‘<samp>o</samp>’</dt>
1726 <dt> ‘<samp>s</samp>’</dt>
1732 <dt> ‘<samp>width, w</samp>’</dt>
1733 <dd><p>Specify the band-width of a filter in width_type units.
1737 <a name="bandreject"></a>
1738 <h2 class="section"><a href="ffmpeg-filters.html#toc-bandreject">6.23 bandreject</a></h2>
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).
1744 <p>The filter accepts the following options:
1746 <dl compact="compact">
1747 <dt> ‘<samp>frequency, f</samp>’</dt>
1748 <dd><p>Set the filter’s central frequency. Default is <code>3000</code>.
1751 <dt> ‘<samp>width_type</samp>’</dt>
1752 <dd><p>Set method to specify band-width of filter.
1753 </p><dl compact="compact">
1754 <dt> ‘<samp>h</samp>’</dt>
1757 <dt> ‘<samp>q</samp>’</dt>
1760 <dt> ‘<samp>o</samp>’</dt>
1763 <dt> ‘<samp>s</samp>’</dt>
1769 <dt> ‘<samp>width, w</samp>’</dt>
1770 <dd><p>Specify the band-width of a filter in width_type units.
1775 <h2 class="section"><a href="ffmpeg-filters.html#toc-bass">6.24 bass</a></h2>
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’s tone-controls. This is also known as shelving equalisation (EQ).
1781 <p>The filter accepts the following options:
1783 <dl compact="compact">
1784 <dt> ‘<samp>gain, g</samp>’</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.
1790 <dt> ‘<samp>frequency, f</samp>’</dt>
1791 <dd><p>Set the filter’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.
1796 <dt> ‘<samp>width_type</samp>’</dt>
1797 <dd><p>Set method to specify band-width of filter.
1798 </p><dl compact="compact">
1799 <dt> ‘<samp>h</samp>’</dt>
1802 <dt> ‘<samp>q</samp>’</dt>
1805 <dt> ‘<samp>o</samp>’</dt>
1808 <dt> ‘<samp>s</samp>’</dt>
1814 <dt> ‘<samp>width, w</samp>’</dt>
1815 <dd><p>Determine how steep is the filter’s shelf transition.
1819 <a name="biquad"></a>
1820 <h2 class="section"><a href="ffmpeg-filters.html#toc-biquad">6.25 biquad</a></h2>
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.
1826 <a name="channelmap"></a>
1827 <h2 class="section"><a href="ffmpeg-filters.html#toc-channelmap">6.26 channelmap</a></h2>
1829 <p>Remap input channels to new locations.
1831 <p>This filter accepts the following named parameters:
1832 </p><dl compact="compact">
1833 <dt> ‘<samp>channel_layout</samp>’</dt>
1834 <dd><p>Channel layout of the output stream.
1837 <dt> ‘<samp>map</samp>’</dt>
1838 <dd><p>Map channels from input to output. The argument is a ’|’-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.
1848 <p>If no mapping is present, the filter will implicitly map input channels to
1849 output channels preserving index.
1851 <p>For example, assuming a 5.1+downmix input MOV file
1852 </p><table><tr><td> </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
1857 <p>To fix a 5.1 WAV improperly encoded in AAC’s native channel order
1858 </p><table><tr><td> </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>
1861 <a name="channelsplit"></a>
1862 <h2 class="section"><a href="ffmpeg-filters.html#toc-channelsplit">6.27 channelsplit</a></h2>
1864 <p>Split each channel in input audio stream into a separate output stream.
1866 <p>This filter accepts the following named parameters:
1867 </p><dl compact="compact">
1868 <dt> ‘<samp>channel_layout</samp>’</dt>
1869 <dd><p>Channel layout of the input stream. Default is "stereo".
1873 <p>For example, assuming a stereo input MP3 file
1874 </p><table><tr><td> </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.
1879 <p>To split a 5.1 WAV file into per-channel files
1880 </p><table><tr><td> </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]'
1885 </pre></td></tr></table>
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.
1891 <p>A description of the accepted options follows.
1893 <dl compact="compact">
1894 <dt> ‘<samp>attacks</samp>’</dt>
1895 <dt> ‘<samp>decays</samp>’</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.
1905 <dt> ‘<samp>points</samp>’</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>
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>.
1917 <dt> ‘<samp>soft-knee</samp>’</dt>
1918 <dd><p>Set the curve radius in dB for all joints. Defaults to 0.01.
1921 <dt> ‘<samp>gain</samp>’</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.
1926 <dt> ‘<samp>volume</samp>’</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.
1934 <dt> ‘<samp>delay</samp>’</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.
1943 <a name="Examples-65"></a>
1944 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-65">6.28.1 Examples</a></h3>
1948 Make music with both quiet and loud passages suitable for listening in a noisy
1950 <table><tr><td> </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>
1954 Noise gate for when the noise is at a lower level than the signal:
1955 <table><tr><td> </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>
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> </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>
1965 <a name="earwax"></a>
1966 <h2 class="section"><a href="ffmpeg-filters.html#toc-earwax">6.29 earwax</a></h2>
1968 <p>Make audio easier to listen to on headphones.
1970 <p>This filter adds ‘cues’ 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).
1977 <a name="equalizer"></a>
1978 <h2 class="section"><a href="ffmpeg-filters.html#toc-equalizer">6.30 equalizer</a></h2>
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.
1985 <p>In order to produce complex equalisation curves, this filter can
1986 be given several times, each with a different central frequency.
1988 <p>The filter accepts the following options:
1990 <dl compact="compact">
1991 <dt> ‘<samp>frequency, f</samp>’</dt>
1992 <dd><p>Set the filter’s central frequency in Hz.
1995 <dt> ‘<samp>width_type</samp>’</dt>
1996 <dd><p>Set method to specify band-width of filter.
1997 </p><dl compact="compact">
1998 <dt> ‘<samp>h</samp>’</dt>
2001 <dt> ‘<samp>q</samp>’</dt>
2004 <dt> ‘<samp>o</samp>’</dt>
2007 <dt> ‘<samp>s</samp>’</dt>
2013 <dt> ‘<samp>width, w</samp>’</dt>
2014 <dd><p>Specify the band-width of a filter in width_type units.
2017 <dt> ‘<samp>gain, g</samp>’</dt>
2018 <dd><p>Set the required gain or attenuation in dB.
2019 Beware of clipping when using a positive gain.
2023 <a name="Examples-14"></a>
2024 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-14">6.30.1 Examples</a></h3>
2027 Attenuate 10 dB at 1000 Hz, with a bandwidth of 200 Hz:
2028 <table><tr><td> </td><td><pre class="example">equalizer=f=1000:width_type=h:width=200:g=-10
2029 </pre></td></tr></table>
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> </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>
2037 <a name="highpass"></a>
2038 <h2 class="section"><a href="ffmpeg-filters.html#toc-highpass">6.31 highpass</a></h2>
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).
2044 <p>The filter accepts the following options:
2046 <dl compact="compact">
2047 <dt> ‘<samp>frequency, f</samp>’</dt>
2048 <dd><p>Set frequency in Hz. Default is 3000.
2051 <dt> ‘<samp>poles, p</samp>’</dt>
2052 <dd><p>Set number of poles. Default is 2.
2055 <dt> ‘<samp>width_type</samp>’</dt>
2056 <dd><p>Set method to specify band-width of filter.
2057 </p><dl compact="compact">
2058 <dt> ‘<samp>h</samp>’</dt>
2061 <dt> ‘<samp>q</samp>’</dt>
2064 <dt> ‘<samp>o</samp>’</dt>
2067 <dt> ‘<samp>s</samp>’</dt>
2073 <dt> ‘<samp>width, w</samp>’</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.
2081 <h2 class="section"><a href="ffmpeg-filters.html#toc-join">6.32 join</a></h2>
2083 <p>Join multiple input streams into one multi-channel stream.
2085 <p>The filter accepts the following named parameters:
2086 </p><dl compact="compact">
2087 <dt> ‘<samp>inputs</samp>’</dt>
2088 <dd><p>Number of input streams. Defaults to 2.
2091 <dt> ‘<samp>channel_layout</samp>’</dt>
2092 <dd><p>Desired output channel layout. Defaults to stereo.
2095 <dt> ‘<samp>map</samp>’</dt>
2096 <dd><p>Map channels from inputs to output. The argument is a ’|’-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
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.
2109 <p>E.g. to join 3 inputs (with properly set channel layouts)
2110 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT1 -i INPUT2 -i INPUT3 -filter_complex join=inputs=3 OUTPUT
2111 </pre></td></tr></table>
2113 <p>To build a 5.1 output from 6 single-channel streams:
2114 </p><table><tr><td> </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'
2117 </pre></td></tr></table>
2119 <a name="ladspa"></a>
2120 <h2 class="section"><a href="ffmpeg-filters.html#toc-ladspa">6.33 ladspa</a></h2>
2122 <p>Load a LADSPA (Linux Audio Developer’s Simple Plugin API) plugin.
2124 <p>To enable compilation of this filter you need to configure FFmpeg with
2125 <code>--enable-ladspa</code>.
2127 <dl compact="compact">
2128 <dt> ‘<samp>file, f</samp>’</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: ‘<tt>HOME/.ladspa/lib/</tt>’, ‘<tt>/usr/local/lib/ladspa/</tt>’,
2134 ‘<tt>/usr/lib/ladspa/</tt>’.
2137 <dt> ‘<samp>plugin, p</samp>’</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.
2143 <dt> ‘<samp>controls, c</samp>’</dt>
2144 <dd><p>Set the ’|’ separated list of controls which are zero or more floating point
2145 values that determine the behavior of the loaded plugin (for example delay,
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 ‘<samp>controls</samp>’ is set to <code>help</code>, all available controls and
2151 their valid ranges are printed.
2154 <dt> ‘<samp>sample_rate, s</samp>’</dt>
2155 <dd><p>Specify the sample rate, default to 44100. Only used if plugin have
2159 <dt> ‘<samp>nb_samples, n</samp>’</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.
2164 <dt> ‘<samp>duration, d</samp>’</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 "Time duration"
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.
2177 <a name="Examples-35"></a>
2178 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-35">6.33.1 Examples</a></h3>
2182 List all available plugins within amp (LADSPA example plugin) library:
2183 <table><tr><td> </td><td><pre class="example">ladspa=file=amp
2184 </pre></td></tr></table>
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> </td><td><pre class="example">ladspa=f=vcf:p=vcf_notch:c=help
2190 </pre></td></tr></table>
2193 Simulate low quality audio equipment using <code>Computer Music Toolkit</code> (CMT)
2195 <table><tr><td> </td><td><pre class="example">ladspa=file=cmt:plugin=lofi:controls=c0=22|c1=12|c2=12
2196 </pre></td></tr></table>
2199 Add reverberation to the audio using TAP-plugins
2200 (Tom’s Audio Processing plugins):
2201 <table><tr><td> </td><td><pre class="example">ladspa=file=tap_reverb:tap_reverb
2202 </pre></td></tr></table>
2205 Generate white noise, with 0.2 amplitude:
2206 <table><tr><td> </td><td><pre class="example">ladspa=file=cmt:noise_source_white:c=c0=.2
2207 </pre></td></tr></table>
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> </td><td><pre class="example">ladspa=file=caps:Click:c=c1=20'
2213 </pre></td></tr></table>
2216 Apply <code>C* Eq10X2 - Stereo 10-band equaliser</code> effect:
2217 <table><tr><td> </td><td><pre class="example">ladspa=caps:Eq10X2:c=c0=-48|c9=-24|c3=12|c4=2
2218 </pre></td></tr></table>
2221 <a name="Commands"></a>
2222 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Commands">6.33.2 Commands</a></h3>
2224 <p>This filter supports the following commands:
2225 </p><dl compact="compact">
2226 <dt> ‘<samp>cN</samp>’</dt>
2227 <dd><p>Modify the <var>N</var>-th control value.
2229 <p>If the specified value is not valid, it is ignored and prior one is kept.
2233 <a name="lowpass"></a>
2234 <h2 class="section"><a href="ffmpeg-filters.html#toc-lowpass">6.34 lowpass</a></h2>
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).
2240 <p>The filter accepts the following options:
2242 <dl compact="compact">
2243 <dt> ‘<samp>frequency, f</samp>’</dt>
2244 <dd><p>Set frequency in Hz. Default is 500.
2247 <dt> ‘<samp>poles, p</samp>’</dt>
2248 <dd><p>Set number of poles. Default is 2.
2251 <dt> ‘<samp>width_type</samp>’</dt>
2252 <dd><p>Set method to specify band-width of filter.
2253 </p><dl compact="compact">
2254 <dt> ‘<samp>h</samp>’</dt>
2257 <dt> ‘<samp>q</samp>’</dt>
2260 <dt> ‘<samp>o</samp>’</dt>
2263 <dt> ‘<samp>s</samp>’</dt>
2269 <dt> ‘<samp>width, w</samp>’</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.
2277 <h2 class="section"><a href="ffmpeg-filters.html#toc-pan">6.35 pan</a></h2>
2279 <p>Mix channels with specific gain levels. The filter accepts the output
2280 channel layout followed by a set of channels definitions.
2282 <p>This filter is also designed to remap efficiently the channels of an audio
2285 <p>The filter accepts parameters of the form:
2286 "<var>l</var>:<var>outdef</var>:<var>outdef</var>:..."
2288 <dl compact="compact">
2289 <dt> ‘<samp>l</samp>’</dt>
2290 <dd><p>output channel layout or number of channels
2293 <dt> ‘<samp>outdef</samp>’</dt>
2294 <dd><p>output channel specification, of the form:
2295 "<var>out_name</var>=[<var>gain</var>*]<var>in_name</var>[+[<var>gain</var>*]<var>in_name</var>...]"
2298 <dt> ‘<samp>out_name</samp>’</dt>
2299 <dd><p>output channel to define, either a channel name (FL, FR, etc.) or a channel
2300 number (c0, c1, etc.)
2303 <dt> ‘<samp>gain</samp>’</dt>
2304 <dd><p>multiplicative coefficient for the channel, 1 leaving the volume unchanged
2307 <dt> ‘<samp>in_name</samp>’</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
2313 <p>If the ‘=’ in a channel specification is replaced by ‘<’, then the gains for
2314 that specification will be renormalized so that the total is 1, thus
2315 avoiding clipping noise.
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>
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> </td><td><pre class="example">pan=1:c0=0.9*c0+0.1*c1
2323 </pre></td></tr></table>
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> </td><td><pre class="example">pan=stereo: FL < FL + 0.5*FC + 0.6*BL + 0.6*SL : FR < FR + 0.5*FC + 0.6*BR + 0.6*SR
2328 </pre></td></tr></table>
2330 <p>Note that <code>ffmpeg</code> integrates a default down-mix (and up-mix) system
2331 that should be preferred (see "-ac" option) unless you have very specific
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>
2337 <p>The channel remapping will be effective if, and only if:
2340 <li> gain coefficients are zeroes or ones,
2341 </li><li> only one input per channel output,
2344 <p>If all these conditions are satisfied, the filter will notify the user ("Pure
2345 channel mapping detected"), and use an optimized and lossless method to do the
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> </td><td><pre class="example">pan="stereo: c0=FL : c1=FR"
2351 </pre></td></tr></table>
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> </td><td><pre class="example">pan="5.1: c0=c1 : c1=c0 : c2=c2 : c3=c3 : c4=c4 : c5=c5"
2356 </pre></td></tr></table>
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> </td><td><pre class="example">pan="stereo:c1=c1"
2361 </pre></td></tr></table>
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> </td><td><pre class="example">pan="stereo: c0=FR : c1=FR"
2366 </pre></td></tr></table>
2368 <a name="replaygain"></a>
2369 <h2 class="section"><a href="ffmpeg-filters.html#toc-replaygain">6.36 replaygain</a></h2>
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>.
2375 <a name="resample"></a>
2376 <h2 class="section"><a href="ffmpeg-filters.html#toc-resample">6.37 resample</a></h2>
2378 <p>Convert the audio sample format, sample rate and channel layout. This filter is
2379 not meant to be used directly.
2381 <a name="silencedetect"></a>
2382 <h2 class="section"><a href="ffmpeg-filters.html#toc-silencedetect">6.38 silencedetect</a></h2>
2384 <p>Detect silence in an audio stream.
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.
2390 <p>The printed times and duration are expressed in seconds.
2392 <p>The filter accepts the following options:
2394 <dl compact="compact">
2395 <dt> ‘<samp>duration, d</samp>’</dt>
2396 <dd><p>Set silence duration until notification (default is 2 seconds).
2399 <dt> ‘<samp>noise, n</samp>’</dt>
2400 <dd><p>Set noise tolerance. Can be specified in dB (in case "dB" is appended to the
2401 specified value) or amplitude ratio. Default is -60dB, or 0.001.
2405 <a name="Examples-3"></a>
2406 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-3">6.38.1 Examples</a></h3>
2410 Detect 5 seconds of silence with -50dB noise tolerance:
2411 <table><tr><td> </td><td><pre class="example">silencedetect=n=-50dB:d=5
2412 </pre></td></tr></table>
2415 Complete example with <code>ffmpeg</code> to detect silence with 0.0001 noise
2416 tolerance in ‘<tt>silence.mp3</tt>’:
2417 <table><tr><td> </td><td><pre class="example">ffmpeg -i silence.mp3 -af silencedetect=noise=0.0001 -f null -
2418 </pre></td></tr></table>
2421 <a name="treble"></a>
2422 <h2 class="section"><a href="ffmpeg-filters.html#toc-treble">6.39 treble</a></h2>
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’s tone-controls. This is also known as shelving equalisation (EQ).
2428 <p>The filter accepts the following options:
2430 <dl compact="compact">
2431 <dt> ‘<samp>gain, g</samp>’</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.
2437 <dt> ‘<samp>frequency, f</samp>’</dt>
2438 <dd><p>Set the filter’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.
2443 <dt> ‘<samp>width_type</samp>’</dt>
2444 <dd><p>Set method to specify band-width of filter.
2445 </p><dl compact="compact">
2446 <dt> ‘<samp>h</samp>’</dt>
2449 <dt> ‘<samp>q</samp>’</dt>
2452 <dt> ‘<samp>o</samp>’</dt>
2455 <dt> ‘<samp>s</samp>’</dt>
2461 <dt> ‘<samp>width, w</samp>’</dt>
2462 <dd><p>Determine how steep is the filter’s shelf transition.
2466 <a name="volume"></a>
2467 <h2 class="section"><a href="ffmpeg-filters.html#toc-volume">6.40 volume</a></h2>
2469 <p>Adjust the input audio volume.
2471 <p>The filter accepts the following options:
2473 <dl compact="compact">
2474 <dt> ‘<samp>volume</samp>’</dt>
2475 <dd><p>Set audio volume expression.
2477 <p>Output values are clipped to the maximum value.
2479 <p>The output audio volume is given by the relation:
2480 </p><table><tr><td> </td><td><pre class="example"><var>output_volume</var> = <var>volume</var> * <var>input_volume</var>
2481 </pre></td></tr></table>
2483 <p>Default value for <var>volume</var> is "1.0".
2486 <dt> ‘<samp>precision</samp>’</dt>
2487 <dd><p>Set the mathematical precision.
2489 <p>This determines which input sample formats will be allowed, which affects the
2490 precision of the volume scaling.
2492 <dl compact="compact">
2493 <dt> ‘<samp>fixed</samp>’</dt>
2494 <dd><p>8-bit fixed-point; limits input sample format to U8, S16, and S32.
2496 <dt> ‘<samp>float</samp>’</dt>
2497 <dd><p>32-bit floating-point; limits input sample format to FLT. (default)
2499 <dt> ‘<samp>double</samp>’</dt>
2500 <dd><p>64-bit floating-point; limits input sample format to DBL.
2505 <dt> ‘<samp>eval</samp>’</dt>
2506 <dd><p>Set when the volume expression is evaluated.
2508 <p>It accepts the following values:
2509 </p><dl compact="compact">
2510 <dt> ‘<samp>once</samp>’</dt>
2511 <dd><p>only evaluate expression once during the filter initialization, or
2512 when the ‘<samp>volume</samp>’ command is sent
2515 <dt> ‘<samp>frame</samp>’</dt>
2516 <dd><p>evaluate expression for each incoming frame
2520 <p>Default value is ‘<samp>once</samp>’.
2524 <p>The volume expression can contain the following parameters.
2526 <dl compact="compact">
2527 <dt> ‘<samp>n</samp>’</dt>
2528 <dd><p>frame number (starting at zero)
2530 <dt> ‘<samp>nb_channels</samp>’</dt>
2531 <dd><p>number of channels
2533 <dt> ‘<samp>nb_consumed_samples</samp>’</dt>
2534 <dd><p>number of samples consumed by the filter
2536 <dt> ‘<samp>nb_samples</samp>’</dt>
2537 <dd><p>number of samples in the current frame
2539 <dt> ‘<samp>pos</samp>’</dt>
2540 <dd><p>original frame position in the file
2542 <dt> ‘<samp>pts</samp>’</dt>
2545 <dt> ‘<samp>sample_rate</samp>’</dt>
2548 <dt> ‘<samp>startpts</samp>’</dt>
2549 <dd><p>PTS at start of stream
2551 <dt> ‘<samp>startt</samp>’</dt>
2552 <dd><p>time at start of stream
2554 <dt> ‘<samp>t</samp>’</dt>
2557 <dt> ‘<samp>tb</samp>’</dt>
2558 <dd><p>timestamp timebase
2560 <dt> ‘<samp>volume</samp>’</dt>
2561 <dd><p>last set volume value
2565 <p>Note that when ‘<samp>eval</samp>’ is set to ‘<samp>once</samp>’ only the
2566 <var>sample_rate</var> and <var>tb</var> variables are available, all other
2567 variables will evaluate to NAN.
2569 <a name="Commands-5"></a>
2570 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Commands-5">6.40.1 Commands</a></h3>
2572 <p>This filter supports the following commands:
2573 </p><dl compact="compact">
2574 <dt> ‘<samp>volume</samp>’</dt>
2575 <dd><p>Modify the volume expression.
2576 The command accepts the same syntax of the corresponding option.
2578 <p>If the specified expression is not valid, it is kept at its current
2583 <a name="Examples-55"></a>
2584 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-55">6.40.2 Examples</a></h3>
2588 Halve the input audio volume:
2589 <table><tr><td> </td><td><pre class="example">volume=volume=0.5
2591 volume=volume=-6.0206dB
2592 </pre></td></tr></table>
2594 <p>In all the above example the named key for ‘<samp>volume</samp>’ can be
2595 omitted, for example like in:
2596 </p><table><tr><td> </td><td><pre class="example">volume=0.5
2597 </pre></td></tr></table>
2600 Increase input audio power by 6 decibels using fixed-point precision:
2601 <table><tr><td> </td><td><pre class="example">volume=volume=6dB:precision=fixed
2602 </pre></td></tr></table>
2605 Fade volume after time 10 with an annihilation period of 5 seconds:
2606 <table><tr><td> </td><td><pre class="example">volume='if(lt(t,10),1,max(1-(t-10)/5,0))':eval=frame
2607 </pre></td></tr></table>
2610 <a name="volumedetect"></a>
2611 <h2 class="section"><a href="ffmpeg-filters.html#toc-volumedetect">6.41 volumedetect</a></h2>
2613 <p>Detect the volume of the input video.
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.
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
2623 <p>All volumes are in decibels relative to the maximum PCM value.
2625 <a name="Examples-17"></a>
2626 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-17">6.41.1 Examples</a></h3>
2628 <p>Here is an excerpt of the output:
2629 </p><table><tr><td> </td><td><pre class="example">[Parsed_volumedetect_0 0xa23120] mean_volume: -27 dB
2630 [Parsed_volumedetect_0 0xa23120] max_volume: -4 dB
2631 [Parsed_volumedetect_0 0xa23120] histogram_4db: 6
2632 [Parsed_volumedetect_0 0xa23120] histogram_5db: 62
2633 [Parsed_volumedetect_0 0xa23120] histogram_6db: 286
2634 [Parsed_volumedetect_0 0xa23120] histogram_7db: 1042
2635 [Parsed_volumedetect_0 0xa23120] histogram_8db: 2551
2636 [Parsed_volumedetect_0 0xa23120] histogram_9db: 4609
2637 [Parsed_volumedetect_0 0xa23120] histogram_10db: 8409
2638 </pre></td></tr></table>
2643 The mean square energy is approximately -27 dB, or 10^-2.7.
2645 The largest sample is at -4 dB, or more precisely between -4 dB and -5 dB.
2647 There are 6 samples at -4 dB, 62 at -5 dB, 286 at -6 dB, etc.
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.
2654 <a name="Audio-Sources"></a>
2655 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Audio-Sources">7. Audio Sources</a></h1>
2657 <p>Below is a description of the currently available audio sources.
2659 <a name="abuffer"></a>
2660 <h2 class="section"><a href="ffmpeg-filters.html#toc-abuffer">7.1 abuffer</a></h2>
2662 <p>Buffer audio frames, and make them available to the filter chain.
2664 <p>This source is mainly intended for a programmatic use, in particular
2665 through the interface defined in ‘<tt>libavfilter/asrc_abuffer.h</tt>’.
2667 <p>It accepts the following named parameters:
2669 <dl compact="compact">
2670 <dt> ‘<samp>time_base</samp>’</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.
2675 <dt> ‘<samp>sample_rate</samp>’</dt>
2676 <dd><p>The sample rate of the incoming audio buffers.
2679 <dt> ‘<samp>sample_fmt</samp>’</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 ‘<tt>libavutil/samplefmt.h</tt>’
2685 <dt> ‘<samp>channel_layout</samp>’</dt>
2686 <dd><p>The channel layout of the incoming audio buffers.
2687 Either a channel layout name from channel_layout_map in
2688 ‘<tt>libavutil/channel_layout.c</tt>’ or its corresponding integer representation
2689 from the AV_CH_LAYOUT_* macros in ‘<tt>libavutil/channel_layout.h</tt>’
2692 <dt> ‘<samp>channels</samp>’</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
2700 <a name="Examples-44"></a>
2701 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-44">7.1.1 Examples</a></h3>
2703 <table><tr><td> </td><td><pre class="example">abuffer=sample_rate=44100:sample_fmt=s16p:channel_layout=stereo
2704 </pre></td></tr></table>
2706 <p>will instruct the source to accept planar 16bit signed stereo at 44100Hz.
2707 Since the sample format with name "s16p" corresponds to the number
2708 6 and the "stereo" channel layout corresponds to the value 0x3, this is
2710 </p><table><tr><td> </td><td><pre class="example">abuffer=sample_rate=44100:sample_fmt=6:channel_layout=0x3
2711 </pre></td></tr></table>
2713 <a name="aevalsrc"></a>
2714 <h2 class="section"><a href="ffmpeg-filters.html#toc-aevalsrc">7.2 aevalsrc</a></h2>
2716 <p>Generate an audio signal specified by an expression.
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
2722 <p>This source accepts the following options:
2724 <dl compact="compact">
2725 <dt> ‘<samp>exprs</samp>’</dt>
2726 <dd><p>Set the ’|’-separated expressions list for each separate channel. In case the
2727 ‘<samp>channel_layout</samp>’ 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.
2732 <dt> ‘<samp>channel_layout, c</samp>’</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.
2737 <dt> ‘<samp>duration, d</samp>’</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
2744 <p>If not specified, or the expressed duration is negative, the audio is
2745 supposed to be generated forever.
2748 <dt> ‘<samp>nb_samples, n</samp>’</dt>
2749 <dd><p>Set the number of samples per channel per each output frame,
2753 <dt> ‘<samp>sample_rate, s</samp>’</dt>
2754 <dd><p>Specify the sample rate, default to 44100.
2758 <p>Each expression in <var>exprs</var> can contain the following constants:
2760 <dl compact="compact">
2761 <dt> ‘<samp>n</samp>’</dt>
2762 <dd><p>number of the evaluated sample, starting from 0
2765 <dt> ‘<samp>t</samp>’</dt>
2766 <dd><p>time of the evaluated sample expressed in seconds, starting from 0
2769 <dt> ‘<samp>s</samp>’</dt>
2775 <a name="Examples-9"></a>
2776 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-9">7.2.1 Examples</a></h3>
2781 <table><tr><td> </td><td><pre class="example">aevalsrc=0
2782 </pre></td></tr></table>
2785 Generate a sin signal with frequency of 440 Hz, set sample rate to
2787 <table><tr><td> </td><td><pre class="example">aevalsrc="sin(440*2*PI*t):s=8000"
2788 </pre></td></tr></table>
2791 Generate a two channels signal, specify the channel layout (Front
2792 Center + Back Center) explicitly:
2793 <table><tr><td> </td><td><pre class="example">aevalsrc="sin(420*2*PI*t)|cos(430*2*PI*t):c=FC|BC"
2794 </pre></td></tr></table>
2797 Generate white noise:
2798 <table><tr><td> </td><td><pre class="example">aevalsrc="-2+random(0)"
2799 </pre></td></tr></table>
2802 Generate an amplitude modulated signal:
2803 <table><tr><td> </td><td><pre class="example">aevalsrc="sin(10*2*PI*t)*sin(880*2*PI*t)"
2804 </pre></td></tr></table>
2807 Generate 2.5 Hz binaural beats on a 360 Hz carrier:
2808 <table><tr><td> </td><td><pre class="example">aevalsrc="0.1*sin(2*PI*(360-2.5/2)*t) | 0.1*sin(2*PI*(360+2.5/2)*t)"
2809 </pre></td></tr></table>
2813 <a name="anullsrc"></a>
2814 <h2 class="section"><a href="ffmpeg-filters.html#toc-anullsrc">7.3 anullsrc</a></h2>
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
2821 <p>This source accepts the following options:
2823 <dl compact="compact">
2824 <dt> ‘<samp>channel_layout, cl</samp>’</dt>
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 "stereo".
2830 <p>Check the channel_layout_map definition in
2831 ‘<tt>libavutil/channel_layout.c</tt>’ for the mapping between strings and
2832 channel layout values.
2835 <dt> ‘<samp>sample_rate, r</samp>’</dt>
2836 <dd><p>Specify the sample rate, and defaults to 44100.
2839 <dt> ‘<samp>nb_samples, n</samp>’</dt>
2840 <dd><p>Set the number of samples per requested frames.
2845 <a name="Examples-72"></a>
2846 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-72">7.3.1 Examples</a></h3>
2850 Set the sample rate to 48000 Hz and the channel layout to AV_CH_LAYOUT_MONO.
2851 <table><tr><td> </td><td><pre class="example">anullsrc=r=48000:cl=4
2852 </pre></td></tr></table>
2855 Do the same operation with a more obvious syntax:
2856 <table><tr><td> </td><td><pre class="example">anullsrc=r=48000:cl=mono
2857 </pre></td></tr></table>
2860 <p>All the parameters need to be explicitly defined.
2862 <a name="flite"></a>
2863 <h2 class="section"><a href="ffmpeg-filters.html#toc-flite">7.4 flite</a></h2>
2865 <p>Synthesize a voice utterance using the libflite library.
2867 <p>To enable compilation of this filter you need to configure FFmpeg with
2868 <code>--enable-libflite</code>.
2870 <p>Note that the flite library is not thread-safe.
2872 <p>The filter accepts the following options:
2874 <dl compact="compact">
2875 <dt> ‘<samp>list_voices</samp>’</dt>
2876 <dd><p>If set to 1, list the names of the available voices and exit
2877 immediately. Default value is 0.
2880 <dt> ‘<samp>nb_samples, n</samp>’</dt>
2881 <dd><p>Set the maximum number of samples per frame. Default value is 512.
2884 <dt> ‘<samp>textfile</samp>’</dt>
2885 <dd><p>Set the filename containing the text to speak.
2888 <dt> ‘<samp>text</samp>’</dt>
2889 <dd><p>Set the text to speak.
2892 <dt> ‘<samp>voice, v</samp>’</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.
2898 <a name="Examples-74"></a>
2899 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-74">7.4.1 Examples</a></h3>
2903 Read from file ‘<tt>speech.txt</tt>’, and synthetize the text using the
2904 standard flite voice:
2905 <table><tr><td> </td><td><pre class="example">flite=textfile=speech.txt
2906 </pre></td></tr></table>
2909 Read the specified text selecting the <code>slt</code> voice:
2910 <table><tr><td> </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>
2914 Input text to ffmpeg:
2915 <table><tr><td> </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>
2919 Make ‘<tt>ffplay</tt>’ speak the specified text, using <code>flite</code> and
2920 the <code>lavfi</code> device:
2921 <table><tr><td> </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>
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>
2929 <h2 class="section"><a href="ffmpeg-filters.html#toc-sine">7.5 sine</a></h2>
2931 <p>Generate an audio signal made of a sine wave with amplitude 1/8.
2933 <p>The audio signal is bit-exact.
2935 <p>The filter accepts the following options:
2937 <dl compact="compact">
2938 <dt> ‘<samp>frequency, f</samp>’</dt>
2939 <dd><p>Set the carrier frequency. Default is 440 Hz.
2942 <dt> ‘<samp>beep_factor, b</samp>’</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.
2947 <dt> ‘<samp>sample_rate, r</samp>’</dt>
2948 <dd><p>Specify the sample rate, default is 44100.
2951 <dt> ‘<samp>duration, d</samp>’</dt>
2952 <dd><p>Specify the duration of the generated audio stream.
2955 <dt> ‘<samp>samples_per_frame</samp>’</dt>
2956 <dd><p>Set the number of samples per output frame, default is 1024.
2960 <a name="Examples-58"></a>
2961 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-58">7.5.1 Examples</a></h3>
2965 Generate a simple 440 Hz sine wave:
2966 <table><tr><td> </td><td><pre class="example">sine
2967 </pre></td></tr></table>
2970 Generate a 220 Hz sine wave with a 880 Hz beep each second, for 5 seconds:
2971 <table><tr><td> </td><td><pre class="example">sine=220:4:d=5
2973 sine=frequency=220:beep_factor=4:duration=5
2974 </pre></td></tr></table>
2979 <a name="Audio-Sinks"></a>
2980 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Audio-Sinks">8. Audio Sinks</a></h1>
2982 <p>Below is a description of the currently available audio sinks.
2984 <a name="abuffersink"></a>
2985 <h2 class="section"><a href="ffmpeg-filters.html#toc-abuffersink">8.1 abuffersink</a></h2>
2987 <p>Buffer audio frames, and make them available to the end of filter chain.
2989 <p>This sink is mainly intended for programmatic use, in particular
2990 through the interface defined in ‘<tt>libavfilter/buffersink.h</tt>’
2991 or the options system.
2993 <p>It accepts a pointer to an AVABufferSinkContext structure, which
2994 defines the incoming buffers’ formats, to be passed as the opaque
2995 parameter to <code>avfilter_init_filter</code> for initialization.
2997 <a name="anullsink"></a>
2998 <h2 class="section"><a href="ffmpeg-filters.html#toc-anullsink">8.2 anullsink</a></h2>
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
3005 <a name="Video-Filters"></a>
3006 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Video-Filters">9. Video Filters</a></h1>
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
3013 <p>Below is a description of the currently available video filters.
3015 <a name="alphaextract"></a>
3016 <h2 class="section"><a href="ffmpeg-filters.html#toc-alphaextract">9.1 alphaextract</a></h2>
3018 <p>Extract the alpha component from the input as a grayscale video. This
3019 is especially useful with the <var>alphamerge</var> filter.
3021 <a name="alphamerge"></a>
3022 <h2 class="section"><a href="ffmpeg-filters.html#toc-alphamerge">9.2 alphamerge</a></h2>
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’t support an alpha
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> </td><td><pre class="example">movie=in_alpha.mkv [alpha]; [in][alpha] alphamerge [out]
3033 </pre></td></tr></table>
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’re trying to apply an image as an
3039 overlay to a video stream, consider the <var>overlay</var> filter instead.
3042 <h2 class="section"><a href="ffmpeg-filters.html#toc-ass">9.3 ass</a></h2>
3044 <p>Same as the <a href="#subtitles">subtitles</a> filter, except that it doesn’t require libavcodec
3045 and libavformat to work. On the other hand, it is limited to ASS (Advanced
3046 Substation Alpha) subtitles files.
3049 <h2 class="section"><a href="ffmpeg-filters.html#toc-bbox">9.4 bbox</a></h2>
3051 <p>Compute the bounding box for the non-black pixels in the input frame
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
3059 <p>The filter accepts the following option:
3061 <dl compact="compact">
3062 <dt> ‘<samp>min_val</samp>’</dt>
3063 <dd><p>Set the minimal luminance value. Default is <code>16</code>.
3067 <a name="blackdetect"></a>
3068 <h2 class="section"><a href="ffmpeg-filters.html#toc-blackdetect">9.5 blackdetect</a></h2>
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.
3075 <p>In order to display the output lines, you need to set the loglevel at
3076 least to the AV_LOG_INFO value.
3078 <p>The filter accepts the following options:
3080 <dl compact="compact">
3081 <dt> ‘<samp>black_min_duration, d</samp>’</dt>
3082 <dd><p>Set the minimum detected black duration expressed in seconds. It must
3083 be a non-negative floating point number.
3085 <p>Default value is 2.0.
3088 <dt> ‘<samp>picture_black_ratio_th, pic_th</samp>’</dt>
3089 <dd><p>Set the threshold for considering a picture "black".
3090 Express the minimum value for the ratio:
3091 </p><table><tr><td> </td><td><pre class="example"><var>nb_black_pixels</var> / <var>nb_pixels</var>
3092 </pre></td></tr></table>
3094 <p>for which a picture is considered black.
3095 Default value is 0.98.
3098 <dt> ‘<samp>pixel_black_th, pix_th</samp>’</dt>
3099 <dd><p>Set the threshold for considering a pixel "black".
3101 <p>The threshold expresses the maximum pixel luminance value for which a
3102 pixel is considered "black". The provided value is scaled according to
3103 the following equation:
3104 </p><table><tr><td> </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>
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.
3111 <p>Default value is 0.10.
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> </td><td><pre class="example">blackdetect=d=2:pix_th=0.00
3118 </pre></td></tr></table>
3120 <a name="blackframe"></a>
3121 <h2 class="section"><a href="ffmpeg-filters.html#toc-blackframe">9.6 blackframe</a></h2>
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.
3128 <p>In order to display the output lines, you need to set the loglevel at
3129 least to the AV_LOG_INFO value.
3131 <p>The filter accepts the following options:
3133 <dl compact="compact">
3134 <dt> ‘<samp>amount</samp>’</dt>
3135 <dd><p>Set the percentage of the pixels that have to be below the threshold, defaults
3139 <dt> ‘<samp>threshold, thresh</samp>’</dt>
3140 <dd><p>Set the threshold below which a pixel value is considered black, defaults to
3146 <a name="blend"></a>
3147 <h2 class="section"><a href="ffmpeg-filters.html#toc-blend">9.7 blend</a></h2>
3149 <p>Blend two video frames into each other.
3151 <p>It takes two input streams and outputs one stream, the first input is the
3152 "top" layer and second input is "bottom" layer.
3153 Output terminates when shortest input terminates.
3155 <p>A description of the accepted options follows.
3157 <dl compact="compact">
3158 <dt> ‘<samp>c0_mode</samp>’</dt>
3159 <dt> ‘<samp>c1_mode</samp>’</dt>
3160 <dt> ‘<samp>c2_mode</samp>’</dt>
3161 <dt> ‘<samp>c3_mode</samp>’</dt>
3162 <dt> ‘<samp>all_mode</samp>’</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>.
3166 <p>Available values for component modes are:
3167 </p><dl compact="compact">
3168 <dt> ‘<samp>addition</samp>’</dt>
3169 <dt> ‘<samp>and</samp>’</dt>
3170 <dt> ‘<samp>average</samp>’</dt>
3171 <dt> ‘<samp>burn</samp>’</dt>
3172 <dt> ‘<samp>darken</samp>’</dt>
3173 <dt> ‘<samp>difference</samp>’</dt>
3174 <dt> ‘<samp>divide</samp>’</dt>
3175 <dt> ‘<samp>dodge</samp>’</dt>
3176 <dt> ‘<samp>exclusion</samp>’</dt>
3177 <dt> ‘<samp>hardlight</samp>’</dt>
3178 <dt> ‘<samp>lighten</samp>’</dt>
3179 <dt> ‘<samp>multiply</samp>’</dt>
3180 <dt> ‘<samp>negation</samp>’</dt>
3181 <dt> ‘<samp>normal</samp>’</dt>
3182 <dt> ‘<samp>or</samp>’</dt>
3183 <dt> ‘<samp>overlay</samp>’</dt>
3184 <dt> ‘<samp>phoenix</samp>’</dt>
3185 <dt> ‘<samp>pinlight</samp>’</dt>
3186 <dt> ‘<samp>reflect</samp>’</dt>
3187 <dt> ‘<samp>screen</samp>’</dt>
3188 <dt> ‘<samp>softlight</samp>’</dt>
3189 <dt> ‘<samp>subtract</samp>’</dt>
3190 <dt> ‘<samp>vividlight</samp>’</dt>
3191 <dt> ‘<samp>xor</samp>’</dt>
3195 <dt> ‘<samp>c0_opacity</samp>’</dt>
3196 <dt> ‘<samp>c1_opacity</samp>’</dt>
3197 <dt> ‘<samp>c2_opacity</samp>’</dt>
3198 <dt> ‘<samp>c3_opacity</samp>’</dt>
3199 <dt> ‘<samp>all_opacity</samp>’</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.
3204 <dt> ‘<samp>c0_expr</samp>’</dt>
3205 <dt> ‘<samp>c1_expr</samp>’</dt>
3206 <dt> ‘<samp>c2_expr</samp>’</dt>
3207 <dt> ‘<samp>c3_expr</samp>’</dt>
3208 <dt> ‘<samp>all_expr</samp>’</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.
3212 <p>The expressions can use the following variables:
3214 <dl compact="compact">
3215 <dt> ‘<samp>N</samp>’</dt>
3216 <dd><p>The sequential number of the filtered frame, starting from <code>0</code>.
3219 <dt> ‘<samp>X</samp>’</dt>
3220 <dt> ‘<samp>Y</samp>’</dt>
3221 <dd><p>the coordinates of the current sample
3224 <dt> ‘<samp>W</samp>’</dt>
3225 <dt> ‘<samp>H</samp>’</dt>
3226 <dd><p>the width and height of currently filtered plane
3229 <dt> ‘<samp>SW</samp>’</dt>
3230 <dt> ‘<samp>SH</samp>’</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.
3237 <dt> ‘<samp>T</samp>’</dt>
3238 <dd><p>Time of the current frame, expressed in seconds.
3241 <dt> ‘<samp>TOP, A</samp>’</dt>
3242 <dd><p>Value of pixel component at current location for first video frame (top layer).
3245 <dt> ‘<samp>BOTTOM, B</samp>’</dt>
3246 <dd><p>Value of pixel component at current location for second video frame (bottom layer).
3251 <dt> ‘<samp>shortest</samp>’</dt>
3252 <dd><p>Force termination when the shortest input terminates. Default is <code>0</code>.
3254 <dt> ‘<samp>repeatlast</samp>’</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>.
3261 <a name="Examples-73"></a>
3262 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-73">9.7.1 Examples</a></h3>
3266 Apply transition from bottom layer to top layer in first 10 seconds:
3267 <table><tr><td> </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>
3271 Apply 1x1 checkerboard effect:
3272 <table><tr><td> </td><td><pre class="example">blend=all_expr='if(eq(mod(X,2),mod(Y,2)),A,B)'
3273 </pre></td></tr></table>
3276 Apply uncover left effect:
3277 <table><tr><td> </td><td><pre class="example">blend=all_expr='if(gte(N*SW+X,W),A,B)'
3278 </pre></td></tr></table>
3281 Apply uncover down effect:
3282 <table><tr><td> </td><td><pre class="example">blend=all_expr='if(gte(Y-N*SH,0),A,B)'
3283 </pre></td></tr></table>
3286 Apply uncover up-left effect:
3287 <table><tr><td> </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>
3291 <a name="boxblur"></a>
3292 <h2 class="section"><a href="ffmpeg-filters.html#toc-boxblur">9.8 boxblur</a></h2>
3294 <p>Apply boxblur algorithm to the input video.
3296 <p>The filter accepts the following options:
3298 <dl compact="compact">
3299 <dt> ‘<samp>luma_radius, lr</samp>’</dt>
3300 <dt> ‘<samp>luma_power, lp</samp>’</dt>
3301 <dt> ‘<samp>chroma_radius, cr</samp>’</dt>
3302 <dt> ‘<samp>chroma_power, cp</samp>’</dt>
3303 <dt> ‘<samp>alpha_radius, ar</samp>’</dt>
3304 <dt> ‘<samp>alpha_power, ap</samp>’</dt>
3307 <p>A description of the accepted options follows.
3309 <dl compact="compact">
3310 <dt> ‘<samp>luma_radius, lr</samp>’</dt>
3311 <dt> ‘<samp>chroma_radius, cr</samp>’</dt>
3312 <dt> ‘<samp>alpha_radius, ar</samp>’</dt>
3313 <dd><p>Set an expression for the box radius in pixels used for blurring the
3314 corresponding input plane.
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
3321 <p>Default value for ‘<samp>luma_radius</samp>’ is "2". If not specified,
3322 ‘<samp>chroma_radius</samp>’ and ‘<samp>alpha_radius</samp>’ default to the
3323 corresponding value set for ‘<samp>luma_radius</samp>’.
3325 <p>The expressions can contain the following constants:
3326 </p><dl compact="compact">
3327 <dt> ‘<samp>w</samp>’</dt>
3328 <dt> ‘<samp>h</samp>’</dt>
3329 <dd><p>the input width and height in pixels
3332 <dt> ‘<samp>cw</samp>’</dt>
3333 <dt> ‘<samp>ch</samp>’</dt>
3334 <dd><p>the input chroma image width and height in pixels
3337 <dt> ‘<samp>hsub</samp>’</dt>
3338 <dt> ‘<samp>vsub</samp>’</dt>
3339 <dd><p>horizontal and vertical chroma subsample values. For example for the
3340 pixel format "yuv422p" <var>hsub</var> is 2 and <var>vsub</var> is 1.
3345 <dt> ‘<samp>luma_power, lp</samp>’</dt>
3346 <dt> ‘<samp>chroma_power, cp</samp>’</dt>
3347 <dt> ‘<samp>alpha_power, ap</samp>’</dt>
3348 <dd><p>Specify how many times the boxblur filter is applied to the
3349 corresponding plane.
3351 <p>Default value for ‘<samp>luma_power</samp>’ is 2. If not specified,
3352 ‘<samp>chroma_power</samp>’ and ‘<samp>alpha_power</samp>’ default to the
3353 corresponding value set for ‘<samp>luma_power</samp>’.
3355 <p>A value of 0 will disable the effect.
3359 <a name="Examples-15"></a>
3360 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-15">9.8.1 Examples</a></h3>
3364 Apply a boxblur filter with luma, chroma, and alpha radius
3366 <table><tr><td> </td><td><pre class="example">boxblur=luma_radius=2:luma_power=1
3368 </pre></td></tr></table>
3371 Set luma radius to 2, alpha and chroma radius to 0:
3372 <table><tr><td> </td><td><pre class="example">boxblur=2:1:cr=0:ar=0
3373 </pre></td></tr></table>
3376 Set luma and chroma radius to a fraction of the video dimension:
3377 <table><tr><td> </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>
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.
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.
3388 <p>A positive adjustment value shifts the balance towards the primary color, a negative
3389 value towards the complementary color.
3391 <p>The filter accepts the following options:
3393 <dl compact="compact">
3394 <dt> ‘<samp>rs</samp>’</dt>
3395 <dt> ‘<samp>gs</samp>’</dt>
3396 <dt> ‘<samp>bs</samp>’</dt>
3397 <dd><p>Adjust red, green and blue shadows (darkest pixels).
3400 <dt> ‘<samp>rm</samp>’</dt>
3401 <dt> ‘<samp>gm</samp>’</dt>
3402 <dt> ‘<samp>bm</samp>’</dt>
3403 <dd><p>Adjust red, green and blue midtones (medium pixels).
3406 <dt> ‘<samp>rh</samp>’</dt>
3407 <dt> ‘<samp>gh</samp>’</dt>
3408 <dt> ‘<samp>bh</samp>’</dt>
3409 <dd><p>Adjust red, green and blue highlights (brightest pixels).
3411 <p>Allowed ranges for options are <code>[-1.0, 1.0]</code>. Defaults are <code>0</code>.
3415 <a name="Examples-21"></a>
3416 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-21">9.9.1 Examples</a></h3>
3420 Add red color cast to shadows:
3421 <table><tr><td> </td><td><pre class="example">colorbalance=rs=.3
3422 </pre></td></tr></table>
3425 <a name="colorchannelmixer"></a>
3426 <h2 class="section"><a href="ffmpeg-filters.html#toc-colorchannelmixer">9.10 colorchannelmixer</a></h2>
3428 <p>Adjust video input frames by re-mixing color channels.
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> </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>
3436 <p>The filter accepts the following options:
3438 <dl compact="compact">
3439 <dt> ‘<samp>rr</samp>’</dt>
3440 <dt> ‘<samp>rg</samp>’</dt>
3441 <dt> ‘<samp>rb</samp>’</dt>
3442 <dt> ‘<samp>ra</samp>’</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>.
3447 <dt> ‘<samp>gr</samp>’</dt>
3448 <dt> ‘<samp>gg</samp>’</dt>
3449 <dt> ‘<samp>gb</samp>’</dt>
3450 <dt> ‘<samp>ga</samp>’</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>.
3455 <dt> ‘<samp>br</samp>’</dt>
3456 <dt> ‘<samp>bg</samp>’</dt>
3457 <dt> ‘<samp>bb</samp>’</dt>
3458 <dt> ‘<samp>ba</samp>’</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>.
3463 <dt> ‘<samp>ar</samp>’</dt>
3464 <dt> ‘<samp>ag</samp>’</dt>
3465 <dt> ‘<samp>ab</samp>’</dt>
3466 <dt> ‘<samp>aa</samp>’</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>.
3470 <p>Allowed ranges for options are <code>[-2.0, 2.0]</code>.
3474 <a name="Examples-12"></a>
3475 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-12">9.10.1 Examples</a></h3>
3479 Convert source to grayscale:
3480 <table><tr><td> </td><td><pre class="example">colorchannelmixer=.3:.4:.3:0:.3:.4:.3:0:.3:.4:.3
3481 </pre></td></tr></table>
3483 Simulate sepia tones:
3484 <table><tr><td> </td><td><pre class="example">colorchannelmixer=.393:.769:.189:0:.349:.686:.168:0:.272:.534:.131
3485 </pre></td></tr></table>
3488 <a name="colormatrix"></a>
3489 <h2 class="section"><a href="ffmpeg-filters.html#toc-colormatrix">9.11 colormatrix</a></h2>
3491 <p>Convert color matrix.
3493 <p>The filter accepts the following options:
3495 <dl compact="compact">
3496 <dt> ‘<samp>src</samp>’</dt>
3497 <dt> ‘<samp>dst</samp>’</dt>
3498 <dd><p>Specify the source and destination color matrix. Both values must be
3501 <p>The accepted values are:
3502 </p><dl compact="compact">
3503 <dt> ‘<samp>bt709</samp>’</dt>
3507 <dt> ‘<samp>bt601</samp>’</dt>
3511 <dt> ‘<samp>smpte240m</samp>’</dt>
3515 <dt> ‘<samp>fcc</samp>’</dt>
3522 <p>For example to convert from BT.601 to SMPTE-240M, use the command:
3523 </p><table><tr><td> </td><td><pre class="example">colormatrix=bt601:smpte240m
3524 </pre></td></tr></table>
3527 <h2 class="section"><a href="ffmpeg-filters.html#toc-copy">9.12 copy</a></h2>
3529 <p>Copy the input source unchanged to the output. Mainly useful for
3533 <h2 class="section"><a href="ffmpeg-filters.html#toc-crop">9.13 crop</a></h2>
3535 <p>Crop the input video to given dimensions.
3537 <p>The filter accepts the following options:
3539 <dl compact="compact">
3540 <dt> ‘<samp>w, out_w</samp>’</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
3546 <dt> ‘<samp>h, out_h</samp>’</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
3552 <dt> ‘<samp>x</samp>’</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.
3558 <dt> ‘<samp>y</samp>’</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.
3564 <dt> ‘<samp>keep_aspect</samp>’</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.
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:
3574 <dl compact="compact">
3575 <dt> ‘<samp>x</samp>’</dt>
3576 <dt> ‘<samp>y</samp>’</dt>
3577 <dd><p>the computed values for <var>x</var> and <var>y</var>. They are evaluated for
3581 <dt> ‘<samp>in_w</samp>’</dt>
3582 <dt> ‘<samp>in_h</samp>’</dt>
3583 <dd><p>the input width and height
3586 <dt> ‘<samp>iw</samp>’</dt>
3587 <dt> ‘<samp>ih</samp>’</dt>
3588 <dd><p>same as <var>in_w</var> and <var>in_h</var>
3591 <dt> ‘<samp>out_w</samp>’</dt>
3592 <dt> ‘<samp>out_h</samp>’</dt>
3593 <dd><p>the output (cropped) width and height
3596 <dt> ‘<samp>ow</samp>’</dt>
3597 <dt> ‘<samp>oh</samp>’</dt>
3598 <dd><p>same as <var>out_w</var> and <var>out_h</var>
3601 <dt> ‘<samp>a</samp>’</dt>
3602 <dd><p>same as <var>iw</var> / <var>ih</var>
3605 <dt> ‘<samp>sar</samp>’</dt>
3606 <dd><p>input sample aspect ratio
3609 <dt> ‘<samp>dar</samp>’</dt>
3610 <dd><p>input display aspect ratio, it is the same as (<var>iw</var> / <var>ih</var>) * <var>sar</var>
3613 <dt> ‘<samp>hsub</samp>’</dt>
3614 <dt> ‘<samp>vsub</samp>’</dt>
3615 <dd><p>horizontal and vertical chroma subsample values. For example for the
3616 pixel format "yuv422p" <var>hsub</var> is 2 and <var>vsub</var> is 1.
3619 <dt> ‘<samp>n</samp>’</dt>
3620 <dd><p>the number of input frame, starting from 0
3623 <dt> ‘<samp>pos</samp>’</dt>
3624 <dd><p>the position in the file of the input frame, NAN if unknown
3627 <dt> ‘<samp>t</samp>’</dt>
3628 <dd><p>timestamp expressed in seconds, NAN if the input timestamp is unknown
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>.
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.
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>.
3646 <a name="Examples-8"></a>
3647 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-8">9.13.1 Examples</a></h3>
3651 Crop area with size 100x100 at position (12,34).
3652 <table><tr><td> </td><td><pre class="example">crop=100:100:12:34
3653 </pre></td></tr></table>
3655 <p>Using named options, the example above becomes:
3656 </p><table><tr><td> </td><td><pre class="example">crop=w=100:h=100:x=12:y=34
3657 </pre></td></tr></table>
3660 Crop the central input area with size 100x100:
3661 <table><tr><td> </td><td><pre class="example">crop=100:100
3662 </pre></td></tr></table>
3665 Crop the central input area with size 2/3 of the input video:
3666 <table><tr><td> </td><td><pre class="example">crop=2/3*in_w:2/3*in_h
3667 </pre></td></tr></table>
3670 Crop the input video central square:
3671 <table><tr><td> </td><td><pre class="example">crop=out_w=in_h
3673 </pre></td></tr></table>
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> </td><td><pre class="example">crop=in_w-100:in_h-100:100:100
3680 </pre></td></tr></table>
3683 Crop 10 pixels from the left and right borders, and 20 pixels from
3684 the top and bottom borders
3685 <table><tr><td> </td><td><pre class="example">crop=in_w-2*10:in_h-2*20
3686 </pre></td></tr></table>
3689 Keep only the bottom right quarter of the input image:
3690 <table><tr><td> </td><td><pre class="example">crop=in_w/2:in_h/2:in_w/2:in_h/2
3691 </pre></td></tr></table>
3694 Crop height for getting Greek harmony:
3695 <table><tr><td> </td><td><pre class="example">crop=in_w:1/PHI*in_w
3696 </pre></td></tr></table>
3699 Appply trembling effect:
3700 <table><tr><td> </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>
3704 Apply erratic camera effect depending on timestamp:
3705 <table><tr><td> </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)"
3706 </pre></td></tr></table>
3709 Set x depending on the value of y:
3710 <table><tr><td> </td><td><pre class="example">crop=in_w/2:in_h/2:y:10+10*sin(n/10)
3711 </pre></td></tr></table>
3714 <a name="cropdetect"></a>
3715 <h2 class="section"><a href="ffmpeg-filters.html#toc-cropdetect">9.14 cropdetect</a></h2>
3717 <p>Auto-detect crop size.
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.
3723 <p>The filter accepts the following options:
3725 <dl compact="compact">
3726 <dt> ‘<samp>limit</samp>’</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.
3732 <dt> ‘<samp>round</samp>’</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.
3739 <dt> ‘<samp>reset_count, reset</samp>’</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.
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
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>
3754 <p>Apply color adjustments using curves.
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
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 "adjusted" to its own value, which means no change to the image.
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.
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.
3777 <p>The filter accepts the following options:
3779 <dl compact="compact">
3780 <dt> ‘<samp>preset</samp>’</dt>
3781 <dd><p>Select one of the available color presets. This option can be used in addition
3782 to the ‘<samp>r</samp>’, ‘<samp>g</samp>’, ‘<samp>b</samp>’ 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> ‘<samp>none</samp>’</dt>
3787 <dt> ‘<samp>color_negative</samp>’</dt>
3788 <dt> ‘<samp>cross_process</samp>’</dt>
3789 <dt> ‘<samp>darker</samp>’</dt>
3790 <dt> ‘<samp>increase_contrast</samp>’</dt>
3791 <dt> ‘<samp>lighter</samp>’</dt>
3792 <dt> ‘<samp>linear_contrast</samp>’</dt>
3793 <dt> ‘<samp>medium_contrast</samp>’</dt>
3794 <dt> ‘<samp>negative</samp>’</dt>
3795 <dt> ‘<samp>strong_contrast</samp>’</dt>
3796 <dt> ‘<samp>vintage</samp>’</dt>
3798 <p>Default is <code>none</code>.
3800 <dt> ‘<samp>master, m</samp>’</dt>
3801 <dd><p>Set the master key points. These points will define a second pass mapping. It
3802 is sometimes called a "luminance" or "value" mapping. It can be used with
3803 ‘<samp>r</samp>’, ‘<samp>g</samp>’, ‘<samp>b</samp>’ or ‘<samp>all</samp>’ since it acts like a
3804 post-processing LUT.
3806 <dt> ‘<samp>red, r</samp>’</dt>
3807 <dd><p>Set the key points for the red component.
3809 <dt> ‘<samp>green, g</samp>’</dt>
3810 <dd><p>Set the key points for the green component.
3812 <dt> ‘<samp>blue, b</samp>’</dt>
3813 <dd><p>Set the key points for the blue component.
3815 <dt> ‘<samp>all</samp>’</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 ‘<samp>all</samp>’ setting.
3821 <dt> ‘<samp>psfile</samp>’</dt>
3822 <dd><p>Specify a Photoshop curves file (<code>.asv</code>) to import the settings from.
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>.
3829 <a name="Examples-1"></a>
3830 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-1">9.15.1 Examples</a></h3>
3834 Increase slightly the middle level of blue:
3835 <table><tr><td> </td><td><pre class="example">curves=blue='0.5/0.58'
3836 </pre></td></tr></table>
3840 <table><tr><td> </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>
3847 <dt> <var>green</var></dt>
3848 <dd><p><code>(0;0) (0.50;0.48) (1;1)</code>
3850 <dt> <var>blue</var></dt>
3851 <dd><p><code>(0;0.22) (0.49;0.44) (1;0.80)</code>
3856 The previous example can also be achieved with the associated built-in preset:
3857 <table><tr><td> </td><td><pre class="example">curves=preset=vintage
3858 </pre></td></tr></table>
3862 <table><tr><td> </td><td><pre class="example">curves=vintage
3863 </pre></td></tr></table>
3866 Use a Photoshop preset and redefine the points of the green component:
3867 <table><tr><td> </td><td><pre class="example">curves=psfile='MyCurvesPresets/purple.asv':green='0.45/0.53'
3868 </pre></td></tr></table>
3871 <a name="dctdnoiz"></a>
3872 <h2 class="section"><a href="ffmpeg-filters.html#toc-dctdnoiz">9.16 dctdnoiz</a></h2>
3874 <p>Denoise frames using 2D DCT (frequency domain filtering).
3876 <p>This filter is not designed for real time and can be extremely slow.
3878 <p>The filter accepts the following options:
3880 <dl compact="compact">
3881 <dt> ‘<samp>sigma, s</samp>’</dt>
3882 <dd><p>Set the noise sigma constant.
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.
3887 <p>If you need a more advanced filtering, see ‘<samp>expr</samp>’.
3889 <p>Default is <code>0</code>.
3892 <dt> ‘<samp>overlap</samp>’</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.
3897 <p>If the overlapping value doesn’t allow to process the whole input width or
3898 height, a warning will be displayed and according borders won’t be denoised.
3900 <p>Default value is <code>15</code>.
3903 <dt> ‘<samp>expr, e</samp>’</dt>
3904 <dd><p>Set the coefficient factor expression.
3906 <p>For each coefficient of a DCT block, this expression will be evaluated as a
3907 multiplier value for the coefficient.
3909 <p>If this is option is set, the ‘<samp>sigma</samp>’ option will be ignored.
3911 <p>The absolute value of the coefficient can be accessed through the <var>c</var>
3916 <a name="Examples-70"></a>
3917 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-70">9.16.1 Examples</a></h3>
3919 <p>Apply a denoise with a ‘<samp>sigma</samp>’ of <code>4.5</code>:
3920 </p><table><tr><td> </td><td><pre class="example">dctdnoiz=4.5
3921 </pre></td></tr></table>
3923 <p>The same operation can be achieved using the expression system:
3924 </p><table><tr><td> </td><td><pre class="example">dctdnoiz=e='gte(c, 4.5*3)'
3925 </pre></td></tr></table>
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>
3931 <p>Drop duplicated frames at regular intervals.
3933 <p>The filter accepts the following options:
3935 <dl compact="compact">
3936 <dt> ‘<samp>cycle</samp>’</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>.
3942 <dt> ‘<samp>dupthresh</samp>’</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
3948 <dt> ‘<samp>scthresh</samp>’</dt>
3949 <dd><p>Set scene change threshold. Default is <code>15</code>.
3952 <dt> ‘<samp>blockx</samp>’</dt>
3953 <dt> ‘<samp>blocky</samp>’</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>.
3959 <dt> ‘<samp>ppsrc</samp>’</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
3968 <dt> ‘<samp>chroma</samp>’</dt>
3969 <dd><p>Set whether or not chroma is considered in the metric calculations. Default is
3974 <a name="dejudder"></a>
3975 <h2 class="section"><a href="ffmpeg-filters.html#toc-dejudder">9.18 dejudder</a></h2>
3977 <p>Remove judder produced by partially interlaced telecined content.
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
3985 <p>The option available in this filter is:
3986 </p><dl compact="compact">
3987 <dt> ‘<samp>cycle</samp>’</dt>
3988 <dd><p>Specify the length of the window over which the judder repeats.
3990 <p>Accepts any interger greater than 1. Useful values are:
3991 </p><dl compact="compact">
3992 <dt> ‘<samp>4</samp>’</dt>
3993 <dd><p>If the original was telecined from 24 to 30 fps (Film to NTSC).
3996 <dt> ‘<samp>5</samp>’</dt>
3997 <dd><p>If the original was telecined from 25 to 30 fps (PAL to NTSC).
4000 <dt> ‘<samp>20</samp>’</dt>
4001 <dd><p>If a mixture of the two.
4005 <p>The default is ‘<samp>4</samp>’.
4009 <a name="delogo"></a>
4010 <h2 class="section"><a href="ffmpeg-filters.html#toc-delogo">9.19 delogo</a></h2>
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).
4016 <p>This filter accepts the following options:
4017 </p><dl compact="compact">
4018 <dt> ‘<samp>x</samp>’</dt>
4019 <dt> ‘<samp>y</samp>’</dt>
4020 <dd><p>Specify the top left corner coordinates of the logo. They must be
4024 <dt> ‘<samp>w</samp>’</dt>
4025 <dt> ‘<samp>h</samp>’</dt>
4026 <dd><p>Specify the width and height of the logo to clear. They must be
4030 <dt> ‘<samp>band, t</samp>’</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.
4035 <dt> ‘<samp>show</samp>’</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.
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.
4048 <a name="Examples-27"></a>
4049 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-27">9.19.1 Examples</a></h3>
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> </td><td><pre class="example">delogo=x=0:y=0:w=100:h=77:band=10
4056 </pre></td></tr></table>
4060 <a name="deshake"></a>
4061 <h2 class="section"><a href="ffmpeg-filters.html#toc-deshake">9.20 deshake</a></h2>
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.
4067 <p>The filter accepts the following options:
4069 <dl compact="compact">
4070 <dt> ‘<samp>x</samp>’</dt>
4071 <dt> ‘<samp>y</samp>’</dt>
4072 <dt> ‘<samp>w</samp>’</dt>
4073 <dt> ‘<samp>h</samp>’</dt>
4074 <dd><p>Specify a rectangular area where to limit the search for motion
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
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.
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.
4089 <p>Default - search the whole frame.
4092 <dt> ‘<samp>rx</samp>’</dt>
4093 <dt> ‘<samp>ry</samp>’</dt>
4094 <dd><p>Specify the maximum extent of movement in x and y directions in the
4095 range 0-64 pixels. Default 16.
4098 <dt> ‘<samp>edge</samp>’</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> ‘<samp>blank, 0</samp>’</dt>
4103 <dd><p>Fill zeroes at blank locations
4105 <dt> ‘<samp>original, 1</samp>’</dt>
4106 <dd><p>Original image at blank locations
4108 <dt> ‘<samp>clamp, 2</samp>’</dt>
4109 <dd><p>Extruded edge value at blank locations
4111 <dt> ‘<samp>mirror, 3</samp>’</dt>
4112 <dd><p>Mirrored edge at blank locations
4115 <p>Default value is ‘<samp>mirror</samp>’.
4118 <dt> ‘<samp>blocksize</samp>’</dt>
4119 <dd><p>Specify the blocksize to use for motion search. Range 4-128 pixels,
4123 <dt> ‘<samp>contrast</samp>’</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.
4129 <dt> ‘<samp>search</samp>’</dt>
4130 <dd><p>Specify the search strategy. Available values are:
4131 </p><dl compact="compact">
4132 <dt> ‘<samp>exhaustive, 0</samp>’</dt>
4133 <dd><p>Set exhaustive search
4135 <dt> ‘<samp>less, 1</samp>’</dt>
4136 <dd><p>Set less exhaustive search.
4139 <p>Default value is ‘<samp>exhaustive</samp>’.
4142 <dt> ‘<samp>filename</samp>’</dt>
4143 <dd><p>If set then a detailed log of the motion search is written to the
4147 <dt> ‘<samp>opencl</samp>’</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.
4154 <a name="drawbox"></a>
4155 <h2 class="section"><a href="ffmpeg-filters.html#toc-drawbox">9.21 drawbox</a></h2>
4157 <p>Draw a colored box on the input image.
4159 <p>This filter accepts the following options:
4161 <dl compact="compact">
4162 <dt> ‘<samp>x</samp>’</dt>
4163 <dt> ‘<samp>y</samp>’</dt>
4164 <dd><p>The expressions which specify the top left corner coordinates of the box. Default to 0.
4167 <dt> ‘<samp>width, w</samp>’</dt>
4168 <dt> ‘<samp>height, h</samp>’</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.
4173 <dt> ‘<samp>color, c</samp>’</dt>
4174 <dd><p>Specify the color of the box to write. For the general syntax of this option,
4175 check the "Color" 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.
4180 <dt> ‘<samp>thickness, t</samp>’</dt>
4181 <dd><p>The expression which sets the thickness of the box edge. Default value is <code>3</code>.
4183 <p>See below for the list of accepted constants.
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:
4190 <dl compact="compact">
4191 <dt> ‘<samp>dar</samp>’</dt>
4192 <dd><p>The input display aspect ratio, it is the same as (<var>w</var> / <var>h</var>) * <var>sar</var>.
4195 <dt> ‘<samp>hsub</samp>’</dt>
4196 <dt> ‘<samp>vsub</samp>’</dt>
4197 <dd><p>horizontal and vertical chroma subsample values. For example for the
4198 pixel format "yuv422p" <var>hsub</var> is 2 and <var>vsub</var> is 1.
4201 <dt> ‘<samp>in_h, ih</samp>’</dt>
4202 <dt> ‘<samp>in_w, iw</samp>’</dt>
4203 <dd><p>The input width and height.
4206 <dt> ‘<samp>sar</samp>’</dt>
4207 <dd><p>The input sample aspect ratio.
4210 <dt> ‘<samp>x</samp>’</dt>
4211 <dt> ‘<samp>y</samp>’</dt>
4212 <dd><p>The x and y offset coordinates where the box is drawn.
4215 <dt> ‘<samp>w</samp>’</dt>
4216 <dt> ‘<samp>h</samp>’</dt>
4217 <dd><p>The width and height of the drawn box.
4220 <dt> ‘<samp>t</samp>’</dt>
4221 <dd><p>The thickness of the drawn box.
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>.
4229 <a name="Examples-46"></a>
4230 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-46">9.21.1 Examples</a></h3>
4234 Draw a black box around the edge of the input image:
4235 <table><tr><td> </td><td><pre class="example">drawbox
4236 </pre></td></tr></table>
4239 Draw a box with color red and an opacity of 50%:
4240 <table><tr><td> </td><td><pre class="example">drawbox=10:20:200:60:red@0.5
4241 </pre></td></tr></table>
4243 <p>The previous example can be specified as:
4244 </p><table><tr><td> </td><td><pre class="example">drawbox=x=10:y=20:w=200:h=60:color=red@0.5
4245 </pre></td></tr></table>
4248 Fill the box with pink color:
4249 <table><tr><td> </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>
4253 Draw a 2-pixel red 2.40:1 mask:
4254 <table><tr><td> </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>
4258 <a name="drawgrid"></a>
4259 <h2 class="section"><a href="ffmpeg-filters.html#toc-drawgrid">9.22 drawgrid</a></h2>
4261 <p>Draw a grid on the input image.
4263 <p>This filter accepts the following options:
4265 <dl compact="compact">
4266 <dt> ‘<samp>x</samp>’</dt>
4267 <dt> ‘<samp>y</samp>’</dt>
4268 <dd><p>The expressions which specify the coordinates of some point of grid intersection (meant to configure offset). Both default to 0.
4271 <dt> ‘<samp>width, w</samp>’</dt>
4272 <dt> ‘<samp>height, h</samp>’</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.
4278 <dt> ‘<samp>color, c</samp>’</dt>
4279 <dd><p>Specify the color of the grid. For the general syntax of this option,
4280 check the "Color" 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.
4285 <dt> ‘<samp>thickness, t</samp>’</dt>
4286 <dd><p>The expression which sets the thickness of the grid line. Default value is <code>1</code>.
4288 <p>See below for the list of accepted constants.
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:
4295 <dl compact="compact">
4296 <dt> ‘<samp>dar</samp>’</dt>
4297 <dd><p>The input display aspect ratio, it is the same as (<var>w</var> / <var>h</var>) * <var>sar</var>.
4300 <dt> ‘<samp>hsub</samp>’</dt>
4301 <dt> ‘<samp>vsub</samp>’</dt>
4302 <dd><p>horizontal and vertical chroma subsample values. For example for the
4303 pixel format "yuv422p" <var>hsub</var> is 2 and <var>vsub</var> is 1.
4306 <dt> ‘<samp>in_h, ih</samp>’</dt>
4307 <dt> ‘<samp>in_w, iw</samp>’</dt>
4308 <dd><p>The input grid cell width and height.
4311 <dt> ‘<samp>sar</samp>’</dt>
4312 <dd><p>The input sample aspect ratio.
4315 <dt> ‘<samp>x</samp>’</dt>
4316 <dt> ‘<samp>y</samp>’</dt>
4317 <dd><p>The x and y coordinates of some point of grid intersection (meant to configure offset).
4320 <dt> ‘<samp>w</samp>’</dt>
4321 <dt> ‘<samp>h</samp>’</dt>
4322 <dd><p>The width and height of the drawn cell.
4325 <dt> ‘<samp>t</samp>’</dt>
4326 <dd><p>The thickness of the drawn cell.
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>.
4334 <a name="Examples-18"></a>
4335 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-18">9.22.1 Examples</a></h3>
4339 Draw a grid with cell 100x100 pixels, thickness 2 pixels, with color red and an opacity of 50%:
4340 <table><tr><td> </td><td><pre class="example">drawgrid=width=100:height=100:thickness=2:color=red@0.5
4341 </pre></td></tr></table>
4344 Draw a white 3x3 grid with an opacity of 50%:
4345 <table><tr><td> </td><td><pre class="example">drawgrid=w=iw/3:h=ih/3:t=2:c=white@0.5
4346 </pre></td></tr></table>
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>
4353 <p>Draw text string or text from specified file on top of video using the
4354 libfreetype library.
4356 <p>To enable compilation of this filter you need to configure FFmpeg with
4357 <code>--enable-libfreetype</code>.
4359 <a name="Syntax"></a>
4360 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Syntax">9.23.1 Syntax</a></h3>
4362 <p>The description of the accepted parameters follows.
4364 <dl compact="compact">
4365 <dt> ‘<samp>box</samp>’</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.
4371 <dt> ‘<samp>boxcolor</samp>’</dt>
4372 <dd><p>The color to be used for drawing box around text. For the syntax of this
4373 option, check the "Color" section in the ffmpeg-utils manual.
4375 <p>The default value of <var>boxcolor</var> is "white".
4378 <dt> ‘<samp>borderw</samp>’</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.
4383 <dt> ‘<samp>bordercolor</samp>’</dt>
4384 <dd><p>Set the color to be used for drawing border around text. For the syntax of this
4385 option, check the "Color" section in the ffmpeg-utils manual.
4387 <p>The default value of <var>bordercolor</var> is "black".
4390 <dt> ‘<samp>expansion</samp>’</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
4397 <dt> ‘<samp>fix_bounds</samp>’</dt>
4398 <dd><p>If true, check and fix text coords to avoid clipping.
4401 <dt> ‘<samp>fontcolor</samp>’</dt>
4402 <dd><p>The color to be used for drawing fonts. For the syntax of this option, check
4403 the "Color" section in the ffmpeg-utils manual.
4405 <p>The default value of <var>fontcolor</var> is "black".
4408 <dt> ‘<samp>fontfile</samp>’</dt>
4409 <dd><p>The font file to be used for drawing text. Path must be included.
4410 This parameter is mandatory.
4413 <dt> ‘<samp>fontsize</samp>’</dt>
4414 <dd><p>The font size to be used for drawing text.
4415 The default value of <var>fontsize</var> is 16.
4418 <dt> ‘<samp>ft_load_flags</samp>’</dt>
4419 <dd><p>Flags to be used for loading the fonts.
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>
4441 <p>Default value is "default".
4443 <p>For more information consult the documentation for the FT_LOAD_*
4447 <dt> ‘<samp>shadowcolor</samp>’</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 "Color" section in the ffmpeg-utils manual.
4451 <p>The default value of <var>shadowcolor</var> is "black".
4454 <dt> ‘<samp>shadowx</samp>’</dt>
4455 <dt> ‘<samp>shadowy</samp>’</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 "0".
4461 <dt> ‘<samp>start_number</samp>’</dt>
4462 <dd><p>The starting frame number for the n/frame_num variable. The default value
4466 <dt> ‘<samp>tabsize</samp>’</dt>
4467 <dd><p>The size in number of spaces to use for rendering the tab.
4471 <dt> ‘<samp>timecode</samp>’</dt>
4472 <dd><p>Set the initial timecode representation in "hh:mm:ss[:;.]ff"
4473 format. It can be used with or without text parameter. <var>timecode_rate</var>
4474 option must be specified.
4477 <dt> ‘<samp>timecode_rate, rate, r</samp>’</dt>
4478 <dd><p>Set the timecode frame rate (timecode only).
4481 <dt> ‘<samp>text</samp>’</dt>
4482 <dd><p>The text string to be drawn. The text must be a sequence of UTF-8
4484 This parameter is mandatory if no file is specified with the parameter
4485 <var>textfile</var>.
4488 <dt> ‘<samp>textfile</samp>’</dt>
4489 <dd><p>A text file containing text to be drawn. The text must be a sequence
4490 of UTF-8 encoded characters.
4492 <p>This parameter is mandatory if no text string is specified with the
4493 parameter <var>text</var>.
4495 <p>If both <var>text</var> and <var>textfile</var> are specified, an error is thrown.
4498 <dt> ‘<samp>reload</samp>’</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.
4503 <dt> ‘<samp>x</samp>’</dt>
4504 <dt> ‘<samp>y</samp>’</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
4509 <p>The default value of <var>x</var> and <var>y</var> is "0".
4511 <p>See below for the list of accepted constants and functions.
4515 <p>The parameters for <var>x</var> and <var>y</var> are expressions containing the
4516 following constants and functions:
4518 <dl compact="compact">
4519 <dt> ‘<samp>dar</samp>’</dt>
4520 <dd><p>input display aspect ratio, it is the same as (<var>w</var> / <var>h</var>) * <var>sar</var>
4523 <dt> ‘<samp>hsub</samp>’</dt>
4524 <dt> ‘<samp>vsub</samp>’</dt>
4525 <dd><p>horizontal and vertical chroma subsample values. For example for the
4526 pixel format "yuv422p" <var>hsub</var> is 2 and <var>vsub</var> is 1.
4529 <dt> ‘<samp>line_h, lh</samp>’</dt>
4530 <dd><p>the height of each text line
4533 <dt> ‘<samp>main_h, h, H</samp>’</dt>
4534 <dd><p>the input height
4537 <dt> ‘<samp>main_w, w, W</samp>’</dt>
4538 <dd><p>the input width
4541 <dt> ‘<samp>max_glyph_a, ascent</samp>’</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
4545 It is a positive value, due to the grid’s orientation with the Y axis
4549 <dt> ‘<samp>max_glyph_d, descent</samp>’</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’s orientation, with the Y axis
4556 <dt> ‘<samp>max_glyph_h</samp>’</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> -
4562 <dt> ‘<samp>max_glyph_w</samp>’</dt>
4563 <dd><p>maximum glyph width, that is the maximum width for all the glyphs
4564 contained in the rendered text
4567 <dt> ‘<samp>n</samp>’</dt>
4568 <dd><p>the number of input frame, starting from 0
4571 <dt> ‘<samp>rand(min, max)</samp>’</dt>
4572 <dd><p>return a random number included between <var>min</var> and <var>max</var>
4575 <dt> ‘<samp>sar</samp>’</dt>
4576 <dd><p>input sample aspect ratio
4579 <dt> ‘<samp>t</samp>’</dt>
4580 <dd><p>timestamp expressed in seconds, NAN if the input timestamp is unknown
4583 <dt> ‘<samp>text_h, th</samp>’</dt>
4584 <dd><p>the height of the rendered text
4587 <dt> ‘<samp>text_w, tw</samp>’</dt>
4588 <dd><p>the width of the rendered text
4591 <dt> ‘<samp>x</samp>’</dt>
4592 <dt> ‘<samp>y</samp>’</dt>
4593 <dd><p>the x and y offset coordinates where the text is drawn.
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>.
4600 <p>If libavfilter was built with <code>--enable-fontconfig</code>, then
4601 ‘<samp>fontfile</samp>’ can be a fontconfig pattern or omitted.
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>
4607 <p>If ‘<samp>expansion</samp>’ 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.
4612 <p>If ‘<samp>expansion</samp>’ is set to <code>none</code>, the text is printed verbatim.
4614 <p>If ‘<samp>expansion</samp>’ is set to <code>normal</code> (which is the default),
4615 the following expansion mechanism is used.
4617 <p>The backslash character ’\’, followed by any character, always expands to
4618 the second character.
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 ’:’.
4622 If the arguments contain special characters or delimiters (’:’ or ’}’),
4623 they should be escaped.
4625 <p>Note that they probably must also be escaped as the value for the
4626 ‘<samp>text</samp>’ 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
4631 <p>The following functions are available:
4633 <dl compact="compact">
4634 <dt> <code>expr, e</code></dt>
4635 <dd><p>The expression evaluation result.
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
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.
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.
4655 <dt> <code>metadata</code></dt>
4656 <dd><p>Frame metadata. It must take one argument specifying metadata key.
4659 <dt> <code>n, frame_num</code></dt>
4660 <dd><p>The frame number, starting from 0.
4663 <dt> <code>pict_type</code></dt>
4664 <dd><p>A 1 character description of the current picture type.
4667 <dt> <code>pts</code></dt>
4668 <dd><p>The timestamp of the current frame, in seconds, with microsecond accuracy.
4673 <a name="Examples-34"></a>
4674 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-34">9.23.3 Examples</a></h3>
4678 Draw "Test Text" with font FreeSerif, using the default values for the
4679 optional parameters.
4681 <table><tr><td> </td><td><pre class="example">drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
4682 </pre></td></tr></table>
4685 Draw ’Test Text’ 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
4690 <table><tr><td> </td><td><pre class="example">drawtext="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"
4692 </pre></td></tr></table>
4694 <p>Note that the double quotes are not necessary if spaces are not used
4695 within the parameter list.
4698 Show the text at the center of the video frame:
4699 <table><tr><td> </td><td><pre class="example">drawtext="fontsize=30:fontfile=FreeSerif.ttf:text='hello world':x=(w-text_w)/2:y=(h-text_h-line_h)/2"
4700 </pre></td></tr></table>
4703 Show a text line sliding from right to left in the last row of the video
4704 frame. The file ‘<tt>LONG_LINE</tt>’ is assumed to contain a single line
4706 <table><tr><td> </td><td><pre class="example">drawtext="fontsize=15:fontfile=FreeSerif.ttf:text=LONG_LINE:y=h-line_h:x=-50*t"
4707 </pre></td></tr></table>
4710 Show the content of file ‘<tt>CREDITS</tt>’ off the bottom of the frame and scroll up.
4711 <table><tr><td> </td><td><pre class="example">drawtext="fontsize=20:fontfile=FreeSerif.ttf:textfile=CREDITS:y=h-20*t"
4712 </pre></td></tr></table>
4715 Draw a single green letter "g", at the center of the input video.
4716 The glyph baseline is placed at half screen height.
4717 <table><tr><td> </td><td><pre class="example">drawtext="fontsize=60:fontfile=FreeSerif.ttf:fontcolor=green:text=g:x=(w-max_glyph_w)/2:y=h/2-ascent"
4718 </pre></td></tr></table>
4721 Show text for 1 second every 3 seconds:
4722 <table><tr><td> </td><td><pre class="example">drawtext="fontfile=FreeSerif.ttf:fontcolor=white:x=100:y=x/dar:enable=lt(mod(t\,3)\,1):text='blink'"
4723 </pre></td></tr></table>
4726 Use fontconfig to set the font. Note that the colons need to be escaped.
4727 <table><tr><td> </td><td><pre class="example">drawtext='fontfile=Linux Libertine O-40\:style=Semibold:text=FFmpeg'
4728 </pre></td></tr></table>
4731 Print the date of a real-time encoding (see strftime(3)):
4732 <table><tr><td> </td><td><pre class="example">drawtext='fontfile=FreeSans.ttf:text=%{localtime:%a %b %d %Y}'
4733 </pre></td></tr></table>
4737 <p>For more information about libfreetype, check:
4738 <a href="http://www.freetype.org/">http://www.freetype.org/</a>.
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>.
4743 <a name="edgedetect"></a>
4744 <h2 class="section"><a href="ffmpeg-filters.html#toc-edgedetect">9.24 edgedetect</a></h2>
4746 <p>Detect and draw edges. The filter uses the Canny Edge Detection algorithm.
4748 <p>The filter accepts the following options:
4750 <dl compact="compact">
4751 <dt> ‘<samp>low</samp>’</dt>
4752 <dt> ‘<samp>high</samp>’</dt>
4753 <dd><p>Set low and high threshold values used by the Canny thresholding
4756 <p>The high threshold selects the "strong" edge pixels, which are then
4757 connected through 8-connectivity with the "weak" edge pixels selected
4758 by the low threshold.
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>.
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>.
4769 </p><table><tr><td> </td><td><pre class="example">edgedetect=low=0.1:high=0.4
4770 </pre></td></tr></table>
4772 <a name="extractplanes"></a>
4773 <h2 class="section"><a href="ffmpeg-filters.html#toc-extractplanes">9.25 extractplanes</a></h2>
4775 <p>Extract color channel components from input video stream into
4776 separate grayscale video streams.
4778 <p>The filter accepts the following option:
4780 <dl compact="compact">
4781 <dt> ‘<samp>planes</samp>’</dt>
4782 <dd><p>Set plane(s) to extract.
4784 <p>Available values for planes are:
4785 </p><dl compact="compact">
4786 <dt> ‘<samp>y</samp>’</dt>
4787 <dt> ‘<samp>u</samp>’</dt>
4788 <dt> ‘<samp>v</samp>’</dt>
4789 <dt> ‘<samp>a</samp>’</dt>
4790 <dt> ‘<samp>r</samp>’</dt>
4791 <dt> ‘<samp>g</samp>’</dt>
4792 <dt> ‘<samp>b</samp>’</dt>
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.
4801 <a name="Examples-54"></a>
4802 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-54">9.25.1 Examples</a></h3>
4806 Extract luma, u and v color channel component from input video frame
4807 into 3 grayscale outputs:
4808 <table><tr><td> </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>
4813 <h2 class="section"><a href="ffmpeg-filters.html#toc-elbg">9.26 elbg</a></h2>
4815 <p>Apply a posterize effect using the ELBG (Enhanced LBG) algorithm.
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.
4821 <p>This filter accepts the following options.
4823 <dl compact="compact">
4824 <dt> ‘<samp>codebook_length, l</samp>’</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.
4829 <dt> ‘<samp>nb_steps, n</samp>’</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.
4835 <dt> ‘<samp>seed, s</samp>’</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.
4843 <h2 class="section"><a href="ffmpeg-filters.html#toc-fade">9.27 fade</a></h2>
4845 <p>Apply fade-in/out effect to input video.
4847 <p>This filter accepts the following options:
4849 <dl compact="compact">
4850 <dt> ‘<samp>type, t</samp>’</dt>
4851 <dd><p>The effect type – can be either "in" for fade-in, or "out" for a fade-out
4853 Default is <code>in</code>.
4856 <dt> ‘<samp>start_frame, s</samp>’</dt>
4857 <dd><p>Specify the number of the start frame for starting to apply the fade
4858 effect. Default is 0.
4861 <dt> ‘<samp>nb_frames, n</samp>’</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 ‘<samp>color</samp>’.
4869 <dt> ‘<samp>alpha</samp>’</dt>
4870 <dd><p>If set to 1, fade only alpha channel, if one exists on the input.
4874 <dt> ‘<samp>start_time, st</samp>’</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.
4880 <dt> ‘<samp>duration, d</samp>’</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 ‘<samp>color</samp>’.
4885 If both duration and nb_frames are specified, duration is used. Default is 0.
4888 <dt> ‘<samp>color, c</samp>’</dt>
4889 <dd><p>Specify the color of the fade. Default is "black".
4893 <a name="Examples-22"></a>
4894 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-22">9.27.1 Examples</a></h3>
4898 Fade in first 30 frames of video:
4899 <table><tr><td> </td><td><pre class="example">fade=in:0:30
4900 </pre></td></tr></table>
4902 <p>The command above is equivalent to:
4903 </p><table><tr><td> </td><td><pre class="example">fade=t=in:s=0:n=30
4904 </pre></td></tr></table>
4907 Fade out last 45 frames of a 200-frame video:
4908 <table><tr><td> </td><td><pre class="example">fade=out:155:45
4909 fade=type=out:start_frame=155:nb_frames=45
4910 </pre></td></tr></table>
4913 Fade in first 25 frames and fade out last 25 frames of a 1000-frame video:
4914 <table><tr><td> </td><td><pre class="example">fade=in:0:25, fade=out:975:25
4915 </pre></td></tr></table>
4918 Make first 5 frames yellow, then fade in from frame 5-24:
4919 <table><tr><td> </td><td><pre class="example">fade=in:5:20:color=yellow
4920 </pre></td></tr></table>
4923 Fade in alpha over first 25 frames of video:
4924 <table><tr><td> </td><td><pre class="example">fade=in:0:25:alpha=1
4925 </pre></td></tr></table>
4928 Make first 5.5 seconds black, then fade in for 0.5 seconds:
4929 <table><tr><td> </td><td><pre class="example">fade=t=in:st=5.5:d=0.5
4930 </pre></td></tr></table>
4934 <a name="field"></a>
4935 <h2 class="section"><a href="ffmpeg-filters.html#toc-field">9.28 field</a></h2>
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
4941 <p>The filter accepts the following options:
4943 <dl compact="compact">
4944 <dt> ‘<samp>type</samp>’</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>).
4951 <a name="fieldmatch"></a>
4952 <h2 class="section"><a href="ffmpeg-filters.html#toc-fieldmatch">9.29 fieldmatch</a></h2>
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.
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.
4966 <p>In addition to the various configuration options, <code>fieldmatch</code> can take an
4967 optional second stream, activated through the ‘<samp>ppsrc</samp>’ 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.
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.
4979 <p>The filter accepts the following options:
4981 <dl compact="compact">
4982 <dt> ‘<samp>order</samp>’</dt>
4983 <dd><p>Specify the assumed field order of the input stream. Available values are:
4985 <dl compact="compact">
4986 <dt> ‘<samp>auto</samp>’</dt>
4987 <dd><p>Auto detect parity (use FFmpeg’s internal parity value).
4989 <dt> ‘<samp>bff</samp>’</dt>
4990 <dd><p>Assume bottom field first.
4992 <dt> ‘<samp>tff</samp>’</dt>
4993 <dd><p>Assume top field first.
4997 <p>Note that it is sometimes recommended not to trust the parity announced by the
5000 <p>Default value is <var>auto</var>.
5003 <dt> ‘<samp>mode</samp>’</dt>
5004 <dd><p>Set the matching mode or strategy to use. ‘<samp>pc</samp>’ mode is the safest in the
5005 sense that it won’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, ‘<samp>pcn_ub</samp>’ 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 ‘<samp>pc</samp>’ and ‘<samp>pcn_ub</samp>’ 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.
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.
5016 <p>Available values are:
5018 <dl compact="compact">
5019 <dt> ‘<samp>pc</samp>’</dt>
5020 <dd><p>2-way matching (p/c)
5022 <dt> ‘<samp>pc_n</samp>’</dt>
5023 <dd><p>2-way matching, and trying 3rd match if still combed (p/c + n)
5025 <dt> ‘<samp>pc_u</samp>’</dt>
5026 <dd><p>2-way matching, and trying 3rd match (same order) if still combed (p/c + u)
5028 <dt> ‘<samp>pc_n_ub</samp>’</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)
5032 <dt> ‘<samp>pcn</samp>’</dt>
5033 <dd><p>3-way matching (p/c/n)
5035 <dt> ‘<samp>pcn_ub</samp>’</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)
5041 <p>The parenthesis at the end indicate the matches that would be used for that
5042 mode assuming ‘<samp>order</samp>’=<var>tff</var> (and ‘<samp>field</samp>’ on <var>auto</var> or
5045 <p>In terms of speed ‘<samp>pc</samp>’ mode is by far the fastest and ‘<samp>pcn_ub</samp>’ is
5048 <p>Default value is <var>pc_n</var>.
5051 <dt> ‘<samp>ppsrc</samp>’</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 ‘<samp>clip2</samp>’ feature from
5057 <p>Default value is <code>0</code> (disabled).
5060 <dt> ‘<samp>field</samp>’</dt>
5061 <dd><p>Set the field to match from. It is recommended to set this to the same value as
5062 ‘<samp>order</samp>’ 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:
5066 <dl compact="compact">
5067 <dt> ‘<samp>auto</samp>’</dt>
5068 <dd><p>Automatic (same value as ‘<samp>order</samp>’).
5070 <dt> ‘<samp>bottom</samp>’</dt>
5071 <dd><p>Match from the bottom field.
5073 <dt> ‘<samp>top</samp>’</dt>
5074 <dd><p>Match from the top field.
5078 <p>Default value is <var>auto</var>.
5081 <dt> ‘<samp>mchroma</samp>’</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.
5088 <p>Default value is <code>1</code>.
5091 <dt> ‘<samp>y0</samp>’</dt>
5092 <dt> ‘<samp>y1</samp>’</dt>
5093 <dd><p>These define an exclusion band which excludes the lines between ‘<samp>y0</samp>’ and
5094 ‘<samp>y1</samp>’ 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. ‘<samp>y0</samp>’ sets the starting scan line and
5097 ‘<samp>y1</samp>’ sets the ending line; all lines in between ‘<samp>y0</samp>’ and
5098 ‘<samp>y1</samp>’ (including ‘<samp>y0</samp>’ and ‘<samp>y1</samp>’) will be ignored. Setting
5099 ‘<samp>y0</samp>’ and ‘<samp>y1</samp>’ to the same value will disable the feature.
5100 ‘<samp>y0</samp>’ and ‘<samp>y1</samp>’ defaults to <code>0</code>.
5103 <dt> ‘<samp>scthresh</samp>’</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 ‘<samp>combmatch</samp>’=<var>sc</var>. The range for
5107 ‘<samp>scthresh</samp>’ is <code>[0.0, 100.0]</code>.
5109 <p>Default value is <code>12.0</code>.
5112 <dt> ‘<samp>combmatch</samp>’</dt>
5113 <dd><p>When ‘<samp>combatch</samp>’ 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:
5117 <dl compact="compact">
5118 <dt> ‘<samp>none</samp>’</dt>
5119 <dd><p>No final matching based on combed scores.
5121 <dt> ‘<samp>sc</samp>’</dt>
5122 <dd><p>Combed scores are only used when a scene change is detected.
5124 <dt> ‘<samp>full</samp>’</dt>
5125 <dd><p>Use combed scores all the time.
5129 <p>Default is <var>sc</var>.
5132 <dt> ‘<samp>combdbg</samp>’</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 ‘<samp>micout</samp>’ in TFM/VFM vocabulary.
5135 Available values are:
5137 <dl compact="compact">
5138 <dt> ‘<samp>none</samp>’</dt>
5139 <dd><p>No forced calculation.
5141 <dt> ‘<samp>pcn</samp>’</dt>
5142 <dd><p>Force p/c/n calculations.
5144 <dt> ‘<samp>pcnub</samp>’</dt>
5145 <dd><p>Force p/c/n/u/b calculations.
5149 <p>Default value is <var>none</var>.
5152 <dt> ‘<samp>cthresh</samp>’</dt>
5153 <dd><p>This is the area combing threshold used for combed frame detection. This
5154 essentially controls how "strong" or "visible" 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>.
5161 <p>Default value is <code>9</code>.
5164 <dt> ‘<samp>chroma</samp>’</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 ‘<samp>chroma</samp>’=<var>0</var> is usually more reliable, except for the case
5169 where there is chroma only combing in the source.
5171 <p>Default value is <code>0</code>.
5174 <dt> ‘<samp>blockx</samp>’</dt>
5175 <dt> ‘<samp>blocky</samp>’</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 ‘<samp>combpel</samp>’ pixels are required to be detected as combed for a frame to be
5179 declared combed. See the ‘<samp>combpel</samp>’ parameter description for more info.
5180 Possible values are any number that is a power of 2 starting at 4 and going up
5183 <p>Default value is <code>16</code>.
5186 <dt> ‘<samp>combpel</samp>’</dt>
5187 <dd><p>The number of combed pixels inside any of the ‘<samp>blocky</samp>’ by
5188 ‘<samp>blockx</samp>’ size blocks on the frame for the frame to be detected as
5189 combed. While ‘<samp>cthresh</samp>’ controls how "visible" the combing must be, this
5190 setting controls "how much" combing there must be in any localized area (a
5191 window defined by the ‘<samp>blockx</samp>’ and ‘<samp>blocky</samp>’ 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 ‘<samp>MI</samp>’ in TFM/VFM vocabulary.
5196 <p>Default value is <code>80</code>.
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>
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>
5207 <p>We assume the following telecined stream:
5209 <table><tr><td> </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>
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.
5216 <p>When <code>fieldmatch</code> is configured to run a matching from bottom
5217 (‘<samp>field</samp>’=<var>bottom</var>) this is how this input stream get transformed:
5219 <table><tr><td> </td><td><pre class="example">Input stream:
5221 B 1 2 3 4 4 <-- matching reference
5228 </pre></td></tr></table>
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.
5234 <p>The same operation now matching from top fields (‘<samp>field</samp>’=<var>top</var>)
5237 <table><tr><td> </td><td><pre class="example">Input stream:
5238 T 1 2 2 3 4 <-- matching reference
5246 </pre></td></tr></table>
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:
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
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>
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 ’x’ is placed above and below each matched fields.
5265 <p>With bottom matching (‘<samp>field</samp>’=<var>bottom</var>):
5266 </p><table><tr><td> </td><td><pre class="example">Match: c p n b u
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
5276 </pre></td></tr></table>
5278 <p>With top matching (‘<samp>field</samp>’=<var>top</var>):
5279 </p><table><tr><td> </td><td><pre class="example">Match: c p n b u
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
5289 </pre></td></tr></table>
5291 <a name="Examples-30"></a>
5292 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-30">9.29.2 Examples</a></h3>
5294 <p>Simple IVTC of a top field first telecined stream:
5295 </p><table><tr><td> </td><td><pre class="example">fieldmatch=order=tff:combmatch=none, decimate
5296 </pre></td></tr></table>
5298 <p>Advanced IVTC, with fallback on <a href="#yadif">yadif</a> for still combed frames:
5299 </p><table><tr><td> </td><td><pre class="example">fieldmatch=order=tff:combmatch=full, yadif=deint=interlaced, decimate
5300 </pre></td></tr></table>
5302 <a name="fieldorder"></a>
5303 <h2 class="section"><a href="ffmpeg-filters.html#toc-fieldorder">9.30 fieldorder</a></h2>
5305 <p>Transform the field order of the input video.
5307 <p>This filter accepts the following options:
5309 <dl compact="compact">
5310 <dt> ‘<samp>order</samp>’</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.
5316 <p>Default value is ‘<samp>tff</samp>’.
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.
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.
5326 <p>This filter is very useful when converting to or from PAL DV material,
5327 which is bottom field first.
5330 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
5331 </pre></td></tr></table>
5334 <h2 class="section"><a href="ffmpeg-filters.html#toc-fifo">9.31 fifo</a></h2>
5336 <p>Buffer input images and send them when they are requested.
5338 <p>This filter is mainly useful when auto-inserted by the libavfilter
5341 <p>The filter does not take parameters.
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>
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
5351 <p>This filter accepts the following parameters:
5352 </p><dl compact="compact">
5353 <dt> ‘<samp>pix_fmts</samp>’</dt>
5354 <dd><p>A ’|’-separated list of pixel format names, for example
5355 "pix_fmts=yuv420p|monow|rgb24".
5360 <a name="Examples-71"></a>
5361 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-71">9.32.1 Examples</a></h3>
5365 Convert the input video to the format <var>yuv420p</var>
5366 <table><tr><td> </td><td><pre class="example">format=pix_fmts=yuv420p
5367 </pre></td></tr></table>
5369 <p>Convert the input video to any of the formats in the list
5370 </p><table><tr><td> </td><td><pre class="example">format=pix_fmts=yuv420p|yuv444p|yuv410p
5371 </pre></td></tr></table>
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>
5378 <p>Convert the video to specified constant frame rate by duplicating or dropping
5379 frames as necessary.
5381 <p>This filter accepts the following named parameters:
5382 </p><dl compact="compact">
5383 <dt> ‘<samp>fps</samp>’</dt>
5384 <dd><p>Desired output frame rate. The default is <code>25</code>.
5387 <dt> ‘<samp>round</samp>’</dt>
5388 <dd><p>Rounding method.
5390 <p>Possible values are:
5391 </p><dl compact="compact">
5392 <dt> ‘<samp>zero</samp>’</dt>
5393 <dd><p>zero round towards 0
5395 <dt> ‘<samp>inf</samp>’</dt>
5396 <dd><p>round away from 0
5398 <dt> ‘<samp>down</samp>’</dt>
5399 <dd><p>round towards -infinity
5401 <dt> ‘<samp>up</samp>’</dt>
5402 <dd><p>round towards +infinity
5404 <dt> ‘<samp>near</samp>’</dt>
5405 <dd><p>round to nearest
5408 <p>The default is <code>near</code>.
5411 <dt> ‘<samp>start_time</samp>’</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’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.
5422 <p>Alternatively, the options can be specified as a flat string:
5423 <var>fps</var>[:<var>round</var>].
5425 <p>See also the <a href="#setpts">setpts</a> filter.
5427 <a name="Examples-31"></a>
5428 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-31">9.33.1 Examples</a></h3>
5432 A typical usage in order to set the fps to 25:
5433 <table><tr><td> </td><td><pre class="example">fps=fps=25
5434 </pre></td></tr></table>
5437 Sets the fps to 24, using abbreviation and rounding method to round to nearest:
5438 <table><tr><td> </td><td><pre class="example">fps=fps=film:round=near
5439 </pre></td></tr></table>
5442 <a name="framepack"></a>
5443 <h2 class="section"><a href="ffmpeg-filters.html#toc-framepack">9.34 framepack</a></h2>
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.
5451 <p>This filter accepts the following named parameters:
5452 </p><dl compact="compact">
5453 <dt> ‘<samp>format</samp>’</dt>
5454 <dd><p>Desired packing format. Supported values are:
5456 <dl compact="compact">
5457 <dt> ‘<samp>sbs</samp>’</dt>
5458 <dd><p>Views are next to each other (default).
5461 <dt> ‘<samp>tab</samp>’</dt>
5462 <dd><p>Views are on top of each other.
5465 <dt> ‘<samp>lines</samp>’</dt>
5466 <dd><p>Views are packed by line.
5469 <dt> ‘<samp>columns</samp>’</dt>
5470 <dd><p>Views are eacked by column.
5473 <dt> ‘<samp>frameseq</samp>’</dt>
5474 <dd><p>Views are temporally interleaved.
5482 <p>Some examples follow:
5484 <table><tr><td> </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
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>
5491 <a name="framestep"></a>
5492 <h2 class="section"><a href="ffmpeg-filters.html#toc-framestep">9.35 framestep</a></h2>
5494 <p>Select one frame every N-th frame.
5496 <p>This filter accepts the following option:
5497 </p><dl compact="compact">
5498 <dt> ‘<samp>step</samp>’</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>.
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>
5508 <p>Apply a frei0r effect to the input video.
5510 <p>To enable compilation of this filter you need to install the frei0r
5511 header and configure FFmpeg with <code>--enable-frei0r</code>.
5513 <p>This filter accepts the following options:
5515 <dl compact="compact">
5516 <dt> ‘<samp>filter_name</samp>’</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 ‘<tt>HOME/.frei0r-1/lib/</tt>’, ‘<tt>/usr/local/lib/frei0r-1/</tt>’,
5522 ‘<tt>/usr/lib/frei0r-1/</tt>’.
5525 <dt> ‘<samp>filter_params</samp>’</dt>
5526 <dd><p>A ’|’-separated list of parameters to pass to the frei0r effect.
5531 <p>A frei0r effect parameter can be a boolean (whose values are specified
5532 with "y" and "n"), 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 "Color"
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.
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.
5541 <a name="Examples-49"></a>
5542 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-49">9.36.1 Examples</a></h3>
5546 Apply the distort0r effect, set the first two double parameters:
5547 <table><tr><td> </td><td><pre class="example">frei0r=filter_name=distort0r:filter_params=0.5|0.01
5548 </pre></td></tr></table>
5551 Apply the colordistance effect, take a color as first parameter:
5552 <table><tr><td> </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>
5558 Apply the perspective effect, specify the top left and top right image
5560 <table><tr><td> </td><td><pre class="example">frei0r=perspective:0.2/0.2|0.8/0.2
5561 </pre></td></tr></table>
5564 <p>For more information see:
5565 <a href="http://frei0r.dyne.org">http://frei0r.dyne.org</a>
5568 <h2 class="section"><a href="ffmpeg-filters.html#toc-geq">9.37 geq</a></h2>
5570 <p>The filter accepts the following options:
5572 <dl compact="compact">
5573 <dt> ‘<samp>lum_expr, lum</samp>’</dt>
5574 <dd><p>Set the luminance expression.
5576 <dt> ‘<samp>cb_expr, cb</samp>’</dt>
5577 <dd><p>Set the chrominance blue expression.
5579 <dt> ‘<samp>cr_expr, cr</samp>’</dt>
5580 <dd><p>Set the chrominance red expression.
5582 <dt> ‘<samp>alpha_expr, a</samp>’</dt>
5583 <dd><p>Set the alpha expression.
5585 <dt> ‘<samp>red_expr, r</samp>’</dt>
5586 <dd><p>Set the red expression.
5588 <dt> ‘<samp>green_expr, g</samp>’</dt>
5589 <dd><p>Set the green expression.
5591 <dt> ‘<samp>blue_expr, b</samp>’</dt>
5592 <dd><p>Set the blue expression.
5596 <p>The colorspace is selected according to the specified options. If one
5597 of the ‘<samp>lum_expr</samp>’, ‘<samp>cb_expr</samp>’, or ‘<samp>cr_expr</samp>’
5598 options is specified, the filter will automatically select a YCbCr
5599 colorspace. If one of the ‘<samp>red_expr</samp>’, ‘<samp>green_expr</samp>’, or
5600 ‘<samp>blue_expr</samp>’ options is specified, it will select an RGB
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.
5608 <p>The expressions can use the following variables and functions:
5610 <dl compact="compact">
5611 <dt> ‘<samp>N</samp>’</dt>
5612 <dd><p>The sequential number of the filtered frame, starting from <code>0</code>.
5615 <dt> ‘<samp>X</samp>’</dt>
5616 <dt> ‘<samp>Y</samp>’</dt>
5617 <dd><p>The coordinates of the current sample.
5620 <dt> ‘<samp>W</samp>’</dt>
5621 <dt> ‘<samp>H</samp>’</dt>
5622 <dd><p>The width and height of the image.
5625 <dt> ‘<samp>SW</samp>’</dt>
5626 <dt> ‘<samp>SH</samp>’</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.
5633 <dt> ‘<samp>T</samp>’</dt>
5634 <dd><p>Time of the current frame, expressed in seconds.
5637 <dt> ‘<samp>p(x, y)</samp>’</dt>
5638 <dd><p>Return the value of the pixel at location (<var>x</var>,<var>y</var>) of the current
5642 <dt> ‘<samp>lum(x, y)</samp>’</dt>
5643 <dd><p>Return the value of the pixel at location (<var>x</var>,<var>y</var>) of the luminance
5647 <dt> ‘<samp>cb(x, y)</samp>’</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.
5652 <dt> ‘<samp>cr(x, y)</samp>’</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.
5657 <dt> ‘<samp>r(x, y)</samp>’</dt>
5658 <dt> ‘<samp>g(x, y)</samp>’</dt>
5659 <dt> ‘<samp>b(x, y)</samp>’</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.
5664 <dt> ‘<samp>alpha(x, y)</samp>’</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.
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.
5673 <a name="Examples-29"></a>
5674 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-29">9.37.1 Examples</a></h3>
5678 Flip the image horizontally:
5679 <table><tr><td> </td><td><pre class="example">geq=p(W-X\,Y)
5680 </pre></td></tr></table>
5683 Generate a bidimensional sine wave, with angle <code>PI/3</code> and a
5684 wavelength of 100 pixels:
5685 <table><tr><td> </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>
5689 Generate a fancy enigmatic moving light:
5690 <table><tr><td> </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>
5694 Generate a quick emboss effect:
5695 <table><tr><td> </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>
5699 Modify RGB components depending on pixel position:
5700 <table><tr><td> </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>
5704 <a name="gradfun"></a>
5705 <h2 class="section"><a href="ffmpeg-filters.html#toc-gradfun">9.38 gradfun</a></h2>
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
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.
5716 <p>This filter accepts the following options:
5718 <dl compact="compact">
5719 <dt> ‘<samp>strength</samp>’</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
5726 <dt> ‘<samp>radius</samp>’</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.
5735 <p>Alternatively, the options can be specified as a flat string:
5736 <var>strength</var>[:<var>radius</var>]
5738 <a name="Examples-41"></a>
5739 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-41">9.38.1 Examples</a></h3>
5743 Apply the filter with a <code>3.5</code> strength and radius of <code>8</code>:
5744 <table><tr><td> </td><td><pre class="example">gradfun=3.5:8
5745 </pre></td></tr></table>
5748 Specify radius, omitting the strength (which will fall-back to the default
5750 <table><tr><td> </td><td><pre class="example">gradfun=radius=8
5751 </pre></td></tr></table>
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>
5759 <p>Apply a Hald CLUT to a video stream.
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.
5764 <p>The filter accepts the following options:
5766 <dl compact="compact">
5767 <dt> ‘<samp>shortest</samp>’</dt>
5768 <dd><p>Force termination when the shortest input terminates. Default is <code>0</code>.
5770 <dt> ‘<samp>repeatlast</samp>’</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>.
5777 <p><code>haldclut</code> also has the same interpolation options as <a href="#lut3d">lut3d</a> (both
5778 filters share the same internals).
5780 <p>More information about the Hald CLUT can be found on Eskil Steenberg’s website
5781 (Hald CLUT author) at <a href="http://www.quelsolaar.com/technology/clut.html">http://www.quelsolaar.com/technology/clut.html</a>.
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>
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>
5789 <p>Generate an identity Hald CLUT stream altered with various effects:
5790 </p><table><tr><td> </td><td><pre class="example">ffmpeg -f lavfi -i <a href="#haldclutsrc">haldclutsrc</a>=8 -vf "hue=H=2*PI*t:s=sin(2*PI*t)+1, curves=cross_process" -t 10 -c:v ffv1 clut.nut
5791 </pre></td></tr></table>
5793 <p>Note: make sure you use a lossless codec.
5795 <p>Then use it with <code>haldclut</code> to apply it on some random stream:
5796 </p><table><tr><td> </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>
5799 <p>The Hald CLUT will be applied to the 10 first seconds (duration of
5800 ‘<tt>clut.nut</tt>’), then the latest picture of that CLUT stream will be applied
5801 to the remaining frames of the <code>mandelbrot</code> stream.
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>
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.
5812 <p>Typically, the following generated Hald CLUT will be supported by the
5813 <code>haldclut</code> filter:
5815 <table><tr><td> </td><td><pre class="example">ffmpeg -f lavfi -i <a href="#haldclutsrc">haldclutsrc</a>=8 -vf "
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" -frames:v 1 clut.png
5820 </pre></td></tr></table>
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
5826 <p>Then, the effect of this Hald CLUT can be visualized with:
5827 </p><table><tr><td> </td><td><pre class="example">ffplay input.mkv -vf "movie=clut.png, [in] haldclut"
5828 </pre></td></tr></table>
5830 <a name="hflip"></a>
5831 <h2 class="section"><a href="ffmpeg-filters.html#toc-hflip">9.40 hflip</a></h2>
5833 <p>Flip the input video horizontally.
5835 <p>For example to horizontally flip the input video with <code>ffmpeg</code>:
5836 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i in.avi -vf "hflip" out.avi
5837 </pre></td></tr></table>
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
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 "automatically adjusting contrast filter". This filter is
5848 useful only for correcting degraded or poorly captured source
5851 <p>The filter accepts the following options:
5853 <dl compact="compact">
5854 <dt> ‘<samp>strength</samp>’</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.
5861 <dt> ‘<samp>intensity</samp>’</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.
5868 <dt> ‘<samp>antibanding</samp>’</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>.
5876 <a name="histogram"></a>
5877 <h2 class="section"><a href="ffmpeg-filters.html#toc-histogram">9.42 histogram</a></h2>
5879 <p>Compute and draw a color distribution histogram for the input video.
5881 <p>The computed histogram is a representation of the color component
5882 distribution in an image.
5884 <p>The filter accepts the following options:
5886 <dl compact="compact">
5887 <dt> ‘<samp>mode</samp>’</dt>
5888 <dd><p>Set histogram mode.
5890 <p>It accepts the following values:
5891 </p><dl compact="compact">
5892 <dt> ‘<samp>levels</samp>’</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.
5899 <dt> ‘<samp>color</samp>’</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.
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.
5918 <dt> ‘<samp>color2</samp>’</dt>
5919 <dd><p>Chroma values in vectorscope, similar as <code>color</code> but actual chroma values
5923 <dt> ‘<samp>waveform</samp>’</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.
5930 <p>Default value is <code>levels</code>.
5933 <dt> ‘<samp>level_height</samp>’</dt>
5934 <dd><p>Set height of level in <code>levels</code>. Default value is <code>200</code>.
5935 Allowed range is [50, 2048].
5938 <dt> ‘<samp>scale_height</samp>’</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].
5943 <dt> ‘<samp>step</samp>’</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].
5949 <dt> ‘<samp>waveform_mode</samp>’</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>.
5954 <dt> ‘<samp>waveform_mirror</samp>’</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).
5961 <dt> ‘<samp>display_mode</samp>’</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> ‘<samp>parade</samp>’</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.
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.
5980 <dt> ‘<samp>overlay</samp>’</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
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,
5991 <p>Default is <code>parade</code>.
5994 <dt> ‘<samp>levels_mode</samp>’</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>.
6000 <a name="Examples-52"></a>
6001 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-52">9.42.1 Examples</a></h3>
6005 Calculate and draw histogram:
6006 <table><tr><td> </td><td><pre class="example">ffplay -i input -vf histogram
6007 </pre></td></tr></table>
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>
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.
6019 <p>It accepts the following optional parameters:
6021 <dl compact="compact">
6022 <dt> ‘<samp>luma_spatial</samp>’</dt>
6023 <dd><p>a non-negative float number which specifies spatial luma strength,
6027 <dt> ‘<samp>chroma_spatial</samp>’</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
6032 <dt> ‘<samp>luma_tmp</samp>’</dt>
6033 <dd><p>a float number which specifies luma temporal strength, defaults to
6034 6.0*<var>luma_spatial</var>/4.0
6037 <dt> ‘<samp>chroma_tmp</samp>’</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>
6044 <h2 class="section"><a href="ffmpeg-filters.html#toc-hue">9.44 hue</a></h2>
6046 <p>Modify the hue and/or the saturation of the input.
6048 <p>This filter accepts the following options:
6050 <dl compact="compact">
6051 <dt> ‘<samp>h</samp>’</dt>
6052 <dd><p>Specify the hue angle as a number of degrees. It accepts an expression,
6053 and defaults to "0".
6056 <dt> ‘<samp>s</samp>’</dt>
6057 <dd><p>Specify the saturation in the [-10,10] range. It accepts an expression and
6058 defaults to "1".
6061 <dt> ‘<samp>H</samp>’</dt>
6062 <dd><p>Specify the hue angle as a number of radians. It accepts an
6063 expression, and defaults to "0".
6066 <dt> ‘<samp>b</samp>’</dt>
6067 <dd><p>Specify the brightness in the [-10,10] range. It accepts an expression and
6068 defaults to "0".
6072 <p>‘<samp>h</samp>’ and ‘<samp>H</samp>’ are mutually exclusive, and can’t be
6073 specified at the same time.
6075 <p>The ‘<samp>b</samp>’, ‘<samp>h</samp>’, ‘<samp>H</samp>’ and ‘<samp>s</samp>’ option values are
6076 expressions containing the following constants:
6078 <dl compact="compact">
6079 <dt> ‘<samp>n</samp>’</dt>
6080 <dd><p>frame count of the input frame starting from 0
6083 <dt> ‘<samp>pts</samp>’</dt>
6084 <dd><p>presentation timestamp of the input frame expressed in time base units
6087 <dt> ‘<samp>r</samp>’</dt>
6088 <dd><p>frame rate of the input video, NAN if the input frame rate is unknown
6091 <dt> ‘<samp>t</samp>’</dt>
6092 <dd><p>timestamp expressed in seconds, NAN if the input timestamp is unknown
6095 <dt> ‘<samp>tb</samp>’</dt>
6096 <dd><p>time base of the input video
6100 <a name="Examples-42"></a>
6101 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-42">9.44.1 Examples</a></h3>
6105 Set the hue to 90 degrees and the saturation to 1.0:
6106 <table><tr><td> </td><td><pre class="example">hue=h=90:s=1
6107 </pre></td></tr></table>
6110 Same command but expressing the hue in radians:
6111 <table><tr><td> </td><td><pre class="example">hue=H=PI/2:s=1
6112 </pre></td></tr></table>
6115 Rotate hue and make the saturation swing between 0
6116 and 2 over a period of 1 second:
6117 <table><tr><td> </td><td><pre class="example">hue="H=2*PI*t: s=sin(2*PI*t)+1"
6118 </pre></td></tr></table>
6121 Apply a 3 seconds saturation fade-in effect starting at 0:
6122 <table><tr><td> </td><td><pre class="example">hue="s=min(t/3\,1)"
6123 </pre></td></tr></table>
6125 <p>The general fade-in expression can be written as:
6126 </p><table><tr><td> </td><td><pre class="example">hue="s=min(0\, max((t-START)/DURATION\, 1))"
6127 </pre></td></tr></table>
6130 Apply a 3 seconds saturation fade-out effect starting at 5 seconds:
6131 <table><tr><td> </td><td><pre class="example">hue="s=max(0\, min(1\, (8-t)/3))"
6132 </pre></td></tr></table>
6134 <p>The general fade-out expression can be written as:
6135 </p><table><tr><td> </td><td><pre class="example">hue="s=max(0\, min(1\, (START+DURATION-t)/DURATION))"
6136 </pre></td></tr></table>
6140 <a name="Commands-3"></a>
6141 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Commands-3">9.44.2 Commands</a></h3>
6143 <p>This filter supports the following commands:
6144 </p><dl compact="compact">
6145 <dt> ‘<samp>b</samp>’</dt>
6146 <dt> ‘<samp>s</samp>’</dt>
6147 <dt> ‘<samp>h</samp>’</dt>
6148 <dt> ‘<samp>H</samp>’</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.
6152 <p>If the specified expression is not valid, it is kept at its current
6158 <h2 class="section"><a href="ffmpeg-filters.html#toc-idet">9.45 idet</a></h2>
6160 <p>Detect video interlacing type.
6162 <p>This filter tries to detect if the input is interlaced or progressive,
6163 top or bottom field first.
6165 <p>The filter accepts the following options:
6167 <dl compact="compact">
6168 <dt> ‘<samp>intl_thres</samp>’</dt>
6169 <dd><p>Set interlacing threshold.
6171 <dt> ‘<samp>prog_thres</samp>’</dt>
6172 <dd><p>Set progressive threshold.
6177 <h2 class="section"><a href="ffmpeg-filters.html#toc-il">9.46 il</a></h2>
6179 <p>Deinterleave or interleave fields.
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.
6187 <p>The filter accepts the following options:
6189 <dl compact="compact">
6190 <dt> ‘<samp>luma_mode, l</samp>’</dt>
6191 <dt> ‘<samp>chroma_mode, c</samp>’</dt>
6192 <dt> ‘<samp>alpha_mode, a</samp>’</dt>
6193 <dd><p>Available values for <var>luma_mode</var>, <var>chroma_mode</var> and
6194 <var>alpha_mode</var> are:
6196 <dl compact="compact">
6197 <dt> ‘<samp>none</samp>’</dt>
6201 <dt> ‘<samp>deinterleave, d</samp>’</dt>
6202 <dd><p>Deinterleave fields, placing one above the other.
6205 <dt> ‘<samp>interleave, i</samp>’</dt>
6206 <dd><p>Interleave fields. Reverse the effect of deinterleaving.
6209 <p>Default value is <code>none</code>.
6212 <dt> ‘<samp>luma_swap, ls</samp>’</dt>
6213 <dt> ‘<samp>chroma_swap, cs</samp>’</dt>
6214 <dt> ‘<samp>alpha_swap, as</samp>’</dt>
6215 <dd><p>Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value is <code>0</code>.
6219 <a name="interlace"></a>
6220 <h2 class="section"><a href="ffmpeg-filters.html#toc-interlace">9.47 interlace</a></h2>
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.
6227 <table><tr><td> </td><td><pre class="example"> Original Original New Frame
6228 Frame 'j' Frame 'j+1' (tff)
6229 ========== =========== ==================
6230 Line 0 --------------------> Frame 'j' Line 0
6231 Line 1 Line 1 ----> Frame 'j+1' Line 1
6232 Line 2 ---------------------> Frame 'j' Line 2
6233 Line 3 Line 3 ----> Frame 'j+1' Line 3
6235 New Frame + 1 will be generated by Frame 'j+2' and Frame 'j+3' and so on
6236 </pre></td></tr></table>
6238 <p>It accepts the following optional parameters:
6240 <dl compact="compact">
6241 <dt> ‘<samp>scan</samp>’</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.
6247 <a name="kerndeint"></a>
6248 <h2 class="section"><a href="ffmpeg-filters.html#toc-kerndeint">9.48 kerndeint</a></h2>
6250 <p>Deinterlace input video by applying Donald Graft’s adaptive kernel
6251 deinterling. Work on interlaced parts of a video to produce
6254 <p>The description of the accepted parameters follows.
6256 <dl compact="compact">
6257 <dt> ‘<samp>thresh</samp>’</dt>
6258 <dd><p>Set the threshold which affects the filter’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.
6264 <dt> ‘<samp>map</samp>’</dt>
6265 <dd><p>Paint pixels exceeding the threshold value to white if set to 1.
6269 <dt> ‘<samp>order</samp>’</dt>
6270 <dd><p>Set the fields order. Swap fields if set to 1, leave fields alone if
6274 <dt> ‘<samp>sharp</samp>’</dt>
6275 <dd><p>Enable additional sharpening if set to 1. Default is 0.
6278 <dt> ‘<samp>twoway</samp>’</dt>
6279 <dd><p>Enable twoway sharpening if set to 1. Default is 0.
6283 <a name="Examples-26"></a>
6284 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-26">9.48.1 Examples</a></h3>
6288 Apply default values:
6289 <table><tr><td> </td><td><pre class="example">kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0
6290 </pre></td></tr></table>
6293 Enable additional sharpening:
6294 <table><tr><td> </td><td><pre class="example">kerndeint=sharp=1
6295 </pre></td></tr></table>
6298 Paint processed pixels in white:
6299 <table><tr><td> </td><td><pre class="example">kerndeint=map=1
6300 </pre></td></tr></table>
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>
6307 <p>Apply a 3D LUT to an input video.
6309 <p>The filter accepts the following options:
6311 <dl compact="compact">
6312 <dt> ‘<samp>file</samp>’</dt>
6313 <dd><p>Set the 3D LUT file name.
6315 <p>Currently supported formats:
6316 </p><dl compact="compact">
6317 <dt> ‘<samp>3dl</samp>’</dt>
6320 <dt> ‘<samp>cube</samp>’</dt>
6323 <dt> ‘<samp>dat</samp>’</dt>
6326 <dt> ‘<samp>m3d</samp>’</dt>
6331 <dt> ‘<samp>interp</samp>’</dt>
6332 <dd><p>Select interpolation mode.
6334 <p>Available values are:
6336 <dl compact="compact">
6337 <dt> ‘<samp>nearest</samp>’</dt>
6338 <dd><p>Use values from the nearest defined point.
6340 <dt> ‘<samp>trilinear</samp>’</dt>
6341 <dd><p>Interpolate values using the 8 points defining a cube.
6343 <dt> ‘<samp>tetrahedral</samp>’</dt>
6344 <dd><p>Interpolate values using a tetrahedron.
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>
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.
6356 <p><var>lutyuv</var> applies a lookup table to a YUV input video, <var>lutrgb</var>
6357 to an RGB input video.
6359 <p>These filters accept the following options:
6360 </p><dl compact="compact">
6361 <dt> ‘<samp>c0</samp>’</dt>
6362 <dd><p>set first pixel component expression
6364 <dt> ‘<samp>c1</samp>’</dt>
6365 <dd><p>set second pixel component expression
6367 <dt> ‘<samp>c2</samp>’</dt>
6368 <dd><p>set third pixel component expression
6370 <dt> ‘<samp>c3</samp>’</dt>
6371 <dd><p>set fourth pixel component expression, corresponds to the alpha component
6374 <dt> ‘<samp>r</samp>’</dt>
6375 <dd><p>set red component expression
6377 <dt> ‘<samp>g</samp>’</dt>
6378 <dd><p>set green component expression
6380 <dt> ‘<samp>b</samp>’</dt>
6381 <dd><p>set blue component expression
6383 <dt> ‘<samp>a</samp>’</dt>
6384 <dd><p>alpha component expression
6387 <dt> ‘<samp>y</samp>’</dt>
6388 <dd><p>set Y/luminance component expression
6390 <dt> ‘<samp>u</samp>’</dt>
6391 <dd><p>set U/Cb component expression
6393 <dt> ‘<samp>v</samp>’</dt>
6394 <dd><p>set V/Cr component expression
6398 <p>Each of them specifies the expression to use for computing the lookup table for
6399 the corresponding pixel component values.
6401 <p>The exact component associated to each of the <var>c*</var> options depends on the
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.
6407 <p>The expressions can contain the following constants and functions:
6409 <dl compact="compact">
6410 <dt> ‘<samp>w</samp>’</dt>
6411 <dt> ‘<samp>h</samp>’</dt>
6412 <dd><p>the input width and height
6415 <dt> ‘<samp>val</samp>’</dt>
6416 <dd><p>input value for the pixel component
6419 <dt> ‘<samp>clipval</samp>’</dt>
6420 <dd><p>the input value clipped in the <var>minval</var>-<var>maxval</var> range
6423 <dt> ‘<samp>maxval</samp>’</dt>
6424 <dd><p>maximum value for the pixel component
6427 <dt> ‘<samp>minval</samp>’</dt>
6428 <dd><p>minimum value for the pixel component
6431 <dt> ‘<samp>negval</samp>’</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 "maxval-clipval+minval"
6437 <dt> ‘<samp>clip(val)</samp>’</dt>
6438 <dd><p>the computed value in <var>val</var> clipped in the
6439 <var>minval</var>-<var>maxval</var> range
6442 <dt> ‘<samp>gammaval(gamma)</samp>’</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
6446 "pow((clipval-minval)/(maxval-minval)\,<var>gamma</var>)*(maxval-minval)+minval"
6451 <p>All expressions default to "val".
6453 <a name="Examples-4"></a>
6454 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-4">9.50.1 Examples</a></h3>
6459 <table><tr><td> </td><td><pre class="example">lutrgb="r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val"
6460 lutyuv="y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val"
6461 </pre></td></tr></table>
6463 <p>The above is the same as:
6464 </p><table><tr><td> </td><td><pre class="example">lutrgb="r=negval:g=negval:b=negval"
6465 lutyuv="y=negval:u=negval:v=negval"
6466 </pre></td></tr></table>
6470 <table><tr><td> </td><td><pre class="example">lutyuv=y=negval
6471 </pre></td></tr></table>
6474 Remove chroma components, turns the video into a graytone image:
6475 <table><tr><td> </td><td><pre class="example">lutyuv="u=128:v=128"
6476 </pre></td></tr></table>
6479 Apply a luma burning effect:
6480 <table><tr><td> </td><td><pre class="example">lutyuv="y=2*val"
6481 </pre></td></tr></table>
6484 Remove green and blue components:
6485 <table><tr><td> </td><td><pre class="example">lutrgb="g=0:b=0"
6486 </pre></td></tr></table>
6489 Set a constant alpha channel value on input:
6490 <table><tr><td> </td><td><pre class="example">format=rgba,lutrgb=a="maxval-minval/2"
6491 </pre></td></tr></table>
6494 Correct luminance gamma by a 0.5 factor:
6495 <table><tr><td> </td><td><pre class="example">lutyuv=y=gammaval(0.5)
6496 </pre></td></tr></table>
6499 Discard least significant bits of luma:
6500 <table><tr><td> </td><td><pre class="example">lutyuv=y='bitand(val, 128+64+32)'
6501 </pre></td></tr></table>
6504 <a name="mergeplanes"></a>
6505 <h2 class="section"><a href="ffmpeg-filters.html#toc-mergeplanes">9.51 mergeplanes</a></h2>
6507 <p>Merge color channel components from several video streams.
6509 <p>The filter accepts up to 4 input streams, and merge selected input
6510 planes to the output video.
6512 <p>This filter accepts the following options:
6513 </p><dl compact="compact">
6514 <dt> ‘<samp>mapping</samp>’</dt>
6515 <dd><p>Set input to output plane mapping. Default is <code>0</code>.
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]]]. ’Aa’ describes the
6519 mapping for the first plane of the output stream. ’A’ sets the number of
6520 the input stream to use (from 0 to 3), and ’a’ the plane number of the
6521 corresponding input to use (from 0 to 3). The rest of the mappings is
6522 similar, ’Bb’ describes the mapping for the output stream second
6523 plane, ’Cc’ describes the mapping for the output stream third plane and
6524 ’Dd’ describes the mapping for the output stream fourth plane.
6527 <dt> ‘<samp>format</samp>’</dt>
6528 <dd><p>Set output pixel format. Default is <code>yuva444p</code>.
6532 <a name="Examples-56"></a>
6533 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-56">9.51.1 Examples</a></h3>
6537 Merge three gray video streams of same width and height into single video stream:
6538 <table><tr><td> </td><td><pre class="example">[a0][a1][a2]mergeplanes=0x001020:yuv444p
6539 </pre></td></tr></table>
6542 Merge 1st yuv444p stream and 2nd gray video stream into yuva444p video stream:
6543 <table><tr><td> </td><td><pre class="example">[a0][a1]mergeplanes=0x00010210:yuva444p
6544 </pre></td></tr></table>
6547 Swap Y and A plane in yuva444p stream:
6548 <table><tr><td> </td><td><pre class="example">format=yuva444p,mergeplanes=0x03010200:yuva444p
6549 </pre></td></tr></table>
6552 Swap U and V plane in yuv420p stream:
6553 <table><tr><td> </td><td><pre class="example">format=yuv420p,mergeplanes=0x000201:yuv420p
6554 </pre></td></tr></table>
6557 Cast a rgb24 clip to yuv444p:
6558 <table><tr><td> </td><td><pre class="example">format=rgb24,mergeplanes=0x000102:yuv444p
6559 </pre></td></tr></table>
6562 <a name="mcdeint"></a>
6563 <h2 class="section"><a href="ffmpeg-filters.html#toc-mcdeint">9.52 mcdeint</a></h2>
6565 <p>Apply motion-compensation deinterlacing.
6567 <p>It needs one field per frame as input and must thus be used together
6568 with yadif=1/3 or equivalent.
6570 <p>This filter accepts the following options:
6571 </p><dl compact="compact">
6572 <dt> ‘<samp>mode</samp>’</dt>
6573 <dd><p>Set the deinterlacing mode.
6575 <p>It accepts one of the following values:
6576 </p><dl compact="compact">
6577 <dt> ‘<samp>fast</samp>’</dt>
6578 <dt> ‘<samp>medium</samp>’</dt>
6579 <dt> ‘<samp>slow</samp>’</dt>
6580 <dd><p>use iterative motion estimation
6582 <dt> ‘<samp>extra_slow</samp>’</dt>
6583 <dd><p>like ‘<samp>slow</samp>’, but use multiple reference frames.
6586 <p>Default value is ‘<samp>fast</samp>’.
6589 <dt> ‘<samp>parity</samp>’</dt>
6590 <dd><p>Set the picture field parity assumed for the input video. It must be
6591 one of the following values:
6593 <dl compact="compact">
6594 <dt> ‘<samp>0, tff</samp>’</dt>
6595 <dd><p>assume top field first
6597 <dt> ‘<samp>1, bff</samp>’</dt>
6598 <dd><p>assume bottom field first
6602 <p>Default value is ‘<samp>bff</samp>’.
6605 <dt> ‘<samp>qp</samp>’</dt>
6606 <dd><p>Set per-block quantization parameter (QP) used by the internal
6609 <p>Higher values should result in a smoother motion vector field but less
6610 optimal individual vectors. Default value is 1.
6615 <h2 class="section"><a href="ffmpeg-filters.html#toc-mp">9.53 mp</a></h2>
6617 <p>Apply an MPlayer filter to the input video.
6619 <p>This filter provides a wrapper around some of the filters of
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.
6627 <p>The filter accepts the parameters:
6628 <var>filter_name</var>[:=]<var>filter_params</var>
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
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>
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 "VIDEO FILTERS" section in the MPlayer manual.
6649 <a name="Examples-50"></a>
6650 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-50">9.53.1 Examples</a></h3>
6654 Adjust gamma, brightness, contrast:
6655 <table><tr><td> </td><td><pre class="example">mp=eq2=1.0:2:0.5
6656 </pre></td></tr></table>
6659 <p>See also mplayer(1), <a href="http://www.mplayerhq.hu/">http://www.mplayerhq.hu/</a>.
6661 <a name="mpdecimate"></a>
6662 <h2 class="section"><a href="ffmpeg-filters.html#toc-mpdecimate">9.54 mpdecimate</a></h2>
6664 <p>Drop frames that do not differ greatly from the previous frame in
6665 order to reduce frame rate.
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.
6671 <p>A description of the accepted options follows.
6673 <dl compact="compact">
6674 <dt> ‘<samp>max</samp>’</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.
6680 <p>Default value is 0.
6683 <dt> ‘<samp>hi</samp>’</dt>
6684 <dt> ‘<samp>lo</samp>’</dt>
6685 <dt> ‘<samp>frac</samp>’</dt>
6686 <dd><p>Set the dropping threshold values.
6688 <p>Values for ‘<samp>hi</samp>’ and ‘<samp>lo</samp>’ 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.
6693 <p>A frame is a candidate for dropping if no 8x8 blocks differ by more
6694 than a threshold of ‘<samp>hi</samp>’, and if no more than ‘<samp>frac</samp>’ blocks (1
6695 meaning the whole image) differ by more than a threshold of ‘<samp>lo</samp>’.
6697 <p>Default value for ‘<samp>hi</samp>’ is 64*12, default value for ‘<samp>lo</samp>’ is
6698 64*5, and default value for ‘<samp>frac</samp>’ is 0.33.
6703 <a name="negate"></a>
6704 <h2 class="section"><a href="ffmpeg-filters.html#toc-negate">9.55 negate</a></h2>
6706 <p>Negate input video.
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.
6711 <a name="noformat"></a>
6712 <h2 class="section"><a href="ffmpeg-filters.html#toc-noformat">9.56 noformat</a></h2>
6714 <p>Force libavfilter not to use any of the specified pixel formats for the
6715 input to the next filter.
6717 <p>This filter accepts the following parameters:
6718 </p><dl compact="compact">
6719 <dt> ‘<samp>pix_fmts</samp>’</dt>
6720 <dd><p>A ’|’-separated list of pixel format names, for example
6721 "pix_fmts=yuv420p|monow|rgb24".
6726 <a name="Examples-25"></a>
6727 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-25">9.56.1 Examples</a></h3>
6731 Force libavfilter to use a format different from <var>yuv420p</var> for the
6732 input to the vflip filter:
6733 <table><tr><td> </td><td><pre class="example">noformat=pix_fmts=yuv420p,vflip
6734 </pre></td></tr></table>
6737 Convert the input video to any of the formats not contained in the list:
6738 <table><tr><td> </td><td><pre class="example">noformat=yuv420p|yuv444p|yuv410p
6739 </pre></td></tr></table>
6742 <a name="noise"></a>
6743 <h2 class="section"><a href="ffmpeg-filters.html#toc-noise">9.57 noise</a></h2>
6745 <p>Add noise on video input frame.
6747 <p>The filter accepts the following options:
6749 <dl compact="compact">
6750 <dt> ‘<samp>all_seed</samp>’</dt>
6751 <dt> ‘<samp>c0_seed</samp>’</dt>
6752 <dt> ‘<samp>c1_seed</samp>’</dt>
6753 <dt> ‘<samp>c2_seed</samp>’</dt>
6754 <dt> ‘<samp>c3_seed</samp>’</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>.
6759 <dt> ‘<samp>all_strength, alls</samp>’</dt>
6760 <dt> ‘<samp>c0_strength, c0s</samp>’</dt>
6761 <dt> ‘<samp>c1_strength, c1s</samp>’</dt>
6762 <dt> ‘<samp>c2_strength, c2s</samp>’</dt>
6763 <dt> ‘<samp>c3_strength, c3s</samp>’</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].
6768 <dt> ‘<samp>all_flags, allf</samp>’</dt>
6769 <dt> ‘<samp>c0_flags, c0f</samp>’</dt>
6770 <dt> ‘<samp>c1_flags, c1f</samp>’</dt>
6771 <dt> ‘<samp>c2_flags, c2f</samp>’</dt>
6772 <dt> ‘<samp>c3_flags, c3f</samp>’</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> ‘<samp>a</samp>’</dt>
6777 <dd><p>averaged temporal noise (smoother)
6779 <dt> ‘<samp>p</samp>’</dt>
6780 <dd><p>mix random noise with a (semi)regular pattern
6782 <dt> ‘<samp>t</samp>’</dt>
6783 <dd><p>temporal noise (noise pattern changes between frames)
6785 <dt> ‘<samp>u</samp>’</dt>
6786 <dd><p>uniform noise (gaussian otherwise)
6792 <a name="Examples-53"></a>
6793 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-53">9.57.1 Examples</a></h3>
6795 <p>Add temporal and uniform noise to input video:
6796 </p><table><tr><td> </td><td><pre class="example">noise=alls=20:allf=t+u
6797 </pre></td></tr></table>
6800 <h2 class="section"><a href="ffmpeg-filters.html#toc-null">9.58 null</a></h2>
6802 <p>Pass the video source unchanged to the output.
6805 <h2 class="section"><a href="ffmpeg-filters.html#toc-ocv">9.59 ocv</a></h2>
6807 <p>Apply video transform using libopencv.
6809 <p>To enable this filter install libopencv library and headers and
6810 configure FFmpeg with <code>--enable-libopencv</code>.
6812 <p>This filter accepts the following parameters:
6814 <dl compact="compact">
6815 <dt> ‘<samp>filter_name</samp>’</dt>
6816 <dd><p>The name of the libopencv filter to apply.
6819 <dt> ‘<samp>filter_params</samp>’</dt>
6820 <dd><p>The parameters to pass to the libopencv filter. If not specified the default
6826 <p>Refer to the official libopencv documentation for more precise
6828 <a href="http://opencv.willowgarage.com/documentation/c/image_filtering.html">http://opencv.willowgarage.com/documentation/c/image_filtering.html</a>
6830 <p>Follows the list of supported libopencv filters.
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>
6836 <p>Dilate an image by using a specific structuring element.
6837 This filter corresponds to the libopencv function <code>cvDilate</code>.
6839 <p>It accepts the parameters: <var>struct_el</var>|<var>nb_iterations</var>.
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>
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 "rect", "cross", "ellipse", "custom".
6849 <p>If the value for <var>shape</var> is "custom", it must be followed by a
6850 string of the form "=<var>filename</var>". 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.
6856 <p>The default value for <var>struct_el</var> is "3x3+0x0/rect".
6858 <p><var>nb_iterations</var> specifies the number of times the transform is
6859 applied to the image, and defaults to 1.
6861 <p>Follow some example:
6862 </p><table><tr><td> </td><td><pre class="example"># use the default values
6865 # dilate using a structuring element with a 5x5 cross, iterate two times
6866 ocv=filter_name=dilate:filter_params=5x5+2x2/cross|2
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:
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>
6879 <a name="erode"></a>
6880 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-erode">9.59.2 erode</a></h3>
6882 <p>Erode an image by using a specific structuring element.
6883 This filter corresponds to the libopencv function <code>cvErode</code>.
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.
6888 <a name="smooth"></a>
6889 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-smooth">9.59.3 smooth</a></h3>
6891 <p>Smooth the input video.
6893 <p>The filter takes the following parameters:
6894 <var>type</var>|<var>param1</var>|<var>param2</var>|<var>param3</var>|<var>param4</var>.
6896 <p><var>type</var> is the type of smooth filter to apply, and can be one of
6897 the following values: "blur", "blur_no_scale", "median", "gaussian",
6898 "bilateral". The default value is "gaussian".
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.
6905 <p>The default value for <var>param1</var> is 3, the default value for the
6906 other parameters is 0.
6908 <p>These parameters correspond to the parameters assigned to the
6909 libopencv function <code>cvSmooth</code>.
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>
6915 <p>Overlay one video on top of another.
6917 <p>It takes two inputs and one output, the first input is the "main"
6918 video on which the second input is overlayed.
6920 <p>This filter accepts the following parameters:
6922 <p>A description of the accepted options follows.
6924 <dl compact="compact">
6925 <dt> ‘<samp>x</samp>’</dt>
6926 <dt> ‘<samp>y</samp>’</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 "0" 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).
6933 <dt> ‘<samp>eof_action</samp>’</dt>
6934 <dd><p>The action to take when EOF is encountered on the secondary input, accepts one
6935 of the following values:
6937 <dl compact="compact">
6938 <dt> ‘<samp>repeat</samp>’</dt>
6939 <dd><p>repeat the last frame (the default)
6941 <dt> ‘<samp>endall</samp>’</dt>
6942 <dd><p>end both streams
6944 <dt> ‘<samp>pass</samp>’</dt>
6945 <dd><p>pass through the main input
6950 <dt> ‘<samp>eval</samp>’</dt>
6951 <dd><p>Set when the expressions for ‘<samp>x</samp>’, and ‘<samp>y</samp>’ are evaluated.
6953 <p>It accepts the following values:
6954 </p><dl compact="compact">
6955 <dt> ‘<samp>init</samp>’</dt>
6956 <dd><p>only evaluate expressions once during the filter initialization or
6957 when a command is processed
6960 <dt> ‘<samp>frame</samp>’</dt>
6961 <dd><p>evaluate expressions for each incoming frame
6965 <p>Default value is ‘<samp>frame</samp>’.
6968 <dt> ‘<samp>shortest</samp>’</dt>
6969 <dd><p>If set to 1, force the output to terminate when the shortest input
6970 terminates. Default value is 0.
6973 <dt> ‘<samp>format</samp>’</dt>
6974 <dd><p>Set the format for the output video.
6976 <p>It accepts the following values:
6977 </p><dl compact="compact">
6978 <dt> ‘<samp>yuv420</samp>’</dt>
6979 <dd><p>force YUV420 output
6982 <dt> ‘<samp>yuv422</samp>’</dt>
6983 <dd><p>force YUV422 output
6986 <dt> ‘<samp>yuv444</samp>’</dt>
6987 <dd><p>force YUV444 output
6990 <dt> ‘<samp>rgb</samp>’</dt>
6991 <dd><p>force RGB output
6995 <p>Default value is ‘<samp>yuv420</samp>’.
6998 <dt> ‘<samp>rgb <em>(deprecated)</em></samp>’</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 ‘<samp>format</samp>’ instead.
7004 <dt> ‘<samp>repeatlast</samp>’</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.
7011 <p>The ‘<samp>x</samp>’, and ‘<samp>y</samp>’ expressions can contain the following
7014 <dl compact="compact">
7015 <dt> ‘<samp>main_w, W</samp>’</dt>
7016 <dt> ‘<samp>main_h, H</samp>’</dt>
7017 <dd><p>main input width and height
7020 <dt> ‘<samp>overlay_w, w</samp>’</dt>
7021 <dt> ‘<samp>overlay_h, h</samp>’</dt>
7022 <dd><p>overlay input width and height
7025 <dt> ‘<samp>x</samp>’</dt>
7026 <dt> ‘<samp>y</samp>’</dt>
7027 <dd><p>the computed values for <var>x</var> and <var>y</var>. They are evaluated for
7031 <dt> ‘<samp>hsub</samp>’</dt>
7032 <dt> ‘<samp>vsub</samp>’</dt>
7033 <dd><p>horizontal and vertical chroma subsample values of the output
7034 format. For example for the pixel format "yuv422p" <var>hsub</var> is 2 and
7035 <var>vsub</var> is 1.
7038 <dt> ‘<samp>n</samp>’</dt>
7039 <dd><p>the number of input frame, starting from 0
7042 <dt> ‘<samp>pos</samp>’</dt>
7043 <dd><p>the position in the file of the input frame, NAN if unknown
7046 <dt> ‘<samp>t</samp>’</dt>
7047 <dd><p>timestamp expressed in seconds, NAN if the input timestamp is unknown
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 ‘<samp>eval</samp>’ is set to ‘<samp>init</samp>’.
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.
7062 <p>You can chain together more overlays but you should test the
7063 efficiency of such approach.
7065 <a name="Commands-2"></a>
7066 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Commands-2">9.60.1 Commands</a></h3>
7068 <p>This filter supports the following commands:
7069 </p><dl compact="compact">
7070 <dt> ‘<samp>x</samp>’</dt>
7071 <dt> ‘<samp>y</samp>’</dt>
7072 <dd><p>Modify the x and y of the overlay input.
7073 The command accepts the same syntax of the corresponding option.
7075 <p>If the specified expression is not valid, it is kept at its current
7080 <a name="Examples-33"></a>
7081 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-33">9.60.2 Examples</a></h3>
7085 Draw the overlay at 10 pixels from the bottom right corner of the main
7087 <table><tr><td> </td><td><pre class="example">overlay=main_w-overlay_w-10:main_h-overlay_h-10
7088 </pre></td></tr></table>
7090 <p>Using named options the example above becomes:
7091 </p><table><tr><td> </td><td><pre class="example">overlay=x=main_w-overlay_w-10:y=main_h-overlay_h-10
7092 </pre></td></tr></table>
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> </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>
7101 Insert 2 different transparent PNG logos (second logo on bottom
7102 right corner) using the <code>ffmpeg</code> tool:
7103 <table><tr><td> </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>
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> </td><td><pre class="example">color=color=red@.3:size=WxH [over]; [in][over] overlay [out]
7110 </pre></td></tr></table>
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> </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>
7118 <p>The above command is the same as:
7119 </p><table><tr><td> </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>
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> </td><td><pre class="example">overlay=x='if(gte(t,2), -w+(t-2)*20, NAN)':y=0
7126 </pre></td></tr></table>
7129 Compose output by putting two input videos side to side:
7130 <table><tr><td> </td><td><pre class="example">ffmpeg -i left.avi -i right.avi -filter_complex "
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]
7137 </pre></td></tr></table>
7140 mask 10-20 seconds of a video by applying the delogo filter to a section
7141 <table><tr><td> </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]'
7144 </pre></td></tr></table>
7147 Chain several overlays in cascade:
7148 <table><tr><td> </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>
7158 <a name="owdenoise"></a>
7159 <h2 class="section"><a href="ffmpeg-filters.html#toc-owdenoise">9.61 owdenoise</a></h2>
7161 <p>Apply Overcomplete Wavelet denoiser.
7163 <p>The filter accepts the following options:
7165 <dl compact="compact">
7166 <dt> ‘<samp>depth</samp>’</dt>
7169 <p>Larger depth values will denoise lower frequency components more, but
7170 slow down filtering.
7172 <p>Must be an int in the range 8-16, default is <code>8</code>.
7175 <dt> ‘<samp>luma_strength, ls</samp>’</dt>
7176 <dd><p>Set luma strength.
7178 <p>Must be a double value in the range 0-1000, default is <code>1.0</code>.
7181 <dt> ‘<samp>chroma_strength, cs</samp>’</dt>
7182 <dd><p>Set chroma strength.
7184 <p>Must be a double value in the range 0-1000, default is <code>1.0</code>.
7189 <h2 class="section"><a href="ffmpeg-filters.html#toc-pad">9.62 pad</a></h2>
7191 <p>Add paddings to the input image, and place the original input at the
7192 given coordinates <var>x</var>, <var>y</var>.
7194 <p>This filter accepts the following parameters:
7196 <dl compact="compact">
7197 <dt> ‘<samp>width, w</samp>’</dt>
7198 <dt> ‘<samp>height, h</samp>’</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.
7203 <p>The <var>width</var> expression can reference the value set by the
7204 <var>height</var> expression, and vice versa.
7206 <p>The default value of <var>width</var> and <var>height</var> is 0.
7209 <dt> ‘<samp>x</samp>’</dt>
7210 <dt> ‘<samp>y</samp>’</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
7215 <p>The <var>x</var> expression can reference the value set by the <var>y</var>
7216 expression, and vice versa.
7218 <p>The default value of <var>x</var> and <var>y</var> is 0.
7221 <dt> ‘<samp>color</samp>’</dt>
7222 <dd><p>Specify the color of the padded area. For the syntax of this option,
7223 check the "Color" section in the ffmpeg-utils manual.
7225 <p>The default value of <var>color</var> is "black".
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:
7232 <dl compact="compact">
7233 <dt> ‘<samp>in_w</samp>’</dt>
7234 <dt> ‘<samp>in_h</samp>’</dt>
7235 <dd><p>the input video width and height
7238 <dt> ‘<samp>iw</samp>’</dt>
7239 <dt> ‘<samp>ih</samp>’</dt>
7240 <dd><p>same as <var>in_w</var> and <var>in_h</var>
7243 <dt> ‘<samp>out_w</samp>’</dt>
7244 <dt> ‘<samp>out_h</samp>’</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
7249 <dt> ‘<samp>ow</samp>’</dt>
7250 <dt> ‘<samp>oh</samp>’</dt>
7251 <dd><p>same as <var>out_w</var> and <var>out_h</var>
7254 <dt> ‘<samp>x</samp>’</dt>
7255 <dt> ‘<samp>y</samp>’</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
7260 <dt> ‘<samp>a</samp>’</dt>
7261 <dd><p>same as <var>iw</var> / <var>ih</var>
7264 <dt> ‘<samp>sar</samp>’</dt>
7265 <dd><p>input sample aspect ratio
7268 <dt> ‘<samp>dar</samp>’</dt>
7269 <dd><p>input display aspect ratio, it is the same as (<var>iw</var> / <var>ih</var>) * <var>sar</var>
7272 <dt> ‘<samp>hsub</samp>’</dt>
7273 <dt> ‘<samp>vsub</samp>’</dt>
7274 <dd><p>horizontal and vertical chroma subsample values. For example for the
7275 pixel format "yuv422p" <var>hsub</var> is 2 and <var>vsub</var> is 1.
7279 <a name="Examples-39"></a>
7280 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-39">9.62.1 Examples</a></h3>
7284 Add paddings with color "violet" to the input video. Output video
7285 size is 640x480, the top-left corner of the input video is placed at
7287 <table><tr><td> </td><td><pre class="example">pad=640:480:0:40:violet
7288 </pre></td></tr></table>
7290 <p>The example above is equivalent to the following command:
7291 </p><table><tr><td> </td><td><pre class="example">pad=width=640:height=480:x=0:y=40:color=violet
7292 </pre></td></tr></table>
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> </td><td><pre class="example">pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
7298 </pre></td></tr></table>
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> </td><td><pre class="example">pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
7305 </pre></td></tr></table>
7308 Pad the input to get a final w/h ratio of 16:9:
7309 <table><tr><td> </td><td><pre class="example">pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
7310 </pre></td></tr></table>
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> </td><td><pre class="example">(ih * X / ih) * sar = output_dar
7317 X = output_dar / sar
7318 </pre></td></tr></table>
7320 <p>Thus the previous example needs to be modified to:
7321 </p><table><tr><td> </td><td><pre class="example">pad="ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2"
7322 </pre></td></tr></table>
7325 Double output size and put the input video in the bottom-right
7326 corner of the output padded area:
7327 <table><tr><td> </td><td><pre class="example">pad="2*iw:2*ih:ow-iw:oh-ih"
7328 </pre></td></tr></table>
7331 <a name="perspective"></a>
7332 <h2 class="section"><a href="ffmpeg-filters.html#toc-perspective">9.63 perspective</a></h2>
7334 <p>Correct perspective of video not recorded perpendicular to the screen.
7336 <p>A description of the accepted parameters follows.
7338 <dl compact="compact">
7339 <dt> ‘<samp>x0</samp>’</dt>
7340 <dt> ‘<samp>y0</samp>’</dt>
7341 <dt> ‘<samp>x1</samp>’</dt>
7342 <dt> ‘<samp>y1</samp>’</dt>
7343 <dt> ‘<samp>x2</samp>’</dt>
7344 <dt> ‘<samp>y2</samp>’</dt>
7345 <dt> ‘<samp>x3</samp>’</dt>
7346 <dt> ‘<samp>y3</samp>’</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.
7350 <p>The expressions can use the following variables:
7352 <dl compact="compact">
7353 <dt> ‘<samp>W</samp>’</dt>
7354 <dt> ‘<samp>H</samp>’</dt>
7355 <dd><p>the width and height of video frame.
7360 <dt> ‘<samp>interpolation</samp>’</dt>
7361 <dd><p>Set interpolation for perspective correction.
7363 <p>It accepts the following values:
7364 </p><dl compact="compact">
7365 <dt> ‘<samp>linear</samp>’</dt>
7366 <dt> ‘<samp>cubic</samp>’</dt>
7369 <p>Default value is ‘<samp>linear</samp>’.
7373 <a name="phase"></a>
7374 <h2 class="section"><a href="ffmpeg-filters.html#toc-phase">9.64 phase</a></h2>
7376 <p>Delay interlaced video by one field time so that the field order changes.
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.
7381 <p>A description of the accepted parameters follows.
7383 <dl compact="compact">
7384 <dt> ‘<samp>mode</samp>’</dt>
7385 <dd><p>Set phase mode.
7387 <p>It accepts the following values:
7388 </p><dl compact="compact">
7389 <dt> ‘<samp>t</samp>’</dt>
7390 <dd><p>Capture field order top-first, transfer bottom-first.
7391 Filter will delay the bottom field.
7394 <dt> ‘<samp>b</samp>’</dt>
7395 <dd><p>Capture field order bottom-first, transfer top-first.
7396 Filter will delay the top field.
7399 <dt> ‘<samp>p</samp>’</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.
7405 <dt> ‘<samp>a</samp>’</dt>
7406 <dd><p>Capture field order determined automatically by field flags, transfer
7408 Filter selects among ‘<samp>t</samp>’ and ‘<samp>b</samp>’ modes on a frame by frame
7409 basis using field flags. If no field information is available,
7410 then this works just like ‘<samp>u</samp>’.
7413 <dt> ‘<samp>u</samp>’</dt>
7414 <dd><p>Capture unknown or varying, transfer opposite.
7415 Filter selects among ‘<samp>t</samp>’ and ‘<samp>b</samp>’ on a frame by frame basis by
7416 analyzing the images and selecting the alternative that produces best
7417 match between the fields.
7420 <dt> ‘<samp>T</samp>’</dt>
7421 <dd><p>Capture top-first, transfer unknown or varying.
7422 Filter selects among ‘<samp>t</samp>’ and ‘<samp>p</samp>’ using image analysis.
7425 <dt> ‘<samp>B</samp>’</dt>
7426 <dd><p>Capture bottom-first, transfer unknown or varying.
7427 Filter selects among ‘<samp>b</samp>’ and ‘<samp>p</samp>’ using image analysis.
7430 <dt> ‘<samp>A</samp>’</dt>
7431 <dd><p>Capture determined by field flags, transfer unknown or varying.
7432 Filter selects among ‘<samp>t</samp>’, ‘<samp>b</samp>’ and ‘<samp>p</samp>’ using field flags and
7433 image analysis. If no field information is available, then this works just
7434 like ‘<samp>U</samp>’. This is the default mode.
7437 <dt> ‘<samp>U</samp>’</dt>
7438 <dd><p>Both capture and transfer unknown or varying.
7439 Filter selects among ‘<samp>t</samp>’, ‘<samp>b</samp>’ and ‘<samp>p</samp>’ using image analysis only.
7445 <a name="pixdesctest"></a>
7446 <h2 class="section"><a href="ffmpeg-filters.html#toc-pixdesctest">9.65 pixdesctest</a></h2>
7448 <p>Pixel format descriptor test filter, mainly useful for internal
7449 testing. The output video should be equal to the input video.
7452 </p><table><tr><td> </td><td><pre class="example">format=monow, pixdesctest
7453 </pre></td></tr></table>
7455 <p>can be used to test the monowhite pixel format descriptor definition.
7458 <h2 class="section"><a href="ffmpeg-filters.html#toc-pp">9.66 pp</a></h2>
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 ’/’ and can be disabled by prepending a ’-’.
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.
7466 <p>The filters accept the following options:
7468 <dl compact="compact">
7469 <dt> ‘<samp>subfilters</samp>’</dt>
7470 <dd><p>Set postprocessing subfilters string.
7474 <p>All subfilters share common options to determine their scope:
7476 <dl compact="compact">
7477 <dt> ‘<samp>a/autoq</samp>’</dt>
7478 <dd><p>Honor the quality commands for this subfilter.
7481 <dt> ‘<samp>c/chrom</samp>’</dt>
7482 <dd><p>Do chrominance filtering, too (default).
7485 <dt> ‘<samp>y/nochrom</samp>’</dt>
7486 <dd><p>Do luminance filtering only (no chrominance).
7489 <dt> ‘<samp>n/noluma</samp>’</dt>
7490 <dd><p>Do chrominance filtering only (no luminance).
7494 <p>These options can be appended after the subfilter name, separated by a ’|’.
7496 <p>Available subfilters are:
7498 <dl compact="compact">
7499 <dt> ‘<samp>hb/hdeblock[|difference[|flatness]]</samp>’</dt>
7500 <dd><p>Horizontal deblocking filter
7501 </p><dl compact="compact">
7502 <dt> ‘<samp>difference</samp>’</dt>
7503 <dd><p>Difference factor where higher values mean more deblocking (default: <code>32</code>).
7505 <dt> ‘<samp>flatness</samp>’</dt>
7506 <dd><p>Flatness threshold where lower values mean more deblocking (default: <code>39</code>).
7511 <dt> ‘<samp>vb/vdeblock[|difference[|flatness]]</samp>’</dt>
7512 <dd><p>Vertical deblocking filter
7513 </p><dl compact="compact">
7514 <dt> ‘<samp>difference</samp>’</dt>
7515 <dd><p>Difference factor where higher values mean more deblocking (default: <code>32</code>).
7517 <dt> ‘<samp>flatness</samp>’</dt>
7518 <dd><p>Flatness threshold where lower values mean more deblocking (default: <code>39</code>).
7523 <dt> ‘<samp>ha/hadeblock[|difference[|flatness]]</samp>’</dt>
7524 <dd><p>Accurate horizontal deblocking filter
7525 </p><dl compact="compact">
7526 <dt> ‘<samp>difference</samp>’</dt>
7527 <dd><p>Difference factor where higher values mean more deblocking (default: <code>32</code>).
7529 <dt> ‘<samp>flatness</samp>’</dt>
7530 <dd><p>Flatness threshold where lower values mean more deblocking (default: <code>39</code>).
7535 <dt> ‘<samp>va/vadeblock[|difference[|flatness]]</samp>’</dt>
7536 <dd><p>Accurate vertical deblocking filter
7537 </p><dl compact="compact">
7538 <dt> ‘<samp>difference</samp>’</dt>
7539 <dd><p>Difference factor where higher values mean more deblocking (default: <code>32</code>).
7541 <dt> ‘<samp>flatness</samp>’</dt>
7542 <dd><p>Flatness threshold where lower values mean more deblocking (default: <code>39</code>).
7548 <p>The horizontal and vertical deblocking filters share the difference and
7549 flatness values so you cannot set different horizontal and vertical
7552 <dl compact="compact">
7553 <dt> ‘<samp>h1/x1hdeblock</samp>’</dt>
7554 <dd><p>Experimental horizontal deblocking filter
7557 <dt> ‘<samp>v1/x1vdeblock</samp>’</dt>
7558 <dd><p>Experimental vertical deblocking filter
7561 <dt> ‘<samp>dr/dering</samp>’</dt>
7562 <dd><p>Deringing filter
7565 <dt> ‘<samp>tn/tmpnoise[|threshold1[|threshold2[|threshold3]]], temporal noise reducer</samp>’</dt>
7566 <dd><dl compact="compact">
7567 <dt> ‘<samp>threshold1</samp>’</dt>
7568 <dd><p>larger -> stronger filtering
7570 <dt> ‘<samp>threshold2</samp>’</dt>
7571 <dd><p>larger -> stronger filtering
7573 <dt> ‘<samp>threshold3</samp>’</dt>
7574 <dd><p>larger -> stronger filtering
7579 <dt> ‘<samp>al/autolevels[:f/fullyrange], automatic brightness / contrast correction</samp>’</dt>
7580 <dd><dl compact="compact">
7581 <dt> ‘<samp>f/fullyrange</samp>’</dt>
7582 <dd><p>Stretch luminance to <code>0-255</code>.
7587 <dt> ‘<samp>lb/linblenddeint</samp>’</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.
7592 <dt> ‘<samp>li/linipoldeint</samp>’</dt>
7593 <dd><p>Linear interpolating deinterlacing filter that deinterlaces the given block by
7594 linearly interpolating every second line.
7597 <dt> ‘<samp>ci/cubicipoldeint</samp>’</dt>
7598 <dd><p>Cubic interpolating deinterlacing filter deinterlaces the given block by
7599 cubically interpolating every second line.
7602 <dt> ‘<samp>md/mediandeint</samp>’</dt>
7603 <dd><p>Median deinterlacing filter that deinterlaces the given block by applying a
7604 median filter to every second line.
7607 <dt> ‘<samp>fd/ffmpegdeint</samp>’</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.
7612 <dt> ‘<samp>l5/lowpass5</samp>’</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.
7617 <dt> ‘<samp>fq/forceQuant[|quantizer]</samp>’</dt>
7618 <dd><p>Overrides the quantizer table from the input with the constant quantizer you
7620 </p><dl compact="compact">
7621 <dt> ‘<samp>quantizer</samp>’</dt>
7622 <dd><p>Quantizer to use
7627 <dt> ‘<samp>de/default</samp>’</dt>
7628 <dd><p>Default pp filter combination (<code>hb|a,vb|a,dr|a</code>)
7631 <dt> ‘<samp>fa/fast</samp>’</dt>
7632 <dd><p>Fast pp filter combination (<code>h1|a,v1|a,dr|a</code>)
7635 <dt> ‘<samp>ac</samp>’</dt>
7636 <dd><p>High quality pp filter combination (<code>ha|a|128|7,va|a,dr|a</code>)
7640 <a name="Examples-43"></a>
7641 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-43">9.66.1 Examples</a></h3>
7645 Apply horizontal and vertical deblocking, deringing and automatic
7646 brightness/contrast:
7647 <table><tr><td> </td><td><pre class="example">pp=hb/vb/dr/al
7648 </pre></td></tr></table>
7651 Apply default filters without brightness/contrast correction:
7652 <table><tr><td> </td><td><pre class="example">pp=de/-al
7653 </pre></td></tr></table>
7656 Apply default filters and temporal denoiser:
7657 <table><tr><td> </td><td><pre class="example">pp=default/tmpnoise|1|2|3
7658 </pre></td></tr></table>
7661 Apply deblocking on luminance only, and switch vertical deblocking on or off
7662 automatically depending on available CPU time:
7663 <table><tr><td> </td><td><pre class="example">pp=hb|y/vb|a
7664 </pre></td></tr></table>
7668 <h2 class="section"><a href="ffmpeg-filters.html#toc-psnr">9.67 psnr</a></h2>
7670 <p>Obtain the average, maximum and minimum PSNR (Peak Signal to Noise
7671 Ratio) between two input videos.
7673 <p>This filter takes in input two input videos, the first input is
7674 considered the "main" source and is passed unchanged to the
7675 output. The second input is used as a "reference" video for computing
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.
7682 <p>The obtained average PSNR is printed through the logging system.
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:
7688 <table><tr><td> </td><td><pre class="example">PSNR = 10*log10(MAX^2/MSE)
7689 </pre></td></tr></table>
7691 <p>Where MAX is the average of the maximum values of each component of the
7694 <p>The description of the accepted parameters follows.
7696 <dl compact="compact">
7697 <dt> ‘<samp>stats_file, f</samp>’</dt>
7698 <dd><p>If specified the filter will use the named file to save the PSNR of
7699 each individual frame.
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
7707 <p>A description of each shown parameter follows:
7709 <dl compact="compact">
7710 <dt> ‘<samp>n</samp>’</dt>
7711 <dd><p>sequential number of the input frame, starting from 1
7714 <dt> ‘<samp>mse_avg</samp>’</dt>
7715 <dd><p>Mean Square Error pixel-by-pixel average difference of the compared
7716 frames, averaged over all the image components.
7719 <dt> ‘<samp>mse_y, mse_u, mse_v, mse_r, mse_g, mse_g, mse_a</samp>’</dt>
7720 <dd><p>Mean Square Error pixel-by-pixel average difference of the compared
7721 frames for the component specified by the suffix.
7724 <dt> ‘<samp>psnr_y, psnr_u, psnr_v, psnr_r, psnr_g, psnr_b, psnr_a</samp>’</dt>
7725 <dd><p>Peak Signal to Noise ratio of the compared frames for the component
7726 specified by the suffix.
7731 </p><table><tr><td> </td><td><pre class="example">movie=ref_movie.mpg, setpts=PTS-STARTPTS [main];
7732 [main][ref] psnr="stats_file=stats.log" [out]
7733 </pre></td></tr></table>
7735 <p>On this example the input file being processed is compared with the
7736 reference file ‘<tt>ref_movie.mpg</tt>’. The PSNR of each individual frame
7737 is stored in ‘<tt>stats.log</tt>’.
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>
7743 <p>Pulldown reversal (inverse telecine) filter, capable of handling mixed
7744 hard-telecine, 24000/1001 fps progressive, and 30000/1001 fps progressive
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.
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.
7756 <p>The filter accepts the following options:
7758 <dl compact="compact">
7759 <dt> ‘<samp>jl</samp>’</dt>
7760 <dt> ‘<samp>jr</samp>’</dt>
7761 <dt> ‘<samp>jt</samp>’</dt>
7762 <dt> ‘<samp>jb</samp>’</dt>
7763 <dd><p>These options set the amount of "junk" 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.
7769 <dt> ‘<samp>sb</samp>’</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>.
7779 <dt> ‘<samp>mp</samp>’</dt>
7780 <dd><p>Set the metric plane to use. It accepts the following values:
7781 </p><dl compact="compact">
7782 <dt> ‘<samp>l</samp>’</dt>
7783 <dd><p>Use luma plane.
7786 <dt> ‘<samp>u</samp>’</dt>
7787 <dd><p>Use chroma blue plane.
7790 <dt> ‘<samp>v</samp>’</dt>
7791 <dd><p>Use chroma red plane.
7795 <p>This option may be set to use chroma plane instead of the default luma plane
7796 for doing filter’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 ‘<samp>mp</samp>’ to a chroma plane is to reduce CPU
7800 load and make pullup usable in realtime on slow machines.
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> </td><td><pre class="example">ffmpeg -i input -vf pullup -r 24000/1001 ...
7808 </pre></td></tr></table>
7810 <a name="removelogo"></a>
7811 <h2 class="section"><a href="ffmpeg-filters.html#toc-removelogo">9.69 removelogo</a></h2>
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.
7817 <p>The filter accepts the following options:
7819 <dl compact="compact">
7820 <dt> ‘<samp>filename, f</samp>’</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.
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.
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.
7842 <a name="rotate"></a>
7843 <h2 class="section"><a href="ffmpeg-filters.html#toc-rotate">9.70 rotate</a></h2>
7845 <p>Rotate video by an arbitrary angle expressed in radians.
7847 <p>The filter accepts the following options:
7849 <p>A description of the optional parameters follows.
7850 </p><dl compact="compact">
7851 <dt> ‘<samp>angle, a</samp>’</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 "0".
7856 <p>This expression is evaluated for each frame.
7859 <dt> ‘<samp>out_w, ow</samp>’</dt>
7860 <dd><p>Set the output width expression, default value is "iw".
7861 This expression is evaluated just once during configuration.
7864 <dt> ‘<samp>out_h, oh</samp>’</dt>
7865 <dd><p>Set the output height expression, default value is "ih".
7866 This expression is evaluated just once during configuration.
7869 <dt> ‘<samp>bilinear</samp>’</dt>
7870 <dd><p>Enable bilinear interpolation if set to 1, a value of 0 disables
7871 it. Default value is 1.
7874 <dt> ‘<samp>fillcolor, c</samp>’</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 "Color" section in the
7877 ffmpeg-utils manual. If the special value "none" is selected then no
7878 background is printed (useful for example if the background is never shown).
7880 <p>Default value is "black".
7884 <p>The expressions for the angle and the output size can contain the
7885 following constants and functions:
7887 <dl compact="compact">
7888 <dt> ‘<samp>n</samp>’</dt>
7889 <dd><p>sequential number of the input frame, starting from 0. It is always NAN
7890 before the first frame is filtered.
7893 <dt> ‘<samp>t</samp>’</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.
7898 <dt> ‘<samp>hsub</samp>’</dt>
7899 <dt> ‘<samp>vsub</samp>’</dt>
7900 <dd><p>horizontal and vertical chroma subsample values. For example for the
7901 pixel format "yuv422p" <var>hsub</var> is 2 and <var>vsub</var> is 1.
7904 <dt> ‘<samp>in_w, iw</samp>’</dt>
7905 <dt> ‘<samp>in_h, ih</samp>’</dt>
7906 <dd><p>the input video width and height
7909 <dt> ‘<samp>out_w, ow</samp>’</dt>
7910 <dt> ‘<samp>out_h, oh</samp>’</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
7915 <dt> ‘<samp>rotw(a)</samp>’</dt>
7916 <dt> ‘<samp>roth(a)</samp>’</dt>
7917 <dd><p>the minimal width/height required for completely containing the input
7918 video rotated by <var>a</var> radians.
7920 <p>These are only available when computing the ‘<samp>out_w</samp>’ and
7921 ‘<samp>out_h</samp>’ expressions.
7925 <a name="Examples-62"></a>
7926 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-62">9.70.1 Examples</a></h3>
7930 Rotate the input by PI/6 radians clockwise:
7931 <table><tr><td> </td><td><pre class="example">rotate=PI/6
7932 </pre></td></tr></table>
7935 Rotate the input by PI/6 radians counter-clockwise:
7936 <table><tr><td> </td><td><pre class="example">rotate=-PI/6
7937 </pre></td></tr></table>
7940 Rotate the input by 45 degrees clockwise:
7941 <table><tr><td> </td><td><pre class="example">rotate=45*PI/180
7942 </pre></td></tr></table>
7945 Apply a constant rotation with period T, starting from an angle of PI/3:
7946 <table><tr><td> </td><td><pre class="example">rotate=PI/3+2*PI*t/T
7947 </pre></td></tr></table>
7950 Make the input video rotation oscillating with a period of T
7951 seconds and an amplitude of A radians:
7952 <table><tr><td> </td><td><pre class="example">rotate=A*sin(2*PI/T*t)
7953 </pre></td></tr></table>
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> </td><td><pre class="example">rotate='2*PI*t:ow=hypot(iw,ih):oh=ow'
7959 </pre></td></tr></table>
7962 Rotate the video, reduce the output size so that no background is ever
7964 <table><tr><td> </td><td><pre class="example">rotate=2*PI*t:ow='min(iw,ih)/sqrt(2)':oh=ow:c=none
7965 </pre></td></tr></table>
7968 <a name="Commands-4"></a>
7969 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Commands-4">9.70.2 Commands</a></h3>
7971 <p>The filter supports the following commands:
7973 <dl compact="compact">
7974 <dt> ‘<samp>a, angle</samp>’</dt>
7975 <dd><p>Set the angle expression.
7976 The command accepts the same syntax of the corresponding option.
7978 <p>If the specified expression is not valid, it is kept at its current
7984 <h2 class="section"><a href="ffmpeg-filters.html#toc-sab">9.71 sab</a></h2>
7986 <p>Apply Shape Adaptive Blur.
7988 <p>The filter accepts the following options:
7990 <dl compact="compact">
7991 <dt> ‘<samp>luma_radius, lr</samp>’</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.
7997 <dt> ‘<samp>luma_pre_filter_radius, lpfr</samp>’</dt>
7998 <dd><p>Set luma pre-filter radius, must be a value in the 0.1-2.0 range, default
8002 <dt> ‘<samp>luma_strength, ls</samp>’</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.
8007 <dt> ‘<samp>chroma_radius, cr</samp>’</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
8013 <dt> ‘<samp>chroma_pre_filter_radius, cpfr</samp>’</dt>
8014 <dd><p>Set chroma pre-filter radius, must be a value in the 0.1-2.0 range.
8017 <dt> ‘<samp>chroma_strength, cs</samp>’</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.
8023 <p>Each chroma option value, if not explicitly specified, is set to the
8024 corresponding luma option value.
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>
8030 <p>Scale (resize) the input video, using the libswscale library.
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.
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
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.
8044 <p>See <a href="ffmpeg-scaler.html#scaler_005foptions">(ffmpeg-scaler)scaler_options</a> for
8045 the complete list of scaler options.
8047 <dl compact="compact">
8048 <dt> ‘<samp>width, w</samp>’</dt>
8049 <dt> ‘<samp>height, h</samp>’</dt>
8050 <dd><p>Set the output video dimension expression. Default value is the input
8053 <p>If the value is 0, the input width is used for the output.
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
8060 <p>If one of the values is -n with n > 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.
8065 <p>See below for the list of accepted constants for use in the dimension
8069 <dt> ‘<samp>interl</samp>’</dt>
8070 <dd><p>Set the interlacing mode. It accepts the following values:
8072 <dl compact="compact">
8073 <dt> ‘<samp>1</samp>’</dt>
8074 <dd><p>Force interlaced aware scaling.
8077 <dt> ‘<samp>0</samp>’</dt>
8078 <dd><p>Do not apply interlaced scaling.
8081 <dt> ‘<samp>-1</samp>’</dt>
8082 <dd><p>Select interlaced aware scaling depending on whether the source frames
8083 are flagged as interlaced or not.
8087 <p>Default value is ‘<samp>0</samp>’.
8090 <dt> ‘<samp>flags</samp>’</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
8097 <dt> ‘<samp>size, s</samp>’</dt>
8098 <dd><p>Set the video size. For the syntax of this option, check the "Video size"
8099 section in the ffmpeg-utils manual.
8102 <dt> ‘<samp>in_color_matrix</samp>’</dt>
8103 <dt> ‘<samp>out_color_matrix</samp>’</dt>
8104 <dd><p>Set in/output YCbCr color space type.
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.
8109 <p>If not specified, the color space type depends on the pixel format.
8113 <dl compact="compact">
8114 <dt> ‘<samp>auto</samp>’</dt>
8115 <dd><p>Choose automatically.
8118 <dt> ‘<samp>bt709</samp>’</dt>
8119 <dd><p>Format conforming to International Telecommunication Union (ITU)
8120 Recommendation BT.709.
8123 <dt> ‘<samp>fcc</samp>’</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).
8128 <dt> ‘<samp>bt601</samp>’</dt>
8129 <dd><p>Set color space conforming to:
8133 ITU Radiocommunication Sector (ITU-R) Recommendation BT.601
8136 ITU-R Rec. BT.470-6 (1998) Systems B, B1, and G
8139 Society of Motion Picture and Television Engineers (SMPTE) ST 170:2004
8144 <dt> ‘<samp>smpte240m</samp>’</dt>
8145 <dd><p>Set color space conforming to SMPTE ST 240:1999.
8150 <dt> ‘<samp>in_range</samp>’</dt>
8151 <dt> ‘<samp>out_range</samp>’</dt>
8152 <dd><p>Set in/output YCbCr sample range.
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:
8158 <dl compact="compact">
8159 <dt> ‘<samp>auto</samp>’</dt>
8160 <dd><p>Choose automatically.
8163 <dt> ‘<samp>jpeg/full/pc</samp>’</dt>
8164 <dd><p>Set full range (0-255 in case of 8-bit luma).
8167 <dt> ‘<samp>mpeg/tv</samp>’</dt>
8168 <dd><p>Set "MPEG" range (16-235 in case of 8-bit luma).
8173 <dt> ‘<samp>force_original_aspect_ratio</samp>’</dt>
8174 <dd><p>Enable decreasing or increasing output video width or height if necessary to
8175 keep the original aspect ratio. Possible values:
8177 <dl compact="compact">
8178 <dt> ‘<samp>disable</samp>’</dt>
8179 <dd><p>Scale the video as specified and disable this feature.
8182 <dt> ‘<samp>decrease</samp>’</dt>
8183 <dd><p>The output video dimensions will automatically be decreased if needed.
8186 <dt> ‘<samp>increase</samp>’</dt>
8187 <dd><p>The output video dimensions will automatically be increased if needed.
8192 <p>One useful instance of this option is that when you know a specific device’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
8199 <p>Please note that this is a different thing than specifying -1 for ‘<samp>w</samp>’
8200 or ‘<samp>h</samp>’, you still need to specify the output resolution for this option
8206 <p>The values of the ‘<samp>w</samp>’ and ‘<samp>h</samp>’ options are expressions
8207 containing the following constants:
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
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>
8220 <dt> <var>out_w</var></dt>
8221 <dt> <var>out_h</var></dt>
8222 <dd><p>the output (scaled) width and height
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>
8230 <dt> <var>a</var></dt>
8231 <dd><p>same as <var>iw</var> / <var>ih</var>
8234 <dt> <var>sar</var></dt>
8235 <dd><p>input sample aspect ratio
8238 <dt> <var>dar</var></dt>
8239 <dd><p>input display aspect ratio. Calculated from <code>(iw / ih) * sar</code>.
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 "yuv422p" <var>hsub</var> is 2 and <var>vsub</var> is 1.
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 "yuv422p" <var>hsub</var> is 2 and <var>vsub</var> is 1.
8255 <a name="Examples-24"></a>
8256 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-24">9.72.2 Examples</a></h3>
8260 Scale the input video to a size of 200x100:
8261 <table><tr><td> </td><td><pre class="example">scale=w=200:h=100
8262 </pre></td></tr></table>
8264 <p>This is equivalent to:
8265 </p><table><tr><td> </td><td><pre class="example">scale=200:100
8266 </pre></td></tr></table>
8269 </p><table><tr><td> </td><td><pre class="example">scale=200x100
8270 </pre></td></tr></table>
8273 Specify a size abbreviation for the output size:
8274 <table><tr><td> </td><td><pre class="example">scale=qcif
8275 </pre></td></tr></table>
8277 <p>which can also be written as:
8278 </p><table><tr><td> </td><td><pre class="example">scale=size=qcif
8279 </pre></td></tr></table>
8282 Scale the input to 2x:
8283 <table><tr><td> </td><td><pre class="example">scale=w=2*iw:h=2*ih
8284 </pre></td></tr></table>
8287 The above is the same as:
8288 <table><tr><td> </td><td><pre class="example">scale=2*in_w:2*in_h
8289 </pre></td></tr></table>
8292 Scale the input to 2x with forced interlaced scaling:
8293 <table><tr><td> </td><td><pre class="example">scale=2*iw:2*ih:interl=1
8294 </pre></td></tr></table>
8297 Scale the input to half size:
8298 <table><tr><td> </td><td><pre class="example">scale=w=iw/2:h=ih/2
8299 </pre></td></tr></table>
8302 Increase the width, and set the height to the same size:
8303 <table><tr><td> </td><td><pre class="example">scale=3/2*iw:ow
8304 </pre></td></tr></table>
8307 Seek for Greek harmony:
8308 <table><tr><td> </td><td><pre class="example">scale=iw:1/PHI*iw
8310 </pre></td></tr></table>
8313 Increase the height, and set the width to 3/2 of the height:
8314 <table><tr><td> </td><td><pre class="example">scale=w=3/2*oh:h=3/5*ih
8315 </pre></td></tr></table>
8318 Increase the size, but make the size a multiple of the chroma
8320 <table><tr><td> </td><td><pre class="example">scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
8321 </pre></td></tr></table>
8324 Increase the width to a maximum of 500 pixels, keep the same input
8326 <table><tr><td> </td><td><pre class="example">scale=w='min(500\, iw*3/2):h=-1'
8327 </pre></td></tr></table>
8330 <a name="separatefields"></a>
8331 <h2 class="section"><a href="ffmpeg-filters.html#toc-separatefields">9.73 separatefields</a></h2>
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.
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.
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>
8344 <p>The <code>setdar</code> filter sets the Display Aspect Ratio for the filter
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> </td><td><pre class="example"><var>DAR</var> = <var>HORIZONTAL_RESOLUTION</var> / <var>VERTICAL_RESOLUTION</var> * <var>SAR</var>
8350 </pre></td></tr></table>
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 "setdar" or a "setsar" filter is
8358 <p>The <code>setsar</code> filter sets the Sample (aka Pixel) Aspect Ratio for
8359 the filter output video.
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
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 "setsar" or a "setdar" filter is applied.
8369 <p>The filters accept the following options:
8371 <dl compact="compact">
8372 <dt> ‘<samp>r, ratio, dar (<code>setdar</code> only), sar (<code>setsar</code> only)</samp>’</dt>
8373 <dd><p>Set the aspect ratio used by the filter.
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 "0".
8379 In case the form "<var>num</var>:<var>den</var>" is used, the <code>:</code> character
8383 <dt> ‘<samp>max</samp>’</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>.
8391 <p>The parameter <var>sar</var> is an expression containing
8392 the following constants:
8394 <dl compact="compact">
8395 <dt> ‘<samp>E, PI, PHI</samp>’</dt>
8396 <dd><p>the corresponding mathematical approximated values for e
8397 (euler number), pi (greek PI), phi (golden ratio)
8400 <dt> ‘<samp>w, h</samp>’</dt>
8401 <dd><p>the input width and height
8404 <dt> ‘<samp>a</samp>’</dt>
8405 <dd><p>same as <var>w</var> / <var>h</var>
8408 <dt> ‘<samp>sar</samp>’</dt>
8409 <dd><p>input sample aspect ratio
8412 <dt> ‘<samp>dar</samp>’</dt>
8413 <dd><p>input display aspect ratio, it is the same as (<var>w</var> / <var>h</var>) * <var>sar</var>
8416 <dt> ‘<samp>hsub, vsub</samp>’</dt>
8417 <dd><p>horizontal and vertical chroma subsample values. For example for the
8418 pixel format "yuv422p" <var>hsub</var> is 2 and <var>vsub</var> is 1.
8422 <a name="Examples-66"></a>
8423 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-66">9.74.1 Examples</a></h3>
8427 To change the display aspect ratio to 16:9, specify one of the following:
8428 <table><tr><td> </td><td><pre class="example">setdar=dar=1.77777
8431 </pre></td></tr></table>
8434 To change the sample aspect ratio to 10:11, specify:
8435 <table><tr><td> </td><td><pre class="example">setsar=sar=10/11
8436 </pre></td></tr></table>
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> </td><td><pre class="example">setdar=ratio=16/9:max=1000
8442 </pre></td></tr></table>
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>
8450 <p>Force field for the output video frame.
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>).
8457 <p>The filter accepts the following options:
8459 <dl compact="compact">
8460 <dt> ‘<samp>mode</samp>’</dt>
8461 <dd><p>Available values are:
8463 <dl compact="compact">
8464 <dt> ‘<samp>auto</samp>’</dt>
8465 <dd><p>Keep the same field property.
8468 <dt> ‘<samp>bff</samp>’</dt>
8469 <dd><p>Mark the frame as bottom-field-first.
8472 <dt> ‘<samp>tff</samp>’</dt>
8473 <dd><p>Mark the frame as top-field-first.
8476 <dt> ‘<samp>prog</samp>’</dt>
8477 <dd><p>Mark the frame as progressive.
8483 <a name="showinfo"></a>
8484 <h2 class="section"><a href="ffmpeg-filters.html#toc-showinfo">9.76 showinfo</a></h2>
8486 <p>Show a line containing various information for each input video frame.
8487 The input video is not modified.
8489 <p>The shown line contains a sequence of key/value pairs of the form
8490 <var>key</var>:<var>value</var>.
8492 <p>A description of each shown parameter follows:
8494 <dl compact="compact">
8495 <dt> ‘<samp>n</samp>’</dt>
8496 <dd><p>sequential number of the input frame, starting from 0
8499 <dt> ‘<samp>pts</samp>’</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.
8504 <dt> ‘<samp>pts_time</samp>’</dt>
8505 <dd><p>Presentation TimeStamp of the input frame, expressed as a number of
8509 <dt> ‘<samp>pos</samp>’</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)
8514 <dt> ‘<samp>fmt</samp>’</dt>
8515 <dd><p>pixel format name
8518 <dt> ‘<samp>sar</samp>’</dt>
8519 <dd><p>sample aspect ratio of the input frame, expressed in the form
8520 <var>num</var>/<var>den</var>
8523 <dt> ‘<samp>s</samp>’</dt>
8524 <dd><p>size of the input frame. For the syntax of this option, check the "Video size"
8525 section in the ffmpeg-utils manual.
8528 <dt> ‘<samp>i</samp>’</dt>
8529 <dd><p>interlaced mode ("P" for "progressive", "T" for top field first, "B"
8530 for bottom field first)
8533 <dt> ‘<samp>iskey</samp>’</dt>
8534 <dd><p>1 if the frame is a key frame, 0 otherwise
8537 <dt> ‘<samp>type</samp>’</dt>
8538 <dd><p>picture type of the input frame ("I" for an I-frame, "P" for a
8539 P-frame, "B" for a B-frame, "?" 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 ‘<tt>libavutil/avutil.h</tt>’.
8545 <dt> ‘<samp>checksum</samp>’</dt>
8546 <dd><p>Adler-32 checksum (printed in hexadecimal) of all the planes of the input frame
8549 <dt> ‘<samp>plane_checksum</samp>’</dt>
8550 <dd><p>Adler-32 checksum (printed in hexadecimal) of each plane of the input frame,
8551 expressed in the form "[<var>c0</var> <var>c1</var> <var>c2</var> <var>c3</var>]"
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>
8559 <p>Blur the input video without impacting the outlines.
8561 <p>The filter accepts the following options:
8563 <dl compact="compact">
8564 <dt> ‘<samp>luma_radius, lr</samp>’</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.
8570 <dt> ‘<samp>luma_strength, ls</samp>’</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.
8577 <dt> ‘<samp>luma_threshold, lt</samp>’</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.
8585 <dt> ‘<samp>chroma_radius, cr</samp>’</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.
8591 <dt> ‘<samp>chroma_strength, cs</samp>’</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.
8598 <dt> ‘<samp>chroma_threshold, ct</samp>’</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.
8607 <p>If a chroma option is not explicitly set, the corresponding luma value
8610 <a name="stereo3d"></a>
8611 <h2 class="section"><a href="ffmpeg-filters.html#toc-stereo3d">9.78 stereo3d</a></h2>
8613 <p>Convert between different stereoscopic image formats.
8615 <p>The filters accept the following options:
8617 <dl compact="compact">
8618 <dt> ‘<samp>in</samp>’</dt>
8619 <dd><p>Set stereoscopic image format of input.
8621 <p>Available values for input image formats are:
8622 </p><dl compact="compact">
8623 <dt> ‘<samp>sbsl</samp>’</dt>
8624 <dd><p>side by side parallel (left eye left, right eye right)
8627 <dt> ‘<samp>sbsr</samp>’</dt>
8628 <dd><p>side by side crosseye (right eye left, left eye right)
8631 <dt> ‘<samp>sbs2l</samp>’</dt>
8632 <dd><p>side by side parallel with half width resolution
8633 (left eye left, right eye right)
8636 <dt> ‘<samp>sbs2r</samp>’</dt>
8637 <dd><p>side by side crosseye with half width resolution
8638 (right eye left, left eye right)
8641 <dt> ‘<samp>abl</samp>’</dt>
8642 <dd><p>above-below (left eye above, right eye below)
8645 <dt> ‘<samp>abr</samp>’</dt>
8646 <dd><p>above-below (right eye above, left eye below)
8649 <dt> ‘<samp>ab2l</samp>’</dt>
8650 <dd><p>above-below with half height resolution
8651 (left eye above, right eye below)
8654 <dt> ‘<samp>ab2r</samp>’</dt>
8655 <dd><p>above-below with half height resolution
8656 (right eye above, left eye below)
8659 <dt> ‘<samp>al</samp>’</dt>
8660 <dd><p>alternating frames (left eye first, right eye second)
8663 <dt> ‘<samp>ar</samp>’</dt>
8664 <dd><p>alternating frames (right eye first, left eye second)
8666 <p>Default value is ‘<samp>sbsl</samp>’.
8671 <dt> ‘<samp>out</samp>’</dt>
8672 <dd><p>Set stereoscopic image format of output.
8674 <p>Available values for output image formats are all the input formats as well as:
8675 </p><dl compact="compact">
8676 <dt> ‘<samp>arbg</samp>’</dt>
8677 <dd><p>anaglyph red/blue gray
8678 (red filter on left eye, blue filter on right eye)
8681 <dt> ‘<samp>argg</samp>’</dt>
8682 <dd><p>anaglyph red/green gray
8683 (red filter on left eye, green filter on right eye)
8686 <dt> ‘<samp>arcg</samp>’</dt>
8687 <dd><p>anaglyph red/cyan gray
8688 (red filter on left eye, cyan filter on right eye)
8691 <dt> ‘<samp>arch</samp>’</dt>
8692 <dd><p>anaglyph red/cyan half colored
8693 (red filter on left eye, cyan filter on right eye)
8696 <dt> ‘<samp>arcc</samp>’</dt>
8697 <dd><p>anaglyph red/cyan color
8698 (red filter on left eye, cyan filter on right eye)
8701 <dt> ‘<samp>arcd</samp>’</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)
8706 <dt> ‘<samp>agmg</samp>’</dt>
8707 <dd><p>anaglyph green/magenta gray
8708 (green filter on left eye, magenta filter on right eye)
8711 <dt> ‘<samp>agmh</samp>’</dt>
8712 <dd><p>anaglyph green/magenta half colored
8713 (green filter on left eye, magenta filter on right eye)
8716 <dt> ‘<samp>agmc</samp>’</dt>
8717 <dd><p>anaglyph green/magenta colored
8718 (green filter on left eye, magenta filter on right eye)
8721 <dt> ‘<samp>agmd</samp>’</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)
8726 <dt> ‘<samp>aybg</samp>’</dt>
8727 <dd><p>anaglyph yellow/blue gray
8728 (yellow filter on left eye, blue filter on right eye)
8731 <dt> ‘<samp>aybh</samp>’</dt>
8732 <dd><p>anaglyph yellow/blue half colored
8733 (yellow filter on left eye, blue filter on right eye)
8736 <dt> ‘<samp>aybc</samp>’</dt>
8737 <dd><p>anaglyph yellow/blue colored
8738 (yellow filter on left eye, blue filter on right eye)
8741 <dt> ‘<samp>aybd</samp>’</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)
8746 <dt> ‘<samp>irl</samp>’</dt>
8747 <dd><p>interleaved rows (left eye has top row, right eye starts on next row)
8750 <dt> ‘<samp>irr</samp>’</dt>
8751 <dd><p>interleaved rows (right eye has top row, left eye starts on next row)
8754 <dt> ‘<samp>ml</samp>’</dt>
8755 <dd><p>mono output (left eye only)
8758 <dt> ‘<samp>mr</samp>’</dt>
8759 <dd><p>mono output (right eye only)
8763 <p>Default value is ‘<samp>arcd</samp>’.
8767 <a name="Examples-16"></a>
8768 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-16">9.78.1 Examples</a></h3>
8772 Convert input video from side by side parallel to anaglyph yellow/blue dubois:
8773 <table><tr><td> </td><td><pre class="example">stereo3d=sbsl:aybd
8774 </pre></td></tr></table>
8777 Convert input video from above bellow (left eye above, right eye below) to side by side crosseye.
8778 <table><tr><td> </td><td><pre class="example">stereo3d=abl:sbsr
8779 </pre></td></tr></table>
8783 <h2 class="section"><a href="ffmpeg-filters.html#toc-spp">9.79 spp</a></h2>
8785 <p>Apply a simple postprocessing filter that compresses and decompresses the image
8786 at several (or - in the case of ‘<samp>quality</samp>’ level <code>6</code> - all) shifts
8787 and average the results.
8789 <p>The filter accepts the following options:
8791 <dl compact="compact">
8792 <dt> ‘<samp>quality</samp>’</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
8800 <dt> ‘<samp>qp</samp>’</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).
8805 <dt> ‘<samp>mode</samp>’</dt>
8806 <dd><p>Set thresholding mode. Available modes are:
8808 <dl compact="compact">
8809 <dt> ‘<samp>hard</samp>’</dt>
8810 <dd><p>Set hard thresholding (default).
8812 <dt> ‘<samp>soft</samp>’</dt>
8813 <dd><p>Set soft thresholding (better de-ringing effect, but likely blurrier).
8818 <dt> ‘<samp>use_bframe_qp</samp>’</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).
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>
8829 <p>Draw subtitles on top of input video using the libass library.
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.
8836 <p>The filter accepts the following options:
8838 <dl compact="compact">
8839 <dt> ‘<samp>filename, f</samp>’</dt>
8840 <dd><p>Set the filename of the subtitle file to read. It must be specified.
8843 <dt> ‘<samp>original_size</samp>’</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 "Video size" 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
8851 <dt> ‘<samp>charenc</samp>’</dt>
8852 <dd><p>Set subtitles input character encoding. <code>subtitles</code> filter only. Only
8853 useful if not UTF-8.
8857 <p>If the first key is not specified, it is assumed that the first value
8858 specifies the ‘<samp>filename</samp>’.
8860 <p>For example, to render the file ‘<tt>sub.srt</tt>’ on top of the input
8861 video, use the command:
8862 </p><table><tr><td> </td><td><pre class="example">subtitles=sub.srt
8863 </pre></td></tr></table>
8865 <p>which is equivalent to:
8866 </p><table><tr><td> </td><td><pre class="example">subtitles=filename=sub.srt
8867 </pre></td></tr></table>
8869 <a name="super2xsai"></a>
8870 <h2 class="section"><a href="ffmpeg-filters.html#toc-super2xsai">9.81 super2xsai</a></h2>
8872 <p>Scale the input by 2x and smooth using the Super2xSaI (Scale and
8873 Interpolate) pixel art scaling algorithm.
8875 <p>Useful for enlarging pixel art images without reducing sharpness.
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 & V plane.
8881 <a name="telecine"></a>
8882 <h2 class="section"><a href="ffmpeg-filters.html#toc-telecine">9.83 telecine</a></h2>
8884 <p>Apply telecine process to the video.
8886 <p>This filter accepts the following options:
8888 <dl compact="compact">
8889 <dt> ‘<samp>first_field</samp>’</dt>
8890 <dd><dl compact="compact">
8891 <dt> ‘<samp>top, t</samp>’</dt>
8892 <dd><p>top field first
8894 <dt> ‘<samp>bottom, b</samp>’</dt>
8895 <dd><p>bottom field first
8896 The default value is <code>top</code>.
8901 <dt> ‘<samp>pattern</samp>’</dt>
8902 <dd><p>A string of numbers representing the pulldown pattern you wish to apply.
8903 The default value is <code>23</code>.
8907 <table><tr><td> </td><td><pre class="example">Some typical patterns:
8912 24p: 2332 (preferred)
8919 24p: 222222222223 ("Euro pulldown")
8922 </pre></td></tr></table>
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.
8928 <p>The filter accepts the following options:
8930 <dl compact="compact">
8931 <dt> ‘<samp>n</samp>’</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>.
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.
8941 <a name="Examples-51"></a>
8942 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-51">9.84.1 Examples</a></h3>
8946 Extract one picture each 50 frames:
8947 <table><tr><td> </td><td><pre class="example">thumbnail=50
8948 </pre></td></tr></table>
8951 Complete example of a thumbnail creation with <code>ffmpeg</code>:
8952 <table><tr><td> </td><td><pre class="example">ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
8953 </pre></td></tr></table>
8957 <h2 class="section"><a href="ffmpeg-filters.html#toc-tile">9.85 tile</a></h2>
8959 <p>Tile several successive frames together.
8961 <p>The filter accepts the following options:
8963 <dl compact="compact">
8964 <dt> ‘<samp>layout</samp>’</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 "Video size" section in the ffmpeg-utils manual.
8969 <dt> ‘<samp>nb_frames</samp>’</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.
8975 <dt> ‘<samp>margin</samp>’</dt>
8976 <dd><p>Set the outer border margin in pixels.
8979 <dt> ‘<samp>padding</samp>’</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.
8985 <dt> ‘<samp>color</samp>’</dt>
8986 <dd><p>Specify the color of the unused areaFor the syntax of this option, check the
8987 "Color" section in the ffmpeg-utils manual. The default value of <var>color</var>
8988 is "black".
8992 <a name="Examples-2"></a>
8993 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-2">9.85.1 Examples</a></h3>
8997 Produce 8x8 PNG tiles of all keyframes (‘<samp>-skip_frame nokey</samp>’) in a movie:
8998 <table><tr><td> </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 ‘<samp>-vsync 0</samp>’ is necessary to prevent <code>ffmpeg</code> from
9001 duplicating each output frame to accommodate the originally detected frame
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> </td><td><pre class="example">tile=3x2:nb_frames=5:padding=7:margin=2
9009 </pre></td></tr></table>
9012 <a name="tinterlace"></a>
9013 <h2 class="section"><a href="ffmpeg-filters.html#toc-tinterlace">9.86 tinterlace</a></h2>
9015 <p>Perform various types of temporal field interlacing.
9017 <p>Frames are counted starting from 1, so the first input frame is
9020 <p>The filter accepts the following options:
9022 <dl compact="compact">
9023 <dt> ‘<samp>mode</samp>’</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.
9027 <p>Available values are:
9029 <dl compact="compact">
9030 <dt> ‘<samp>merge, 0</samp>’</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.
9035 <dt> ‘<samp>drop_odd, 1</samp>’</dt>
9036 <dd><p>Only output even frames, odd frames are dropped, generating a frame with
9037 unchanged height at half frame rate.
9040 <dt> ‘<samp>drop_even, 2</samp>’</dt>
9041 <dd><p>Only output odd frames, even frames are dropped, generating a frame with
9042 unchanged height at half frame rate.
9045 <dt> ‘<samp>pad, 3</samp>’</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.
9050 <dt> ‘<samp>interleave_top, 4</samp>’</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.
9055 <dt> ‘<samp>interleave_bottom, 5</samp>’</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.
9060 <dt> ‘<samp>interlacex2, 6</samp>’</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.
9069 <p>Numeric values are deprecated but are accepted for backward
9070 compatibility reasons.
9072 <p>Default mode is <code>merge</code>.
9075 <dt> ‘<samp>flags</samp>’</dt>
9076 <dd><p>Specify flags influencing the filter process.
9078 <p>Available value for <var>flags</var> is:
9080 <dl compact="compact">
9081 <dt> ‘<samp>low_pass_filter, vlfp</samp>’</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 ’twitter’ and Moire
9088 <p>Vertical low-pass filtering can only be enabled for ‘<samp>mode</samp>’
9089 <var>interleave_top</var> and <var>interleave_bottom</var>.
9096 <a name="transpose"></a>
9097 <h2 class="section"><a href="ffmpeg-filters.html#toc-transpose">9.87 transpose</a></h2>
9099 <p>Transpose rows with columns in the input video and optionally flip it.
9101 <p>This filter accepts the following options:
9103 <dl compact="compact">
9104 <dt> ‘<samp>dir</samp>’</dt>
9105 <dd><p>Specify the transposition direction.
9107 <p>Can assume the following values:
9108 </p><dl compact="compact">
9109 <dt> ‘<samp>0, 4, cclock_flip</samp>’</dt>
9110 <dd><p>Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
9111 </p><table><tr><td> </td><td><pre class="example">L.R L.l
9114 </pre></td></tr></table>
9117 <dt> ‘<samp>1, 5, clock</samp>’</dt>
9118 <dd><p>Rotate by 90 degrees clockwise, that is:
9119 </p><table><tr><td> </td><td><pre class="example">L.R l.L
9122 </pre></td></tr></table>
9125 <dt> ‘<samp>2, 6, cclock</samp>’</dt>
9126 <dd><p>Rotate by 90 degrees counterclockwise, that is:
9127 </p><table><tr><td> </td><td><pre class="example">L.R R.r
9130 </pre></td></tr></table>
9133 <dt> ‘<samp>3, 7, clock_flip</samp>’</dt>
9134 <dd><p>Rotate by 90 degrees clockwise and vertically flip, that is:
9135 </p><table><tr><td> </td><td><pre class="example">L.R r.R
9138 </pre></td></tr></table>
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.
9146 <p>Numerical values are deprecated, and should be dropped in favor of
9150 <dt> ‘<samp>passthrough</samp>’</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> ‘<samp>none</samp>’</dt>
9155 <dd><p>Always apply transposition.
9157 <dt> ‘<samp>portrait</samp>’</dt>
9158 <dd><p>Preserve portrait geometry (when <var>height</var> >= <var>width</var>).
9160 <dt> ‘<samp>landscape</samp>’</dt>
9161 <dd><p>Preserve landscape geometry (when <var>width</var> >= <var>height</var>).
9165 <p>Default value is <code>none</code>.
9169 <p>For example to rotate by 90 degrees clockwise and preserve portrait
9171 </p><table><tr><td> </td><td><pre class="example">transpose=dir=1:passthrough=portrait
9172 </pre></td></tr></table>
9174 <p>The command above can also be specified as:
9175 </p><table><tr><td> </td><td><pre class="example">transpose=1:portrait
9176 </pre></td></tr></table>
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.
9182 <p>This filter accepts the following options:
9183 </p><dl compact="compact">
9184 <dt> ‘<samp>start</samp>’</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.
9189 <dt> ‘<samp>end</samp>’</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.
9195 <dt> ‘<samp>start_pts</samp>’</dt>
9196 <dd><p>Same as <var>start</var>, except this option sets the start timestamp in timebase
9197 units instead of seconds.
9200 <dt> ‘<samp>end_pts</samp>’</dt>
9201 <dd><p>Same as <var>end</var>, except this option sets the end timestamp in timebase units
9205 <dt> ‘<samp>duration</samp>’</dt>
9206 <dd><p>Specify maximum duration of the output.
9209 <dt> ‘<samp>start_frame</samp>’</dt>
9210 <dd><p>Number of the first frame that should be passed to output.
9213 <dt> ‘<samp>end_frame</samp>’</dt>
9214 <dd><p>Number of the first frame that should be dropped.
9218 <p>‘<samp>start</samp>’, ‘<samp>end</samp>’, ‘<samp>duration</samp>’ are expressed as time
9219 duration specifications, check the "Time duration" section in the
9220 ffmpeg-utils manual.
9222 <p>Note that the first two sets of the start/end options and the ‘<samp>duration</samp>’
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.
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
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.
9239 drop everything except the second minute of input
9240 <table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -vf trim=60:120
9241 </pre></td></tr></table>
9244 keep only the first second
9245 <table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -vf trim=duration=1
9246 </pre></td></tr></table>
9251 <a name="unsharp"></a>
9252 <h2 class="section"><a href="ffmpeg-filters.html#toc-unsharp">9.89 unsharp</a></h2>
9254 <p>Sharpen or blur the input video.
9256 <p>It accepts the following parameters:
9258 <dl compact="compact">
9259 <dt> ‘<samp>luma_msize_x, lx</samp>’</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.
9264 <dt> ‘<samp>luma_msize_y, ly</samp>’</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.
9269 <dt> ‘<samp>luma_amount, la</samp>’</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.
9273 <p>Negative values will blur the input video, while positive values will
9274 sharpen it, a value of zero will disable the effect.
9276 <p>Default value is 1.0.
9279 <dt> ‘<samp>chroma_msize_x, cx</samp>’</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.
9284 <dt> ‘<samp>chroma_msize_y, cy</samp>’</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.
9289 <dt> ‘<samp>chroma_amount, ca</samp>’</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.
9293 <p>Negative values will blur the input video, while positive values will
9294 sharpen it, a value of zero will disable the effect.
9296 <p>Default value is 0.0.
9299 <dt> ‘<samp>opencl</samp>’</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.
9306 <p>All parameters are optional and default to the equivalent of the
9307 string ’5:5:1.0:5:5:0.0’.
9309 <a name="Examples-19"></a>
9310 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-19">9.89.1 Examples</a></h3>
9314 Apply strong luma sharpen effect:
9315 <table><tr><td> </td><td><pre class="example">unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=2.5
9316 </pre></td></tr></table>
9319 Apply strong blur of both luma and chroma parameters:
9320 <table><tr><td> </td><td><pre class="example">unsharp=7:7:-2:7:7:-2
9321 </pre></td></tr></table>
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>
9328 <p>Analyze video stabilization/deshaking. Perform pass 1 of 2, see
9329 <a href="#vidstabtransform">vidstabtransform</a> for pass 2.
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.
9335 <p>To enable compilation of this filter you need to configure FFmpeg with
9336 <code>--enable-libvidstab</code>.
9338 <p>This filter accepts the following options:
9340 <dl compact="compact">
9341 <dt> ‘<samp>result</samp>’</dt>
9342 <dd><p>Set the path to the file used to write the transforms information.
9343 Default value is ‘<tt>transforms.trf</tt>’.
9346 <dt> ‘<samp>shakiness</samp>’</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.
9352 <dt> ‘<samp>accuracy</samp>’</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.
9358 <dt> ‘<samp>stepsize</samp>’</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.
9363 <dt> ‘<samp>mincontrast</samp>’</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
9369 <dt> ‘<samp>tripod</samp>’</dt>
9370 <dd><p>Set reference frame number for tripod mode.
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.
9377 <p>If set to 0, it is disabled. The frames are counted starting from 1.
9380 <dt> ‘<samp>show</samp>’</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
9387 <a name="Examples-59"></a>
9388 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-59">9.90.1 Examples</a></h3>
9393 <table><tr><td> </td><td><pre class="example">vidstabdetect
9394 </pre></td></tr></table>
9397 Analyze strongly shaky movie and put the results in file
9398 ‘<tt>mytransforms.trf</tt>’:
9399 <table><tr><td> </td><td><pre class="example">vidstabdetect=shakiness=10:accuracy=15:result="mytransforms.trf"
9400 </pre></td></tr></table>
9403 Visualize the result of internal transformations in the resulting
9405 <table><tr><td> </td><td><pre class="example">vidstabdetect=show=1
9406 </pre></td></tr></table>
9409 Analyze a video with medium shakiness using <code>ffmpeg</code>:
9410 <table><tr><td> </td><td><pre class="example">ffmpeg -i input -vf vidstabdetect=shakiness=5:show=1 dummy.avi
9411 </pre></td></tr></table>
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>
9418 <p>Video stabilization/deshaking: pass 2 of 2,
9419 see <a href="#vidstabdetect">vidstabdetect</a> for pass 1.
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.
9427 <p>To enable compilation of this filter you need to configure FFmpeg with
9428 <code>--enable-libvidstab</code>.
9430 <a name="Options"></a>
9431 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Options">9.91.1 Options</a></h3>
9433 <dl compact="compact">
9434 <dt> ‘<samp>input</samp>’</dt>
9435 <dd><p>Set path to the file used to read the transforms. Default value is
9436 ‘<tt>transforms.trf</tt>’).
9439 <dt> ‘<samp>smoothing</samp>’</dt>
9440 <dd><p>Set the number of frames (value*2 + 1) used for lowpass filtering the
9441 camera movements. Default value is 10.
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.
9450 <dt> ‘<samp>optalgo</samp>’</dt>
9451 <dd><p>Set the camera path optimization algorithm.
9453 <p>Accepted values are:
9454 </p><dl compact="compact">
9455 <dt> ‘<samp>gauss</samp>’</dt>
9456 <dd><p>gaussian kernel low-pass filter on camera motion (default)
9458 <dt> ‘<samp>avg</samp>’</dt>
9459 <dd><p>averaging on transformations
9464 <dt> ‘<samp>maxshift</samp>’</dt>
9465 <dd><p>Set maximal number of pixels to translate frames. Default value is -1,
9469 <dt> ‘<samp>maxangle</samp>’</dt>
9470 <dd><p>Set maximal angle in radians (degree*PI/180) to rotate frames. Default
9471 value is -1, meaning no limit.
9474 <dt> ‘<samp>crop</samp>’</dt>
9475 <dd><p>Specify how to deal with borders that may be visible due to movement
9478 <p>Available values are:
9479 </p><dl compact="compact">
9480 <dt> ‘<samp>keep</samp>’</dt>
9481 <dd><p>keep image information from previous frame (default)
9483 <dt> ‘<samp>black</samp>’</dt>
9484 <dd><p>fill the border black
9489 <dt> ‘<samp>invert</samp>’</dt>
9490 <dd><p>Invert transforms if set to 1. Default value is 0.
9493 <dt> ‘<samp>relative</samp>’</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.
9498 <dt> ‘<samp>zoom</samp>’</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
9504 <dt> ‘<samp>optzoom</samp>’</dt>
9505 <dd><p>Set optimal zooming to avoid borders.
9507 <p>Accepted values are:
9508 </p><dl compact="compact">
9509 <dt> ‘<samp>0</samp>’</dt>
9512 <dt> ‘<samp>1</samp>’</dt>
9513 <dd><p>optimal static zoom value is determined (only very strong movements
9514 will lead to visible borders) (default)
9516 <dt> ‘<samp>2</samp>’</dt>
9517 <dd><p>optimal adaptive zoom value is determined (no borders will be
9518 visible), see ‘<samp>zoomspeed</samp>’
9522 <p>Note that the value given at zoom is added to the one calculated here.
9525 <dt> ‘<samp>zoomspeed</samp>’</dt>
9526 <dd><p>Set percent to zoom maximally each frame (enabled when
9527 ‘<samp>optzoom</samp>’ is set to 2). Range is from 0 to 5, default value is
9531 <dt> ‘<samp>interpol</samp>’</dt>
9532 <dd><p>Specify type of interpolation.
9534 <p>Available values are:
9535 </p><dl compact="compact">
9536 <dt> ‘<samp>no</samp>’</dt>
9537 <dd><p>no interpolation
9539 <dt> ‘<samp>linear</samp>’</dt>
9540 <dd><p>linear only horizontal
9542 <dt> ‘<samp>bilinear</samp>’</dt>
9543 <dd><p>linear in both directions (default)
9545 <dt> ‘<samp>bicubic</samp>’</dt>
9546 <dd><p>cubic in both directions (slow)
9551 <dt> ‘<samp>tripod</samp>’</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.
9555 <p>Use also <code>tripod</code> option of <a href="#vidstabdetect">vidstabdetect</a>.
9558 <dt> ‘<samp>debug</samp>’</dt>
9559 <dd><p>Increase log verbosity if set to 1. Also the detected global motions
9560 are written to the temporary file ‘<tt>global_motions.trf</tt>’. Default
9565 <a name="Examples-13"></a>
9566 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-13">9.91.2 Examples</a></h3>
9570 Use <code>ffmpeg</code> for a typical stabilization with default values:
9571 <table><tr><td> </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>
9574 <p>Note the use of the unsharp filter which is always recommended.
9577 Zoom in a bit more and load transform data from a given file:
9578 <table><tr><td> </td><td><pre class="example">vidstabtransform=zoom=5:input="mytransforms.trf"
9579 </pre></td></tr></table>
9582 Smoothen the video even more:
9583 <table><tr><td> </td><td><pre class="example">vidstabtransform=smoothing=30
9584 </pre></td></tr></table>
9587 <a name="vflip"></a>
9588 <h2 class="section"><a href="ffmpeg-filters.html#toc-vflip">9.92 vflip</a></h2>
9590 <p>Flip the input video vertically.
9592 <p>For example, to vertically flip a video with <code>ffmpeg</code>:
9593 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i in.avi -vf "vflip" out.avi
9594 </pre></td></tr></table>
9596 <a name="vignette"></a>
9597 <h2 class="section"><a href="ffmpeg-filters.html#toc-vignette">9.93 vignette</a></h2>
9599 <p>Make or reverse a natural vignetting effect.
9601 <p>The filter accepts the following options:
9603 <dl compact="compact">
9604 <dt> ‘<samp>angle, a</samp>’</dt>
9605 <dd><p>Set lens angle expression as a number of radians.
9607 <p>The value is clipped in the <code>[0,PI/2]</code> range.
9609 <p>Default value: <code>"PI/5"</code>
9612 <dt> ‘<samp>x0</samp>’</dt>
9613 <dt> ‘<samp>y0</samp>’</dt>
9614 <dd><p>Set center coordinates expressions. Respectively <code>"w/2"</code> and <code>"h/2"</code>
9618 <dt> ‘<samp>mode</samp>’</dt>
9619 <dd><p>Set forward/backward mode.
9621 <p>Available modes are:
9622 </p><dl compact="compact">
9623 <dt> ‘<samp>forward</samp>’</dt>
9624 <dd><p>The larger the distance from the central point, the darker the image becomes.
9627 <dt> ‘<samp>backward</samp>’</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 ‘<samp>angle</samp>’ and other settings (yet). It can
9631 also be used to create a burning effect.
9635 <p>Default value is ‘<samp>forward</samp>’.
9638 <dt> ‘<samp>eval</samp>’</dt>
9639 <dd><p>Set evaluation mode for the expressions (‘<samp>angle</samp>’, ‘<samp>x0</samp>’, ‘<samp>y0</samp>’).
9641 <p>It accepts the following values:
9642 </p><dl compact="compact">
9643 <dt> ‘<samp>init</samp>’</dt>
9644 <dd><p>Evaluate expressions only once during the filter initialization.
9647 <dt> ‘<samp>frame</samp>’</dt>
9648 <dd><p>Evaluate expressions for each incoming frame. This is way slower than the
9649 ‘<samp>init</samp>’ mode since it requires all the scalers to be re-computed, but it
9650 allows advanced dynamic expressions.
9654 <p>Default value is ‘<samp>init</samp>’.
9657 <dt> ‘<samp>dither</samp>’</dt>
9658 <dd><p>Set dithering to reduce the circular banding effects. Default is <code>1</code>
9662 <dt> ‘<samp>aspect</samp>’</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.
9667 <p>Default is <code>1/1</code>.
9671 <a name="Expressions"></a>
9672 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Expressions">9.93.1 Expressions</a></h3>
9674 <p>The ‘<samp>alpha</samp>’, ‘<samp>x0</samp>’ and ‘<samp>y0</samp>’ expressions can contain the
9675 following parameters.
9677 <dl compact="compact">
9678 <dt> ‘<samp>w</samp>’</dt>
9679 <dt> ‘<samp>h</samp>’</dt>
9680 <dd><p>input width and height
9683 <dt> ‘<samp>n</samp>’</dt>
9684 <dd><p>the number of input frame, starting from 0
9687 <dt> ‘<samp>pts</samp>’</dt>
9688 <dd><p>the PTS (Presentation TimeStamp) time of the filtered video frame, expressed in
9689 <var>TB</var> units, NAN if undefined
9692 <dt> ‘<samp>r</samp>’</dt>
9693 <dd><p>frame rate of the input video, NAN if the input frame rate is unknown
9696 <dt> ‘<samp>t</samp>’</dt>
9697 <dd><p>the PTS (Presentation TimeStamp) of the filtered video frame,
9698 expressed in seconds, NAN if undefined
9701 <dt> ‘<samp>tb</samp>’</dt>
9702 <dd><p>time base of the input video
9707 <a name="Examples-48"></a>
9708 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-48">9.93.2 Examples</a></h3>
9712 Apply simple strong vignetting effect:
9713 <table><tr><td> </td><td><pre class="example">vignette=PI/4
9714 </pre></td></tr></table>
9717 Make a flickering vignetting:
9718 <table><tr><td> </td><td><pre class="example">vignette='PI/4+random(1)*PI/50':eval=frame
9719 </pre></td></tr></table>
9723 <a name="w3fdif"></a>
9724 <h2 class="section"><a href="ffmpeg-filters.html#toc-w3fdif">9.94 w3fdif</a></h2>
9726 <p>Deinterlace the input video ("w3fdif" stands for "Weston 3 Field
9727 Deinterlacing Filter").
9729 <p>Based on the process described by Martin Weston for BBC R&D, and
9730 implemented based on the de-interlace algorithm written by Jim
9731 Easterbrook for BBC R&D, the Weston 3 field deinterlacing filter
9732 uses filter coefficients calculated by BBC R&D.
9734 <p>There are two sets of filter coefficients, so called "simple":
9735 and "complex". Which set of filter coefficients is used can
9736 be set by passing an optional parameter:
9738 <dl compact="compact">
9739 <dt> ‘<samp>filter</samp>’</dt>
9740 <dd><p>Set the interlacing filter coefficients. Accepts one of the following values:
9742 <dl compact="compact">
9743 <dt> ‘<samp>simple</samp>’</dt>
9744 <dd><p>Simple filter coefficient set.
9746 <dt> ‘<samp>complex</samp>’</dt>
9747 <dd><p>More-complex filter coefficient set.
9750 <p>Default value is ‘<samp>complex</samp>’.
9753 <dt> ‘<samp>deint</samp>’</dt>
9754 <dd><p>Specify which frames to deinterlace. Accept one of the following values:
9756 <dl compact="compact">
9757 <dt> ‘<samp>all</samp>’</dt>
9758 <dd><p>Deinterlace all frames,
9760 <dt> ‘<samp>interlaced</samp>’</dt>
9761 <dd><p>Only deinterlace frames marked as interlaced.
9765 <p>Default value is ‘<samp>all</samp>’.
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>
9773 <p>Deinterlace the input video ("yadif" means "yet another deinterlacing
9776 <p>This filter accepts the following options:
9779 <dl compact="compact">
9780 <dt> ‘<samp>mode</samp>’</dt>
9781 <dd><p>The interlacing mode to adopt, accepts one of the following values:
9783 <dl compact="compact">
9784 <dt> ‘<samp>0, send_frame</samp>’</dt>
9785 <dd><p>output 1 frame for each frame
9787 <dt> ‘<samp>1, send_field</samp>’</dt>
9788 <dd><p>output 1 frame for each field
9790 <dt> ‘<samp>2, send_frame_nospatial</samp>’</dt>
9791 <dd><p>like <code>send_frame</code> but skip spatial interlacing check
9793 <dt> ‘<samp>3, send_field_nospatial</samp>’</dt>
9794 <dd><p>like <code>send_field</code> but skip spatial interlacing check
9798 <p>Default value is <code>send_frame</code>.
9801 <dt> ‘<samp>parity</samp>’</dt>
9802 <dd><p>The picture field parity assumed for the input interlaced video, accepts one of
9803 the following values:
9805 <dl compact="compact">
9806 <dt> ‘<samp>0, tff</samp>’</dt>
9807 <dd><p>assume top field first
9809 <dt> ‘<samp>1, bff</samp>’</dt>
9810 <dd><p>assume bottom field first
9812 <dt> ‘<samp>-1, auto</samp>’</dt>
9813 <dd><p>enable automatic detection
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.
9822 <dt> ‘<samp>deint</samp>’</dt>
9823 <dd><p>Specify which frames to deinterlace. Accept one of the following
9826 <dl compact="compact">
9827 <dt> ‘<samp>0, all</samp>’</dt>
9828 <dd><p>deinterlace all frames
9830 <dt> ‘<samp>1, interlaced</samp>’</dt>
9831 <dd><p>only deinterlace frames marked as interlaced
9835 <p>Default value is <code>all</code>.
9840 <a name="Video-Sources"></a>
9841 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Video-Sources">10. Video Sources</a></h1>
9843 <p>Below is a description of the currently available video sources.
9845 <a name="buffer"></a>
9846 <h2 class="section"><a href="ffmpeg-filters.html#toc-buffer">10.1 buffer</a></h2>
9848 <p>Buffer video frames, and make them available to the filter chain.
9850 <p>This source is mainly intended for a programmatic use, in particular
9851 through the interface defined in ‘<tt>libavfilter/vsrc_buffer.h</tt>’.
9853 <p>This source accepts the following options:
9855 <dl compact="compact">
9856 <dt> ‘<samp>video_size</samp>’</dt>
9857 <dd><p>Specify the size (width and height) of the buffered video frames. For the
9858 syntax of this option, check the "Video size" section in the ffmpeg-utils
9862 <dt> ‘<samp>width</samp>’</dt>
9863 <dd><p>Input video width.
9866 <dt> ‘<samp>height</samp>’</dt>
9867 <dd><p>Input video height.
9870 <dt> ‘<samp>pix_fmt</samp>’</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
9876 <dt> ‘<samp>time_base</samp>’</dt>
9877 <dd><p>Specify the timebase assumed by the timestamps of the buffered frames.
9880 <dt> ‘<samp>frame_rate</samp>’</dt>
9881 <dd><p>Specify the frame rate expected for the video stream.
9884 <dt> ‘<samp>pixel_aspect, sar</samp>’</dt>
9885 <dd><p>Specify the sample aspect ratio assumed by the video frames.
9888 <dt> ‘<samp>sws_param</samp>’</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.
9896 </p><table><tr><td> </td><td><pre class="example">buffer=width=320:height=240:pix_fmt=yuv410p:time_base=1/24:sar=1
9897 </pre></td></tr></table>
9899 <p>will instruct the source to accept video frames with size 320x240 and
9900 with format "yuv410p", assuming 1/24 as the timestamps timebase and
9901 square pixels (1:1 sample aspect ratio).
9902 Since the pixel format with name "yuv410p" corresponds to the number 6
9903 (check the enum AVPixelFormat definition in ‘<tt>libavutil/pixfmt.h</tt>’),
9904 this example corresponds to:
9905 </p><table><tr><td> </td><td><pre class="example">buffer=size=320x240:pixfmt=6:time_base=1/24:pixel_aspect=1/1
9906 </pre></td></tr></table>
9908 <p>Alternatively, the options can be specified as a flat string, but this
9909 syntax is deprecated:
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>]
9913 <a name="cellauto"></a>
9914 <h2 class="section"><a href="ffmpeg-filters.html#toc-cellauto">10.2 cellauto</a></h2>
9916 <p>Create a pattern generated by an elementary cellular automaton.
9918 <p>The initial state of the cellular automaton can be defined through the
9919 ‘<samp>filename</samp>’, and ‘<samp>pattern</samp>’ options. If such options are
9920 not specified an initial state is created randomly.
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 ‘<samp>scroll</samp>’ option.
9926 <p>This source accepts the following options:
9928 <dl compact="compact">
9929 <dt> ‘<samp>filename, f</samp>’</dt>
9930 <dd><p>Read the initial cellular automaton state, i.e. the starting row, from
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.
9937 <dt> ‘<samp>pattern, p</samp>’</dt>
9938 <dd><p>Read the initial cellular automaton state, i.e. the starting row, from
9939 the specified string.
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.
9946 <dt> ‘<samp>rate, r</samp>’</dt>
9947 <dd><p>Set the video rate, that is the number of frames generated per second.
9951 <dt> ‘<samp>random_fill_ratio, ratio</samp>’</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
9956 <p>This option is ignored when a file or a pattern is specified.
9959 <dt> ‘<samp>random_seed, seed</samp>’</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
9966 <dt> ‘<samp>rule</samp>’</dt>
9967 <dd><p>Set the cellular automaton rule, it is a number ranging from 0 to 255.
9968 Default value is 110.
9971 <dt> ‘<samp>size, s</samp>’</dt>
9972 <dd><p>Set the size of the output video. For the syntax of this option, check
9973 the "Video size" section in the ffmpeg-utils manual.
9975 <p>If ‘<samp>filename</samp>’ or ‘<samp>pattern</samp>’ 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.
9979 <p>If ‘<samp>size</samp>’ is set, it must contain the width of the specified
9980 pattern string, and the specified pattern will be centered in the
9983 <p>If a filename or a pattern string is not specified, the size value
9984 defaults to "320x518" (used for a randomly generated initial state).
9987 <dt> ‘<samp>scroll</samp>’</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.
9994 <dt> ‘<samp>start_full, full</samp>’</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.
10000 <dt> ‘<samp>stitch</samp>’</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.
10006 <a name="Examples-36"></a>
10007 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-36">10.2.1 Examples</a></h3>
10011 Read the initial state from ‘<tt>pattern</tt>’, and specify an output of
10013 <table><tr><td> </td><td><pre class="example">cellauto=f=pattern:s=200x400
10014 </pre></td></tr></table>
10017 Generate a random initial row with a width of 200 cells, with a fill
10019 <table><tr><td> </td><td><pre class="example">cellauto=ratio=2/3:s=200x200
10020 </pre></td></tr></table>
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> </td><td><pre class="example">cellauto=p=@:s=100x400:full=0:rule=18
10026 </pre></td></tr></table>
10029 Specify a more elaborated initial pattern:
10030 <table><tr><td> </td><td><pre class="example">cellauto=p='@@ @ @@':s=100x400:full=0:rule=18
10031 </pre></td></tr></table>
10035 <a name="mandelbrot"></a>
10036 <h2 class="section"><a href="ffmpeg-filters.html#toc-mandelbrot">10.3 mandelbrot</a></h2>
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>.
10041 <p>This source accepts the following options:
10043 <dl compact="compact">
10044 <dt> ‘<samp>end_pts</samp>’</dt>
10045 <dd><p>Set the terminal pts value. Default value is 400.
10048 <dt> ‘<samp>end_scale</samp>’</dt>
10049 <dd><p>Set the terminal scale value.
10050 Must be a floating point value. Default value is 0.3.
10053 <dt> ‘<samp>inner</samp>’</dt>
10054 <dd><p>Set the inner coloring mode, that is the algorithm used to draw the
10055 Mandelbrot fractal internal region.
10057 <p>It shall assume one of the following values:
10058 </p><dl compact="compact">
10059 <dt> ‘<samp>black</samp>’</dt>
10060 <dd><p>Set black mode.
10062 <dt> ‘<samp>convergence</samp>’</dt>
10063 <dd><p>Show time until convergence.
10065 <dt> ‘<samp>mincol</samp>’</dt>
10066 <dd><p>Set color based on point closest to the origin of the iterations.
10068 <dt> ‘<samp>period</samp>’</dt>
10069 <dd><p>Set period mode.
10073 <p>Default value is <var>mincol</var>.
10076 <dt> ‘<samp>bailout</samp>’</dt>
10077 <dd><p>Set the bailout value. Default value is 10.0.
10080 <dt> ‘<samp>maxiter</samp>’</dt>
10081 <dd><p>Set the maximum of iterations performed by the rendering
10082 algorithm. Default value is 7189.
10085 <dt> ‘<samp>outer</samp>’</dt>
10086 <dd><p>Set outer coloring mode.
10087 It shall assume one of following values:
10088 </p><dl compact="compact">
10089 <dt> ‘<samp>iteration_count</samp>’</dt>
10090 <dd><p>Set iteration cound mode.
10092 <dt> ‘<samp>normalized_iteration_count</samp>’</dt>
10093 <dd><p>set normalized iteration count mode.
10096 <p>Default value is <var>normalized_iteration_count</var>.
10099 <dt> ‘<samp>rate, r</samp>’</dt>
10100 <dd><p>Set frame rate, expressed as number of frames per second. Default
10101 value is "25".
10104 <dt> ‘<samp>size, s</samp>’</dt>
10105 <dd><p>Set frame size. For the syntax of this option, check the "Video
10106 size" section in the ffmpeg-utils manual. Default value is "640x480".
10109 <dt> ‘<samp>start_scale</samp>’</dt>
10110 <dd><p>Set the initial scale value. Default value is 3.0.
10113 <dt> ‘<samp>start_x</samp>’</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.
10118 <dt> ‘<samp>start_y</samp>’</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.
10124 <a name="mptestsrc"></a>
10125 <h2 class="section"><a href="ffmpeg-filters.html#toc-mptestsrc">10.4 mptestsrc</a></h2>
10127 <p>Generate various test patterns, as generated by the MPlayer test filter.
10129 <p>The size of the generated video is fixed, and is 256x256.
10130 This source is useful in particular for testing encoding features.
10132 <p>This source accepts the following options:
10134 <dl compact="compact">
10135 <dt> ‘<samp>rate, r</samp>’</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
10143 <dt> ‘<samp>duration, d</samp>’</dt>
10144 <dd><p>Set the video duration of the sourced video. The accepted syntax is:
10145 </p><table><tr><td> </td><td><pre class="example">[-]HH:MM:SS[.m...]
10147 </pre></td></tr></table>
10148 <p>See also the function <code>av_parse_time()</code>.
10150 <p>If not specified, or the expressed duration is negative, the video is
10151 supposed to be generated forever.
10154 <dt> ‘<samp>test, t</samp>’</dt>
10156 <p>Set the number or the name of the test to perform. Supported tests are:
10157 </p><dl compact="compact">
10158 <dt> ‘<samp>dc_luma</samp>’</dt>
10159 <dt> ‘<samp>dc_chroma</samp>’</dt>
10160 <dt> ‘<samp>freq_luma</samp>’</dt>
10161 <dt> ‘<samp>freq_chroma</samp>’</dt>
10162 <dt> ‘<samp>amp_luma</samp>’</dt>
10163 <dt> ‘<samp>amp_chroma</samp>’</dt>
10164 <dt> ‘<samp>cbp</samp>’</dt>
10165 <dt> ‘<samp>mv</samp>’</dt>
10166 <dt> ‘<samp>ring1</samp>’</dt>
10167 <dt> ‘<samp>ring2</samp>’</dt>
10168 <dt> ‘<samp>all</samp>’</dt>
10171 <p>Default value is "all", which will cycle through the list of all tests.
10175 <p>For example the following:
10176 </p><table><tr><td> </td><td><pre class="example">testsrc=t=dc_luma
10177 </pre></td></tr></table>
10179 <p>will generate a "dc_luma" test pattern.
10181 <a name="frei0r_005fsrc"></a>
10182 <h2 class="section"><a href="ffmpeg-filters.html#toc-frei0r_005fsrc">10.5 frei0r_src</a></h2>
10184 <p>Provide a frei0r source.
10186 <p>To enable compilation of this filter you need to install the frei0r
10187 header and configure FFmpeg with <code>--enable-frei0r</code>.
10189 <p>This source accepts the following options:
10191 <dl compact="compact">
10192 <dt> ‘<samp>size</samp>’</dt>
10193 <dd><p>The size of the video to generate. For the syntax of this option, check the
10194 "Video size" section in the ffmpeg-utils manual.
10197 <dt> ‘<samp>framerate</samp>’</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.
10202 <dt> ‘<samp>filter_name</samp>’</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
10208 <dt> ‘<samp>filter_params</samp>’</dt>
10209 <dd><p>A ’|’-separated list of parameters to pass to the frei0r source.
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> </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>
10219 <a name="life"></a>
10220 <h2 class="section"><a href="ffmpeg-filters.html#toc-life">10.6 life</a></h2>
10222 <p>Generate a life pattern.
10224 <p>This source is based on a generalization of John Conway’s life game.
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.
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 ‘<samp>rule</samp>’ option allows one to specify
10236 <p>This source accepts the following options:
10238 <dl compact="compact">
10239 <dt> ‘<samp>filename, f</samp>’</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.
10244 <p>If this option is not specified, the initial grid is generated
10248 <dt> ‘<samp>rate, r</samp>’</dt>
10249 <dd><p>Set the video rate, that is the number of frames generated per second.
10253 <dt> ‘<samp>random_fill_ratio, ratio</samp>’</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.
10259 <dt> ‘<samp>random_seed, seed</samp>’</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
10266 <dt> ‘<samp>rule</samp>’</dt>
10267 <dd><p>Set the life rule.
10269 <p>A rule can be specified with a code of the kind "S<var>NS</var>/B<var>NB</var>",
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 "born").
10274 "s" and "b" can be used in place of "S" and "B", respectively.
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 "borning" new cells. Higher order bits encode for an
10280 higher number of neighbor cells.
10281 For example the number 6153 = <code>(12<<9)+9</code> specifies a stay alive
10282 rule of 12 and a born rule of 9, which corresponds to "S23/B03".
10284 <p>Default value is "S23/B3", which is the original Conway’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
10290 <dt> ‘<samp>size, s</samp>’</dt>
10291 <dd><p>Set the size of the output video. For the syntax of this option, check the
10292 "Video size" section in the ffmpeg-utils manual.
10294 <p>If ‘<samp>filename</samp>’ is specified, the size is set by default to the
10295 same size of the input file. If ‘<samp>size</samp>’ 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.
10299 <p>If a filename is not specified, the size value defaults to "320x240"
10300 (used for a randomly generated initial grid).
10303 <dt> ‘<samp>stitch</samp>’</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.
10308 <dt> ‘<samp>mold</samp>’</dt>
10309 <dd><p>Set cell mold speed. If set, a dead cell will go from ‘<samp>death_color</samp>’ to
10310 ‘<samp>mold_color</samp>’ with a step of ‘<samp>mold</samp>’. ‘<samp>mold</samp>’ can have a
10311 value from 0 to 255.
10314 <dt> ‘<samp>life_color</samp>’</dt>
10315 <dd><p>Set the color of living (or new born) cells.
10318 <dt> ‘<samp>death_color</samp>’</dt>
10319 <dd><p>Set the color of dead cells. If ‘<samp>mold</samp>’ is set, this is the first color
10320 used to represent a dead cell.
10323 <dt> ‘<samp>mold_color</samp>’</dt>
10324 <dd><p>Set mold color, for definitely dead and moldy cells.
10326 <p>For the syntax of these 3 color options, check the "Color" section in the
10327 ffmpeg-utils manual.
10331 <a name="Examples-11"></a>
10332 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-11">10.6.1 Examples</a></h3>
10336 Read a grid from ‘<tt>pattern</tt>’, and center it on a grid of size
10338 <table><tr><td> </td><td><pre class="example">life=f=pattern:s=300x300
10339 </pre></td></tr></table>
10342 Generate a random grid of size 200x200, with a fill ratio of 2/3:
10343 <table><tr><td> </td><td><pre class="example">life=ratio=2/3:s=200x200
10344 </pre></td></tr></table>
10347 Specify a custom rule for evolving a randomly generated grid:
10348 <table><tr><td> </td><td><pre class="example">life=rule=S14/B34
10349 </pre></td></tr></table>
10352 Full example with slow death effect (mold) using <code>ffplay</code>:
10353 <table><tr><td> </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>
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>
10367 <p>The <code>color</code> source provides an uniformly colored input.
10369 <p>The <code>haldclutsrc</code> source provides an identity Hald CLUT. See also
10370 <a href="#haldclut">haldclut</a> filter.
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.
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.
10380 <p>The <code>smptebars</code> source generates a color bars pattern, based on
10381 the SMPTE Engineering Guideline EG 1-1990.
10383 <p>The <code>smptehdbars</code> source generates a color bars pattern, based on
10384 the SMPTE RP 219-2002.
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.
10390 <p>The sources accept the following options:
10392 <dl compact="compact">
10393 <dt> ‘<samp>color, c</samp>’</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 "Color" section in the
10396 ffmpeg-utils manual.
10399 <dt> ‘<samp>level</samp>’</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.
10406 <dt> ‘<samp>size, s</samp>’</dt>
10407 <dd><p>Specify the size of the sourced video. For the syntax of this option, check the
10408 "Video size" section in the ffmpeg-utils manual. The default value is
10409 "320x240".
10411 <p>This option is not available with the <code>haldclutsrc</code> filter.
10414 <dt> ‘<samp>rate, r</samp>’</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
10422 <dt> ‘<samp>sar</samp>’</dt>
10423 <dd><p>Set the sample aspect ratio of the sourced video.
10426 <dt> ‘<samp>duration, d</samp>’</dt>
10427 <dd><p>Set the video duration of the sourced video. The accepted syntax is:
10428 </p><table><tr><td> </td><td><pre class="example">[-]HH[:MM[:SS[.m...]]]
10430 </pre></td></tr></table>
10431 <p>See also the function <code>av_parse_time()</code>.
10433 <p>If not specified, or the expressed duration is negative, the video is
10434 supposed to be generated forever.
10437 <dt> ‘<samp>decimals, n</samp>’</dt>
10438 <dd><p>Set the number of decimals to show in the timestamp, only available in the
10439 <code>testsrc</code> source.
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.
10447 <p>For example the following:
10448 </p><table><tr><td> </td><td><pre class="example">testsrc=duration=5.3:size=qcif:rate=10
10449 </pre></td></tr></table>
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.
10454 <p>The following graph description will generate a red source
10455 with an opacity of 0.2, with size "qcif" and a frame rate of 10
10457 </p><table><tr><td> </td><td><pre class="example">color=c=red@0.2:s=qcif:r=10
10458 </pre></td></tr></table>
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> </td><td><pre class="example">nullsrc=s=256x256, geq=random(1)*255:128:128
10464 </pre></td></tr></table>
10466 <a name="Commands-1"></a>
10467 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Commands-1">10.7.1 Commands</a></h3>
10469 <p>The <code>color</code> source supports the following commands:
10471 <dl compact="compact">
10472 <dt> ‘<samp>c, color</samp>’</dt>
10473 <dd><p>Set the color of the created image. Accepts the same syntax of the
10474 corresponding ‘<samp>color</samp>’ option.
10479 <a name="Video-Sinks"></a>
10480 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Video-Sinks">11. Video Sinks</a></h1>
10482 <p>Below is a description of the currently available video sinks.
10484 <a name="buffersink"></a>
10485 <h2 class="section"><a href="ffmpeg-filters.html#toc-buffersink">11.1 buffersink</a></h2>
10487 <p>Buffer video frames, and make them available to the end of the filter
10490 <p>This sink is mainly intended for a programmatic use, in particular
10491 through the interface defined in ‘<tt>libavfilter/buffersink.h</tt>’
10492 or the options system.
10494 <p>It accepts a pointer to an AVBufferSinkContext structure, which
10495 defines the incoming buffers’ formats, to be passed as the opaque
10496 parameter to <code>avfilter_init_filter</code> for initialization.
10498 <a name="nullsink"></a>
10499 <h2 class="section"><a href="ffmpeg-filters.html#toc-nullsink">11.2 nullsink</a></h2>
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
10506 <a name="Multimedia-Filters"></a>
10507 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Multimedia-Filters">12. Multimedia Filters</a></h1>
10509 <p>Below is a description of the currently available multimedia filters.
10511 <a name="avectorscope"></a>
10512 <h2 class="section"><a href="ffmpeg-filters.html#toc-avectorscope">12.1 avectorscope</a></h2>
10514 <p>Convert input audio to a video output, representing the audio vector
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.
10524 <p>The filter accepts the following options:
10526 <dl compact="compact">
10527 <dt> ‘<samp>mode, m</samp>’</dt>
10528 <dd><p>Set the vectorscope mode.
10530 <p>Available values are:
10531 </p><dl compact="compact">
10532 <dt> ‘<samp>lissajous</samp>’</dt>
10533 <dd><p>Lissajous rotated by 45 degrees.
10536 <dt> ‘<samp>lissajous_xy</samp>’</dt>
10537 <dd><p>Same as above but not rotated.
10541 <p>Default value is ‘<samp>lissajous</samp>’.
10544 <dt> ‘<samp>size, s</samp>’</dt>
10545 <dd><p>Set the video size for the output. For the syntax of this option, check the "Video size"
10546 section in the ffmpeg-utils manual. Default value is <code>400x400</code>.
10549 <dt> ‘<samp>rate, r</samp>’</dt>
10550 <dd><p>Set the output frame rate. Default value is <code>25</code>.
10553 <dt> ‘<samp>rc</samp>’</dt>
10554 <dt> ‘<samp>gc</samp>’</dt>
10555 <dt> ‘<samp>bc</samp>’</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>.
10560 <dt> ‘<samp>rf</samp>’</dt>
10561 <dt> ‘<samp>gf</samp>’</dt>
10562 <dt> ‘<samp>bf</samp>’</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>.
10567 <dt> ‘<samp>zoom</samp>’</dt>
10568 <dd><p>Set the zoom factor. Default value is <code>1</code>. Allowed range is <code>[1, 10]</code>.
10572 <a name="Examples-57"></a>
10573 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-57">12.1.1 Examples</a></h3>
10577 Complete example using <code>ffplay</code>:
10578 <table><tr><td> </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>
10583 <a name="concat"></a>
10584 <h2 class="section"><a href="ffmpeg-filters.html#toc-concat">12.2 concat</a></h2>
10586 <p>Concatenate audio and video streams, joining them together one after the
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.
10593 <p>The filter accepts the following options:
10595 <dl compact="compact">
10596 <dt> ‘<samp>n</samp>’</dt>
10597 <dd><p>Set the number of segments. Default is 2.
10600 <dt> ‘<samp>v</samp>’</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.
10605 <dt> ‘<samp>a</samp>’</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.
10610 <dt> ‘<samp>unsafe</samp>’</dt>
10611 <dd><p>Activate unsafe mode: do not fail if segments have a different format.
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.
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
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.
10630 <p>For this filter to work correctly, all segments must start at timestamp 0.
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.
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.
10641 <a name="Examples-10"></a>
10642 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-10">12.2.1 Examples</a></h3>
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> </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>
10655 Concatenate two parts, handling audio and video separately, using the
10656 (a)movie sources, and adjusting the resolution:
10657 <table><tr><td> </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.
10666 <a name="ebur128"></a>
10667 <h2 class="section"><a href="ffmpeg-filters.html#toc-ebur128">12.3 ebur128</a></h2>
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>).
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).
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>.
10684 <p>The filter accepts the following options:
10686 <dl compact="compact">
10687 <dt> ‘<samp>video</samp>’</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>.
10693 <dt> ‘<samp>size</samp>’</dt>
10694 <dd><p>Set the video size. This option is for video only. For the syntax of this
10695 option, check the "Video size" section in the ffmpeg-utils manual. Default
10696 and minimum resolution is <code>640x480</code>.
10699 <dt> ‘<samp>meter</samp>’</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.
10705 <dt> ‘<samp>metadata</samp>’</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>.
10710 <p>Default is <code>0</code>.
10713 <dt> ‘<samp>framelog</samp>’</dt>
10714 <dd><p>Force the frame logging level.
10716 <p>Available values are:
10717 </p><dl compact="compact">
10718 <dt> ‘<samp>info</samp>’</dt>
10719 <dd><p>information logging level
10721 <dt> ‘<samp>verbose</samp>’</dt>
10722 <dd><p>verbose logging level
10726 <p>By default, the logging level is set to <var>info</var>. If the ‘<samp>video</samp>’ or
10727 the ‘<samp>metadata</samp>’ options are set, it switches to <var>verbose</var>.
10730 <dt> ‘<samp>peak</samp>’</dt>
10731 <dd><p>Set peak mode(s).
10733 <p>Available modes can be cumulated (the option is a <code>flag</code> type). Possible
10735 </p><dl compact="compact">
10736 <dt> ‘<samp>none</samp>’</dt>
10737 <dd><p>Disable any peak mode (default).
10739 <dt> ‘<samp>sample</samp>’</dt>
10740 <dd><p>Enable sample-peak mode.
10742 <p>Simple peak mode looking for the higher sample value. It logs a message
10743 for sample-peak (identified by <code>SPK</code>).
10745 <dt> ‘<samp>true</samp>’</dt>
10746 <dd><p>Enable true-peak mode.
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>.
10758 <a name="Examples-6"></a>
10759 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-6">12.3.1 Examples</a></h3>
10763 Real-time graph using <code>ffplay</code>, with a EBU scale meter +18:
10764 <table><tr><td> </td><td><pre class="example">ffplay -f lavfi -i "amovie=input.mp3,ebur128=video=1:meter=18 [out0][out1]"
10765 </pre></td></tr></table>
10768 Run an analysis with <code>ffmpeg</code>:
10769 <table><tr><td> </td><td><pre class="example">ffmpeg -nostats -i input.mp3 -filter_complex ebur128 -f null -
10770 </pre></td></tr></table>
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>
10776 <p>Temporally interleave frames from several inputs.
10778 <p><code>interleave</code> works with video inputs, <code>ainterleave</code> with audio.
10780 <p>These filters read frames from several inputs and send the oldest
10781 queued frame to the output.
10783 <p>Input streams must have a well defined, monotonically increasing frame
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.
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.
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.
10799 <p>These filters accept the following options:
10801 <dl compact="compact">
10802 <dt> ‘<samp>nb_inputs, n</samp>’</dt>
10803 <dd><p>Set the number of different inputs, it is 2 by default.
10807 <a name="Examples-60"></a>
10808 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-60">12.4.1 Examples</a></h3>
10812 Interleave frames belonging to different streams using <code>ffmpeg</code>:
10813 <table><tr><td> </td><td><pre class="example">ffmpeg -i bambi.avi -i pr0n.mkv -filter_complex "[0:v][1:v] interleave" out.avi
10814 </pre></td></tr></table>
10817 Add flickering blur effect:
10818 <table><tr><td> </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>
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>
10825 <p>Set read/write permissions for the output frames.
10827 <p>These filters are mainly aimed at developers to test direct path in the
10828 following filter in the filtergraph.
10830 <p>The filters accept the following options:
10832 <dl compact="compact">
10833 <dt> ‘<samp>mode</samp>’</dt>
10834 <dd><p>Select the permissions mode.
10836 <p>It accepts the following values:
10837 </p><dl compact="compact">
10838 <dt> ‘<samp>none</samp>’</dt>
10839 <dd><p>Do nothing. This is the default.
10841 <dt> ‘<samp>ro</samp>’</dt>
10842 <dd><p>Set all the output frames read-only.
10844 <dt> ‘<samp>rw</samp>’</dt>
10845 <dd><p>Set all the output frames directly writable.
10847 <dt> ‘<samp>toggle</samp>’</dt>
10848 <dd><p>Make the frame read-only if writable, and writable if read-only.
10850 <dt> ‘<samp>random</samp>’</dt>
10851 <dd><p>Set each output frame read-only or writable randomly.
10856 <dt> ‘<samp>seed</samp>’</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
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.
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>
10872 <p>Select frames to pass in output.
10874 <p>This filter accepts the following options:
10876 <dl compact="compact">
10877 <dt> ‘<samp>expr, e</samp>’</dt>
10878 <dd><p>Set expression, which is evaluated for each input frame.
10880 <p>If the expression is evaluated to zero, the frame is discarded.
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.
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.
10890 <dt> ‘<samp>outputs, n</samp>’</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.
10896 <p>The expression can contain the following constants:
10898 <dl compact="compact">
10899 <dt> ‘<samp>n</samp>’</dt>
10900 <dd><p>the sequential number of the filtered frame, starting from 0
10903 <dt> ‘<samp>selected_n</samp>’</dt>
10904 <dd><p>the sequential number of the selected frame, starting from 0
10907 <dt> ‘<samp>prev_selected_n</samp>’</dt>
10908 <dd><p>the sequential number of the last selected frame, NAN if undefined
10911 <dt> ‘<samp>TB</samp>’</dt>
10912 <dd><p>timebase of the input timestamps
10915 <dt> ‘<samp>pts</samp>’</dt>
10916 <dd><p>the PTS (Presentation TimeStamp) of the filtered video frame,
10917 expressed in <var>TB</var> units, NAN if undefined
10920 <dt> ‘<samp>t</samp>’</dt>
10921 <dd><p>the PTS (Presentation TimeStamp) of the filtered video frame,
10922 expressed in seconds, NAN if undefined
10925 <dt> ‘<samp>prev_pts</samp>’</dt>
10926 <dd><p>the PTS of the previously filtered video frame, NAN if undefined
10929 <dt> ‘<samp>prev_selected_pts</samp>’</dt>
10930 <dd><p>the PTS of the last previously filtered video frame, NAN if undefined
10933 <dt> ‘<samp>prev_selected_t</samp>’</dt>
10934 <dd><p>the PTS of the last previously selected video frame, NAN if undefined
10937 <dt> ‘<samp>start_pts</samp>’</dt>
10938 <dd><p>the PTS of the first video frame in the video, NAN if undefined
10941 <dt> ‘<samp>start_t</samp>’</dt>
10942 <dd><p>the time of the first video frame in the video, NAN if undefined
10945 <dt> ‘<samp>pict_type <em>(video only)</em></samp>’</dt>
10946 <dd><p>the type of the filtered frame, can assume one of the following
10948 </p><dl compact="compact">
10949 <dt> ‘<samp>I</samp>’</dt>
10950 <dt> ‘<samp>P</samp>’</dt>
10951 <dt> ‘<samp>B</samp>’</dt>
10952 <dt> ‘<samp>S</samp>’</dt>
10953 <dt> ‘<samp>SI</samp>’</dt>
10954 <dt> ‘<samp>SP</samp>’</dt>
10955 <dt> ‘<samp>BI</samp>’</dt>
10959 <dt> ‘<samp>interlace_type <em>(video only)</em></samp>’</dt>
10960 <dd><p>the frame interlace type, can assume one of the following values:
10961 </p><dl compact="compact">
10962 <dt> ‘<samp>PROGRESSIVE</samp>’</dt>
10963 <dd><p>the frame is progressive (not interlaced)
10965 <dt> ‘<samp>TOPFIRST</samp>’</dt>
10966 <dd><p>the frame is top-field-first
10968 <dt> ‘<samp>BOTTOMFIRST</samp>’</dt>
10969 <dd><p>the frame is bottom-field-first
10974 <dt> ‘<samp>consumed_sample_n <em>(audio only)</em></samp>’</dt>
10975 <dd><p>the number of selected samples before the current frame
10978 <dt> ‘<samp>samples_n <em>(audio only)</em></samp>’</dt>
10979 <dd><p>the number of samples in the current frame
10982 <dt> ‘<samp>sample_rate <em>(audio only)</em></samp>’</dt>
10983 <dd><p>the input sample rate
10986 <dt> ‘<samp>key</samp>’</dt>
10987 <dd><p>1 if the filtered frame is a key-frame, 0 otherwise
10990 <dt> ‘<samp>pos</samp>’</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)
10995 <dt> ‘<samp>scene <em>(video only)</em></samp>’</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)
11003 <p>The default value of the select expression is "1".
11005 <a name="Examples-40"></a>
11006 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-40">12.6.1 Examples</a></h3>
11010 Select all frames in input:
11011 <table><tr><td> </td><td><pre class="example">select
11012 </pre></td></tr></table>
11014 <p>The example above is the same as:
11015 </p><table><tr><td> </td><td><pre class="example">select=1
11016 </pre></td></tr></table>
11020 <table><tr><td> </td><td><pre class="example">select=0
11021 </pre></td></tr></table>
11024 Select only I-frames:
11025 <table><tr><td> </td><td><pre class="example">select='eq(pict_type\,I)'
11026 </pre></td></tr></table>
11029 Select one frame every 100:
11030 <table><tr><td> </td><td><pre class="example">select='not(mod(n\,100))'
11031 </pre></td></tr></table>
11034 Select only frames contained in the 10-20 time interval:
11035 <table><tr><td> </td><td><pre class="example">select=between(t\,10\,20)
11036 </pre></td></tr></table>
11039 Select only I frames contained in the 10-20 time interval:
11040 <table><tr><td> </td><td><pre class="example">select=between(t\,10\,20)*eq(pict_type\,I)
11041 </pre></td></tr></table>
11044 Select frames with a minimum distance of 10 seconds:
11045 <table><tr><td> </td><td><pre class="example">select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
11046 </pre></td></tr></table>
11049 Use aselect to select only audio frames with samples number > 100:
11050 <table><tr><td> </td><td><pre class="example">aselect='gt(samples_n\,100)'
11051 </pre></td></tr></table>
11054 Create a mosaic of the first scenes:
11055 <table><tr><td> </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>
11058 <p>Comparing <var>scene</var> against a value between 0.3 and 0.5 is generally a sane
11062 Send even and odd frames to separate outputs, and compose them:
11063 <table><tr><td> </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>
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>
11070 <p>Send commands to filters in the filtergraph.
11072 <p>These filters read commands to be sent to other filters in the
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.
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.
11083 <p>These filters accept the following options:
11084 </p><dl compact="compact">
11085 <dt> ‘<samp>commands, c</samp>’</dt>
11086 <dd><p>Set the commands to be read and sent to the other filters.
11088 <dt> ‘<samp>filename, f</samp>’</dt>
11089 <dd><p>Set the filename of the commands to be read and sent to the other
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>
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
11103 <p>An interval is specified by the following syntax:
11104 </p><table><tr><td> </td><td><pre class="example"><var>START</var>[-<var>END</var>] <var>COMMANDS</var>;
11105 </pre></td></tr></table>
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.
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
11115 <p><var>COMMANDS</var> consists of a sequence of one or more command
11116 specifications, separated by ",", relating to that interval. The
11117 syntax of a command specification is given by:
11118 </p><table><tr><td> </td><td><pre class="example">[<var>FLAGS</var>] <var>TARGET</var> <var>COMMAND</var> <var>ARG</var>
11119 </pre></td></tr></table>
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 "+" or "|" and
11124 enclosed between "[" and "]".
11126 <p>The following flags are recognized:
11127 </p><dl compact="compact">
11128 <dt> ‘<samp>enter</samp>’</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
11135 <dt> ‘<samp>leave</samp>’</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
11143 <p>If <var>FLAGS</var> is not specified, a default value of <code>[enter]</code> is
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.
11149 <p><var>COMMAND</var> specifies the name of the command for the target filter.
11151 <p><var>ARG</var> is optional and specifies the optional list of argument for
11152 the given <var>COMMAND</var>.
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.
11158 <p>A simplified BNF description of the commands specification syntax
11160 </p><table><tr><td> </td><td><pre class="example"><var>COMMAND_FLAG</var> ::= "enter" | "leave"
11161 <var>COMMAND_FLAGS</var> ::= <var>COMMAND_FLAG</var> [(+|"|")<var>COMMAND_FLAG</var>]
11162 <var>COMMAND</var> ::= ["[" <var>COMMAND_FLAGS</var> "]"] <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>
11168 <a name="Examples-7"></a>
11169 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-7">12.7.2 Examples</a></h3>
11173 Specify audio tempo change at second 4:
11174 <table><tr><td> </td><td><pre class="example">asendcmd=c='4.0 atempo tempo 1.5',atempo
11175 </pre></td></tr></table>
11178 Specify a list of drawtext and hue commands in a file.
11179 <table><tr><td> </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=';
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',
11187 [leave] drawtext reinit 'fontfile=FreeSerif.ttf:text=color';
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>
11193 <p>A filtergraph allowing to read and process the above command list
11194 stored in a file ‘<tt>test.cmd</tt>’, can be specified with:
11195 </p><table><tr><td> </td><td><pre class="example">sendcmd=f=test.cmd,drawtext=fontfile=FreeSerif.ttf:text='',hue
11196 </pre></td></tr></table>
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>
11203 <p>Change the PTS (presentation timestamp) of the input frames.
11205 <p><code>setpts</code> works on video frames, <code>asetpts</code> on audio frames.
11207 <p>This filter accepts the following options:
11209 <dl compact="compact">
11210 <dt> ‘<samp>expr</samp>’</dt>
11211 <dd><p>The expression which is evaluated for each frame to construct its timestamp.
11216 <p>The expression is evaluated through the eval API and can contain the following
11219 <dl compact="compact">
11220 <dt> ‘<samp>FRAME_RATE</samp>’</dt>
11221 <dd><p>frame rate, only defined for constant frame-rate video
11224 <dt> ‘<samp>PTS</samp>’</dt>
11225 <dd><p>the presentation timestamp in input
11228 <dt> ‘<samp>N</samp>’</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.
11233 <dt> ‘<samp>NB_CONSUMED_SAMPLES</samp>’</dt>
11234 <dd><p>the number of consumed samples, not including the current frame (only
11238 <dt> ‘<samp>NB_SAMPLES, S</samp>’</dt>
11239 <dd><p>the number of samples in the current frame (only audio)
11242 <dt> ‘<samp>SAMPLE_RATE, SR</samp>’</dt>
11243 <dd><p>audio sample rate
11246 <dt> ‘<samp>STARTPTS</samp>’</dt>
11247 <dd><p>the PTS of the first frame
11250 <dt> ‘<samp>STARTT</samp>’</dt>
11251 <dd><p>the time in seconds of the first frame
11254 <dt> ‘<samp>INTERLACED</samp>’</dt>
11255 <dd><p>tell if the current frame is interlaced
11258 <dt> ‘<samp>T</samp>’</dt>
11259 <dd><p>the time in seconds of the current frame
11262 <dt> ‘<samp>POS</samp>’</dt>
11263 <dd><p>original position in the file of the frame, or undefined if undefined
11264 for the current frame
11267 <dt> ‘<samp>PREV_INPTS</samp>’</dt>
11268 <dd><p>previous input PTS
11271 <dt> ‘<samp>PREV_INT</samp>’</dt>
11272 <dd><p>previous input time in seconds
11275 <dt> ‘<samp>PREV_OUTPTS</samp>’</dt>
11276 <dd><p>previous output PTS
11279 <dt> ‘<samp>PREV_OUTT</samp>’</dt>
11280 <dd><p>previous output time in seconds
11283 <dt> ‘<samp>RTCTIME</samp>’</dt>
11284 <dd><p>wallclock (RTC) time in microseconds. This is deprecated, use time(0)
11288 <dt> ‘<samp>RTCSTART</samp>’</dt>
11289 <dd><p>wallclock (RTC) time at the start of the movie in microseconds
11292 <dt> ‘<samp>TB</samp>’</dt>
11293 <dd><p>timebase of the input timestamps
11298 <a name="Examples"></a>
11299 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples">12.8.1 Examples</a></h3>
11303 Start counting PTS from zero
11304 <table><tr><td> </td><td><pre class="example">setpts=PTS-STARTPTS
11305 </pre></td></tr></table>
11308 Apply fast motion effect:
11309 <table><tr><td> </td><td><pre class="example">setpts=0.5*PTS
11310 </pre></td></tr></table>
11313 Apply slow motion effect:
11314 <table><tr><td> </td><td><pre class="example">setpts=2.0*PTS
11315 </pre></td></tr></table>
11318 Set fixed rate of 25 frames per second:
11319 <table><tr><td> </td><td><pre class="example">setpts=N/(25*TB)
11320 </pre></td></tr></table>
11323 Set fixed rate 25 fps with some jitter:
11324 <table><tr><td> </td><td><pre class="example">setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
11325 </pre></td></tr></table>
11328 Apply an offset of 10 seconds to the input PTS:
11329 <table><tr><td> </td><td><pre class="example">setpts=PTS+10/TB
11330 </pre></td></tr></table>
11333 Generate timestamps from a "live source" and rebase onto the current timebase:
11334 <table><tr><td> </td><td><pre class="example">setpts='(RTCTIME - RTCSTART) / (TB * 1000000)'
11335 </pre></td></tr></table>
11338 Generate timestamps by counting samples:
11339 <table><tr><td> </td><td><pre class="example">asetpts=N/SR/TB
11340 </pre></td></tr></table>
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>
11347 <p>Set the timebase to use for the output frames timestamps.
11348 It is mainly useful for testing timebase configuration.
11350 <p>This filter accepts the following options:
11352 <dl compact="compact">
11353 <dt> ‘<samp>expr, tb</samp>’</dt>
11354 <dd><p>The expression which is evaluated into the output timebase.
11359 <p>The value for ‘<samp>tb</samp>’ is an arithmetic expression representing a
11360 rational. The expression can contain the constants "AVTB" (the default
11361 timebase), "intb" (the input timebase) and "sr" (the sample rate,
11362 audio only). Default value is "intb".
11364 <a name="Examples-67"></a>
11365 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-67">12.9.1 Examples</a></h3>
11369 Set the timebase to 1/25:
11370 <table><tr><td> </td><td><pre class="example">settb=expr=1/25
11371 </pre></td></tr></table>
11374 Set the timebase to 1/10:
11375 <table><tr><td> </td><td><pre class="example">settb=expr=0.1
11376 </pre></td></tr></table>
11379 Set the timebase to 1001/1000:
11380 <table><tr><td> </td><td><pre class="example">settb=1+0.001
11381 </pre></td></tr></table>
11384 Set the timebase to 2*intb:
11385 <table><tr><td> </td><td><pre class="example">settb=2*intb
11386 </pre></td></tr></table>
11389 Set the default timebase value:
11390 <table><tr><td> </td><td><pre class="example">settb=AVTB
11391 </pre></td></tr></table>
11394 <a name="showspectrum"></a>
11395 <h2 class="section"><a href="ffmpeg-filters.html#toc-showspectrum">12.10 showspectrum</a></h2>
11397 <p>Convert input audio to a video output, representing the audio frequency
11400 <p>The filter accepts the following options:
11402 <dl compact="compact">
11403 <dt> ‘<samp>size, s</samp>’</dt>
11404 <dd><p>Specify the video size for the output. For the syntax of this option, check
11405 the "Video size" section in the ffmpeg-utils manual. Default value is
11406 <code>640x512</code>.
11409 <dt> ‘<samp>slide</samp>’</dt>
11410 <dd><p>Specify if the spectrum should slide along the window. Default value is
11414 <dt> ‘<samp>mode</samp>’</dt>
11415 <dd><p>Specify display mode.
11417 <p>It accepts the following values:
11418 </p><dl compact="compact">
11419 <dt> ‘<samp>combined</samp>’</dt>
11420 <dd><p>all channels are displayed in the same row
11422 <dt> ‘<samp>separate</samp>’</dt>
11423 <dd><p>all channels are displayed in separate rows
11427 <p>Default value is ‘<samp>combined</samp>’.
11430 <dt> ‘<samp>color</samp>’</dt>
11431 <dd><p>Specify display color mode.
11433 <p>It accepts the following values:
11434 </p><dl compact="compact">
11435 <dt> ‘<samp>channel</samp>’</dt>
11436 <dd><p>each channel is displayed in a separate color
11438 <dt> ‘<samp>intensity</samp>’</dt>
11439 <dd><p>each channel is is displayed using the same color scheme
11443 <p>Default value is ‘<samp>channel</samp>’.
11446 <dt> ‘<samp>scale</samp>’</dt>
11447 <dd><p>Specify scale used for calculating intensity color values.
11449 <p>It accepts the following values:
11450 </p><dl compact="compact">
11451 <dt> ‘<samp>lin</samp>’</dt>
11454 <dt> ‘<samp>sqrt</samp>’</dt>
11455 <dd><p>square root, default
11457 <dt> ‘<samp>cbrt</samp>’</dt>
11460 <dt> ‘<samp>log</samp>’</dt>
11465 <p>Default value is ‘<samp>sqrt</samp>’.
11468 <dt> ‘<samp>saturation</samp>’</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>.
11475 <dt> ‘<samp>win_func</samp>’</dt>
11476 <dd><p>Set window function.
11478 <p>It accepts the following values:
11479 </p><dl compact="compact">
11480 <dt> ‘<samp>none</samp>’</dt>
11481 <dd><p>No samples pre-processing (do not expect this to be faster)
11483 <dt> ‘<samp>hann</samp>’</dt>
11486 <dt> ‘<samp>hamming</samp>’</dt>
11487 <dd><p>Hamming window
11489 <dt> ‘<samp>blackman</samp>’</dt>
11490 <dd><p>Blackman window
11494 <p>Default value is <code>hann</code>.
11498 <p>The usage is very similar to the showwaves filter; see the examples in that
11501 <a name="Examples-68"></a>
11502 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-68">12.10.1 Examples</a></h3>
11506 Large window with logarithmic color scaling:
11507 <table><tr><td> </td><td><pre class="example">showspectrum=s=1280x480:scale=log
11508 </pre></td></tr></table>
11511 Complete example for a colored and sliding spectrum per channel using <code>ffplay</code>:
11512 <table><tr><td> </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>
11517 <a name="showwaves"></a>
11518 <h2 class="section"><a href="ffmpeg-filters.html#toc-showwaves">12.11 showwaves</a></h2>
11520 <p>Convert input audio to a video output, representing the samples waves.
11522 <p>The filter accepts the following options:
11524 <dl compact="compact">
11525 <dt> ‘<samp>size, s</samp>’</dt>
11526 <dd><p>Specify the video size for the output. For the syntax of this option, check
11527 the "Video size" section in the ffmpeg-utils manual. Default value
11528 is "600x240".
11531 <dt> ‘<samp>mode</samp>’</dt>
11532 <dd><p>Set display mode.
11534 <p>Available values are:
11535 </p><dl compact="compact">
11536 <dt> ‘<samp>point</samp>’</dt>
11537 <dd><p>Draw a point for each sample.
11540 <dt> ‘<samp>line</samp>’</dt>
11541 <dd><p>Draw a vertical line for each sample.
11545 <p>Default value is <code>point</code>.
11548 <dt> ‘<samp>n</samp>’</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.
11555 <dt> ‘<samp>rate, r</samp>’</dt>
11556 <dd><p>Set the (approximate) output frame rate. This is done by setting the
11557 option <var>n</var>. Default value is "25".
11562 <a name="Examples-47"></a>
11563 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-47">12.11.1 Examples</a></h3>
11567 Output the input file audio and the corresponding video representation
11569 <table><tr><td> </td><td><pre class="example">amovie=a.mp3,asplit[out0],showwaves[out1]
11570 </pre></td></tr></table>
11573 Create a synthetic signal and show it with showwaves, forcing a
11574 frame rate of 30 frames per second:
11575 <table><tr><td> </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>
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>
11582 <p>Split input into several identical outputs.
11584 <p><code>asplit</code> works with audio input, <code>split</code> with video.
11586 <p>The filter accepts a single parameter which specifies the number of outputs. If
11587 unspecified, it defaults to 2.
11589 <a name="Examples-63"></a>
11590 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-63">12.12.1 Examples</a></h3>
11594 Create two separate outputs from the same input:
11595 <table><tr><td> </td><td><pre class="example">[in] split [out0][out1]
11596 </pre></td></tr></table>
11599 To create 3 or more outputs, you need to specify the number of
11601 <table><tr><td> </td><td><pre class="example">[in] asplit=3 [out0][out1][out2]
11602 </pre></td></tr></table>
11605 Create two separate outputs from the same input, one cropped and
11607 <table><tr><td> </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>
11613 Create 5 copies of the input audio with <code>ffmpeg</code>:
11614 <table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -filter_complex asplit=5 OUTPUT
11615 </pre></td></tr></table>
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>
11621 <p>Receive commands sent through a libzmq client, and forward them to
11622 filters in the filtergraph.
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
11628 <p>To enable these filters you need to install the libzmq library and
11629 headers and configure FFmpeg with <code>--enable-libzmq</code>.
11631 <p>For more information about libzmq see:
11632 <a href="http://www.zeromq.org/">http://www.zeromq.org/</a>
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 ‘<samp>bind_address</samp>’ option.
11638 <p>The received message must be in the form:
11639 </p><table><tr><td> </td><td><pre class="example"><var>TARGET</var> <var>COMMAND</var> [<var>ARG</var>]
11640 </pre></td></tr></table>
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.
11645 <p><var>COMMAND</var> specifies the name of the command for the target filter.
11647 <p><var>ARG</var> is optional and specifies the optional argument list for the
11648 given <var>COMMAND</var>.
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> </td><td><pre class="example"><var>ERROR_CODE</var> <var>ERROR_REASON</var>
11655 </pre></td></tr></table>
11657 <p><var>MESSAGE</var> is optional.
11659 <a name="Examples-61"></a>
11660 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-61">12.13.1 Examples</a></h3>
11662 <p>Look at ‘<tt>tools/zmqsend</tt>’ for an example of a zmq client which can
11663 be used to send commands processed by these filters.
11665 <p>Consider the following filtergraph generated by <code>ffplay</code>
11666 </p><table><tr><td> </td><td><pre class="example">ffplay -dumpgraph 1 -f lavfi "
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 "
11672 </pre></td></tr></table>
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> </td><td><pre class="example">echo Parsed_color_0 c yellow | tools/zmqsend
11677 </pre></td></tr></table>
11679 <p>To change the right side:
11680 </p><table><tr><td> </td><td><pre class="example">echo Parsed_color_1 c pink | tools/zmqsend
11681 </pre></td></tr></table>
11684 <a name="Multimedia-Sources"></a>
11685 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Multimedia-Sources">13. Multimedia Sources</a></h1>
11687 <p>Below is a description of the currently available multimedia sources.
11689 <a name="amovie"></a>
11690 <h2 class="section"><a href="ffmpeg-filters.html#toc-amovie">13.1 amovie</a></h2>
11692 <p>This is the same as <a href="#movie">movie</a> source, except it selects an audio
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>
11699 <p>Read audio and/or video stream(s) from a movie container.
11701 <p>This filter accepts the following options:
11703 <dl compact="compact">
11704 <dt> ‘<samp>filename</samp>’</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).
11709 <dt> ‘<samp>format_name, f</samp>’</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.
11715 <dt> ‘<samp>seek_point, sp</samp>’</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 "0".
11722 <dt> ‘<samp>streams, s</samp>’</dt>
11723 <dd><p>Specifies the streams to read. Several streams can be specified,
11724 separated by "+". The source will then have as many outputs, in the
11725 same order. The syntax is explained in the “Stream specifiers”
11726 section in the ffmpeg manual. Two special names, "dv" and "da" specify
11727 respectively the default (best suited) video and audio stream. Default
11728 is "dv", or "da" if the filter is called as "amovie".
11731 <dt> ‘<samp>stream_index, si</samp>’</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 "-1". Deprecated. If the filter is called "amovie", it will select
11735 audio instead of video.
11738 <dt> ‘<samp>loop</samp>’</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 "1".
11743 <p>Note that when the movie is looped the source timestamps are not
11744 changed, so it will generate non monotonically increasing timestamps.
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> </td><td><pre class="example">input -----------> deltapts0 --> overlay --> output
11753 movie --> scale--> deltapts1 -------+
11754 </pre></td></tr></table>
11756 <a name="Examples-69"></a>
11757 <h3 class="subsection"><a href="ffmpeg-filters.html#toc-Examples-69">13.2.1 Examples</a></h3>
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 "in":
11763 <table><tr><td> </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>
11769 Read from a video4linux2 device, and overlay it on top of the input
11770 labelled as "in":
11771 <table><tr><td> </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>
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 "video" and the audio is
11779 connected to the pad named "audio":
11780 <table><tr><td> </td><td><pre class="example">movie=dvd.vob:s=v:0+#0x81 [video] [audio]
11781 </pre></td></tr></table>
11785 <a name="See-Also"></a>
11786 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-See-Also">14. See Also</a></h1>
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>
11792 <a name="Authors"></a>
11793 <h1 class="chapter"><a href="ffmpeg-filters.html#toc-Authors">15. Authors</a></h1>
11795 <p>The FFmpeg developers.
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>.
11802 <p>Maintainers for the specific components are listed in the file
11803 ‘<tt>MAINTAINERS</tt>’ in the source code tree.
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>