]> git.sesse.net Git - casparcg/blob - ffmpeg 0.8/doc/ffmpeg.html
2.0. new dlls.
[casparcg] / ffmpeg 0.8 / doc / ffmpeg.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
2 <html>
3 <!-- Created on September 2, 2011 by texi2html 1.82
4 texi2html was written by: 
5             Lionel Cons <Lionel.Cons@cern.ch> (original author)
6             Karl Berry  <karl@freefriends.org>
7             Olaf Bachmann <obachman@mathematik.uni-kl.de>
8             and many others.
9 Maintained by: Many creative people.
10 Send bugs and suggestions to <texi2html-bug@nongnu.org>
11 -->
12 <head>
13 <title>ffmpeg Documentation</title>
14
15 <meta name="description" content="ffmpeg Documentation">
16 <meta name="keywords" content="ffmpeg Documentation">
17 <meta name="resource-type" content="document">
18 <meta name="distribution" content="global">
19 <meta name="Generator" content="texi2html 1.82">
20 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
21 <style type="text/css">
22 <!--
23 a.summary-letter {text-decoration: none}
24 blockquote.smallquotation {font-size: smaller}
25 pre.display {font-family: serif}
26 pre.format {font-family: serif}
27 pre.menu-comment {font-family: serif}
28 pre.menu-preformatted {font-family: serif}
29 pre.smalldisplay {font-family: serif; font-size: smaller}
30 pre.smallexample {font-size: smaller}
31 pre.smallformat {font-family: serif; font-size: smaller}
32 pre.smalllisp {font-size: smaller}
33 span.roman {font-family:serif; font-weight:normal;}
34 span.sansserif {font-family:sans-serif; font-weight:normal;}
35 ul.toc {list-style: none}
36 -->
37 </style>
38
39
40 </head>
41
42 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
43
44 <a name="SEC_Top"></a>
45 <h1 class="settitle">ffmpeg Documentation</h1>
46
47 <a name="SEC_Contents"></a>
48 <h1>Table of Contents</h1>
49 <div class="contents">
50
51 <ul class="toc">
52   <li><a name="toc-Synopsis" href="#Synopsis">1. Synopsis</a></li>
53   <li><a name="toc-Description" href="#Description">2. Description</a></li>
54   <li><a name="toc-Options-6" href="#Options-6">3. Options</a>
55   <ul class="toc">
56     <li><a name="toc-Generic-options" href="#Generic-options">3.1 Generic options</a></li>
57     <li><a name="toc-AVOptions" href="#AVOptions">3.2 AVOptions</a></li>
58     <li><a name="toc-Main-options" href="#Main-options">3.3 Main options</a></li>
59     <li><a name="toc-Video-Options" href="#Video-Options">3.4 Video Options</a></li>
60     <li><a name="toc-Advanced-Video-Options" href="#Advanced-Video-Options">3.5 Advanced Video Options</a></li>
61     <li><a name="toc-Audio-Options" href="#Audio-Options">3.6 Audio Options</a></li>
62     <li><a name="toc-Advanced-Audio-options_003a" href="#Advanced-Audio-options_003a">3.7 Advanced Audio options:</a></li>
63     <li><a name="toc-Subtitle-options_003a" href="#Subtitle-options_003a">3.8 Subtitle options:</a></li>
64     <li><a name="toc-Audio_002fVideo-grab-options" href="#Audio_002fVideo-grab-options">3.9 Audio/Video grab options</a></li>
65     <li><a name="toc-Advanced-options" href="#Advanced-options">3.10 Advanced options</a></li>
66     <li><a name="toc-Preset-files" href="#Preset-files">3.11 Preset files</a></li>
67   </ul></li>
68   <li><a name="toc-Tips" href="#Tips">4. Tips</a></li>
69   <li><a name="toc-Examples" href="#Examples">5. Examples</a>
70   <ul class="toc">
71     <li><a name="toc-Video-and-Audio-grabbing" href="#Video-and-Audio-grabbing">5.1 Video and Audio grabbing</a></li>
72     <li><a name="toc-X11-grabbing" href="#X11-grabbing">5.2 X11 grabbing</a></li>
73     <li><a name="toc-Video-and-Audio-file-format-conversion" href="#Video-and-Audio-file-format-conversion">5.3 Video and Audio file format conversion</a></li>
74   </ul></li>
75   <li><a name="toc-Expression-Evaluation" href="#Expression-Evaluation">6. Expression Evaluation</a></li>
76   <li><a name="toc-Decoders" href="#Decoders">7. Decoders</a></li>
77   <li><a name="toc-Video-Decoders" href="#Video-Decoders">8. Video Decoders</a>
78   <ul class="toc">
79     <li><a name="toc-rawvideo" href="#rawvideo">8.1 rawvideo</a>
80     <ul class="toc">
81       <li><a name="toc-Options-1" href="#Options-1">8.1.1 Options</a></li>
82     </ul>
83 </li>
84   </ul></li>
85   <li><a name="toc-Encoders" href="#Encoders">9. Encoders</a></li>
86   <li><a name="toc-Audio-Encoders" href="#Audio-Encoders">10. Audio Encoders</a>
87   <ul class="toc">
88     <li><a name="toc-ac3-and-ac3_005ffixed" href="#ac3-and-ac3_005ffixed">10.1 ac3 and ac3_fixed</a>
89     <ul class="toc">
90       <li><a name="toc-AC_002d3-Metadata" href="#AC_002d3-Metadata">10.1.1 AC-3 Metadata</a>
91       <ul class="toc">
92         <li><a name="toc-Metadata-Control-Options" href="#Metadata-Control-Options">10.1.1.1 Metadata Control Options</a></li>
93         <li><a name="toc-Downmix-Levels" href="#Downmix-Levels">10.1.1.2 Downmix Levels</a></li>
94         <li><a name="toc-Audio-Production-Information" href="#Audio-Production-Information">10.1.1.3 Audio Production Information</a></li>
95         <li><a name="toc-Other-Metadata-Options" href="#Other-Metadata-Options">10.1.1.4 Other Metadata Options</a></li>
96       </ul></li>
97       <li><a name="toc-Extended-Bitstream-Information" href="#Extended-Bitstream-Information">10.1.2 Extended Bitstream Information</a>
98       <ul class="toc">
99         <li><a name="toc-Extended-Bitstream-Information-_002d-Part-1" href="#Extended-Bitstream-Information-_002d-Part-1">10.1.2.1 Extended Bitstream Information - Part 1</a></li>
100         <li><a name="toc-Extended-Bitstream-Information-_002d-Part-2" href="#Extended-Bitstream-Information-_002d-Part-2">10.1.2.2 Extended Bitstream Information - Part 2</a></li>
101       </ul></li>
102       <li><a name="toc-Other-AC_002d3-Encoding-Options" href="#Other-AC_002d3-Encoding-Options">10.1.3 Other AC-3 Encoding Options</a></li>
103       <li><a name="toc-Floating_002dPoint_002dOnly-AC_002d3-Encoding-Options" href="#Floating_002dPoint_002dOnly-AC_002d3-Encoding-Options">10.1.4 Floating-Point-Only AC-3 Encoding Options</a></li>
104     </ul>
105 </li>
106   </ul></li>
107   <li><a name="toc-Video-Encoders" href="#Video-Encoders">11. Video Encoders</a>
108   <ul class="toc">
109     <li><a name="toc-libvpx" href="#libvpx">11.1 libvpx</a>
110     <ul class="toc">
111       <li><a name="toc-Options-4" href="#Options-4">11.1.1 Options</a></li>
112     </ul></li>
113     <li><a name="toc-libx264" href="#libx264">11.2 libx264</a>
114     <ul class="toc">
115       <li><a name="toc-Options-5" href="#Options-5">11.2.1 Options</a></li>
116     </ul>
117 </li>
118   </ul></li>
119   <li><a name="toc-Demuxers" href="#Demuxers">12. Demuxers</a>
120   <ul class="toc">
121     <li><a name="toc-image2" href="#image2">12.1 image2</a></li>
122     <li><a name="toc-applehttp-1" href="#applehttp-1">12.2 applehttp</a></li>
123   </ul></li>
124   <li><a name="toc-Muxers" href="#Muxers">13. Muxers</a>
125   <ul class="toc">
126     <li><a name="toc-crc-1" href="#crc-1">13.1 crc</a></li>
127     <li><a name="toc-framecrc-1" href="#framecrc-1">13.2 framecrc</a></li>
128     <li><a name="toc-image2-1" href="#image2-1">13.3 image2</a></li>
129     <li><a name="toc-mpegts" href="#mpegts">13.4 mpegts</a></li>
130     <li><a name="toc-null-1" href="#null-1">13.5 null</a></li>
131     <li><a name="toc-matroska" href="#matroska">13.6 matroska</a></li>
132   </ul></li>
133   <li><a name="toc-Input-Devices" href="#Input-Devices">14. Input Devices</a>
134   <ul class="toc">
135     <li><a name="toc-alsa-1" href="#alsa-1">14.1 alsa</a></li>
136     <li><a name="toc-bktr" href="#bktr">14.2 bktr</a></li>
137     <li><a name="toc-dv1394" href="#dv1394">14.3 dv1394</a></li>
138     <li><a name="toc-fbdev" href="#fbdev">14.4 fbdev</a></li>
139     <li><a name="toc-jack" href="#jack">14.5 jack</a></li>
140     <li><a name="toc-lavfi" href="#lavfi">14.6 lavfi</a>
141     <ul class="toc">
142       <li><a name="toc-Options" href="#Options">14.6.1 Options</a></li>
143       <li><a name="toc-Examples-3" href="#Examples-3">14.6.2 Examples</a></li>
144     </ul></li>
145     <li><a name="toc-libdc1394" href="#libdc1394">14.7 libdc1394</a></li>
146     <li><a name="toc-openal" href="#openal">14.8 openal</a>
147     <ul class="toc">
148       <li><a name="toc-Options-3" href="#Options-3">14.8.1 Options</a></li>
149       <li><a name="toc-Examples-2" href="#Examples-2">14.8.2 Examples</a></li>
150     </ul></li>
151     <li><a name="toc-oss" href="#oss">14.9 oss</a></li>
152     <li><a name="toc-sndio" href="#sndio">14.10 sndio</a></li>
153     <li><a name="toc-video4linux-and-video4linux2" href="#video4linux-and-video4linux2">14.11 video4linux and video4linux2</a></li>
154     <li><a name="toc-vfwcap" href="#vfwcap">14.12 vfwcap</a></li>
155     <li><a name="toc-x11grab" href="#x11grab">14.13 x11grab</a>
156     <ul class="toc">
157       <li><a name="toc-follow_005fmouse-AVOption" href="#follow_005fmouse-AVOption">14.13.1 <var>follow_mouse</var> AVOption</a></li>
158       <li><a name="toc-show_005fregion-AVOption" href="#show_005fregion-AVOption">14.13.2 <var>show_region</var> AVOption</a></li>
159     </ul>
160 </li>
161   </ul></li>
162   <li><a name="toc-Output-Devices" href="#Output-Devices">15. Output Devices</a>
163   <ul class="toc">
164     <li><a name="toc-alsa" href="#alsa">15.1 alsa</a></li>
165     <li><a name="toc-oss-1" href="#oss-1">15.2 oss</a></li>
166     <li><a name="toc-sdl" href="#sdl">15.3 sdl</a>
167     <ul class="toc">
168       <li><a name="toc-Options-2" href="#Options-2">15.3.1 Options</a></li>
169       <li><a name="toc-Examples-1" href="#Examples-1">15.3.2 Examples</a></li>
170     </ul></li>
171     <li><a name="toc-sndio-1" href="#sndio-1">15.4 sndio</a></li>
172   </ul></li>
173   <li><a name="toc-Protocols" href="#Protocols">16. Protocols</a>
174   <ul class="toc">
175     <li><a name="toc-applehttp" href="#applehttp">16.1 applehttp</a></li>
176     <li><a name="toc-concat" href="#concat">16.2 concat</a></li>
177     <li><a name="toc-file" href="#file">16.3 file</a></li>
178     <li><a name="toc-gopher" href="#gopher">16.4 gopher</a></li>
179     <li><a name="toc-http" href="#http">16.5 http</a></li>
180     <li><a name="toc-mmst" href="#mmst">16.6 mmst</a></li>
181     <li><a name="toc-mmsh" href="#mmsh">16.7 mmsh</a></li>
182     <li><a name="toc-md5" href="#md5">16.8 md5</a></li>
183     <li><a name="toc-pipe" href="#pipe">16.9 pipe</a></li>
184     <li><a name="toc-rtmp" href="#rtmp">16.10 rtmp</a></li>
185     <li><a name="toc-rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte" href="#rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte">16.11 rtmp, rtmpe, rtmps, rtmpt, rtmpte</a></li>
186     <li><a name="toc-rtp" href="#rtp">16.12 rtp</a></li>
187     <li><a name="toc-rtsp" href="#rtsp">16.13 rtsp</a></li>
188     <li><a name="toc-sap" href="#sap">16.14 sap</a>
189     <ul class="toc">
190       <li><a name="toc-Muxer" href="#Muxer">16.14.1 Muxer</a></li>
191       <li><a name="toc-Demuxer" href="#Demuxer">16.14.2 Demuxer</a></li>
192     </ul></li>
193     <li><a name="toc-tcp" href="#tcp">16.15 tcp</a></li>
194     <li><a name="toc-udp" href="#udp">16.16 udp</a></li>
195   </ul></li>
196   <li><a name="toc-Bitstream-Filters" href="#Bitstream-Filters">17. Bitstream Filters</a>
197   <ul class="toc">
198     <li><a name="toc-aac_005fadtstoasc" href="#aac_005fadtstoasc">17.1 aac_adtstoasc</a></li>
199     <li><a name="toc-chomp" href="#chomp">17.2 chomp</a></li>
200     <li><a name="toc-dump_005fextradata" href="#dump_005fextradata">17.3 dump_extradata</a></li>
201     <li><a name="toc-h264_005fmp4toannexb" href="#h264_005fmp4toannexb">17.4 h264_mp4toannexb</a></li>
202     <li><a name="toc-imx_005fdump_005fheader" href="#imx_005fdump_005fheader">17.5 imx_dump_header</a></li>
203     <li><a name="toc-mjpeg2jpeg" href="#mjpeg2jpeg">17.6 mjpeg2jpeg</a></li>
204     <li><a name="toc-mjpega_005fdump_005fheader" href="#mjpega_005fdump_005fheader">17.7 mjpega_dump_header</a></li>
205     <li><a name="toc-movsub" href="#movsub">17.8 movsub</a></li>
206     <li><a name="toc-mp3_005fheader_005fcompress" href="#mp3_005fheader_005fcompress">17.9 mp3_header_compress</a></li>
207     <li><a name="toc-mp3_005fheader_005fdecompress" href="#mp3_005fheader_005fdecompress">17.10 mp3_header_decompress</a></li>
208     <li><a name="toc-noise" href="#noise">17.11 noise</a></li>
209     <li><a name="toc-remove_005fextradata" href="#remove_005fextradata">17.12 remove_extradata</a></li>
210   </ul></li>
211   <li><a name="toc-Filtergraph-description" href="#Filtergraph-description">18. Filtergraph description</a>
212   <ul class="toc">
213     <li><a name="toc-Filtergraph-syntax" href="#Filtergraph-syntax">18.1 Filtergraph syntax</a></li>
214   </ul></li>
215   <li><a name="toc-Audio-Filters" href="#Audio-Filters">19. Audio Filters</a>
216   <ul class="toc">
217     <li><a name="toc-aformat" href="#aformat">19.1 aformat</a></li>
218     <li><a name="toc-anull" href="#anull">19.2 anull</a></li>
219     <li><a name="toc-aresample" href="#aresample">19.3 aresample</a></li>
220     <li><a name="toc-ashowinfo" href="#ashowinfo">19.4 ashowinfo</a></li>
221   </ul></li>
222   <li><a name="toc-Audio-Sources" href="#Audio-Sources">20. Audio Sources</a>
223   <ul class="toc">
224     <li><a name="toc-abuffer" href="#abuffer">20.1 abuffer</a></li>
225     <li><a name="toc-amovie" href="#amovie">20.2 amovie</a></li>
226     <li><a name="toc-anullsrc" href="#anullsrc">20.3 anullsrc</a></li>
227   </ul></li>
228   <li><a name="toc-Audio-Sinks" href="#Audio-Sinks">21. Audio Sinks</a>
229   <ul class="toc">
230     <li><a name="toc-abuffersink" href="#abuffersink">21.1 abuffersink</a></li>
231     <li><a name="toc-anullsink" href="#anullsink">21.2 anullsink</a></li>
232   </ul></li>
233   <li><a name="toc-Video-Filters" href="#Video-Filters">22. Video Filters</a>
234   <ul class="toc">
235     <li><a name="toc-blackframe" href="#blackframe">22.1 blackframe</a></li>
236     <li><a name="toc-boxblur" href="#boxblur">22.2 boxblur</a></li>
237     <li><a name="toc-copy" href="#copy">22.3 copy</a></li>
238     <li><a name="toc-crop" href="#crop">22.4 crop</a></li>
239     <li><a name="toc-cropdetect" href="#cropdetect">22.5 cropdetect</a></li>
240     <li><a name="toc-delogo" href="#delogo">22.6 delogo</a></li>
241     <li><a name="toc-drawbox" href="#drawbox">22.7 drawbox</a></li>
242     <li><a name="toc-drawtext" href="#drawtext">22.8 drawtext</a></li>
243     <li><a name="toc-fade" href="#fade">22.9 fade</a></li>
244     <li><a name="toc-fieldorder" href="#fieldorder">22.10 fieldorder</a></li>
245     <li><a name="toc-fifo" href="#fifo">22.11 fifo</a></li>
246     <li><a name="toc-format" href="#format">22.12 format</a></li>
247     <li><a name="toc-frei0r-1" href="#frei0r-1">22.13 frei0r</a></li>
248     <li><a name="toc-gradfun" href="#gradfun">22.14 gradfun</a></li>
249     <li><a name="toc-hflip" href="#hflip">22.15 hflip</a></li>
250     <li><a name="toc-hqdn3d" href="#hqdn3d">22.16 hqdn3d</a></li>
251     <li><a name="toc-lut_002c-lutrgb_002c-lutyuv" href="#lut_002c-lutrgb_002c-lutyuv">22.17 lut, lutrgb, lutyuv</a></li>
252     <li><a name="toc-mp" href="#mp">22.18 mp</a></li>
253     <li><a name="toc-negate" href="#negate">22.19 negate</a></li>
254     <li><a name="toc-noformat" href="#noformat">22.20 noformat</a></li>
255     <li><a name="toc-null" href="#null">22.21 null</a></li>
256     <li><a name="toc-ocv" href="#ocv">22.22 ocv</a>
257     <ul class="toc">
258       <li><a name="toc-dilate-1" href="#dilate-1">22.22.1 dilate</a></li>
259       <li><a name="toc-erode" href="#erode">22.22.2 erode</a></li>
260       <li><a name="toc-smooth" href="#smooth">22.22.3 smooth</a></li>
261     </ul></li>
262     <li><a name="toc-overlay" href="#overlay">22.23 overlay</a></li>
263     <li><a name="toc-pad" href="#pad">22.24 pad</a></li>
264     <li><a name="toc-pixdesctest" href="#pixdesctest">22.25 pixdesctest</a></li>
265     <li><a name="toc-scale" href="#scale">22.26 scale</a></li>
266     <li><a name="toc-select" href="#select">22.27 select</a></li>
267     <li><a name="toc-setdar-1" href="#setdar-1">22.28 setdar</a></li>
268     <li><a name="toc-setpts" href="#setpts">22.29 setpts</a></li>
269     <li><a name="toc-setsar-1" href="#setsar-1">22.30 setsar</a></li>
270     <li><a name="toc-settb" href="#settb">22.31 settb</a></li>
271     <li><a name="toc-showinfo" href="#showinfo">22.32 showinfo</a></li>
272     <li><a name="toc-slicify" href="#slicify">22.33 slicify</a></li>
273     <li><a name="toc-split" href="#split">22.34 split</a></li>
274     <li><a name="toc-transpose" href="#transpose">22.35 transpose</a></li>
275     <li><a name="toc-unsharp" href="#unsharp">22.36 unsharp</a></li>
276     <li><a name="toc-vflip" href="#vflip">22.37 vflip</a></li>
277     <li><a name="toc-yadif" href="#yadif">22.38 yadif</a></li>
278   </ul></li>
279   <li><a name="toc-Video-Sources" href="#Video-Sources">23. Video Sources</a>
280   <ul class="toc">
281     <li><a name="toc-buffer" href="#buffer">23.1 buffer</a></li>
282     <li><a name="toc-color" href="#color">23.2 color</a></li>
283     <li><a name="toc-movie" href="#movie">23.3 movie</a></li>
284     <li><a name="toc-mptestsrc" href="#mptestsrc">23.4 mptestsrc</a></li>
285     <li><a name="toc-nullsrc" href="#nullsrc">23.5 nullsrc</a></li>
286     <li><a name="toc-frei0r_005fsrc" href="#frei0r_005fsrc">23.6 frei0r_src</a></li>
287     <li><a name="toc-rgbtestsrc_002c-testsrc" href="#rgbtestsrc_002c-testsrc">23.7 rgbtestsrc, testsrc</a></li>
288   </ul></li>
289   <li><a name="toc-Video-Sinks" href="#Video-Sinks">24. Video Sinks</a>
290   <ul class="toc">
291     <li><a name="toc-buffersink" href="#buffersink">24.1 buffersink</a></li>
292     <li><a name="toc-nullsink" href="#nullsink">24.2 nullsink</a></li>
293   </ul></li>
294   <li><a name="toc-Metadata" href="#Metadata">25. Metadata</a></li>
295 </ul>
296 </div>
297
298 <hr size="1">
299 <a name="Synopsis"></a>
300 <h1 class="chapter"><a href="ffmpeg.html#toc-Synopsis">1. Synopsis</a></h1>
301
302 <p>The generic syntax is:
303 </p>
304 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg [[infile options][&lsquo;<samp>-i</samp>&rsquo; <var>infile</var>]]... {[outfile options] <var>outfile</var>}...
305 </pre></td></tr></table>
306
307 <a name="Description"></a>
308 <h1 class="chapter"><a href="ffmpeg.html#toc-Description">2. Description</a></h1>
309
310 <p>ffmpeg is a very fast video and audio converter that can also grab from
311 a live audio/video source. It can also convert between arbitrary sample
312 rates and resize video on the fly with a high quality polyphase filter.
313 </p>
314 <p>The command line interface is designed to be intuitive, in the sense
315 that ffmpeg tries to figure out all parameters that can possibly be
316 derived automatically. You usually only have to specify the target
317 bitrate you want.
318 </p>
319 <p>As a general rule, options are applied to the next specified
320 file. Therefore, order is important, and you can have the same
321 option on the command line multiple times. Each occurrence is
322 then applied to the next input or output file.
323 </p>
324 <ul>
325 <li>
326 To set the video bitrate of the output file to 64kbit/s:
327 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i input.avi -b 64k output.avi
328 </pre></td></tr></table>
329
330 </li><li>
331 To force the frame rate of the output file to 24 fps:
332 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i input.avi -r 24 output.avi
333 </pre></td></tr></table>
334
335 </li><li>
336 To force the frame rate of the input file (valid for raw formats only)
337 to 1 fps and the frame rate of the output file to 24 fps:
338 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -r 1 -i input.m2v -r 24 output.avi
339 </pre></td></tr></table>
340 </li></ul>
341
342 <p>The format option may be needed for raw input files.
343 </p>
344 <p>By default ffmpeg tries to convert as losslessly as possible: It
345 uses the same audio and video parameters for the outputs as the one
346 specified for the inputs.
347 </p>
348
349 <a name="Options-6"></a>
350 <h1 class="chapter"><a href="ffmpeg.html#toc-Options-6">3. Options</a></h1>
351
352 <p>All the numerical options, if not specified otherwise, accept in input
353 a string representing a number, which may contain one of the
354 International System number postfixes, for example &rsquo;K&rsquo;, &rsquo;M&rsquo;, &rsquo;G&rsquo;.
355 If &rsquo;i&rsquo; is appended after the postfix, powers of 2 are used instead of
356 powers of 10. The &rsquo;B&rsquo; postfix multiplies the value for 8, and can be
357 appended after another postfix or used alone. This allows using for
358 example &rsquo;KB&rsquo;, &rsquo;MiB&rsquo;, &rsquo;G&rsquo; and &rsquo;B&rsquo; as postfix.
359 </p>
360 <p>Options which do not take arguments are boolean options, and set the
361 corresponding value to true. They can be set to false by prefixing
362 with &quot;no&quot; the option name, for example using &quot;-nofoo&quot; in the
363 commandline will set to false the boolean option with name &quot;foo&quot;.
364 </p>
365 <a name="Generic-options"></a>
366 <h2 class="section"><a href="ffmpeg.html#toc-Generic-options">3.1 Generic options</a></h2>
367
368 <p>These options are shared amongst the ff* tools.
369 </p>
370 <dl compact="compact">
371 <dt> &lsquo;<samp>-L</samp>&rsquo;</dt>
372 <dd><p>Show license.
373 </p>
374 </dd>
375 <dt> &lsquo;<samp>-h, -?, -help, --help</samp>&rsquo;</dt>
376 <dd><p>Show help.
377 </p>
378 </dd>
379 <dt> &lsquo;<samp>-version</samp>&rsquo;</dt>
380 <dd><p>Show version.
381 </p>
382 </dd>
383 <dt> &lsquo;<samp>-formats</samp>&rsquo;</dt>
384 <dd><p>Show available formats.
385 </p>
386 <p>The fields preceding the format names have the following meanings:
387 </p><dl compact="compact">
388 <dt> &lsquo;<samp>D</samp>&rsquo;</dt>
389 <dd><p>Decoding available
390 </p></dd>
391 <dt> &lsquo;<samp>E</samp>&rsquo;</dt>
392 <dd><p>Encoding available
393 </p></dd>
394 </dl>
395
396 </dd>
397 <dt> &lsquo;<samp>-codecs</samp>&rsquo;</dt>
398 <dd><p>Show available codecs.
399 </p>
400 <p>The fields preceding the codec names have the following meanings:
401 </p><dl compact="compact">
402 <dt> &lsquo;<samp>D</samp>&rsquo;</dt>
403 <dd><p>Decoding available
404 </p></dd>
405 <dt> &lsquo;<samp>E</samp>&rsquo;</dt>
406 <dd><p>Encoding available
407 </p></dd>
408 <dt> &lsquo;<samp>V/A/S</samp>&rsquo;</dt>
409 <dd><p>Video/audio/subtitle codec
410 </p></dd>
411 <dt> &lsquo;<samp>S</samp>&rsquo;</dt>
412 <dd><p>Codec supports slices
413 </p></dd>
414 <dt> &lsquo;<samp>D</samp>&rsquo;</dt>
415 <dd><p>Codec supports direct rendering
416 </p></dd>
417 <dt> &lsquo;<samp>T</samp>&rsquo;</dt>
418 <dd><p>Codec can handle input truncated at random locations instead of only at frame boundaries
419 </p></dd>
420 </dl>
421
422 </dd>
423 <dt> &lsquo;<samp>-bsfs</samp>&rsquo;</dt>
424 <dd><p>Show available bitstream filters.
425 </p>
426 </dd>
427 <dt> &lsquo;<samp>-protocols</samp>&rsquo;</dt>
428 <dd><p>Show available protocols.
429 </p>
430 </dd>
431 <dt> &lsquo;<samp>-filters</samp>&rsquo;</dt>
432 <dd><p>Show available libavfilter filters.
433 </p>
434 </dd>
435 <dt> &lsquo;<samp>-pix_fmts</samp>&rsquo;</dt>
436 <dd><p>Show available pixel formats.
437 </p>
438 </dd>
439 <dt> &lsquo;<samp>-loglevel <var>loglevel</var></samp>&rsquo;</dt>
440 <dd><p>Set the logging level used by the library.
441 <var>loglevel</var> is a number or a string containing one of the following values:
442 </p><dl compact="compact">
443 <dt> &lsquo;<samp>quiet</samp>&rsquo;</dt>
444 <dt> &lsquo;<samp>panic</samp>&rsquo;</dt>
445 <dt> &lsquo;<samp>fatal</samp>&rsquo;</dt>
446 <dt> &lsquo;<samp>error</samp>&rsquo;</dt>
447 <dt> &lsquo;<samp>warning</samp>&rsquo;</dt>
448 <dt> &lsquo;<samp>info</samp>&rsquo;</dt>
449 <dt> &lsquo;<samp>verbose</samp>&rsquo;</dt>
450 <dt> &lsquo;<samp>debug</samp>&rsquo;</dt>
451 </dl>
452
453 <p>By default the program logs to stderr, if coloring is supported by the
454 terminal, colors are used to mark errors and warnings. Log coloring
455 can be disabled setting the environment variable
456 <code>FFMPEG_FORCE_NOCOLOR</code> or <code>NO_COLOR</code>, or can be forced setting
457 the environment variable <code>FFMPEG_FORCE_COLOR</code>.
458 The use of the environment variable <code>NO_COLOR</code> is deprecated and
459 will be dropped in a following FFmpeg version.
460 </p>
461 </dd>
462 </dl>
463
464 <a name="AVOptions"></a>
465 <h2 class="section"><a href="ffmpeg.html#toc-AVOptions">3.2 AVOptions</a></h2>
466
467 <p>These options are provided directly by the libavformat, libavdevice and
468 libavcodec libraries. To see the list of available AVOptions, use the
469 &lsquo;<samp>-help</samp>&rsquo; option. They are separated into two categories:
470 </p><dl compact="compact">
471 <dt> &lsquo;<samp>generic</samp>&rsquo;</dt>
472 <dd><p>These options can be set for any container, codec or device. Generic options are
473 listed under AVFormatContext options for containers/devices and under
474 AVCodecContext options for codecs.
475 </p></dd>
476 <dt> &lsquo;<samp>private</samp>&rsquo;</dt>
477 <dd><p>These options are specific to the given container, device or codec. Private
478 options are listed under their corresponding containers/devices/codecs.
479 </p></dd>
480 </dl>
481
482 <p>For example to write an ID3v2.3 header instead of a default ID3v2.4 to
483 an MP3 file, use the &lsquo;<samp>id3v2_version</samp>&rsquo; private option of the MP3
484 muxer:
485 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i input.flac -id3v2_version 3 out.mp3
486 </pre></td></tr></table>
487
488 <p>You can precisely specify which stream(s) should the codec AVOption apply to by
489 appending a stream specifier of the form
490 &lsquo;<samp>[:<var>stream_type</var>][:<var>stream_index</var>]</samp>&rsquo; to the option name.
491 <var>stream_type</var> is &rsquo;v&rsquo; for video, &rsquo;a&rsquo; for audio and &rsquo;s&rsquo; for subtitle streams.
492 <var>stream_index</var> is a global stream index when <var>stream_type</var> isn&rsquo;t
493 given, otherwise it counts streams of the given type only. As always, the index
494 is zero-based. For example
495 </p><table><tr><td>&nbsp;</td><td><pre class="example">-foo -- applies to all applicable streams
496 -foo:v -- applies to all video streams
497 -foo:a:2 -- applies to the third audio stream
498 -foo:0 -- applies to the first stream
499 </pre></td></tr></table>
500
501 <p>Note -nooption syntax cannot be used for boolean AVOptions, use -option
502 0/-option 1.
503 </p>
504 <p>Note2 old undocumented way of specifying per-stream AVOptions by prepending
505 v/a/s to the options name is now obsolete and will be removed soon.
506 </p>
507 <a name="Main-options"></a>
508 <h2 class="section"><a href="ffmpeg.html#toc-Main-options">3.3 Main options</a></h2>
509
510 <dl compact="compact">
511 <dt> &lsquo;<samp>-f <var>fmt</var></samp>&rsquo;</dt>
512 <dd><p>Force format.
513 </p>
514 </dd>
515 <dt> &lsquo;<samp>-i <var>filename</var></samp>&rsquo;</dt>
516 <dd><p>input file name
517 </p>
518 </dd>
519 <dt> &lsquo;<samp>-y</samp>&rsquo;</dt>
520 <dd><p>Overwrite output files.
521 </p>
522 </dd>
523 <dt> &lsquo;<samp>-t <var>duration</var></samp>&rsquo;</dt>
524 <dd><p>Restrict the transcoded/captured video sequence
525 to the duration specified in seconds.
526 <code>hh:mm:ss[.xxx]</code> syntax is also supported.
527 </p>
528 </dd>
529 <dt> &lsquo;<samp>-fs <var>limit_size</var></samp>&rsquo;</dt>
530 <dd><p>Set the file size limit.
531 </p>
532 </dd>
533 <dt> &lsquo;<samp>-ss <var>position</var></samp>&rsquo;</dt>
534 <dd><p>Seek to given time position in seconds.
535 <code>hh:mm:ss[.xxx]</code> syntax is also supported.
536 </p>
537 </dd>
538 <dt> &lsquo;<samp>-itsoffset <var>offset</var></samp>&rsquo;</dt>
539 <dd><p>Set the input time offset in seconds.
540 <code>[-]hh:mm:ss[.xxx]</code> syntax is also supported.
541 This option affects all the input files that follow it.
542 The offset is added to the timestamps of the input files.
543 Specifying a positive offset means that the corresponding
544 streams are delayed by &rsquo;offset&rsquo; seconds.
545 </p>
546 </dd>
547 <dt> &lsquo;<samp>-timestamp <var>time</var></samp>&rsquo;</dt>
548 <dd><p>Set the recording timestamp in the container.
549 The syntax for <var>time</var> is:
550 </p><table><tr><td>&nbsp;</td><td><pre class="example">now|([(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH[:MM[:SS[.m...]]])|(HH[MM[SS[.m...]]]))[Z|z])
551 </pre></td></tr></table>
552 <p>If the value is &quot;now&quot; it takes the current time.
553 Time is local time unless &rsquo;Z&rsquo; or &rsquo;z&rsquo; is appended, in which case it is
554 interpreted as UTC.
555 If the year-month-day part is not specified it takes the current
556 year-month-day.
557 </p>
558 </dd>
559 <dt> &lsquo;<samp>-metadata <var>key</var>=<var>value</var></samp>&rsquo;</dt>
560 <dd><p>Set a metadata key/value pair.
561 </p>
562 <p>For example, for setting the title in the output file:
563 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -metadata title=&quot;my title&quot; out.flv
564 </pre></td></tr></table>
565
566 </dd>
567 <dt> &lsquo;<samp>-v <var>number</var></samp>&rsquo;</dt>
568 <dd><p>Set the logging verbosity level.
569 </p>
570 </dd>
571 <dt> &lsquo;<samp>-target <var>type</var></samp>&rsquo;</dt>
572 <dd><p>Specify target file type (&quot;vcd&quot;, &quot;svcd&quot;, &quot;dvd&quot;, &quot;dv&quot;, &quot;dv50&quot;, &quot;pal-vcd&quot;,
573 &quot;ntsc-svcd&quot;, ... ). All the format options (bitrate, codecs,
574 buffer sizes) are then set automatically. You can just type:
575 </p>
576 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
577 </pre></td></tr></table>
578
579 <p>Nevertheless you can specify additional options as long as you know
580 they do not conflict with the standard, as in:
581 </p>
582 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
583 </pre></td></tr></table>
584
585 </dd>
586 <dt> &lsquo;<samp>-dframes <var>number</var></samp>&rsquo;</dt>
587 <dd><p>Set the number of data frames to record.
588 </p>
589 </dd>
590 <dt> &lsquo;<samp>-scodec <var>codec</var></samp>&rsquo;</dt>
591 <dd><p>Force subtitle codec (&rsquo;copy&rsquo; to copy stream).
592 </p>
593 </dd>
594 <dt> &lsquo;<samp>-newsubtitle</samp>&rsquo;</dt>
595 <dd><p>Add a new subtitle stream to the current output stream.
596 </p>
597 </dd>
598 <dt> &lsquo;<samp>-slang <var>code</var></samp>&rsquo;</dt>
599 <dd><p>Set the ISO 639 language code (3 letters) of the current subtitle stream.
600 </p>
601 </dd>
602 </dl>
603
604 <a name="Video-Options"></a>
605 <h2 class="section"><a href="ffmpeg.html#toc-Video-Options">3.4 Video Options</a></h2>
606
607 <dl compact="compact">
608 <dt> &lsquo;<samp>-vframes <var>number</var></samp>&rsquo;</dt>
609 <dd><p>Set the number of video frames to record.
610 </p></dd>
611 <dt> &lsquo;<samp>-r <var>fps</var></samp>&rsquo;</dt>
612 <dd><p>Set frame rate (Hz value, fraction or abbreviation), (default = 25).
613 </p></dd>
614 <dt> &lsquo;<samp>-s <var>size</var></samp>&rsquo;</dt>
615 <dd><p>Set frame size. The format is &lsquo;<samp>wxh</samp>&rsquo; (ffserver default = 160x128).
616 There is no default for input streams,
617 for output streams it is set by default to the size of the source stream.
618 The following abbreviations are recognized:
619 </p><dl compact="compact">
620 <dt> &lsquo;<samp>sqcif</samp>&rsquo;</dt>
621 <dd><p>128x96
622 </p></dd>
623 <dt> &lsquo;<samp>qcif</samp>&rsquo;</dt>
624 <dd><p>176x144
625 </p></dd>
626 <dt> &lsquo;<samp>cif</samp>&rsquo;</dt>
627 <dd><p>352x288
628 </p></dd>
629 <dt> &lsquo;<samp>4cif</samp>&rsquo;</dt>
630 <dd><p>704x576
631 </p></dd>
632 <dt> &lsquo;<samp>16cif</samp>&rsquo;</dt>
633 <dd><p>1408x1152
634 </p></dd>
635 <dt> &lsquo;<samp>qqvga</samp>&rsquo;</dt>
636 <dd><p>160x120
637 </p></dd>
638 <dt> &lsquo;<samp>qvga</samp>&rsquo;</dt>
639 <dd><p>320x240
640 </p></dd>
641 <dt> &lsquo;<samp>vga</samp>&rsquo;</dt>
642 <dd><p>640x480
643 </p></dd>
644 <dt> &lsquo;<samp>svga</samp>&rsquo;</dt>
645 <dd><p>800x600
646 </p></dd>
647 <dt> &lsquo;<samp>xga</samp>&rsquo;</dt>
648 <dd><p>1024x768
649 </p></dd>
650 <dt> &lsquo;<samp>uxga</samp>&rsquo;</dt>
651 <dd><p>1600x1200
652 </p></dd>
653 <dt> &lsquo;<samp>qxga</samp>&rsquo;</dt>
654 <dd><p>2048x1536
655 </p></dd>
656 <dt> &lsquo;<samp>sxga</samp>&rsquo;</dt>
657 <dd><p>1280x1024
658 </p></dd>
659 <dt> &lsquo;<samp>qsxga</samp>&rsquo;</dt>
660 <dd><p>2560x2048
661 </p></dd>
662 <dt> &lsquo;<samp>hsxga</samp>&rsquo;</dt>
663 <dd><p>5120x4096
664 </p></dd>
665 <dt> &lsquo;<samp>wvga</samp>&rsquo;</dt>
666 <dd><p>852x480
667 </p></dd>
668 <dt> &lsquo;<samp>wxga</samp>&rsquo;</dt>
669 <dd><p>1366x768
670 </p></dd>
671 <dt> &lsquo;<samp>wsxga</samp>&rsquo;</dt>
672 <dd><p>1600x1024
673 </p></dd>
674 <dt> &lsquo;<samp>wuxga</samp>&rsquo;</dt>
675 <dd><p>1920x1200
676 </p></dd>
677 <dt> &lsquo;<samp>woxga</samp>&rsquo;</dt>
678 <dd><p>2560x1600
679 </p></dd>
680 <dt> &lsquo;<samp>wqsxga</samp>&rsquo;</dt>
681 <dd><p>3200x2048
682 </p></dd>
683 <dt> &lsquo;<samp>wquxga</samp>&rsquo;</dt>
684 <dd><p>3840x2400
685 </p></dd>
686 <dt> &lsquo;<samp>whsxga</samp>&rsquo;</dt>
687 <dd><p>6400x4096
688 </p></dd>
689 <dt> &lsquo;<samp>whuxga</samp>&rsquo;</dt>
690 <dd><p>7680x4800
691 </p></dd>
692 <dt> &lsquo;<samp>cga</samp>&rsquo;</dt>
693 <dd><p>320x200
694 </p></dd>
695 <dt> &lsquo;<samp>ega</samp>&rsquo;</dt>
696 <dd><p>640x350
697 </p></dd>
698 <dt> &lsquo;<samp>hd480</samp>&rsquo;</dt>
699 <dd><p>852x480
700 </p></dd>
701 <dt> &lsquo;<samp>hd720</samp>&rsquo;</dt>
702 <dd><p>1280x720
703 </p></dd>
704 <dt> &lsquo;<samp>hd1080</samp>&rsquo;</dt>
705 <dd><p>1920x1080
706 </p></dd>
707 </dl>
708
709 </dd>
710 <dt> &lsquo;<samp>-aspect <var>aspect</var></samp>&rsquo;</dt>
711 <dd><p>Set the video display aspect ratio specified by <var>aspect</var>.
712 </p>
713 <p><var>aspect</var> can be a floating point number string, or a string of the
714 form <var>num</var>:<var>den</var>, where <var>num</var> and <var>den</var> are the
715 numerator and denominator of the aspect ratio. For example &quot;4:3&quot;,
716 &quot;16:9&quot;, &quot;1.3333&quot;, and &quot;1.7777&quot; are valid argument values.
717 </p>
718 </dd>
719 <dt> &lsquo;<samp>-croptop <var>size</var></samp>&rsquo;</dt>
720 <dt> &lsquo;<samp>-cropbottom <var>size</var></samp>&rsquo;</dt>
721 <dt> &lsquo;<samp>-cropleft <var>size</var></samp>&rsquo;</dt>
722 <dt> &lsquo;<samp>-cropright <var>size</var></samp>&rsquo;</dt>
723 <dd><p>All the crop options have been removed. Use -vf
724 crop=width:height:x:y instead.
725 </p>
726 </dd>
727 <dt> &lsquo;<samp>-padtop <var>size</var></samp>&rsquo;</dt>
728 <dt> &lsquo;<samp>-padbottom <var>size</var></samp>&rsquo;</dt>
729 <dt> &lsquo;<samp>-padleft <var>size</var></samp>&rsquo;</dt>
730 <dt> &lsquo;<samp>-padright <var>size</var></samp>&rsquo;</dt>
731 <dt> &lsquo;<samp>-padcolor <var>hex_color</var></samp>&rsquo;</dt>
732 <dd><p>All the pad options have been removed. Use -vf
733 pad=width:height:x:y:color instead.
734 </p></dd>
735 <dt> &lsquo;<samp>-vn</samp>&rsquo;</dt>
736 <dd><p>Disable video recording.
737 </p></dd>
738 <dt> &lsquo;<samp>-bt <var>tolerance</var></samp>&rsquo;</dt>
739 <dd><p>Set video bitrate tolerance (in bits, default 4000k).
740 Has a minimum value of: (target_bitrate/target_framerate).
741 In 1-pass mode, bitrate tolerance specifies how far ratecontrol is
742 willing to deviate from the target average bitrate value. This is
743 not related to min/max bitrate. Lowering tolerance too much has
744 an adverse effect on quality.
745 </p></dd>
746 <dt> &lsquo;<samp>-maxrate <var>bitrate</var></samp>&rsquo;</dt>
747 <dd><p>Set max video bitrate (in bit/s).
748 Requires -bufsize to be set.
749 </p></dd>
750 <dt> &lsquo;<samp>-minrate <var>bitrate</var></samp>&rsquo;</dt>
751 <dd><p>Set min video bitrate (in bit/s).
752 Most useful in setting up a CBR encode:
753 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
754 </pre></td></tr></table>
755 <p>It is of little use elsewise.
756 </p></dd>
757 <dt> &lsquo;<samp>-bufsize <var>size</var></samp>&rsquo;</dt>
758 <dd><p>Set video buffer verifier buffer size (in bits).
759 </p></dd>
760 <dt> &lsquo;<samp>-vcodec <var>codec</var></samp>&rsquo;</dt>
761 <dd><p>Force video codec to <var>codec</var>. Use the <code>copy</code> special value to
762 tell that the raw codec data must be copied as is.
763 </p></dd>
764 <dt> &lsquo;<samp>-sameq</samp>&rsquo;</dt>
765 <dd><p>Use same quantizer as source (implies VBR).
766 </p>
767 </dd>
768 <dt> &lsquo;<samp>-pass <var>n</var></samp>&rsquo;</dt>
769 <dd><p>Select the pass number (1 or 2). It is used to do two-pass
770 video encoding. The statistics of the video are recorded in the first
771 pass into a log file (see also the option -passlogfile),
772 and in the second pass that log file is used to generate the video
773 at the exact requested bitrate.
774 On pass 1, you may just deactivate audio and set output to null,
775 examples for Windows and Unix:
776 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y NUL
777 ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y /dev/null
778 </pre></td></tr></table>
779
780 </dd>
781 <dt> &lsquo;<samp>-passlogfile <var>prefix</var></samp>&rsquo;</dt>
782 <dd><p>Set two-pass log file name prefix to <var>prefix</var>, the default file name
783 prefix is &ldquo;ffmpeg2pass&rdquo;. The complete file name will be
784 &lsquo;<tt>PREFIX-N.log</tt>&rsquo;, where N is a number specific to the output
785 stream.
786 </p>
787 </dd>
788 <dt> &lsquo;<samp>-newvideo</samp>&rsquo;</dt>
789 <dd><p>Add a new video stream to the current output stream.
790 </p>
791 </dd>
792 <dt> &lsquo;<samp>-vlang <var>code</var></samp>&rsquo;</dt>
793 <dd><p>Set the ISO 639 language code (3 letters) of the current video stream.
794 </p>
795 </dd>
796 <dt> &lsquo;<samp>-vf <var>filter_graph</var></samp>&rsquo;</dt>
797 <dd><p><var>filter_graph</var> is a description of the filter graph to apply to
798 the input video.
799 Use the option &quot;-filters&quot; to show all the available filters (including
800 also sources and sinks).
801 </p>
802 </dd>
803 </dl>
804
805 <a name="Advanced-Video-Options"></a>
806 <h2 class="section"><a href="ffmpeg.html#toc-Advanced-Video-Options">3.5 Advanced Video Options</a></h2>
807
808 <dl compact="compact">
809 <dt> &lsquo;<samp>-pix_fmt <var>format</var></samp>&rsquo;</dt>
810 <dd><p>Set pixel format. Use &rsquo;list&rsquo; as parameter to show all the supported
811 pixel formats.
812 </p></dd>
813 <dt> &lsquo;<samp>-sws_flags <var>flags</var></samp>&rsquo;</dt>
814 <dd><p>Set SwScaler flags.
815 </p></dd>
816 <dt> &lsquo;<samp>-g <var>gop_size</var></samp>&rsquo;</dt>
817 <dd><p>Set the group of pictures size.
818 </p></dd>
819 <dt> &lsquo;<samp>-intra</samp>&rsquo;</dt>
820 <dd><p>Use only intra frames.
821 </p></dd>
822 <dt> &lsquo;<samp>-vdt <var>n</var></samp>&rsquo;</dt>
823 <dd><p>Discard threshold.
824 </p></dd>
825 <dt> &lsquo;<samp>-qscale <var>q</var></samp>&rsquo;</dt>
826 <dd><p>Use fixed video quantizer scale (VBR).
827 </p></dd>
828 <dt> &lsquo;<samp>-qmin <var>q</var></samp>&rsquo;</dt>
829 <dd><p>minimum video quantizer scale (VBR)
830 </p></dd>
831 <dt> &lsquo;<samp>-qmax <var>q</var></samp>&rsquo;</dt>
832 <dd><p>maximum video quantizer scale (VBR)
833 </p></dd>
834 <dt> &lsquo;<samp>-qdiff <var>q</var></samp>&rsquo;</dt>
835 <dd><p>maximum difference between the quantizer scales (VBR)
836 </p></dd>
837 <dt> &lsquo;<samp>-qblur <var>blur</var></samp>&rsquo;</dt>
838 <dd><p>video quantizer scale blur (VBR) (range 0.0 - 1.0)
839 </p></dd>
840 <dt> &lsquo;<samp>-qcomp <var>compression</var></samp>&rsquo;</dt>
841 <dd><p>video quantizer scale compression (VBR) (default 0.5).
842 Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0
843 </p>
844 </dd>
845 <dt> &lsquo;<samp>-lmin <var>lambda</var></samp>&rsquo;</dt>
846 <dd><p>minimum video lagrange factor (VBR)
847 </p></dd>
848 <dt> &lsquo;<samp>-lmax <var>lambda</var></samp>&rsquo;</dt>
849 <dd><p>max video lagrange factor (VBR)
850 </p></dd>
851 <dt> &lsquo;<samp>-mblmin <var>lambda</var></samp>&rsquo;</dt>
852 <dd><p>minimum macroblock quantizer scale (VBR)
853 </p></dd>
854 <dt> &lsquo;<samp>-mblmax <var>lambda</var></samp>&rsquo;</dt>
855 <dd><p>maximum macroblock quantizer scale (VBR)
856 </p>
857 <p>These four options (lmin, lmax, mblmin, mblmax) use &rsquo;lambda&rsquo; units,
858 but you may use the QP2LAMBDA constant to easily convert from &rsquo;q&rsquo; units:
859 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
860 </pre></td></tr></table>
861
862 </dd>
863 <dt> &lsquo;<samp>-rc_init_cplx <var>complexity</var></samp>&rsquo;</dt>
864 <dd><p>initial complexity for single pass encoding
865 </p></dd>
866 <dt> &lsquo;<samp>-b_qfactor <var>factor</var></samp>&rsquo;</dt>
867 <dd><p>qp factor between P- and B-frames
868 </p></dd>
869 <dt> &lsquo;<samp>-i_qfactor <var>factor</var></samp>&rsquo;</dt>
870 <dd><p>qp factor between P- and I-frames
871 </p></dd>
872 <dt> &lsquo;<samp>-b_qoffset <var>offset</var></samp>&rsquo;</dt>
873 <dd><p>qp offset between P- and B-frames
874 </p></dd>
875 <dt> &lsquo;<samp>-i_qoffset <var>offset</var></samp>&rsquo;</dt>
876 <dd><p>qp offset between P- and I-frames
877 </p></dd>
878 <dt> &lsquo;<samp>-rc_eq <var>equation</var></samp>&rsquo;</dt>
879 <dd><p>Set rate control equation (see section &quot;Expression Evaluation&quot;)
880 (default = <code>tex^qComp</code>).
881 </p>
882 <p>When computing the rate control equation expression, besides the
883 standard functions defined in the section &quot;Expression Evaluation&quot;, the
884 following functions are available:
885 </p><dl compact="compact">
886 <dt> <var>bits2qp(bits)</var></dt>
887 <dt> <var>qp2bits(qp)</var></dt>
888 </dl>
889
890 <p>and the following constants are available:
891 </p><dl compact="compact">
892 <dt> <var>iTex</var></dt>
893 <dt> <var>pTex</var></dt>
894 <dt> <var>tex</var></dt>
895 <dt> <var>mv</var></dt>
896 <dt> <var>fCode</var></dt>
897 <dt> <var>iCount</var></dt>
898 <dt> <var>mcVar</var></dt>
899 <dt> <var>var</var></dt>
900 <dt> <var>isI</var></dt>
901 <dt> <var>isP</var></dt>
902 <dt> <var>isB</var></dt>
903 <dt> <var>avgQP</var></dt>
904 <dt> <var>qComp</var></dt>
905 <dt> <var>avgIITex</var></dt>
906 <dt> <var>avgPITex</var></dt>
907 <dt> <var>avgPPTex</var></dt>
908 <dt> <var>avgBPTex</var></dt>
909 <dt> <var>avgTex</var></dt>
910 </dl>
911
912 </dd>
913 <dt> &lsquo;<samp>-rc_override <var>override</var></samp>&rsquo;</dt>
914 <dd><p>Rate control override for specific intervals, formated as &quot;int,int,int&quot;
915 list separated with slashes. Two first values are the beginning and
916 end frame numbers, last one is quantizer to use if positive, or quality
917 factor if negative.
918 </p></dd>
919 <dt> &lsquo;<samp>-me_method <var>method</var></samp>&rsquo;</dt>
920 <dd><p>Set motion estimation method to <var>method</var>.
921 Available methods are (from lowest to best quality):
922 </p><dl compact="compact">
923 <dt> &lsquo;<samp>zero</samp>&rsquo;</dt>
924 <dd><p>Try just the (0, 0) vector.
925 </p></dd>
926 <dt> &lsquo;<samp>phods</samp>&rsquo;</dt>
927 <dt> &lsquo;<samp>log</samp>&rsquo;</dt>
928 <dt> &lsquo;<samp>x1</samp>&rsquo;</dt>
929 <dt> &lsquo;<samp>hex</samp>&rsquo;</dt>
930 <dt> &lsquo;<samp>umh</samp>&rsquo;</dt>
931 <dt> &lsquo;<samp>epzs</samp>&rsquo;</dt>
932 <dd><p>(default method)
933 </p></dd>
934 <dt> &lsquo;<samp>full</samp>&rsquo;</dt>
935 <dd><p>exhaustive search (slow and marginally better than epzs)
936 </p></dd>
937 </dl>
938
939 </dd>
940 <dt> &lsquo;<samp>-dct_algo <var>algo</var></samp>&rsquo;</dt>
941 <dd><p>Set DCT algorithm to <var>algo</var>. Available values are:
942 </p><dl compact="compact">
943 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
944 <dd><p>FF_DCT_AUTO (default)
945 </p></dd>
946 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
947 <dd><p>FF_DCT_FASTINT
948 </p></dd>
949 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
950 <dd><p>FF_DCT_INT
951 </p></dd>
952 <dt> &lsquo;<samp>3</samp>&rsquo;</dt>
953 <dd><p>FF_DCT_MMX
954 </p></dd>
955 <dt> &lsquo;<samp>4</samp>&rsquo;</dt>
956 <dd><p>FF_DCT_MLIB
957 </p></dd>
958 <dt> &lsquo;<samp>5</samp>&rsquo;</dt>
959 <dd><p>FF_DCT_ALTIVEC
960 </p></dd>
961 </dl>
962
963 </dd>
964 <dt> &lsquo;<samp>-idct_algo <var>algo</var></samp>&rsquo;</dt>
965 <dd><p>Set IDCT algorithm to <var>algo</var>. Available values are:
966 </p><dl compact="compact">
967 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
968 <dd><p>FF_IDCT_AUTO (default)
969 </p></dd>
970 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
971 <dd><p>FF_IDCT_INT
972 </p></dd>
973 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
974 <dd><p>FF_IDCT_SIMPLE
975 </p></dd>
976 <dt> &lsquo;<samp>3</samp>&rsquo;</dt>
977 <dd><p>FF_IDCT_SIMPLEMMX
978 </p></dd>
979 <dt> &lsquo;<samp>4</samp>&rsquo;</dt>
980 <dd><p>FF_IDCT_LIBMPEG2MMX
981 </p></dd>
982 <dt> &lsquo;<samp>5</samp>&rsquo;</dt>
983 <dd><p>FF_IDCT_PS2
984 </p></dd>
985 <dt> &lsquo;<samp>6</samp>&rsquo;</dt>
986 <dd><p>FF_IDCT_MLIB
987 </p></dd>
988 <dt> &lsquo;<samp>7</samp>&rsquo;</dt>
989 <dd><p>FF_IDCT_ARM
990 </p></dd>
991 <dt> &lsquo;<samp>8</samp>&rsquo;</dt>
992 <dd><p>FF_IDCT_ALTIVEC
993 </p></dd>
994 <dt> &lsquo;<samp>9</samp>&rsquo;</dt>
995 <dd><p>FF_IDCT_SH4
996 </p></dd>
997 <dt> &lsquo;<samp>10</samp>&rsquo;</dt>
998 <dd><p>FF_IDCT_SIMPLEARM
999 </p></dd>
1000 </dl>
1001
1002 </dd>
1003 <dt> &lsquo;<samp>-er <var>n</var></samp>&rsquo;</dt>
1004 <dd><p>Set error resilience to <var>n</var>.
1005 </p><dl compact="compact">
1006 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
1007 <dd><p>FF_ER_CAREFUL (default)
1008 </p></dd>
1009 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
1010 <dd><p>FF_ER_COMPLIANT
1011 </p></dd>
1012 <dt> &lsquo;<samp>3</samp>&rsquo;</dt>
1013 <dd><p>FF_ER_AGGRESSIVE
1014 </p></dd>
1015 <dt> &lsquo;<samp>4</samp>&rsquo;</dt>
1016 <dd><p>FF_ER_EXPLODE
1017 </p></dd>
1018 </dl>
1019
1020 </dd>
1021 <dt> &lsquo;<samp>-ec <var>bit_mask</var></samp>&rsquo;</dt>
1022 <dd><p>Set error concealment to <var>bit_mask</var>. <var>bit_mask</var> is a bit mask of
1023 the following values:
1024 </p><dl compact="compact">
1025 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
1026 <dd><p>FF_EC_GUESS_MVS (default = enabled)
1027 </p></dd>
1028 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
1029 <dd><p>FF_EC_DEBLOCK (default = enabled)
1030 </p></dd>
1031 </dl>
1032
1033 </dd>
1034 <dt> &lsquo;<samp>-bf <var>frames</var></samp>&rsquo;</dt>
1035 <dd><p>Use &rsquo;frames&rsquo; B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
1036 </p></dd>
1037 <dt> &lsquo;<samp>-mbd <var>mode</var></samp>&rsquo;</dt>
1038 <dd><p>macroblock decision
1039 </p><dl compact="compact">
1040 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
1041 <dd><p>FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in ffmpeg).
1042 </p></dd>
1043 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
1044 <dd><p>FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
1045 </p></dd>
1046 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
1047 <dd><p>FF_MB_DECISION_RD: rate distortion
1048 </p></dd>
1049 </dl>
1050
1051 </dd>
1052 <dt> &lsquo;<samp>-4mv</samp>&rsquo;</dt>
1053 <dd><p>Use four motion vector by macroblock (MPEG-4 only).
1054 </p></dd>
1055 <dt> &lsquo;<samp>-part</samp>&rsquo;</dt>
1056 <dd><p>Use data partitioning (MPEG-4 only).
1057 </p></dd>
1058 <dt> &lsquo;<samp>-bug <var>param</var></samp>&rsquo;</dt>
1059 <dd><p>Work around encoder bugs that are not auto-detected.
1060 </p></dd>
1061 <dt> &lsquo;<samp>-strict <var>strictness</var></samp>&rsquo;</dt>
1062 <dd><p>How strictly to follow the standards.
1063 </p></dd>
1064 <dt> &lsquo;<samp>-aic</samp>&rsquo;</dt>
1065 <dd><p>Enable Advanced intra coding (h263+).
1066 </p></dd>
1067 <dt> &lsquo;<samp>-umv</samp>&rsquo;</dt>
1068 <dd><p>Enable Unlimited Motion Vector (h263+)
1069 </p>
1070 </dd>
1071 <dt> &lsquo;<samp>-deinterlace</samp>&rsquo;</dt>
1072 <dd><p>Deinterlace pictures.
1073 </p></dd>
1074 <dt> &lsquo;<samp>-ilme</samp>&rsquo;</dt>
1075 <dd><p>Force interlacing support in encoder (MPEG-2 and MPEG-4 only).
1076 Use this option if your input file is interlaced and you want
1077 to keep the interlaced format for minimum losses.
1078 The alternative is to deinterlace the input stream with
1079 &lsquo;<samp>-deinterlace</samp>&rsquo;, but deinterlacing introduces losses.
1080 </p></dd>
1081 <dt> &lsquo;<samp>-psnr</samp>&rsquo;</dt>
1082 <dd><p>Calculate PSNR of compressed frames.
1083 </p></dd>
1084 <dt> &lsquo;<samp>-vstats</samp>&rsquo;</dt>
1085 <dd><p>Dump video coding statistics to &lsquo;<tt>vstats_HHMMSS.log</tt>&rsquo;.
1086 </p></dd>
1087 <dt> &lsquo;<samp>-vstats_file <var>file</var></samp>&rsquo;</dt>
1088 <dd><p>Dump video coding statistics to <var>file</var>.
1089 </p></dd>
1090 <dt> &lsquo;<samp>-top <var>n</var></samp>&rsquo;</dt>
1091 <dd><p>top=1/bottom=0/auto=-1 field first
1092 </p></dd>
1093 <dt> &lsquo;<samp>-dc <var>precision</var></samp>&rsquo;</dt>
1094 <dd><p>Intra_dc_precision.
1095 </p></dd>
1096 <dt> &lsquo;<samp>-vtag <var>fourcc/tag</var></samp>&rsquo;</dt>
1097 <dd><p>Force video tag/fourcc.
1098 </p></dd>
1099 <dt> &lsquo;<samp>-qphist</samp>&rsquo;</dt>
1100 <dd><p>Show QP histogram.
1101 </p></dd>
1102 <dt> &lsquo;<samp>-vbsf <var>bitstream_filter</var></samp>&rsquo;</dt>
1103 <dd><p>Bitstream filters available are &quot;dump_extra&quot;, &quot;remove_extra&quot;, &quot;noise&quot;, &quot;h264_mp4toannexb&quot;, &quot;imxdump&quot;, &quot;mjpegadump&quot;, &quot;mjpeg2jpeg&quot;.
1104 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i h264.mp4 -vcodec copy -vbsf h264_mp4toannexb -an out.h264
1105 </pre></td></tr></table>
1106 </dd>
1107 <dt> &lsquo;<samp>-force_key_frames <var>time</var>[,<var>time</var>...]</samp>&rsquo;</dt>
1108 <dd><p>Force key frames at the specified timestamps, more precisely at the first
1109 frames after each specified time.
1110 This option can be useful to ensure that a seek point is present at a
1111 chapter mark or any other designated place in the output file.
1112 The timestamps must be specified in ascending order.
1113 </p></dd>
1114 </dl>
1115
1116 <a name="Audio-Options"></a>
1117 <h2 class="section"><a href="ffmpeg.html#toc-Audio-Options">3.6 Audio Options</a></h2>
1118
1119 <dl compact="compact">
1120 <dt> &lsquo;<samp>-aframes <var>number</var></samp>&rsquo;</dt>
1121 <dd><p>Set the number of audio frames to record.
1122 </p></dd>
1123 <dt> &lsquo;<samp>-ar <var>freq</var></samp>&rsquo;</dt>
1124 <dd><p>Set the audio sampling frequency. For output streams it is set by
1125 default to the frequency of the corresponding input stream. For input
1126 streams this option only makes sense for audio grabbing devices and raw
1127 demuxers and is mapped to the corresponding demuxer options.
1128 </p></dd>
1129 <dt> &lsquo;<samp>-aq <var>q</var></samp>&rsquo;</dt>
1130 <dd><p>Set the audio quality (codec-specific, VBR).
1131 </p></dd>
1132 <dt> &lsquo;<samp>-ac <var>channels</var></samp>&rsquo;</dt>
1133 <dd><p>Set the number of audio channels. For output streams it is set by
1134 default to the number of input audio channels. For input streams
1135 this option only makes sense for audio grabbing devices and raw demuxers
1136 and is mapped to the corresponding demuxer options.
1137 </p></dd>
1138 <dt> &lsquo;<samp>-an</samp>&rsquo;</dt>
1139 <dd><p>Disable audio recording.
1140 </p></dd>
1141 <dt> &lsquo;<samp>-acodec <var>codec</var></samp>&rsquo;</dt>
1142 <dd><p>Force audio codec to <var>codec</var>. Use the <code>copy</code> special value to
1143 specify that the raw codec data must be copied as is.
1144 </p></dd>
1145 <dt> &lsquo;<samp>-newaudio</samp>&rsquo;</dt>
1146 <dd><p>Add a new audio track to the output file. If you want to specify parameters,
1147 do so before <code>-newaudio</code> (<code>-acodec</code>, <code>-ab</code>, etc..).
1148 </p>
1149 <p>Mapping will be done automatically, if the number of output streams is equal to
1150 the number of input streams, else it will pick the first one that matches. You
1151 can override the mapping using <code>-map</code> as usual.
1152 </p>
1153 <p>Example:
1154 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i file.mpg -vcodec copy -acodec ac3 -ab 384k test.mpg -acodec mp2 -ab 192k -newaudio
1155 </pre></td></tr></table>
1156 </dd>
1157 <dt> &lsquo;<samp>-alang <var>code</var></samp>&rsquo;</dt>
1158 <dd><p>Set the ISO 639 language code (3 letters) of the current audio stream.
1159 </p></dd>
1160 </dl>
1161
1162 <a name="Advanced-Audio-options_003a"></a>
1163 <h2 class="section"><a href="ffmpeg.html#toc-Advanced-Audio-options_003a">3.7 Advanced Audio options:</a></h2>
1164
1165 <dl compact="compact">
1166 <dt> &lsquo;<samp>-atag <var>fourcc/tag</var></samp>&rsquo;</dt>
1167 <dd><p>Force audio tag/fourcc.
1168 </p></dd>
1169 <dt> &lsquo;<samp>-audio_service_type <var>type</var></samp>&rsquo;</dt>
1170 <dd><p>Set the type of service that the audio stream contains.
1171 </p><dl compact="compact">
1172 <dt> &lsquo;<samp>ma</samp>&rsquo;</dt>
1173 <dd><p>Main Audio Service (default)
1174 </p></dd>
1175 <dt> &lsquo;<samp>ef</samp>&rsquo;</dt>
1176 <dd><p>Effects
1177 </p></dd>
1178 <dt> &lsquo;<samp>vi</samp>&rsquo;</dt>
1179 <dd><p>Visually Impaired
1180 </p></dd>
1181 <dt> &lsquo;<samp>hi</samp>&rsquo;</dt>
1182 <dd><p>Hearing Impaired
1183 </p></dd>
1184 <dt> &lsquo;<samp>di</samp>&rsquo;</dt>
1185 <dd><p>Dialogue
1186 </p></dd>
1187 <dt> &lsquo;<samp>co</samp>&rsquo;</dt>
1188 <dd><p>Commentary
1189 </p></dd>
1190 <dt> &lsquo;<samp>em</samp>&rsquo;</dt>
1191 <dd><p>Emergency
1192 </p></dd>
1193 <dt> &lsquo;<samp>vo</samp>&rsquo;</dt>
1194 <dd><p>Voice Over
1195 </p></dd>
1196 <dt> &lsquo;<samp>ka</samp>&rsquo;</dt>
1197 <dd><p>Karaoke
1198 </p></dd>
1199 </dl>
1200 </dd>
1201 <dt> &lsquo;<samp>-absf <var>bitstream_filter</var></samp>&rsquo;</dt>
1202 <dd><p>Bitstream filters available are &quot;dump_extra&quot;, &quot;remove_extra&quot;, &quot;noise&quot;, &quot;mp3comp&quot;, &quot;mp3decomp&quot;.
1203 </p></dd>
1204 </dl>
1205
1206 <a name="Subtitle-options_003a"></a>
1207 <h2 class="section"><a href="ffmpeg.html#toc-Subtitle-options_003a">3.8 Subtitle options:</a></h2>
1208
1209 <dl compact="compact">
1210 <dt> &lsquo;<samp>-scodec <var>codec</var></samp>&rsquo;</dt>
1211 <dd><p>Force subtitle codec (&rsquo;copy&rsquo; to copy stream).
1212 </p></dd>
1213 <dt> &lsquo;<samp>-newsubtitle</samp>&rsquo;</dt>
1214 <dd><p>Add a new subtitle stream to the current output stream.
1215 </p></dd>
1216 <dt> &lsquo;<samp>-slang <var>code</var></samp>&rsquo;</dt>
1217 <dd><p>Set the ISO 639 language code (3 letters) of the current subtitle stream.
1218 </p></dd>
1219 <dt> &lsquo;<samp>-sn</samp>&rsquo;</dt>
1220 <dd><p>Disable subtitle recording.
1221 </p></dd>
1222 <dt> &lsquo;<samp>-sbsf <var>bitstream_filter</var></samp>&rsquo;</dt>
1223 <dd><p>Bitstream filters available are &quot;mov2textsub&quot;, &quot;text2movsub&quot;.
1224 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i file.mov -an -vn -sbsf mov2textsub -scodec copy -f rawvideo sub.txt
1225 </pre></td></tr></table>
1226 </dd>
1227 </dl>
1228
1229 <a name="Audio_002fVideo-grab-options"></a>
1230 <h2 class="section"><a href="ffmpeg.html#toc-Audio_002fVideo-grab-options">3.9 Audio/Video grab options</a></h2>
1231
1232 <dl compact="compact">
1233 <dt> &lsquo;<samp>-vc <var>channel</var></samp>&rsquo;</dt>
1234 <dd><p>Set video grab channel (DV1394 only).
1235 </p></dd>
1236 <dt> &lsquo;<samp>-tvstd <var>standard</var></samp>&rsquo;</dt>
1237 <dd><p>Set television standard (NTSC, PAL (SECAM)).
1238 </p></dd>
1239 <dt> &lsquo;<samp>-isync</samp>&rsquo;</dt>
1240 <dd><p>Synchronize read on input.
1241 </p></dd>
1242 </dl>
1243
1244 <a name="Advanced-options"></a>
1245 <h2 class="section"><a href="ffmpeg.html#toc-Advanced-options">3.10 Advanced options</a></h2>
1246
1247 <dl compact="compact">
1248 <dt> &lsquo;<samp>-map <var>input_file_id</var>.<var>input_stream_id</var>[:<var>sync_file_id</var>.<var>sync_stream_id</var>]</samp>&rsquo;</dt>
1249 <dd>
1250 <p>Designate an input stream as a source for the output file. Each input
1251 stream is identified by the input file index <var>input_file_id</var> and
1252 the input stream index <var>input_stream_id</var> within the input
1253 file. Both indexes start at 0. If specified,
1254 <var>sync_file_id</var>.<var>sync_stream_id</var> sets which input stream
1255 is used as a presentation sync reference.
1256 </p>
1257 <p>The <code>-map</code> options must be specified just after the output file.
1258 If any <code>-map</code> options are used, the number of <code>-map</code> options
1259 on the command line must match the number of streams in the output
1260 file. The first <code>-map</code> option on the command line specifies the
1261 source for output stream 0, the second <code>-map</code> option specifies
1262 the source for output stream 1, etc.
1263 </p>
1264 <p>For example, if you have two audio streams in the first input file,
1265 these streams are identified by &quot;0.0&quot; and &quot;0.1&quot;. You can use
1266 <code>-map</code> to select which stream to place in an output file. For
1267 example:
1268 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT out.wav -map 0.1
1269 </pre></td></tr></table>
1270 <p>will map the input stream in &lsquo;<tt>INPUT</tt>&rsquo; identified by &quot;0.1&quot; to
1271 the (single) output stream in &lsquo;<tt>out.wav</tt>&rsquo;.
1272 </p>
1273 <p>For example, to select the stream with index 2 from input file
1274 &lsquo;<tt>a.mov</tt>&rsquo; (specified by the identifier &quot;0.2&quot;), and stream with
1275 index 6 from input &lsquo;<tt>b.mov</tt>&rsquo; (specified by the identifier &quot;1.6&quot;),
1276 and copy them to the output file &lsquo;<tt>out.mov</tt>&rsquo;:
1277 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i a.mov -i b.mov -vcodec copy -acodec copy out.mov -map 0.2 -map 1.6
1278 </pre></td></tr></table>
1279
1280 <p>To add more streams to the output file, you can use the
1281 <code>-newaudio</code>, <code>-newvideo</code>, <code>-newsubtitle</code> options.
1282 </p>
1283 </dd>
1284 <dt> &lsquo;<samp>-map_meta_data <var>outfile</var>[,<var>metadata</var>]:<var>infile</var>[,<var>metadata</var>]</samp>&rsquo;</dt>
1285 <dd><p>Deprecated, use <var>-map_metadata</var> instead.
1286 </p>
1287 </dd>
1288 <dt> &lsquo;<samp>-map_metadata <var>outfile</var>[,<var>metadata</var>]:<var>infile</var>[,<var>metadata</var>]</samp>&rsquo;</dt>
1289 <dd><p>Set metadata information of <var>outfile</var> from <var>infile</var>. Note that those
1290 are file indices (zero-based), not filenames.
1291 Optional <var>metadata</var> parameters specify, which metadata to copy - (g)lobal
1292 (i.e. metadata that applies to the whole file), per-(s)tream, per-(c)hapter or
1293 per-(p)rogram. All metadata specifiers other than global must be followed by the
1294 stream/chapter/program number. If metadata specifier is omitted, it defaults to
1295 global.
1296 </p>
1297 <p>By default, global metadata is copied from the first input file to all output files,
1298 per-stream and per-chapter metadata is copied along with streams/chapters. These
1299 default mappings are disabled by creating any mapping of the relevant type. A negative
1300 file index can be used to create a dummy mapping that just disables automatic copying.
1301 </p>
1302 <p>For example to copy metadata from the first stream of the input file to global metadata
1303 of the output file:
1304 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.ogg -map_metadata 0:0,s0 out.mp3
1305 </pre></td></tr></table>
1306 </dd>
1307 <dt> &lsquo;<samp>-map_chapters <var>outfile</var>:<var>infile</var></samp>&rsquo;</dt>
1308 <dd><p>Copy chapters from <var>infile</var> to <var>outfile</var>. If no chapter mapping is specified,
1309 then chapters are copied from the first input file with at least one chapter to all
1310 output files. Use a negative file index to disable any chapter copying.
1311 </p></dd>
1312 <dt> &lsquo;<samp>-debug</samp>&rsquo;</dt>
1313 <dd><p>Print specific debug info.
1314 </p></dd>
1315 <dt> &lsquo;<samp>-benchmark</samp>&rsquo;</dt>
1316 <dd><p>Show benchmarking information at the end of an encode.
1317 Shows CPU time used and maximum memory consumption.
1318 Maximum memory consumption is not supported on all systems,
1319 it will usually display as 0 if not supported.
1320 </p></dd>
1321 <dt> &lsquo;<samp>-dump</samp>&rsquo;</dt>
1322 <dd><p>Dump each input packet.
1323 </p></dd>
1324 <dt> &lsquo;<samp>-hex</samp>&rsquo;</dt>
1325 <dd><p>When dumping packets, also dump the payload.
1326 </p></dd>
1327 <dt> &lsquo;<samp>-bitexact</samp>&rsquo;</dt>
1328 <dd><p>Only use bit exact algorithms (for codec testing).
1329 </p></dd>
1330 <dt> &lsquo;<samp>-ps <var>size</var></samp>&rsquo;</dt>
1331 <dd><p>Set RTP payload size in bytes.
1332 </p></dd>
1333 <dt> &lsquo;<samp>-re</samp>&rsquo;</dt>
1334 <dd><p>Read input at native frame rate. Mainly used to simulate a grab device.
1335 </p></dd>
1336 <dt> &lsquo;<samp>-loop_input</samp>&rsquo;</dt>
1337 <dd><p>Loop over the input stream. Currently it works only for image
1338 streams. This option is used for automatic FFserver testing.
1339 This option is deprecated, use -loop 1.
1340 </p></dd>
1341 <dt> &lsquo;<samp>-loop_output <var>number_of_times</var></samp>&rsquo;</dt>
1342 <dd><p>Repeatedly loop output for formats that support looping such as animated GIF
1343 (0 will loop the output infinitely).
1344 This option is deprecated, use -loop.
1345 </p></dd>
1346 <dt> &lsquo;<samp>-threads <var>count</var></samp>&rsquo;</dt>
1347 <dd><p>Thread count.
1348 </p></dd>
1349 <dt> &lsquo;<samp>-vsync <var>parameter</var></samp>&rsquo;</dt>
1350 <dd><p>Video sync method.
1351 </p>
1352 <dl compact="compact">
1353 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
1354 <dd><p>Each frame is passed with its timestamp from the demuxer to the muxer.
1355 </p></dd>
1356 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
1357 <dd><p>Frames will be duplicated and dropped to achieve exactly the requested
1358 constant framerate.
1359 </p></dd>
1360 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
1361 <dd><p>Frames are passed through with their timestamp or dropped so as to
1362 prevent 2 frames from having the same timestamp.
1363 </p></dd>
1364 <dt> &lsquo;<samp>-1</samp>&rsquo;</dt>
1365 <dd><p>Chooses between 1 and 2 depending on muxer capabilities. This is the
1366 default method.
1367 </p></dd>
1368 </dl>
1369
1370 <p>With -map you can select from which stream the timestamps should be
1371 taken. You can leave either video or audio unchanged and sync the
1372 remaining stream(s) to the unchanged one.
1373 </p>
1374 </dd>
1375 <dt> &lsquo;<samp>-async <var>samples_per_second</var></samp>&rsquo;</dt>
1376 <dd><p>Audio sync method. &quot;Stretches/squeezes&quot; the audio stream to match the timestamps,
1377 the parameter is the maximum samples per second by which the audio is changed.
1378 -async 1 is a special case where only the start of the audio stream is corrected
1379 without any later correction.
1380 </p></dd>
1381 <dt> &lsquo;<samp>-copyts</samp>&rsquo;</dt>
1382 <dd><p>Copy timestamps from input to output.
1383 </p></dd>
1384 <dt> &lsquo;<samp>-copytb</samp>&rsquo;</dt>
1385 <dd><p>Copy input stream time base from input to output when stream copying.
1386 </p></dd>
1387 <dt> &lsquo;<samp>-shortest</samp>&rsquo;</dt>
1388 <dd><p>Finish encoding when the shortest input stream ends.
1389 </p></dd>
1390 <dt> &lsquo;<samp>-dts_delta_threshold</samp>&rsquo;</dt>
1391 <dd><p>Timestamp discontinuity delta threshold.
1392 </p></dd>
1393 <dt> &lsquo;<samp>-muxdelay <var>seconds</var></samp>&rsquo;</dt>
1394 <dd><p>Set the maximum demux-decode delay.
1395 </p></dd>
1396 <dt> &lsquo;<samp>-muxpreload <var>seconds</var></samp>&rsquo;</dt>
1397 <dd><p>Set the initial demux-decode delay.
1398 </p></dd>
1399 <dt> &lsquo;<samp>-streamid <var>output-stream-index</var>:<var>new-value</var></samp>&rsquo;</dt>
1400 <dd><p>Assign a new stream-id value to an output stream. This option should be
1401 specified prior to the output filename to which it applies.
1402 For the situation where multiple output files exist, a streamid
1403 may be reassigned to a different value.
1404 </p>
1405 <p>For example, to set the stream 0 PID to 33 and the stream 1 PID to 36 for
1406 an output mpegts file:
1407 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i infile -streamid 0:33 -streamid 1:36 out.ts
1408 </pre></td></tr></table>
1409 </dd>
1410 </dl>
1411
1412 <a name="Preset-files"></a>
1413 <h2 class="section"><a href="ffmpeg.html#toc-Preset-files">3.11 Preset files</a></h2>
1414
1415 <p>A preset file contains a sequence of <var>option</var>=<var>value</var> pairs,
1416 one for each line, specifying a sequence of options which would be
1417 awkward to specify on the command line. Lines starting with the hash
1418 (&rsquo;#&rsquo;) character are ignored and are used to provide comments. Check
1419 the &lsquo;<tt>ffpresets</tt>&rsquo; directory in the FFmpeg source tree for examples.
1420 </p>
1421 <p>Preset files are specified with the <code>vpre</code>, <code>apre</code>,
1422 <code>spre</code>, and <code>fpre</code> options. The <code>fpre</code> option takes the
1423 filename of the preset instead of a preset name as input and can be
1424 used for any kind of codec. For the <code>vpre</code>, <code>apre</code>, and
1425 <code>spre</code> options, the options specified in a preset file are
1426 applied to the currently selected codec of the same type as the preset
1427 option.
1428 </p>
1429 <p>The argument passed to the <code>vpre</code>, <code>apre</code>, and <code>spre</code>
1430 preset options identifies the preset file to use according to the
1431 following rules:
1432 </p>
1433 <p>First ffmpeg searches for a file named <var>arg</var>.ffpreset in the
1434 directories &lsquo;<tt>$FFMPEG_DATADIR</tt>&rsquo; (if set), and &lsquo;<tt>$HOME/.ffmpeg</tt>&rsquo;, and in
1435 the datadir defined at configuration time (usually &lsquo;<tt>PREFIX/share/ffmpeg</tt>&rsquo;)
1436 or in a &lsquo;<tt>ffpresets</tt>&rsquo; folder along the executable on win32,
1437 in that order. For example, if the argument is <code>libx264-max</code>, it will
1438 search for the file &lsquo;<tt>libx264-max.ffpreset</tt>&rsquo;.
1439 </p>
1440 <p>If no such file is found, then ffmpeg will search for a file named
1441 <var>codec_name</var>-<var>arg</var>.ffpreset in the above-mentioned
1442 directories, where <var>codec_name</var> is the name of the codec to which
1443 the preset file options will be applied. For example, if you select
1444 the video codec with <code>-vcodec libx264</code> and use <code>-vpre max</code>,
1445 then it will search for the file &lsquo;<tt>libx264-max.ffpreset</tt>&rsquo;.
1446 </p>
1447 <a name="Tips"></a>
1448 <h1 class="chapter"><a href="ffmpeg.html#toc-Tips">4. Tips</a></h1>
1449
1450 <ul>
1451 <li>
1452 For streaming at very low bitrate application, use a low frame rate
1453 and a small GOP size. This is especially true for RealVideo where
1454 the Linux player does not seem to be very fast, so it can miss
1455 frames. An example is:
1456
1457 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -g 3 -r 3 -t 10 -b 50k -s qcif -f rv10 /tmp/b.rm
1458 </pre></td></tr></table>
1459
1460 </li><li>
1461 The parameter &rsquo;q&rsquo; which is displayed while encoding is the current
1462 quantizer. The value 1 indicates that a very good quality could
1463 be achieved. The value 31 indicates the worst quality. If q=31 appears
1464 too often, it means that the encoder cannot compress enough to meet
1465 your bitrate. You must either increase the bitrate, decrease the
1466 frame rate or decrease the frame size.
1467
1468 </li><li>
1469 If your computer is not fast enough, you can speed up the
1470 compression at the expense of the compression ratio. You can use
1471 &rsquo;-me zero&rsquo; to speed up motion estimation, and &rsquo;-intra&rsquo; to disable
1472 motion estimation completely (you have only I-frames, which means it
1473 is about as good as JPEG compression).
1474
1475 </li><li>
1476 To have very low audio bitrates, reduce the sampling frequency
1477 (down to 22050 Hz for MPEG audio, 22050 or 11025 for AC-3).
1478
1479 </li><li>
1480 To have a constant quality (but a variable bitrate), use the option
1481 &rsquo;-qscale n&rsquo; when &rsquo;n&rsquo; is between 1 (excellent quality) and 31 (worst
1482 quality).
1483
1484 </li><li>
1485 When converting video files, you can use the &rsquo;-sameq&rsquo; option which
1486 uses the same quality factor in the encoder as in the decoder.
1487 It allows almost lossless encoding.
1488
1489 </li></ul>
1490
1491 <a name="Examples"></a>
1492 <h1 class="chapter"><a href="ffmpeg.html#toc-Examples">5. Examples</a></h1>
1493
1494 <a name="Video-and-Audio-grabbing"></a>
1495 <h2 class="section"><a href="ffmpeg.html#toc-Video-and-Audio-grabbing">5.1 Video and Audio grabbing</a></h2>
1496
1497 <p>If you specify the input format and device then ffmpeg can grab video
1498 and audio directly.
1499 </p>
1500 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg
1501 </pre></td></tr></table>
1502
1503 <p>Note that you must activate the right video source and channel before
1504 launching ffmpeg with any TV viewer such as
1505 <a href="http://linux.bytesex.org/xawtv/">xawtv</a> by Gerd Knorr. You also
1506 have to set the audio recording levels correctly with a
1507 standard mixer.
1508 </p>
1509 <a name="X11-grabbing"></a>
1510 <h2 class="section"><a href="ffmpeg.html#toc-X11-grabbing">5.2 X11 grabbing</a></h2>
1511
1512 <p>Grab the X11 display with ffmpeg via
1513 </p>
1514 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f x11grab -s cif -r 25 -i :0.0 /tmp/out.mpg
1515 </pre></td></tr></table>
1516
1517 <p>0.0 is display.screen number of your X11 server, same as
1518 the DISPLAY environment variable.
1519 </p>
1520 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f x11grab -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg
1521 </pre></td></tr></table>
1522
1523 <p>10 is the x-offset and 20 the y-offset for the grabbing.
1524 </p>
1525 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f x11grab -follow_mouse centered -s cif -r 25 -i :0.0 /tmp/out.mpg
1526 </pre></td></tr></table>
1527
1528 <p>The grabbing region follows the mouse pointer, which stays at the center of
1529 region.
1530 </p>
1531 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f x11grab -follow_mouse 100 -s cif -r 25 -i :0.0 /tmp/out.mpg
1532 </pre></td></tr></table>
1533
1534 <p>Only follows when mouse pointer reaches within 100 pixels to the edge of
1535 region.
1536 </p>
1537 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f x11grab -show_region 1 -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg
1538 </pre></td></tr></table>
1539
1540 <p>The grabbing region will be indicated on screen.
1541 </p>
1542 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f x11grab -follow_mouse centered -show_region 1 -s cif -r 25 -i :0.0 /tmp/out.mpg
1543 </pre></td></tr></table>
1544
1545 <p>The grabbing region indication will follow the mouse pointer.
1546 </p>
1547
1548 <a name="Video-and-Audio-file-format-conversion"></a>
1549 <h2 class="section"><a href="ffmpeg.html#toc-Video-and-Audio-file-format-conversion">5.3 Video and Audio file format conversion</a></h2>
1550
1551 <p>Any supported file format and protocol can serve as input to ffmpeg:
1552 </p>
1553 <p>Examples:
1554 </p><ul>
1555 <li>
1556 You can use YUV files as input:
1557
1558 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
1559 </pre></td></tr></table>
1560
1561 <p>It will use the files:
1562 </p><table><tr><td>&nbsp;</td><td><pre class="example">/tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
1563 /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
1564 </pre></td></tr></table>
1565
1566 <p>The Y files use twice the resolution of the U and V files. They are
1567 raw files, without header. They can be generated by all decent video
1568 decoders. You must specify the size of the image with the &lsquo;<samp>-s</samp>&rsquo; option
1569 if ffmpeg cannot guess it.
1570 </p>
1571 </li><li>
1572 You can input from a raw YUV420P file:
1573
1574 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i /tmp/test.yuv /tmp/out.avi
1575 </pre></td></tr></table>
1576
1577 <p>test.yuv is a file containing raw YUV planar data. Each frame is composed
1578 of the Y plane followed by the U and V planes at half vertical and
1579 horizontal resolution.
1580 </p>
1581 </li><li>
1582 You can output to a raw YUV420P file:
1583
1584 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i mydivx.avi hugefile.yuv
1585 </pre></td></tr></table>
1586
1587 </li><li>
1588 You can set several input files and output files:
1589
1590 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
1591 </pre></td></tr></table>
1592
1593 <p>Converts the audio file a.wav and the raw YUV video file a.yuv
1594 to MPEG file a.mpg.
1595 </p>
1596 </li><li>
1597 You can also do audio and video conversions at the same time:
1598
1599 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
1600 </pre></td></tr></table>
1601
1602 <p>Converts a.wav to MPEG audio at 22050 Hz sample rate.
1603 </p>
1604 </li><li>
1605 You can encode to several formats at the same time and define a
1606 mapping from input stream to output streams:
1607
1608 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i /tmp/a.wav -ab 64k /tmp/a.mp2 -ab 128k /tmp/b.mp2 -map 0:0 -map 0:0
1609 </pre></td></tr></table>
1610
1611 <p>Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. &rsquo;-map
1612 file:index&rsquo; specifies which input stream is used for each output
1613 stream, in the order of the definition of output streams.
1614 </p>
1615 </li><li>
1616 You can transcode decrypted VOBs:
1617
1618 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800k -g 300 -bf 2 -acodec libmp3lame -ab 128k snatch.avi
1619 </pre></td></tr></table>
1620
1621 <p>This is a typical DVD ripping example; the input is a VOB file, the
1622 output an AVI file with MPEG-4 video and MP3 audio. Note that in this
1623 command we use B-frames so the MPEG-4 stream is DivX5 compatible, and
1624 GOP size is 300 which means one intra frame every 10 seconds for 29.97fps
1625 input video. Furthermore, the audio stream is MP3-encoded so you need
1626 to enable LAME support by passing <code>--enable-libmp3lame</code> to configure.
1627 The mapping is particularly useful for DVD transcoding
1628 to get the desired audio language.
1629 </p>
1630 <p>NOTE: To see the supported input formats, use <code>ffmpeg -formats</code>.
1631 </p>
1632 </li><li>
1633 You can extract images from a video, or create a video from many images:
1634
1635 <p>For extracting images from a video:
1636 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
1637 </pre></td></tr></table>
1638
1639 <p>This will extract one video frame per second from the video and will
1640 output them in files named &lsquo;<tt>foo-001.jpeg</tt>&rsquo;, &lsquo;<tt>foo-002.jpeg</tt>&rsquo;,
1641 etc. Images will be rescaled to fit the new WxH values.
1642 </p>
1643 <p>If you want to extract just a limited number of frames, you can use the
1644 above command in combination with the -vframes or -t option, or in
1645 combination with -ss to start extracting from a certain point in time.
1646 </p>
1647 <p>For creating a video from many images:
1648 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi
1649 </pre></td></tr></table>
1650
1651 <p>The syntax <code>foo-%03d.jpeg</code> specifies to use a decimal number
1652 composed of three digits padded with zeroes to express the sequence
1653 number. It is the same syntax supported by the C printf function, but
1654 only formats accepting a normal integer are suitable.
1655 </p>
1656 </li><li>
1657 You can put many streams of the same type in the output:
1658
1659 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i test1.avi -i test2.avi -vcodec copy -acodec copy -vcodec copy -acodec copy test12.avi -newvideo -newaudio
1660 </pre></td></tr></table>
1661
1662 <p>In addition to the first video and audio streams, the resulting
1663 output file &lsquo;<tt>test12.avi</tt>&rsquo; will contain the second video
1664 and the second audio stream found in the input streams list.
1665 </p>
1666 <p>The <code>-newvideo</code>, <code>-newaudio</code> and <code>-newsubtitle</code>
1667 options have to be specified immediately after the name of the output
1668 file to which you want to add them.
1669 </p>
1670 </li></ul>
1671
1672 <a name="Expression-Evaluation"></a>
1673 <h1 class="chapter"><a href="ffmpeg.html#toc-Expression-Evaluation">6. Expression Evaluation</a></h1>
1674
1675 <p>When evaluating an arithemetic expression, FFmpeg uses an internal
1676 formula evaluator, implemented through the &lsquo;<tt>libavutil/eval.h</tt>&rsquo;
1677 interface.
1678 </p>
1679 <p>An expression may contain unary, binary operators, constants, and
1680 functions.
1681 </p>
1682 <p>Two expressions <var>expr1</var> and <var>expr2</var> can be combined to form
1683 another expression &quot;<var>expr1</var>;<var>expr2</var>&quot;.
1684 <var>expr1</var> and <var>expr2</var> are evaluated in turn, and the new
1685 expression evaluates to the value of <var>expr2</var>.
1686 </p>
1687 <p>The following binary operators are available: <code>+</code>, <code>-</code>,
1688 <code>*</code>, <code>/</code>, <code>^</code>.
1689 </p>
1690 <p>The following unary operators are available: <code>+</code>, <code>-</code>.
1691 </p>
1692 <p>The following functions are available:
1693 </p><dl compact="compact">
1694 <dt> &lsquo;<samp>sinh(x)</samp>&rsquo;</dt>
1695 <dt> &lsquo;<samp>cosh(x)</samp>&rsquo;</dt>
1696 <dt> &lsquo;<samp>tanh(x)</samp>&rsquo;</dt>
1697 <dt> &lsquo;<samp>sin(x)</samp>&rsquo;</dt>
1698 <dt> &lsquo;<samp>cos(x)</samp>&rsquo;</dt>
1699 <dt> &lsquo;<samp>tan(x)</samp>&rsquo;</dt>
1700 <dt> &lsquo;<samp>atan(x)</samp>&rsquo;</dt>
1701 <dt> &lsquo;<samp>asin(x)</samp>&rsquo;</dt>
1702 <dt> &lsquo;<samp>acos(x)</samp>&rsquo;</dt>
1703 <dt> &lsquo;<samp>exp(x)</samp>&rsquo;</dt>
1704 <dt> &lsquo;<samp>log(x)</samp>&rsquo;</dt>
1705 <dt> &lsquo;<samp>abs(x)</samp>&rsquo;</dt>
1706 <dt> &lsquo;<samp>squish(x)</samp>&rsquo;</dt>
1707 <dt> &lsquo;<samp>gauss(x)</samp>&rsquo;</dt>
1708 <dt> &lsquo;<samp>isnan(x)</samp>&rsquo;</dt>
1709 <dd><p>Return 1.0 if <var>x</var> is NAN, 0.0 otherwise.
1710 </p>
1711 </dd>
1712 <dt> &lsquo;<samp>mod(x, y)</samp>&rsquo;</dt>
1713 <dt> &lsquo;<samp>max(x, y)</samp>&rsquo;</dt>
1714 <dt> &lsquo;<samp>min(x, y)</samp>&rsquo;</dt>
1715 <dt> &lsquo;<samp>eq(x, y)</samp>&rsquo;</dt>
1716 <dt> &lsquo;<samp>gte(x, y)</samp>&rsquo;</dt>
1717 <dt> &lsquo;<samp>gt(x, y)</samp>&rsquo;</dt>
1718 <dt> &lsquo;<samp>lte(x, y)</samp>&rsquo;</dt>
1719 <dt> &lsquo;<samp>lt(x, y)</samp>&rsquo;</dt>
1720 <dt> &lsquo;<samp>st(var, expr)</samp>&rsquo;</dt>
1721 <dd><p>Allow to store the value of the expression <var>expr</var> in an internal
1722 variable. <var>var</var> specifies the number of the variable where to
1723 store the value, and it is a value ranging from 0 to 9. The function
1724 returns the value stored in the internal variable.
1725 </p>
1726 </dd>
1727 <dt> &lsquo;<samp>ld(var)</samp>&rsquo;</dt>
1728 <dd><p>Allow to load the value of the internal variable with number
1729 <var>var</var>, which was previosly stored with st(<var>var</var>, <var>expr</var>).
1730 The function returns the loaded value.
1731 </p>
1732 </dd>
1733 <dt> &lsquo;<samp>while(cond, expr)</samp>&rsquo;</dt>
1734 <dd><p>Evaluate expression <var>expr</var> while the expression <var>cond</var> is
1735 non-zero, and returns the value of the last <var>expr</var> evaluation, or
1736 NAN if <var>cond</var> was always false.
1737 </p>
1738 </dd>
1739 <dt> &lsquo;<samp>ceil(expr)</samp>&rsquo;</dt>
1740 <dd><p>Round the value of expression <var>expr</var> upwards to the nearest
1741 integer. For example, &quot;ceil(1.5)&quot; is &quot;2.0&quot;.
1742 </p>
1743 </dd>
1744 <dt> &lsquo;<samp>floor(expr)</samp>&rsquo;</dt>
1745 <dd><p>Round the value of expression <var>expr</var> downwards to the nearest
1746 integer. For example, &quot;floor(-1.5)&quot; is &quot;-2.0&quot;.
1747 </p>
1748 </dd>
1749 <dt> &lsquo;<samp>trunc(expr)</samp>&rsquo;</dt>
1750 <dd><p>Round the value of expression <var>expr</var> towards zero to the nearest
1751 integer. For example, &quot;trunc(-1.5)&quot; is &quot;-1.0&quot;.
1752 </p>
1753 </dd>
1754 <dt> &lsquo;<samp>sqrt(expr)</samp>&rsquo;</dt>
1755 <dd><p>Compute the square root of <var>expr</var>. This is equivalent to
1756 &quot;(<var>expr</var>)^.5&quot;.
1757 </p>
1758 </dd>
1759 <dt> &lsquo;<samp>not(expr)</samp>&rsquo;</dt>
1760 <dd><p>Return 1.0 if <var>expr</var> is zero, 0.0 otherwise.
1761 </p>
1762 </dd>
1763 <dt> &lsquo;<samp>pow(x, y)</samp>&rsquo;</dt>
1764 <dd><p>Compute the power of <var>x</var> elevated <var>y</var>, it is equivalent to
1765 &quot;(<var>x</var>)^(<var>y</var>)&quot;.
1766 </p></dd>
1767 </dl>
1768
1769 <p>Note that:
1770 </p>
1771 <p><code>*</code> works like AND
1772 </p>
1773 <p><code>+</code> works like OR
1774 </p>
1775 <p>thus
1776 </p><table><tr><td>&nbsp;</td><td><pre class="example">if A then B else C
1777 </pre></td></tr></table>
1778 <p>is equivalent to
1779 </p><table><tr><td>&nbsp;</td><td><pre class="example">A*B + not(A)*C
1780 </pre></td></tr></table>
1781
1782 <p>In your C code, you can extend the list of unary and binary functions,
1783 and define recognized constants, so that they are available for your
1784 expressions.
1785 </p>
1786 <p>The evaluator also recognizes the International System number
1787 postfixes. If &rsquo;i&rsquo; is appended after the postfix, powers of 2 are used
1788 instead of powers of 10. The &rsquo;B&rsquo; postfix multiplies the value for 8,
1789 and can be appended after another postfix or used alone. This allows
1790 using for example &rsquo;KB&rsquo;, &rsquo;MiB&rsquo;, &rsquo;G&rsquo; and &rsquo;B&rsquo; as postfix.
1791 </p>
1792 <p>Follows the list of available International System postfixes, with
1793 indication of the corresponding powers of 10 and of 2.
1794 </p><dl compact="compact">
1795 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
1796 <dd><p>-24 / -80
1797 </p></dd>
1798 <dt> &lsquo;<samp>z</samp>&rsquo;</dt>
1799 <dd><p>-21 / -70
1800 </p></dd>
1801 <dt> &lsquo;<samp>a</samp>&rsquo;</dt>
1802 <dd><p>-18 / -60
1803 </p></dd>
1804 <dt> &lsquo;<samp>f</samp>&rsquo;</dt>
1805 <dd><p>-15 / -50
1806 </p></dd>
1807 <dt> &lsquo;<samp>p</samp>&rsquo;</dt>
1808 <dd><p>-12 / -40
1809 </p></dd>
1810 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
1811 <dd><p>-9 / -30
1812 </p></dd>
1813 <dt> &lsquo;<samp>u</samp>&rsquo;</dt>
1814 <dd><p>-6 / -20
1815 </p></dd>
1816 <dt> &lsquo;<samp>m</samp>&rsquo;</dt>
1817 <dd><p>-3 / -10
1818 </p></dd>
1819 <dt> &lsquo;<samp>c</samp>&rsquo;</dt>
1820 <dd><p>-2
1821 </p></dd>
1822 <dt> &lsquo;<samp>d</samp>&rsquo;</dt>
1823 <dd><p>-1
1824 </p></dd>
1825 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
1826 <dd><p>2
1827 </p></dd>
1828 <dt> &lsquo;<samp>k</samp>&rsquo;</dt>
1829 <dd><p>3 / 10
1830 </p></dd>
1831 <dt> &lsquo;<samp>K</samp>&rsquo;</dt>
1832 <dd><p>3 / 10
1833 </p></dd>
1834 <dt> &lsquo;<samp>M</samp>&rsquo;</dt>
1835 <dd><p>6 / 20
1836 </p></dd>
1837 <dt> &lsquo;<samp>G</samp>&rsquo;</dt>
1838 <dd><p>9 / 30
1839 </p></dd>
1840 <dt> &lsquo;<samp>T</samp>&rsquo;</dt>
1841 <dd><p>12 / 40
1842 </p></dd>
1843 <dt> &lsquo;<samp>P</samp>&rsquo;</dt>
1844 <dd><p>15 / 40
1845 </p></dd>
1846 <dt> &lsquo;<samp>E</samp>&rsquo;</dt>
1847 <dd><p>18 / 50
1848 </p></dd>
1849 <dt> &lsquo;<samp>Z</samp>&rsquo;</dt>
1850 <dd><p>21 / 60
1851 </p></dd>
1852 <dt> &lsquo;<samp>Y</samp>&rsquo;</dt>
1853 <dd><p>24 / 70
1854 </p></dd>
1855 </dl>
1856
1857 <a name="Decoders"></a>
1858 <h1 class="chapter"><a href="ffmpeg.html#toc-Decoders">7. Decoders</a></h1>
1859
1860 <p>Decoders are configured elements in FFmpeg which allow the decoding of
1861 multimedia streams.
1862 </p>
1863 <p>When you configure your FFmpeg build, all the supported native decoders
1864 are enabled by default. Decoders requiring an external library must be enabled
1865 manually via the corresponding <code>--enable-lib</code> option. You can list all
1866 available decoders using the configure option <code>--list-decoders</code>.
1867 </p>
1868 <p>You can disable all the decoders with the configure option
1869 <code>--disable-decoders</code> and selectively enable / disable single decoders
1870 with the options <code>--enable-decoder=<var>DECODER</var></code> /
1871 <code>--disable-decoder=<var>DECODER</var></code>.
1872 </p>
1873 <p>The option <code>-codecs</code> of the ff* tools will display the list of
1874 enabled decoders.
1875 </p>
1876
1877 <a name="Video-Decoders"></a>
1878 <h1 class="chapter"><a href="ffmpeg.html#toc-Video-Decoders">8. Video Decoders</a></h1>
1879
1880 <p>A description of some of the currently available video decoders
1881 follows.
1882 </p>
1883 <a name="rawvideo"></a>
1884 <h2 class="section"><a href="ffmpeg.html#toc-rawvideo">8.1 rawvideo</a></h2>
1885
1886 <p>Rawvideo decoder.
1887 </p>
1888 <p>This decoder decodes rawvideo streams.
1889 </p>
1890 <a name="Options-1"></a>
1891 <h3 class="subsection"><a href="ffmpeg.html#toc-Options-1">8.1.1 Options</a></h3>
1892
1893 <dl compact="compact">
1894 <dt> &lsquo;<samp>top <var>top_field_first</var></samp>&rsquo;</dt>
1895 <dd><p>Specify the assumed field type of the input video.
1896 </p><dl compact="compact">
1897 <dt> &lsquo;<samp>-1</samp>&rsquo;</dt>
1898 <dd><p>the video is assumed to be progressive (default)
1899 </p></dd>
1900 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
1901 <dd><p>bottom-field-first is assumed
1902 </p></dd>
1903 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
1904 <dd><p>top-field-first is assumed
1905 </p></dd>
1906 </dl>
1907
1908 </dd>
1909 </dl>
1910
1911 <a name="Encoders"></a>
1912 <h1 class="chapter"><a href="ffmpeg.html#toc-Encoders">9. Encoders</a></h1>
1913
1914 <p>Encoders are configured elements in FFmpeg which allow the encoding of
1915 multimedia streams.
1916 </p>
1917 <p>When you configure your FFmpeg build, all the supported native encoders
1918 are enabled by default. Encoders requiring an external library must be enabled
1919 manually via the corresponding <code>--enable-lib</code> option. You can list all
1920 available encoders using the configure option <code>--list-encoders</code>.
1921 </p>
1922 <p>You can disable all the encoders with the configure option
1923 <code>--disable-encoders</code> and selectively enable / disable single encoders
1924 with the options <code>--enable-encoder=<var>ENCODER</var></code> /
1925 <code>--disable-encoder=<var>ENCODER</var></code>.
1926 </p>
1927 <p>The option <code>-codecs</code> of the ff* tools will display the list of
1928 enabled encoders.
1929 </p>
1930
1931 <a name="Audio-Encoders"></a>
1932 <h1 class="chapter"><a href="ffmpeg.html#toc-Audio-Encoders">10. Audio Encoders</a></h1>
1933
1934 <p>A description of some of the currently available audio encoders
1935 follows.
1936 </p>
1937 <a name="ac3-and-ac3_005ffixed"></a>
1938 <h2 class="section"><a href="ffmpeg.html#toc-ac3-and-ac3_005ffixed">10.1 ac3 and ac3_fixed</a></h2>
1939
1940 <p>AC-3 audio encoders.
1941 </p>
1942 <p>These encoders implement part of ATSC A/52:2010 and ETSI TS 102 366, as well as
1943 the undocumented RealAudio 3 (a.k.a. dnet).
1944 </p>
1945 <p>The <var>ac3</var> encoder uses floating-point math, while the <var>ac3_fixed</var>
1946 encoder only uses fixed-point integer math. This does not mean that one is
1947 always faster, just that one or the other may be better suited to a
1948 particular system. The floating-point encoder will generally produce better
1949 quality audio for a given bitrate. The <var>ac3_fixed</var> encoder is not the
1950 default codec for any of the output formats, so it must be specified explicitly
1951 using the option <code>-acodec ac3_fixed</code> in order to use it.
1952 </p>
1953 <a name="AC_002d3-Metadata"></a>
1954 <h3 class="subsection"><a href="ffmpeg.html#toc-AC_002d3-Metadata">10.1.1 AC-3 Metadata</a></h3>
1955
1956 <p>The AC-3 metadata options are used to set parameters that describe the audio,
1957 but in most cases do not affect the audio encoding itself. Some of the options
1958 do directly affect or influence the decoding and playback of the resulting
1959 bitstream, while others are just for informational purposes. A few of the
1960 options will add bits to the output stream that could otherwise be used for
1961 audio data, and will thus affect the quality of the output. Those will be
1962 indicated accordingly with a note in the option list below.
1963 </p>
1964 <p>These parameters are described in detail in several publicly-available
1965 documents.
1966 </p><ul>
1967 <li> <a href="http://www.atsc.org/cms/standards/a_52-2010.pdf">A/52:2010 - Digital Audio Compression (AC-3) (E-AC-3) Standard</a>
1968 </li><li> <a href="http://www.atsc.org/cms/standards/a_54a_with_corr_1.pdf">A/54 - Guide to the Use of the ATSC Digital Television Standard</a>
1969 </li><li> <a href="http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/18_Metadata.Guide.pdf">Dolby Metadata Guide</a>
1970 </li><li> <a href="http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/46_DDEncodingGuidelines.pdf">Dolby Digital Professional Encoding Guidelines</a>
1971 </li></ul>
1972
1973 <a name="Metadata-Control-Options"></a>
1974 <h4 class="subsubsection"><a href="ffmpeg.html#toc-Metadata-Control-Options">10.1.1.1 Metadata Control Options</a></h4>
1975
1976 <dl compact="compact">
1977 <dt> &lsquo;<samp>-per_frame_metadata <var>boolean</var></samp>&rsquo;</dt>
1978 <dd><p>Allow Per-Frame Metadata. Specifies if the encoder should check for changing
1979 metadata for each frame.
1980 </p><dl compact="compact">
1981 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
1982 <dd><p>The metadata values set at initialization will be used for every frame in the
1983 stream. (default)
1984 </p></dd>
1985 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
1986 <dd><p>Metadata values can be changed before encoding each frame.
1987 </p></dd>
1988 </dl>
1989
1990 </dd>
1991 </dl>
1992
1993 <a name="Downmix-Levels"></a>
1994 <h4 class="subsubsection"><a href="ffmpeg.html#toc-Downmix-Levels">10.1.1.2 Downmix Levels</a></h4>
1995
1996 <dl compact="compact">
1997 <dt> &lsquo;<samp>-center_mixlev <var>level</var></samp>&rsquo;</dt>
1998 <dd><p>Center Mix Level. The amount of gain the decoder should apply to the center
1999 channel when downmixing to stereo. This field will only be written to the
2000 bitstream if a center channel is present. The value is specified as a scale
2001 factor. There are 3 valid values:
2002 </p><dl compact="compact">
2003 <dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
2004 <dd><p>Apply -3dB gain
2005 </p></dd>
2006 <dt> &lsquo;<samp>0.595</samp>&rsquo;</dt>
2007 <dd><p>Apply -4.5dB gain (default)
2008 </p></dd>
2009 <dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
2010 <dd><p>Apply -6dB gain
2011 </p></dd>
2012 </dl>
2013
2014 </dd>
2015 <dt> &lsquo;<samp>-surround_mixlev <var>level</var></samp>&rsquo;</dt>
2016 <dd><p>Surround Mix Level. The amount of gain the decoder should apply to the surround
2017 channel(s) when downmixing to stereo. This field will only be written to the
2018 bitstream if one or more surround channels are present. The value is specified
2019 as a scale factor.  There are 3 valid values:
2020 </p><dl compact="compact">
2021 <dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
2022 <dd><p>Apply -3dB gain
2023 </p></dd>
2024 <dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
2025 <dd><p>Apply -6dB gain (default)
2026 </p></dd>
2027 <dt> &lsquo;<samp>0.000</samp>&rsquo;</dt>
2028 <dd><p>Silence Surround Channel(s)
2029 </p></dd>
2030 </dl>
2031
2032 </dd>
2033 </dl>
2034
2035 <a name="Audio-Production-Information"></a>
2036 <h4 class="subsubsection"><a href="ffmpeg.html#toc-Audio-Production-Information">10.1.1.3 Audio Production Information</a></h4>
2037 <p>Audio Production Information is optional information describing the mixing
2038 environment.  Either none or both of the fields are written to the bitstream.
2039 </p>
2040 <dl compact="compact">
2041 <dt> &lsquo;<samp>-mixing_level <var>number</var></samp>&rsquo;</dt>
2042 <dd><p>Mixing Level. Specifies peak sound pressure level (SPL) in the production
2043 environment when the mix was mastered. Valid values are 80 to 111, or -1 for
2044 unknown or not indicated. The default value is -1, but that value cannot be
2045 used if the Audio Production Information is written to the bitstream. Therefore,
2046 if the <code>room_type</code> option is not the default value, the <code>mixing_level</code>
2047 option must not be -1.
2048 </p>
2049 </dd>
2050 <dt> &lsquo;<samp>-room_type <var>type</var></samp>&rsquo;</dt>
2051 <dd><p>Room Type. Describes the equalization used during the final mixing session at
2052 the studio or on the dubbing stage. A large room is a dubbing stage with the
2053 industry standard X-curve equalization; a small room has flat equalization.
2054 This field will not be written to the bitstream if both the <code>mixing_level</code>
2055 option and the <code>room_type</code> option have the default values.
2056 </p><dl compact="compact">
2057 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
2058 <dt> &lsquo;<samp>notindicated</samp>&rsquo;</dt>
2059 <dd><p>Not Indicated (default)
2060 </p></dd>
2061 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
2062 <dt> &lsquo;<samp>large</samp>&rsquo;</dt>
2063 <dd><p>Large Room
2064 </p></dd>
2065 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
2066 <dt> &lsquo;<samp>small</samp>&rsquo;</dt>
2067 <dd><p>Small Room
2068 </p></dd>
2069 </dl>
2070
2071 </dd>
2072 </dl>
2073
2074 <a name="Other-Metadata-Options"></a>
2075 <h4 class="subsubsection"><a href="ffmpeg.html#toc-Other-Metadata-Options">10.1.1.4 Other Metadata Options</a></h4>
2076
2077 <dl compact="compact">
2078 <dt> &lsquo;<samp>-copyright <var>boolean</var></samp>&rsquo;</dt>
2079 <dd><p>Copyright Indicator. Specifies whether a copyright exists for this audio.
2080 </p><dl compact="compact">
2081 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
2082 <dt> &lsquo;<samp>off</samp>&rsquo;</dt>
2083 <dd><p>No Copyright Exists (default)
2084 </p></dd>
2085 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
2086 <dt> &lsquo;<samp>on</samp>&rsquo;</dt>
2087 <dd><p>Copyright Exists
2088 </p></dd>
2089 </dl>
2090
2091 </dd>
2092 <dt> &lsquo;<samp>-dialnorm <var>value</var></samp>&rsquo;</dt>
2093 <dd><p>Dialogue Normalization. Indicates how far the average dialogue level of the
2094 program is below digital 100% full scale (0 dBFS). This parameter determines a
2095 level shift during audio reproduction that sets the average volume of the
2096 dialogue to a preset level. The goal is to match volume level between program
2097 sources. A value of -31dB will result in no volume level change, relative to
2098 the source volume, during audio reproduction. Valid values are whole numbers in
2099 the range -31 to -1, with -31 being the default.
2100 </p>
2101 </dd>
2102 <dt> &lsquo;<samp>-dsur_mode <var>mode</var></samp>&rsquo;</dt>
2103 <dd><p>Dolby Surround Mode. Specifies whether the stereo signal uses Dolby Surround
2104 (Pro Logic). This field will only be written to the bitstream if the audio
2105 stream is stereo. Using this option does <b>NOT</b> mean the encoder will actually
2106 apply Dolby Surround processing.
2107 </p><dl compact="compact">
2108 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
2109 <dt> &lsquo;<samp>notindicated</samp>&rsquo;</dt>
2110 <dd><p>Not Indicated (default)
2111 </p></dd>
2112 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
2113 <dt> &lsquo;<samp>off</samp>&rsquo;</dt>
2114 <dd><p>Not Dolby Surround Encoded
2115 </p></dd>
2116 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
2117 <dt> &lsquo;<samp>on</samp>&rsquo;</dt>
2118 <dd><p>Dolby Surround Encoded
2119 </p></dd>
2120 </dl>
2121
2122 </dd>
2123 <dt> &lsquo;<samp>-original <var>boolean</var></samp>&rsquo;</dt>
2124 <dd><p>Original Bit Stream Indicator. Specifies whether this audio is from the
2125 original source and not a copy.
2126 </p><dl compact="compact">
2127 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
2128 <dt> &lsquo;<samp>off</samp>&rsquo;</dt>
2129 <dd><p>Not Original Source
2130 </p></dd>
2131 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
2132 <dt> &lsquo;<samp>on</samp>&rsquo;</dt>
2133 <dd><p>Original Source (default)
2134 </p></dd>
2135 </dl>
2136
2137 </dd>
2138 </dl>
2139
2140 <a name="Extended-Bitstream-Information"></a>
2141 <h3 class="subsection"><a href="ffmpeg.html#toc-Extended-Bitstream-Information">10.1.2 Extended Bitstream Information</a></h3>
2142 <p>The extended bitstream options are part of the Alternate Bit Stream Syntax as
2143 specified in Annex D of the A/52:2010 standard. It is grouped into 2 parts.
2144 If any one parameter in a group is specified, all values in that group will be
2145 written to the bitstream.  Default values are used for those that are written
2146 but have not been specified.  If the mixing levels are written, the decoder
2147 will use these values instead of the ones specified in the <code>center_mixlev</code>
2148 and <code>surround_mixlev</code> options if it supports the Alternate Bit Stream
2149 Syntax.
2150 </p>
2151 <a name="Extended-Bitstream-Information-_002d-Part-1"></a>
2152 <h4 class="subsubsection"><a href="ffmpeg.html#toc-Extended-Bitstream-Information-_002d-Part-1">10.1.2.1 Extended Bitstream Information - Part 1</a></h4>
2153
2154 <dl compact="compact">
2155 <dt> &lsquo;<samp>-dmix_mode <var>mode</var></samp>&rsquo;</dt>
2156 <dd><p>Preferred Stereo Downmix Mode. Allows the user to select either Lt/Rt
2157 (Dolby Surround) or Lo/Ro (normal stereo) as the preferred stereo downmix mode.
2158 </p><dl compact="compact">
2159 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
2160 <dt> &lsquo;<samp>notindicated</samp>&rsquo;</dt>
2161 <dd><p>Not Indicated (default)
2162 </p></dd>
2163 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
2164 <dt> &lsquo;<samp>ltrt</samp>&rsquo;</dt>
2165 <dd><p>Lt/Rt Downmix Preferred
2166 </p></dd>
2167 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
2168 <dt> &lsquo;<samp>loro</samp>&rsquo;</dt>
2169 <dd><p>Lo/Ro Downmix Preferred
2170 </p></dd>
2171 </dl>
2172
2173 </dd>
2174 <dt> &lsquo;<samp>-ltrt_cmixlev <var>level</var></samp>&rsquo;</dt>
2175 <dd><p>Lt/Rt Center Mix Level. The amount of gain the decoder should apply to the
2176 center channel when downmixing to stereo in Lt/Rt mode.
2177 </p><dl compact="compact">
2178 <dt> &lsquo;<samp>1.414</samp>&rsquo;</dt>
2179 <dd><p>Apply +3dB gain
2180 </p></dd>
2181 <dt> &lsquo;<samp>1.189</samp>&rsquo;</dt>
2182 <dd><p>Apply +1.5dB gain
2183 </p></dd>
2184 <dt> &lsquo;<samp>1.000</samp>&rsquo;</dt>
2185 <dd><p>Apply 0dB gain
2186 </p></dd>
2187 <dt> &lsquo;<samp>0.841</samp>&rsquo;</dt>
2188 <dd><p>Apply -1.5dB gain
2189 </p></dd>
2190 <dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
2191 <dd><p>Apply -3.0dB gain
2192 </p></dd>
2193 <dt> &lsquo;<samp>0.595</samp>&rsquo;</dt>
2194 <dd><p>Apply -4.5dB gain (default)
2195 </p></dd>
2196 <dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
2197 <dd><p>Apply -6.0dB gain
2198 </p></dd>
2199 <dt> &lsquo;<samp>0.000</samp>&rsquo;</dt>
2200 <dd><p>Silence Center Channel
2201 </p></dd>
2202 </dl>
2203
2204 </dd>
2205 <dt> &lsquo;<samp>-ltrt_surmixlev <var>level</var></samp>&rsquo;</dt>
2206 <dd><p>Lt/Rt Surround Mix Level. The amount of gain the decoder should apply to the
2207 surround channel(s) when downmixing to stereo in Lt/Rt mode.
2208 </p><dl compact="compact">
2209 <dt> &lsquo;<samp>0.841</samp>&rsquo;</dt>
2210 <dd><p>Apply -1.5dB gain
2211 </p></dd>
2212 <dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
2213 <dd><p>Apply -3.0dB gain
2214 </p></dd>
2215 <dt> &lsquo;<samp>0.595</samp>&rsquo;</dt>
2216 <dd><p>Apply -4.5dB gain
2217 </p></dd>
2218 <dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
2219 <dd><p>Apply -6.0dB gain (default)
2220 </p></dd>
2221 <dt> &lsquo;<samp>0.000</samp>&rsquo;</dt>
2222 <dd><p>Silence Surround Channel(s)
2223 </p></dd>
2224 </dl>
2225
2226 </dd>
2227 <dt> &lsquo;<samp>-loro_cmixlev <var>level</var></samp>&rsquo;</dt>
2228 <dd><p>Lo/Ro Center Mix Level. The amount of gain the decoder should apply to the
2229 center channel when downmixing to stereo in Lo/Ro mode.
2230 </p><dl compact="compact">
2231 <dt> &lsquo;<samp>1.414</samp>&rsquo;</dt>
2232 <dd><p>Apply +3dB gain
2233 </p></dd>
2234 <dt> &lsquo;<samp>1.189</samp>&rsquo;</dt>
2235 <dd><p>Apply +1.5dB gain
2236 </p></dd>
2237 <dt> &lsquo;<samp>1.000</samp>&rsquo;</dt>
2238 <dd><p>Apply 0dB gain
2239 </p></dd>
2240 <dt> &lsquo;<samp>0.841</samp>&rsquo;</dt>
2241 <dd><p>Apply -1.5dB gain
2242 </p></dd>
2243 <dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
2244 <dd><p>Apply -3.0dB gain
2245 </p></dd>
2246 <dt> &lsquo;<samp>0.595</samp>&rsquo;</dt>
2247 <dd><p>Apply -4.5dB gain (default)
2248 </p></dd>
2249 <dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
2250 <dd><p>Apply -6.0dB gain
2251 </p></dd>
2252 <dt> &lsquo;<samp>0.000</samp>&rsquo;</dt>
2253 <dd><p>Silence Center Channel
2254 </p></dd>
2255 </dl>
2256
2257 </dd>
2258 <dt> &lsquo;<samp>-loro_surmixlev <var>level</var></samp>&rsquo;</dt>
2259 <dd><p>Lo/Ro Surround Mix Level. The amount of gain the decoder should apply to the
2260 surround channel(s) when downmixing to stereo in Lo/Ro mode.
2261 </p><dl compact="compact">
2262 <dt> &lsquo;<samp>0.841</samp>&rsquo;</dt>
2263 <dd><p>Apply -1.5dB gain
2264 </p></dd>
2265 <dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
2266 <dd><p>Apply -3.0dB gain
2267 </p></dd>
2268 <dt> &lsquo;<samp>0.595</samp>&rsquo;</dt>
2269 <dd><p>Apply -4.5dB gain
2270 </p></dd>
2271 <dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
2272 <dd><p>Apply -6.0dB gain (default)
2273 </p></dd>
2274 <dt> &lsquo;<samp>0.000</samp>&rsquo;</dt>
2275 <dd><p>Silence Surround Channel(s)
2276 </p></dd>
2277 </dl>
2278
2279 </dd>
2280 </dl>
2281
2282 <a name="Extended-Bitstream-Information-_002d-Part-2"></a>
2283 <h4 class="subsubsection"><a href="ffmpeg.html#toc-Extended-Bitstream-Information-_002d-Part-2">10.1.2.2 Extended Bitstream Information - Part 2</a></h4>
2284
2285 <dl compact="compact">
2286 <dt> &lsquo;<samp>-dsurex_mode <var>mode</var></samp>&rsquo;</dt>
2287 <dd><p>Dolby Surround EX Mode. Indicates whether the stream uses Dolby Surround EX
2288 (7.1 matrixed to 5.1). Using this option does <b>NOT</b> mean the encoder will actually
2289 apply Dolby Surround EX processing.
2290 </p><dl compact="compact">
2291 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
2292 <dt> &lsquo;<samp>notindicated</samp>&rsquo;</dt>
2293 <dd><p>Not Indicated (default)
2294 </p></dd>
2295 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
2296 <dt> &lsquo;<samp>on</samp>&rsquo;</dt>
2297 <dd><p>Dolby Surround EX On
2298 </p></dd>
2299 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
2300 <dt> &lsquo;<samp>off</samp>&rsquo;</dt>
2301 <dd><p>Dolby Surround EX Off
2302 </p></dd>
2303 </dl>
2304
2305 </dd>
2306 <dt> &lsquo;<samp>-dheadphone_mode <var>mode</var></samp>&rsquo;</dt>
2307 <dd><p>Dolby Headphone Mode. Indicates whether the stream uses Dolby Headphone
2308 encoding (multi-channel matrixed to 2.0 for use with headphones). Using this
2309 option does <b>NOT</b> mean the encoder will actually apply Dolby Headphone
2310 processing.
2311 </p><dl compact="compact">
2312 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
2313 <dt> &lsquo;<samp>notindicated</samp>&rsquo;</dt>
2314 <dd><p>Not Indicated (default)
2315 </p></dd>
2316 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
2317 <dt> &lsquo;<samp>on</samp>&rsquo;</dt>
2318 <dd><p>Dolby Headphone On
2319 </p></dd>
2320 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
2321 <dt> &lsquo;<samp>off</samp>&rsquo;</dt>
2322 <dd><p>Dolby Headphone Off
2323 </p></dd>
2324 </dl>
2325
2326 </dd>
2327 <dt> &lsquo;<samp>-ad_conv_type <var>type</var></samp>&rsquo;</dt>
2328 <dd><p>A/D Converter Type. Indicates whether the audio has passed through HDCD A/D
2329 conversion.
2330 </p><dl compact="compact">
2331 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
2332 <dt> &lsquo;<samp>standard</samp>&rsquo;</dt>
2333 <dd><p>Standard A/D Converter (default)
2334 </p></dd>
2335 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
2336 <dt> &lsquo;<samp>hdcd</samp>&rsquo;</dt>
2337 <dd><p>HDCD A/D Converter
2338 </p></dd>
2339 </dl>
2340
2341 </dd>
2342 </dl>
2343
2344 <a name="Other-AC_002d3-Encoding-Options"></a>
2345 <h3 class="subsection"><a href="ffmpeg.html#toc-Other-AC_002d3-Encoding-Options">10.1.3 Other AC-3 Encoding Options</a></h3>
2346
2347 <dl compact="compact">
2348 <dt> &lsquo;<samp>-stereo_rematrixing <var>boolean</var></samp>&rsquo;</dt>
2349 <dd><p>Stereo Rematrixing. Enables/Disables use of rematrixing for stereo input. This
2350 is an optional AC-3 feature that increases quality by selectively encoding
2351 the left/right channels as mid/side. This option is enabled by default, and it
2352 is highly recommended that it be left as enabled except for testing purposes.
2353 </p>
2354 </dd>
2355 </dl>
2356
2357 <a name="Floating_002dPoint_002dOnly-AC_002d3-Encoding-Options"></a>
2358 <h3 class="subsection"><a href="ffmpeg.html#toc-Floating_002dPoint_002dOnly-AC_002d3-Encoding-Options">10.1.4 Floating-Point-Only AC-3 Encoding Options</a></h3>
2359
2360 <p>These options are only valid for the floating-point encoder and do not exist
2361 for the fixed-point encoder due to the corresponding features not being
2362 implemented in fixed-point.
2363 </p>
2364 <dl compact="compact">
2365 <dt> &lsquo;<samp>-channel_coupling <var>boolean</var></samp>&rsquo;</dt>
2366 <dd><p>Enables/Disables use of channel coupling, which is an optional AC-3 feature
2367 that increases quality by combining high frequency information from multiple
2368 channels into a single channel. The per-channel high frequency information is
2369 sent with less accuracy in both the frequency and time domains. This allows
2370 more bits to be used for lower frequencies while preserving enough information
2371 to reconstruct the high frequencies. This option is enabled by default for the
2372 floating-point encoder and should generally be left as enabled except for
2373 testing purposes or to increase encoding speed.
2374 </p><dl compact="compact">
2375 <dt> &lsquo;<samp>-1</samp>&rsquo;</dt>
2376 <dt> &lsquo;<samp>auto</samp>&rsquo;</dt>
2377 <dd><p>Selected by Encoder (default)
2378 </p></dd>
2379 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
2380 <dt> &lsquo;<samp>off</samp>&rsquo;</dt>
2381 <dd><p>Disable Channel Coupling
2382 </p></dd>
2383 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
2384 <dt> &lsquo;<samp>on</samp>&rsquo;</dt>
2385 <dd><p>Enable Channel Coupling
2386 </p></dd>
2387 </dl>
2388
2389 </dd>
2390 <dt> &lsquo;<samp>-cpl_start_band <var>number</var></samp>&rsquo;</dt>
2391 <dd><p>Coupling Start Band. Sets the channel coupling start band, from 1 to 15. If a
2392 value higher than the bandwidth is used, it will be reduced to 1 less than the
2393 coupling end band. If <var>auto</var> is used, the start band will be determined by
2394 the encoder based on the bit rate, sample rate, and channel layout. This option
2395 has no effect if channel coupling is disabled.
2396 </p><dl compact="compact">
2397 <dt> &lsquo;<samp>-1</samp>&rsquo;</dt>
2398 <dt> &lsquo;<samp>auto</samp>&rsquo;</dt>
2399 <dd><p>Selected by Encoder (default)
2400 </p></dd>
2401 </dl>
2402
2403 </dd>
2404 </dl>
2405
2406
2407 <a name="Video-Encoders"></a>
2408 <h1 class="chapter"><a href="ffmpeg.html#toc-Video-Encoders">11. Video Encoders</a></h1>
2409
2410 <p>A description of some of the currently available video encoders
2411 follows.
2412 </p>
2413 <a name="libvpx"></a>
2414 <h2 class="section"><a href="ffmpeg.html#toc-libvpx">11.1 libvpx</a></h2>
2415
2416 <p>VP8 format supported through libvpx.
2417 </p>
2418 <p>Requires the presence of the libvpx headers and library during configuration.
2419 You need to explicitly configure the build with <code>--enable-libvpx</code>.
2420 </p>
2421 <a name="Options-4"></a>
2422 <h3 class="subsection"><a href="ffmpeg.html#toc-Options-4">11.1.1 Options</a></h3>
2423
2424 <p>Mapping from FFmpeg to libvpx options with conversion notes in parentheses.
2425 </p>
2426 <dl compact="compact">
2427 <dt> &lsquo;<samp>threads</samp>&rsquo;</dt>
2428 <dd><p>g_threads
2429 </p>
2430 </dd>
2431 <dt> &lsquo;<samp>profile</samp>&rsquo;</dt>
2432 <dd><p>g_profile
2433 </p>
2434 </dd>
2435 <dt> &lsquo;<samp>vb</samp>&rsquo;</dt>
2436 <dd><p>rc_target_bitrate
2437 </p>
2438 </dd>
2439 <dt> &lsquo;<samp>g</samp>&rsquo;</dt>
2440 <dd><p>kf_max_dist
2441 </p>
2442 </dd>
2443 <dt> &lsquo;<samp>keyint_min</samp>&rsquo;</dt>
2444 <dd><p>kf_min_dist
2445 </p>
2446 </dd>
2447 <dt> &lsquo;<samp>qmin</samp>&rsquo;</dt>
2448 <dd><p>rc_min_quantizer
2449 </p>
2450 </dd>
2451 <dt> &lsquo;<samp>qmax</samp>&rsquo;</dt>
2452 <dd><p>rc_max_quantizer
2453 </p>
2454 </dd>
2455 <dt> &lsquo;<samp>bufsize, vb</samp>&rsquo;</dt>
2456 <dd><p>rc_buf_sz
2457 <code>(bufsize * 1000 / vb)</code>
2458 </p>
2459 <p>rc_buf_optimal_sz
2460 <code>(bufsize * 1000 / vb * 5 / 6)</code>
2461 </p>
2462 </dd>
2463 <dt> &lsquo;<samp>rc_init_occupancy, vb</samp>&rsquo;</dt>
2464 <dd><p>rc_buf_initial_sz
2465 <code>(rc_init_occupancy * 1000 / vb)</code>
2466 </p>
2467 </dd>
2468 <dt> &lsquo;<samp>rc_buffer_aggressivity</samp>&rsquo;</dt>
2469 <dd><p>rc_undershoot_pct
2470 </p>
2471 </dd>
2472 <dt> &lsquo;<samp>skip_threshold</samp>&rsquo;</dt>
2473 <dd><p>rc_dropframe_thresh
2474 </p>
2475 </dd>
2476 <dt> &lsquo;<samp>qcomp</samp>&rsquo;</dt>
2477 <dd><p>rc_2pass_vbr_bias_pct
2478 </p>
2479 </dd>
2480 <dt> &lsquo;<samp>maxrate, vb</samp>&rsquo;</dt>
2481 <dd><p>rc_2pass_vbr_maxsection_pct
2482 <code>(maxrate * 100 / vb)</code>
2483 </p>
2484 </dd>
2485 <dt> &lsquo;<samp>minrate, vb</samp>&rsquo;</dt>
2486 <dd><p>rc_2pass_vbr_minsection_pct
2487 <code>(minrate * 100 / vb)</code>
2488 </p>
2489 </dd>
2490 <dt> &lsquo;<samp>minrate, maxrate, vb</samp>&rsquo;</dt>
2491 <dd><p><code>VPX_CBR</code>
2492 <code>(minrate == maxrate == vb)</code>
2493 </p>
2494 </dd>
2495 <dt> &lsquo;<samp>crf</samp>&rsquo;</dt>
2496 <dd><p><code>VPX_CQ</code>, <code>VP8E_SET_CQ_LEVEL</code>
2497 </p>
2498 </dd>
2499 <dt> &lsquo;<samp>quality</samp>&rsquo;</dt>
2500 <dd><dl compact="compact">
2501 <dt> &lsquo;<samp><var>best</var></samp>&rsquo;</dt>
2502 <dd><p><code>VPX_DL_BEST_QUALITY</code>
2503 </p></dd>
2504 <dt> &lsquo;<samp><var>good</var></samp>&rsquo;</dt>
2505 <dd><p><code>VPX_DL_GOOD_QUALITY</code>
2506 </p></dd>
2507 <dt> &lsquo;<samp><var>realtime</var></samp>&rsquo;</dt>
2508 <dd><p><code>VPX_DL_REALTIME</code>
2509 </p></dd>
2510 </dl>
2511
2512 </dd>
2513 <dt> &lsquo;<samp>speed</samp>&rsquo;</dt>
2514 <dd><p><code>VP8E_SET_CPUUSED</code>
2515 </p>
2516 </dd>
2517 <dt> &lsquo;<samp>nr</samp>&rsquo;</dt>
2518 <dd><p><code>VP8E_SET_NOISE_SENSITIVITY</code>
2519 </p>
2520 </dd>
2521 <dt> &lsquo;<samp>mb_threshold</samp>&rsquo;</dt>
2522 <dd><p><code>VP8E_SET_STATIC_THRESHOLD</code>
2523 </p>
2524 </dd>
2525 <dt> &lsquo;<samp>slices</samp>&rsquo;</dt>
2526 <dd><p><code>VP8E_SET_TOKEN_PARTITIONS</code>
2527 </p>
2528 </dd>
2529 <dt> &lsquo;<samp>Alternate reference frame related</samp>&rsquo;</dt>
2530 <dd><dl compact="compact">
2531 <dt> &lsquo;<samp>vp8flags altref</samp>&rsquo;</dt>
2532 <dd><p><code>VP8E_SET_ENABLEAUTOALTREF</code>
2533 </p></dd>
2534 <dt> &lsquo;<samp><var>arnr_max_frames</var></samp>&rsquo;</dt>
2535 <dd><p><code>VP8E_SET_ARNR_MAXFRAMES</code>
2536 </p></dd>
2537 <dt> &lsquo;<samp><var>arnr_type</var></samp>&rsquo;</dt>
2538 <dd><p><code>VP8E_SET_ARNR_TYPE</code>
2539 </p></dd>
2540 <dt> &lsquo;<samp><var>arnr_strength</var></samp>&rsquo;</dt>
2541 <dd><p><code>VP8E_SET_ARNR_STRENGTH</code>
2542 </p></dd>
2543 <dt> &lsquo;<samp><var>rc_lookahead</var></samp>&rsquo;</dt>
2544 <dd><p>g_lag_in_frames
2545 </p></dd>
2546 </dl>
2547
2548 </dd>
2549 <dt> &lsquo;<samp>vp8flags error_resilient</samp>&rsquo;</dt>
2550 <dd><p>g_error_resilient
2551 </p>
2552 </dd>
2553 </dl>
2554
2555 <p>For more information about libvpx see:
2556 <a href="http://www.webmproject.org/">http://www.webmproject.org/</a>
2557 </p>
2558 <a name="libx264"></a>
2559 <h2 class="section"><a href="ffmpeg.html#toc-libx264">11.2 libx264</a></h2>
2560
2561 <p>H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 format supported through
2562 libx264.
2563 </p>
2564 <p>Requires the presence of the libx264 headers and library during
2565 configuration. You need to explicitly configure the build with
2566 <code>--enable-libx264</code>.
2567 </p>
2568 <a name="Options-5"></a>
2569 <h3 class="subsection"><a href="ffmpeg.html#toc-Options-5">11.2.1 Options</a></h3>
2570
2571 <dl compact="compact">
2572 <dt> &lsquo;<samp>preset <var>preset_name</var></samp>&rsquo;</dt>
2573 <dd><p>Set the encoding preset.
2574 </p>
2575 </dd>
2576 <dt> &lsquo;<samp>tune <var>tune_name</var></samp>&rsquo;</dt>
2577 <dd><p>Tune the encoding params.
2578 Deprecated in favor of <var>x264_opts</var>
2579 </p>
2580 </dd>
2581 <dt> &lsquo;<samp>fastfirstpass <var>bool</var></samp>&rsquo;</dt>
2582 <dd><p>Use fast settings when encoding first pass, default value is 1.
2583 Deprecated in favor of <var>x264_opts</var>.
2584 </p>
2585 </dd>
2586 <dt> &lsquo;<samp>profile <var>profile_name</var></samp>&rsquo;</dt>
2587 <dd><p>Set profile restrictions.
2588 Deprecated in favor of <var>x264_opts</var>.
2589 </p>
2590 </dd>
2591 <dt> &lsquo;<samp>level <var>level</var></samp>&rsquo;</dt>
2592 <dd><p>Specify level (as defined by Annex A).
2593 Deprecated in favor of <var>x264_opts</var>.
2594 </p>
2595 </dd>
2596 <dt> &lsquo;<samp>passlogfile <var>filename</var></samp>&rsquo;</dt>
2597 <dd><p>Specify filename for 2 pass stats.
2598 Deprecated in favor of <var>x264_opts</var>.
2599 </p>
2600 </dd>
2601 <dt> &lsquo;<samp>wpredp <var>wpred_type</var></samp>&rsquo;</dt>
2602 <dd><p>Specify Weighted prediction for P-frames.
2603 Deprecated in favor of <var>x264_opts</var>.
2604 </p>
2605 </dd>
2606 <dt> &lsquo;<samp>x264opts <var>options</var></samp>&rsquo;</dt>
2607 <dd><p>Allow to set any x264 option, see x264 manual for a list.
2608 </p>
2609 <p><var>options</var> is a list of <var>key</var>=<var>value</var> couples separated by
2610 &quot;:&quot;.
2611 </p></dd>
2612 </dl>
2613
2614 <p>For example to specify libx264 encoding options with &lsquo;<tt>ffmpeg</tt>&rsquo;:
2615 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv
2616 </pre></td></tr></table>
2617
2618 <p>For more information about libx264 and the supported options see:
2619 <a href="http://www.videolan.org/developers/x264.html">http://www.videolan.org/developers/x264.html</a>
2620 </p>
2621 <a name="Demuxers"></a>
2622 <h1 class="chapter"><a href="ffmpeg.html#toc-Demuxers">12. Demuxers</a></h1>
2623
2624 <p>Demuxers are configured elements in FFmpeg which allow to read the
2625 multimedia streams from a particular type of file.
2626 </p>
2627 <p>When you configure your FFmpeg build, all the supported demuxers
2628 are enabled by default. You can list all available ones using the
2629 configure option &quot;&ndash;list-demuxers&quot;.
2630 </p>
2631 <p>You can disable all the demuxers using the configure option
2632 &quot;&ndash;disable-demuxers&quot;, and selectively enable a single demuxer with
2633 the option &quot;&ndash;enable-demuxer=<var>DEMUXER</var>&quot;, or disable it
2634 with the option &quot;&ndash;disable-demuxer=<var>DEMUXER</var>&quot;.
2635 </p>
2636 <p>The option &quot;-formats&quot; of the ff* tools will display the list of
2637 enabled demuxers.
2638 </p>
2639 <p>The description of some of the currently available demuxers follows.
2640 </p>
2641 <a name="image2"></a>
2642 <h2 class="section"><a href="ffmpeg.html#toc-image2">12.1 image2</a></h2>
2643
2644 <p>Image file demuxer.
2645 </p>
2646 <p>This demuxer reads from a list of image files specified by a pattern.
2647 </p>
2648 <p>The pattern may contain the string &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, which
2649 specifies the position of the characters representing a sequential
2650 number in each filename matched by the pattern. If the form
2651 &quot;%d0<var>N</var>d&quot; is used, the string representing the number in each
2652 filename is 0-padded and <var>N</var> is the total number of 0-padded
2653 digits representing the number. The literal character &rsquo;%&rsquo; can be
2654 specified in the pattern with the string &quot;%%&quot;.
2655 </p>
2656 <p>If the pattern contains &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, the first filename of
2657 the file list specified by the pattern must contain a number
2658 inclusively contained between 0 and 4, all the following numbers must
2659 be sequential. This limitation may be hopefully fixed.
2660 </p>
2661 <p>The pattern may contain a suffix which is used to automatically
2662 determine the format of the images contained in the files.
2663 </p>
2664 <p>For example the pattern &quot;img-%03d.bmp&quot; will match a sequence of
2665 filenames of the form &lsquo;<tt>img-001.bmp</tt>&rsquo;, &lsquo;<tt>img-002.bmp</tt>&rsquo;, ...,
2666 &lsquo;<tt>img-010.bmp</tt>&rsquo;, etc.; the pattern &quot;i%%m%%g-%d.jpg&quot; will match a
2667 sequence of filenames of the form &lsquo;<tt>i%m%g-1.jpg</tt>&rsquo;,
2668 &lsquo;<tt>i%m%g-2.jpg</tt>&rsquo;, ..., &lsquo;<tt>i%m%g-10.jpg</tt>&rsquo;, etc.
2669 </p>
2670 <p>The size, the pixel format, and the format of each image must be the
2671 same for all the files in the sequence.
2672 </p>
2673 <p>The following example shows how to use &lsquo;<tt>ffmpeg</tt>&rsquo; for creating a
2674 video from the images in the file sequence &lsquo;<tt>img-001.jpeg</tt>&rsquo;,
2675 &lsquo;<tt>img-002.jpeg</tt>&rsquo;, ..., assuming an input framerate of 10 frames per
2676 second:
2677 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -r 10 -f image2 -i 'img-%03d.jpeg' out.avi
2678 </pre></td></tr></table>
2679
2680 <p>Note that the pattern must not necessarily contain &quot;%d&quot; or
2681 &quot;%0<var>N</var>d&quot;, for example to convert a single image file
2682 &lsquo;<tt>img.jpeg</tt>&rsquo; you can employ the command:
2683 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f image2 -i img.jpeg img.png
2684 </pre></td></tr></table>
2685
2686 <a name="applehttp-1"></a>
2687 <h2 class="section"><a href="ffmpeg.html#toc-applehttp-1">12.2 applehttp</a></h2>
2688
2689 <p>Apple HTTP Live Streaming demuxer.
2690 </p>
2691 <p>This demuxer presents all AVStreams from all variant streams.
2692 The id field is set to the bitrate variant index number. By setting
2693 the discard flags on AVStreams (by pressing &rsquo;a&rsquo; or &rsquo;v&rsquo; in ffplay),
2694 the caller can decide which variant streams to actually receive.
2695 The total bitrate of the variant that the stream belongs to is
2696 available in a metadata key named &quot;variant_bitrate&quot;.
2697 </p>
2698 <a name="Muxers"></a>
2699 <h1 class="chapter"><a href="ffmpeg.html#toc-Muxers">13. Muxers</a></h1>
2700
2701 <p>Muxers are configured elements in FFmpeg which allow writing
2702 multimedia streams to a particular type of file.
2703 </p>
2704 <p>When you configure your FFmpeg build, all the supported muxers
2705 are enabled by default. You can list all available muxers using the
2706 configure option <code>--list-muxers</code>.
2707 </p>
2708 <p>You can disable all the muxers with the configure option
2709 <code>--disable-muxers</code> and selectively enable / disable single muxers
2710 with the options <code>--enable-muxer=<var>MUXER</var></code> /
2711 <code>--disable-muxer=<var>MUXER</var></code>.
2712 </p>
2713 <p>The option <code>-formats</code> of the ff* tools will display the list of
2714 enabled muxers.
2715 </p>
2716 <p>A description of some of the currently available muxers follows.
2717 </p>
2718 <p><a name="crc"></a>
2719 </p><a name="crc-1"></a>
2720 <h2 class="section"><a href="ffmpeg.html#toc-crc-1">13.1 crc</a></h2>
2721
2722 <p>CRC (Cyclic Redundancy Check) testing format.
2723 </p>
2724 <p>This muxer computes and prints the Adler-32 CRC of all the input audio
2725 and video frames. By default audio frames are converted to signed
2726 16-bit raw audio and video frames to raw video before computing the
2727 CRC.
2728 </p>
2729 <p>The output of the muxer consists of a single line of the form:
2730 CRC=0x<var>CRC</var>, where <var>CRC</var> is a hexadecimal number 0-padded to
2731 8 digits containing the CRC for all the decoded input frames.
2732 </p>
2733 <p>For example to compute the CRC of the input, and store it in the file
2734 &lsquo;<tt>out.crc</tt>&rsquo;:
2735 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f crc out.crc
2736 </pre></td></tr></table>
2737
2738 <p>You can print the CRC to stdout with the command:
2739 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f crc -
2740 </pre></td></tr></table>
2741
2742 <p>You can select the output format of each frame with &lsquo;<tt>ffmpeg</tt>&rsquo; by
2743 specifying the audio and video codec and format. For example to
2744 compute the CRC of the input audio converted to PCM unsigned 8-bit
2745 and the input video converted to MPEG-2 video, use the command:
2746 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -acodec pcm_u8 -vcodec mpeg2video -f crc -
2747 </pre></td></tr></table>
2748
2749 <p>See also the <a href="#framecrc">framecrc</a> muxer.
2750 </p>
2751 <p><a name="framecrc"></a>
2752 </p><a name="framecrc-1"></a>
2753 <h2 class="section"><a href="ffmpeg.html#toc-framecrc-1">13.2 framecrc</a></h2>
2754
2755 <p>Per-frame CRC (Cyclic Redundancy Check) testing format.
2756 </p>
2757 <p>This muxer computes and prints the Adler-32 CRC for each decoded audio
2758 and video frame. By default audio frames are converted to signed
2759 16-bit raw audio and video frames to raw video before computing the
2760 CRC.
2761 </p>
2762 <p>The output of the muxer consists of a line for each audio and video
2763 frame of the form: <var>stream_index</var>, <var>frame_dts</var>,
2764 <var>frame_size</var>, 0x<var>CRC</var>, where <var>CRC</var> is a hexadecimal
2765 number 0-padded to 8 digits containing the CRC of the decoded frame.
2766 </p>
2767 <p>For example to compute the CRC of each decoded frame in the input, and
2768 store it in the file &lsquo;<tt>out.crc</tt>&rsquo;:
2769 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f framecrc out.crc
2770 </pre></td></tr></table>
2771
2772 <p>You can print the CRC of each decoded frame to stdout with the command:
2773 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f framecrc -
2774 </pre></td></tr></table>
2775
2776 <p>You can select the output format of each frame with &lsquo;<tt>ffmpeg</tt>&rsquo; by
2777 specifying the audio and video codec and format. For example, to
2778 compute the CRC of each decoded input audio frame converted to PCM
2779 unsigned 8-bit and of each decoded input video frame converted to
2780 MPEG-2 video, use the command:
2781 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -acodec pcm_u8 -vcodec mpeg2video -f framecrc -
2782 </pre></td></tr></table>
2783
2784 <p>See also the <a href="#crc">crc</a> muxer.
2785 </p>
2786 <a name="image2-1"></a>
2787 <h2 class="section"><a href="ffmpeg.html#toc-image2-1">13.3 image2</a></h2>
2788
2789 <p>Image file muxer.
2790 </p>
2791 <p>The image file muxer writes video frames to image files.
2792 </p>
2793 <p>The output filenames are specified by a pattern, which can be used to
2794 produce sequentially numbered series of files.
2795 The pattern may contain the string &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, this string
2796 specifies the position of the characters representing a numbering in
2797 the filenames. If the form &quot;%0<var>N</var>d&quot; is used, the string
2798 representing the number in each filename is 0-padded to <var>N</var>
2799 digits. The literal character &rsquo;%&rsquo; can be specified in the pattern with
2800 the string &quot;%%&quot;.
2801 </p>
2802 <p>If the pattern contains &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, the first filename of
2803 the file list specified will contain the number 1, all the following
2804 numbers will be sequential.
2805 </p>
2806 <p>The pattern may contain a suffix which is used to automatically
2807 determine the format of the image files to write.
2808 </p>
2809 <p>For example the pattern &quot;img-%03d.bmp&quot; will specify a sequence of
2810 filenames of the form &lsquo;<tt>img-001.bmp</tt>&rsquo;, &lsquo;<tt>img-002.bmp</tt>&rsquo;, ...,
2811 &lsquo;<tt>img-010.bmp</tt>&rsquo;, etc.
2812 The pattern &quot;img%%-%d.jpg&quot; will specify a sequence of filenames of the
2813 form &lsquo;<tt>img%-1.jpg</tt>&rsquo;, &lsquo;<tt>img%-2.jpg</tt>&rsquo;, ..., &lsquo;<tt>img%-10.jpg</tt>&rsquo;,
2814 etc.
2815 </p>
2816 <p>The following example shows how to use &lsquo;<tt>ffmpeg</tt>&rsquo; for creating a
2817 sequence of files &lsquo;<tt>img-001.jpeg</tt>&rsquo;, &lsquo;<tt>img-002.jpeg</tt>&rsquo;, ...,
2818 taking one image every second from the input video:
2819 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -r 1 -f image2 'img-%03d.jpeg'
2820 </pre></td></tr></table>
2821
2822 <p>Note that with &lsquo;<tt>ffmpeg</tt>&rsquo;, if the format is not specified with the
2823 <code>-f</code> option and the output filename specifies an image file
2824 format, the image2 muxer is automatically selected, so the previous
2825 command can be written as:
2826 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -r 1 'img-%03d.jpeg'
2827 </pre></td></tr></table>
2828
2829 <p>Note also that the pattern must not necessarily contain &quot;%d&quot; or
2830 &quot;%0<var>N</var>d&quot;, for example to create a single image file
2831 &lsquo;<tt>img.jpeg</tt>&rsquo; from the input video you can employ the command:
2832 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -f image2 -vframes 1 img.jpeg
2833 </pre></td></tr></table>
2834
2835 <p>The image muxer supports the .Y.U.V image file format. This format is
2836 special in that that each image frame consists of three files, for
2837 each of the YUV420P components. To read or write this image file format,
2838 specify the name of the &rsquo;.Y&rsquo; file. The muxer will automatically open the
2839 &rsquo;.U&rsquo; and &rsquo;.V&rsquo; files as required.
2840 </p>
2841 <a name="mpegts"></a>
2842 <h2 class="section"><a href="ffmpeg.html#toc-mpegts">13.4 mpegts</a></h2>
2843
2844 <p>MPEG transport stream muxer.
2845 </p>
2846 <p>This muxer implements ISO 13818-1 and part of ETSI EN 300 468.
2847 </p>
2848 <p>The muxer options are:
2849 </p>
2850 <dl compact="compact">
2851 <dt> &lsquo;<samp>-mpegts_original_network_id <var>number</var></samp>&rsquo;</dt>
2852 <dd><p>Set the original_network_id (default 0x0001). This is unique identifier
2853 of a network in DVB. Its main use is in the unique identification of a
2854 service through the path Original_Network_ID, Transport_Stream_ID.
2855 </p></dd>
2856 <dt> &lsquo;<samp>-mpegts_transport_stream_id <var>number</var></samp>&rsquo;</dt>
2857 <dd><p>Set the transport_stream_id (default 0x0001). This identifies a
2858 transponder in DVB.
2859 </p></dd>
2860 <dt> &lsquo;<samp>-mpegts_service_id <var>number</var></samp>&rsquo;</dt>
2861 <dd><p>Set the service_id (default 0x0001) also known as program in DVB.
2862 </p></dd>
2863 <dt> &lsquo;<samp>-mpegts_pmt_start_pid <var>number</var></samp>&rsquo;</dt>
2864 <dd><p>Set the first PID for PMT (default 0x1000, max 0x1f00).
2865 </p></dd>
2866 <dt> &lsquo;<samp>-mpegts_start_pid <var>number</var></samp>&rsquo;</dt>
2867 <dd><p>Set the first PID for data packets (default 0x0100, max 0x0f00).
2868 </p></dd>
2869 </dl>
2870
2871 <p>The recognized metadata settings in mpegts muxer are <code>service_provider</code>
2872 and <code>service_name</code>. If they are not set the default for
2873 <code>service_provider</code> is &quot;FFmpeg&quot; and the default for
2874 <code>service_name</code> is &quot;Service01&quot;.
2875 </p>
2876 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i file.mpg -acodec copy -vcodec copy \
2877      -mpegts_original_network_id 0x1122 \
2878      -mpegts_transport_stream_id 0x3344 \
2879      -mpegts_service_id 0x5566 \
2880      -mpegts_pmt_start_pid 0x1500 \
2881      -mpegts_start_pid 0x150 \
2882      -metadata service_provider=&quot;Some provider&quot; \
2883      -metadata service_name=&quot;Some Channel&quot; \
2884      -y out.ts
2885 </pre></td></tr></table>
2886
2887 <a name="null-1"></a>
2888 <h2 class="section"><a href="ffmpeg.html#toc-null-1">13.5 null</a></h2>
2889
2890 <p>Null muxer.
2891 </p>
2892 <p>This muxer does not generate any output file, it is mainly useful for
2893 testing or benchmarking purposes.
2894 </p>
2895 <p>For example to benchmark decoding with &lsquo;<tt>ffmpeg</tt>&rsquo; you can use the
2896 command:
2897 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -benchmark -i INPUT -f null out.null
2898 </pre></td></tr></table>
2899
2900 <p>Note that the above command does not read or write the &lsquo;<tt>out.null</tt>&rsquo;
2901 file, but specifying the output file is required by the &lsquo;<tt>ffmpeg</tt>&rsquo;
2902 syntax.
2903 </p>
2904 <p>Alternatively you can write the command as:
2905 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -benchmark -i INPUT -f null -
2906 </pre></td></tr></table>
2907
2908 <a name="matroska"></a>
2909 <h2 class="section"><a href="ffmpeg.html#toc-matroska">13.6 matroska</a></h2>
2910
2911 <p>Matroska container muxer.
2912 </p>
2913 <p>This muxer implements the matroska and webm container specs.
2914 </p>
2915 <p>The recognized metadata settings in this muxer are:
2916 </p>
2917 <dl compact="compact">
2918 <dt> &lsquo;<samp>title=<var>title name</var></samp>&rsquo;</dt>
2919 <dd><p>Name provided to a single track
2920 </p></dd>
2921 </dl>
2922
2923 <dl compact="compact">
2924 <dt> &lsquo;<samp>language=<var>language name</var></samp>&rsquo;</dt>
2925 <dd><p>Specifies the language of the track in the Matroska languages form
2926 </p></dd>
2927 </dl>
2928
2929 <dl compact="compact">
2930 <dt> &lsquo;<samp>stereo_mode=<var>mode</var></samp>&rsquo;</dt>
2931 <dd><p>Stereo 3D video layout of two views in a single video track
2932 </p><dl compact="compact">
2933 <dt> &lsquo;<samp>mono</samp>&rsquo;</dt>
2934 <dd><p>video is not stereo
2935 </p></dd>
2936 <dt> &lsquo;<samp>left_right</samp>&rsquo;</dt>
2937 <dd><p>Both views are arranged side by side, Left-eye view is on the left
2938 </p></dd>
2939 <dt> &lsquo;<samp>bottom_top</samp>&rsquo;</dt>
2940 <dd><p>Both views are arranged in top-bottom orientation, Left-eye view is at bottom
2941 </p></dd>
2942 <dt> &lsquo;<samp>top_bottom</samp>&rsquo;</dt>
2943 <dd><p>Both views are arranged in top-bottom orientation, Left-eye view is on top
2944 </p></dd>
2945 <dt> &lsquo;<samp>checkerboard_rl</samp>&rsquo;</dt>
2946 <dd><p>Each view is arranged in a checkerboard interleaved pattern, Left-eye view being first
2947 </p></dd>
2948 <dt> &lsquo;<samp>checkerboard_lr</samp>&rsquo;</dt>
2949 <dd><p>Each view is arranged in a checkerboard interleaved pattern, Right-eye view being first
2950 </p></dd>
2951 <dt> &lsquo;<samp>row_interleaved_rl</samp>&rsquo;</dt>
2952 <dd><p>Each view is constituted by a row based interleaving, Right-eye view is first row
2953 </p></dd>
2954 <dt> &lsquo;<samp>row_interleaved_lr</samp>&rsquo;</dt>
2955 <dd><p>Each view is constituted by a row based interleaving, Left-eye view is first row
2956 </p></dd>
2957 <dt> &lsquo;<samp>col_interleaved_rl</samp>&rsquo;</dt>
2958 <dd><p>Both views are arranged in a column based interleaving manner, Right-eye view is first column
2959 </p></dd>
2960 <dt> &lsquo;<samp>col_interleaved_lr</samp>&rsquo;</dt>
2961 <dd><p>Both views are arranged in a column based interleaving manner, Left-eye view is first column
2962 </p></dd>
2963 <dt> &lsquo;<samp>anaglyph_cyan_red</samp>&rsquo;</dt>
2964 <dd><p>All frames are in anaglyph format viewable through red-cyan filters
2965 </p></dd>
2966 <dt> &lsquo;<samp>right_left</samp>&rsquo;</dt>
2967 <dd><p>Both views are arranged side by side, Right-eye view is on the left
2968 </p></dd>
2969 <dt> &lsquo;<samp>anaglyph_green_magenta</samp>&rsquo;</dt>
2970 <dd><p>All frames are in anaglyph format viewable through green-magenta filters
2971 </p></dd>
2972 <dt> &lsquo;<samp>block_lr</samp>&rsquo;</dt>
2973 <dd><p>Both eyes laced in one Block, Left-eye view is first
2974 </p></dd>
2975 <dt> &lsquo;<samp>block_rl</samp>&rsquo;</dt>
2976 <dd><p>Both eyes laced in one Block, Right-eye view is first
2977 </p></dd>
2978 </dl>
2979 </dd>
2980 </dl>
2981
2982 <p>For example a 3D WebM clip can be created using the following command line:
2983 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i sample_left_right_clip.mpg -an -vcodec libvpx -metadata stereo_mode=left_right -y stereo_clip.webm
2984 </pre></td></tr></table>
2985
2986 <a name="Input-Devices"></a>
2987 <h1 class="chapter"><a href="ffmpeg.html#toc-Input-Devices">14. Input Devices</a></h1>
2988
2989 <p>Input devices are configured elements in FFmpeg which allow to access
2990 the data coming from a multimedia device attached to your system.
2991 </p>
2992 <p>When you configure your FFmpeg build, all the supported input devices
2993 are enabled by default. You can list all available ones using the
2994 configure option &quot;&ndash;list-indevs&quot;.
2995 </p>
2996 <p>You can disable all the input devices using the configure option
2997 &quot;&ndash;disable-indevs&quot;, and selectively enable an input device using the
2998 option &quot;&ndash;enable-indev=<var>INDEV</var>&quot;, or you can disable a particular
2999 input device using the option &quot;&ndash;disable-indev=<var>INDEV</var>&quot;.
3000 </p>
3001 <p>The option &quot;-formats&quot; of the ff* tools will display the list of
3002 supported input devices (amongst the demuxers).
3003 </p>
3004 <p>A description of the currently available input devices follows.
3005 </p>
3006 <a name="alsa-1"></a>
3007 <h2 class="section"><a href="ffmpeg.html#toc-alsa-1">14.1 alsa</a></h2>
3008
3009 <p>ALSA (Advanced Linux Sound Architecture) input device.
3010 </p>
3011 <p>To enable this input device during configuration you need libasound
3012 installed on your system.
3013 </p>
3014 <p>This device allows capturing from an ALSA device. The name of the
3015 device to capture has to be an ALSA card identifier.
3016 </p>
3017 <p>An ALSA identifier has the syntax:
3018 </p><table><tr><td>&nbsp;</td><td><pre class="example">hw:<var>CARD</var>[,<var>DEV</var>[,<var>SUBDEV</var>]]
3019 </pre></td></tr></table>
3020
3021 <p>where the <var>DEV</var> and <var>SUBDEV</var> components are optional.
3022 </p>
3023 <p>The three arguments (in order: <var>CARD</var>,<var>DEV</var>,<var>SUBDEV</var>)
3024 specify card number or identifier, device number and subdevice number
3025 (-1 means any).
3026 </p>
3027 <p>To see the list of cards currently recognized by your system check the
3028 files &lsquo;<tt>/proc/asound/cards</tt>&rsquo; and &lsquo;<tt>/proc/asound/devices</tt>&rsquo;.
3029 </p>
3030 <p>For example to capture with &lsquo;<tt>ffmpeg</tt>&rsquo; from an ALSA device with
3031 card id 0, you may run the command:
3032 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f alsa -i hw:0 alsaout.wav
3033 </pre></td></tr></table>
3034
3035 <p>For more information see:
3036 <a href="http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html">http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html</a>
3037 </p>
3038 <a name="bktr"></a>
3039 <h2 class="section"><a href="ffmpeg.html#toc-bktr">14.2 bktr</a></h2>
3040
3041 <p>BSD video input device.
3042 </p>
3043 <a name="dv1394"></a>
3044 <h2 class="section"><a href="ffmpeg.html#toc-dv1394">14.3 dv1394</a></h2>
3045
3046 <p>Linux DV 1394 input device.
3047 </p>
3048 <a name="fbdev"></a>
3049 <h2 class="section"><a href="ffmpeg.html#toc-fbdev">14.4 fbdev</a></h2>
3050
3051 <p>Linux framebuffer input device.
3052 </p>
3053 <p>The Linux framebuffer is a graphic hardware-independent abstraction
3054 layer to show graphics on a computer monitor, typically on the
3055 console. It is accessed through a file device node, usually
3056 &lsquo;<tt>/dev/fb0</tt>&rsquo;.
3057 </p>
3058 <p>For more detailed information read the file
3059 Documentation/fb/framebuffer.txt included in the Linux source tree.
3060 </p>
3061 <p>To record from the framebuffer device &lsquo;<tt>/dev/fb0</tt>&rsquo; with
3062 &lsquo;<tt>ffmpeg</tt>&rsquo;:
3063 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f fbdev -r 10 -i /dev/fb0 out.avi
3064 </pre></td></tr></table>
3065
3066 <p>You can take a single screenshot image with the command:
3067 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f fbdev -vframes 1 -r 1 -i /dev/fb0 screenshot.jpeg
3068 </pre></td></tr></table>
3069
3070 <p>See also <a href="http://linux-fbdev.sourceforge.net/">http://linux-fbdev.sourceforge.net/</a>, and fbset(1).
3071 </p>
3072 <a name="jack"></a>
3073 <h2 class="section"><a href="ffmpeg.html#toc-jack">14.5 jack</a></h2>
3074
3075 <p>JACK input device.
3076 </p>
3077 <p>To enable this input device during configuration you need libjack
3078 installed on your system.
3079 </p>
3080 <p>A JACK input device creates one or more JACK writable clients, one for
3081 each audio channel, with name <var>client_name</var>:input_<var>N</var>, where
3082 <var>client_name</var> is the name provided by the application, and <var>N</var>
3083 is a number which identifies the channel.
3084 Each writable client will send the acquired data to the FFmpeg input
3085 device.
3086 </p>
3087 <p>Once you have created one or more JACK readable clients, you need to
3088 connect them to one or more JACK writable clients.
3089 </p>
3090 <p>To connect or disconnect JACK clients you can use the
3091 &lsquo;<tt>jack_connect</tt>&rsquo; and &lsquo;<tt>jack_disconnect</tt>&rsquo; programs, or do it
3092 through a graphical interface, for example with &lsquo;<tt>qjackctl</tt>&rsquo;.
3093 </p>
3094 <p>To list the JACK clients and their properties you can invoke the command
3095 &lsquo;<tt>jack_lsp</tt>&rsquo;.
3096 </p>
3097 <p>Follows an example which shows how to capture a JACK readable client
3098 with &lsquo;<tt>ffmpeg</tt>&rsquo;.
3099 </p><table><tr><td>&nbsp;</td><td><pre class="example"># Create a JACK writable client with name &quot;ffmpeg&quot;.
3100 $ ffmpeg -f jack -i ffmpeg -y out.wav
3101
3102 # Start the sample jack_metro readable client.
3103 $ jack_metro -b 120 -d 0.2 -f 4000
3104
3105 # List the current JACK clients.
3106 $ jack_lsp -c
3107 system:capture_1
3108 system:capture_2
3109 system:playback_1
3110 system:playback_2
3111 ffmpeg:input_1
3112 metro:120_bpm
3113
3114 # Connect metro to the ffmpeg writable client.
3115 $ jack_connect metro:120_bpm ffmpeg:input_1
3116 </pre></td></tr></table>
3117
3118 <p>For more information read:
3119 <a href="http://jackaudio.org/">http://jackaudio.org/</a>
3120 </p>
3121 <a name="lavfi"></a>
3122 <h2 class="section"><a href="ffmpeg.html#toc-lavfi">14.6 lavfi</a></h2>
3123
3124 <p>Libavfilter input virtual device.
3125 </p>
3126 <p>This input device reads data from the open output pads of a libavfilter
3127 filtergraph.
3128 </p>
3129 <p>For each filtergraph open output, the input device will create a
3130 corresponding stream which is mapped to the generated output. Currently
3131 only video data is supported. The filtergraph is specified through the
3132 option &lsquo;<samp>graph</samp>&rsquo;.
3133 </p>
3134 <p>To enable this input device, you need to configure your build with
3135 <code>--enable-libavfilter</code>.
3136 </p>
3137 <a name="Options"></a>
3138 <h3 class="subsection"><a href="ffmpeg.html#toc-Options">14.6.1 Options</a></h3>
3139
3140 <dl compact="compact">
3141 <dt> &lsquo;<samp>graph</samp>&rsquo;</dt>
3142 <dd><p>Specify the filtergraph to use as input. Each video open output must be
3143 labelled by a unique string of the form &quot;out<var>N</var>&quot;, where <var>N</var> is a
3144 number starting from 0 corresponding to the mapped input stream
3145 generated by the device.
3146 The first unlabelled output is automatically assigned to the &quot;out0&quot;
3147 label, but all the others need to be specified explicitely.
3148 </p>
3149 <p>If not specified defaults to the filename specified for the input
3150 device.
3151 </p></dd>
3152 </dl>
3153
3154 <a name="Examples-3"></a>
3155 <h3 class="subsection"><a href="ffmpeg.html#toc-Examples-3">14.6.2 Examples</a></h3>
3156
3157 <ul>
3158 <li>
3159 Create a color video stream and play it back with &lsquo;<tt>ffplay</tt>&rsquo;:
3160 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay -f lavfi -graph &quot;color=pink [out0]&quot; dummy
3161 </pre></td></tr></table>
3162
3163 </li><li>
3164 As the previous example, but use filename for specifying the graph
3165 description, and omit the &quot;out0&quot; label:
3166 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay -f lavfi color=pink
3167 </pre></td></tr></table>
3168
3169 </li><li>
3170 Create three different video test filtered sources and play them:
3171 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay -f lavfi -graph &quot;testsrc [out0]; testsrc,hflip [out1]; testsrc,negate [out2]&quot; test3
3172 </pre></td></tr></table>
3173 </li></ul>
3174
3175 <a name="libdc1394"></a>
3176 <h2 class="section"><a href="ffmpeg.html#toc-libdc1394">14.7 libdc1394</a></h2>
3177
3178 <p>IIDC1394 input device, based on libdc1394 and libraw1394.
3179 </p>
3180 <a name="openal"></a>
3181 <h2 class="section"><a href="ffmpeg.html#toc-openal">14.8 openal</a></h2>
3182
3183 <p>The OpenAL input device provides audio capture on all systems with a
3184 working OpenAL 1.1 implementation.
3185 </p>
3186 <p>To enable this input device during configuration, you need OpenAL
3187 headers and libraries installed on your system, and need to configure
3188 FFmpeg with <code>--enable-openal</code>.
3189 </p>
3190 <p>OpenAL headers and libraries should be provided as part of your OpenAL
3191 implementation, or as an additional download (an SDK). Depending on your
3192 installation you may need to specify additional flags via the
3193 <code>--extra-cflags</code> and <code>--extra-ldflags</code> for allowing the build
3194 system to locate the OpenAL headers and libraries.
3195 </p>
3196 <p>An incomplete list of OpenAL implementations follows:
3197 </p>
3198 <dl compact="compact">
3199 <dt> <strong>Creative</strong></dt>
3200 <dd><p>The official Windows implementation, providing hardware acceleration
3201 with supported devices and software fallback.
3202 See <a href="http://openal.org/">http://openal.org/</a>.
3203 </p></dd>
3204 <dt> <strong>OpenAL Soft</strong></dt>
3205 <dd><p>Portable, open source (LGPL) software implementation. Includes
3206 backends for the most common sound APIs on the Windows, Linux,
3207 Solaris, and BSD operating systems.
3208 See <a href="http://kcat.strangesoft.net/openal.html">http://kcat.strangesoft.net/openal.html</a>.
3209 </p></dd>
3210 <dt> <strong>Apple</strong></dt>
3211 <dd><p>OpenAL is part of Core Audio, the official Mac OS X Audio interface.
3212 See <a href="http://developer.apple.com/technologies/mac/audio-and-video.html">http://developer.apple.com/technologies/mac/audio-and-video.html</a>
3213 </p></dd>
3214 </dl>
3215
3216 <p>This device allows to capture from an audio input device handled
3217 through OpenAL.
3218 </p>
3219 <p>You need to specify the name of the device to capture in the provided
3220 filename. If the empty string is provided, the device will
3221 automatically select the default device. You can get the list of the
3222 supported devices by using the option <var>list_devices</var>.
3223 </p>
3224 <a name="Options-3"></a>
3225 <h3 class="subsection"><a href="ffmpeg.html#toc-Options-3">14.8.1 Options</a></h3>
3226
3227 <dl compact="compact">
3228 <dt> &lsquo;<samp>channels</samp>&rsquo;</dt>
3229 <dd><p>Set the number of channels in the captured audio. Only the values
3230 &lsquo;<samp>1</samp>&rsquo; (monaural) and &lsquo;<samp>2</samp>&rsquo; (stereo) are currently supported.
3231 Defaults to &lsquo;<samp>2</samp>&rsquo;.
3232 </p>
3233 </dd>
3234 <dt> &lsquo;<samp>sample_size</samp>&rsquo;</dt>
3235 <dd><p>Set the sample size (in bits) of the captured audio. Only the values
3236 &lsquo;<samp>8</samp>&rsquo; and &lsquo;<samp>16</samp>&rsquo; are currently supported. Defaults to
3237 &lsquo;<samp>16</samp>&rsquo;.
3238 </p>
3239 </dd>
3240 <dt> &lsquo;<samp>sample_rate</samp>&rsquo;</dt>
3241 <dd><p>Set the sample rate (in Hz) of the captured audio.
3242 Defaults to &lsquo;<samp>44.1k</samp>&rsquo;.
3243 </p>
3244 </dd>
3245 <dt> &lsquo;<samp>list_devices</samp>&rsquo;</dt>
3246 <dd><p>If set to &lsquo;<samp>true</samp>&rsquo;, print a list of devices and exit.
3247 Defaults to &lsquo;<samp>false</samp>&rsquo;.
3248 </p>
3249 </dd>
3250 </dl>
3251
3252 <a name="Examples-2"></a>
3253 <h3 class="subsection"><a href="ffmpeg.html#toc-Examples-2">14.8.2 Examples</a></h3>
3254
3255 <p>Print the list of OpenAL supported devices and exit:
3256 </p><table><tr><td>&nbsp;</td><td><pre class="example">$ ffmpeg -list_devices true -f openal -i dummy out.ogg
3257 </pre></td></tr></table>
3258
3259 <p>Capture from the OpenAL device &lsquo;<tt>DR-BT101 via PulseAudio</tt>&rsquo;:
3260 </p><table><tr><td>&nbsp;</td><td><pre class="example">$ ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out.ogg
3261 </pre></td></tr></table>
3262
3263 <p>Capture from the default device (note the empty string &rdquo; as filename):
3264 </p><table><tr><td>&nbsp;</td><td><pre class="example">$ ffmpeg -f openal -i '' out.ogg
3265 </pre></td></tr></table>
3266
3267 <p>Capture from two devices simultaneously, writing to two different files,
3268 within the same &lsquo;<tt>ffmpeg</tt>&rsquo; command:
3269 </p><table><tr><td>&nbsp;</td><td><pre class="example">$ ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out1.ogg -f openal -i 'ALSA Default' out2.ogg
3270 </pre></td></tr></table>
3271 <p>Note: not all OpenAL implementations support multiple simultaneous capture -
3272 try the latest OpenAL Soft if the above does not work.
3273 </p>
3274 <a name="oss"></a>
3275 <h2 class="section"><a href="ffmpeg.html#toc-oss">14.9 oss</a></h2>
3276
3277 <p>Open Sound System input device.
3278 </p>
3279 <p>The filename to provide to the input device is the device node
3280 representing the OSS input device, and is usually set to
3281 &lsquo;<tt>/dev/dsp</tt>&rsquo;.
3282 </p>
3283 <p>For example to grab from &lsquo;<tt>/dev/dsp</tt>&rsquo; using &lsquo;<tt>ffmpeg</tt>&rsquo; use the
3284 command:
3285 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
3286 </pre></td></tr></table>
3287
3288 <p>For more information about OSS see:
3289 <a href="http://manuals.opensound.com/usersguide/dsp.html">http://manuals.opensound.com/usersguide/dsp.html</a>
3290 </p>
3291 <a name="sndio"></a>
3292 <h2 class="section"><a href="ffmpeg.html#toc-sndio">14.10 sndio</a></h2>
3293
3294 <p>sndio input device.
3295 </p>
3296 <p>To enable this input device during configuration you need libsndio
3297 installed on your system.
3298 </p>
3299 <p>The filename to provide to the input device is the device node
3300 representing the sndio input device, and is usually set to
3301 &lsquo;<tt>/dev/audio0</tt>&rsquo;.
3302 </p>
3303 <p>For example to grab from &lsquo;<tt>/dev/audio0</tt>&rsquo; using &lsquo;<tt>ffmpeg</tt>&rsquo; use the
3304 command:
3305 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav
3306 </pre></td></tr></table>
3307
3308 <a name="video4linux-and-video4linux2"></a>
3309 <h2 class="section"><a href="ffmpeg.html#toc-video4linux-and-video4linux2">14.11 video4linux and video4linux2</a></h2>
3310
3311 <p>Video4Linux and Video4Linux2 input video devices.
3312 </p>
3313 <p>The name of the device to grab is a file device node, usually Linux
3314 systems tend to automatically create such nodes when the device
3315 (e.g. an USB webcam) is plugged into the system, and has a name of the
3316 kind &lsquo;<tt>/dev/video<var>N</var></tt>&rsquo;, where <var>N</var> is a number associated to
3317 the device.
3318 </p>
3319 <p>Video4Linux and Video4Linux2 devices only support a limited set of
3320 <var>width</var>x<var>height</var> sizes and framerates. You can check which are
3321 supported for example with the command &lsquo;<tt>dov4l</tt>&rsquo; for Video4Linux
3322 devices and the command &lsquo;<tt>v4l-info</tt>&rsquo; for Video4Linux2 devices.
3323 </p>
3324 <p>If the size for the device is set to 0x0, the input device will
3325 try to autodetect the size to use.
3326 Only for the video4linux2 device, if the frame rate is set to 0/0 the
3327 input device will use the frame rate value already set in the driver.
3328 </p>
3329 <p>Video4Linux support is deprecated since Linux 2.6.30, and will be
3330 dropped in later versions.
3331 </p>
3332 <p>Follow some usage examples of the video4linux devices with the ff*
3333 tools.
3334 </p><table><tr><td>&nbsp;</td><td><pre class="example"># Grab and show the input of a video4linux device, frame rate is set
3335 # to the default of 25/1.
3336 ffplay -s 320x240 -f video4linux /dev/video0
3337
3338 # Grab and show the input of a video4linux2 device, autoadjust size.
3339 ffplay -f video4linux2 /dev/video0
3340
3341 # Grab and record the input of a video4linux2 device, autoadjust size,
3342 # frame rate value defaults to 0/0 so it is read from the video4linux2
3343 # driver.
3344 ffmpeg -f video4linux2 -i /dev/video0 out.mpeg
3345 </pre></td></tr></table>
3346
3347 <a name="vfwcap"></a>
3348 <h2 class="section"><a href="ffmpeg.html#toc-vfwcap">14.12 vfwcap</a></h2>
3349
3350 <p>VfW (Video for Windows) capture input device.
3351 </p>
3352 <p>The filename passed as input is the capture driver number, ranging from
3353 0 to 9. You may use &quot;list&quot; as filename to print a list of drivers. Any
3354 other filename will be interpreted as device number 0.
3355 </p>
3356 <a name="x11grab"></a>
3357 <h2 class="section"><a href="ffmpeg.html#toc-x11grab">14.13 x11grab</a></h2>
3358
3359 <p>X11 video input device.
3360 </p>
3361 <p>This device allows to capture a region of an X11 display.
3362 </p>
3363 <p>The filename passed as input has the syntax:
3364 </p><table><tr><td>&nbsp;</td><td><pre class="example">[<var>hostname</var>]:<var>display_number</var>.<var>screen_number</var>[+<var>x_offset</var>,<var>y_offset</var>]
3365 </pre></td></tr></table>
3366
3367 <p><var>hostname</var>:<var>display_number</var>.<var>screen_number</var> specifies the
3368 X11 display name of the screen to grab from. <var>hostname</var> can be
3369 ommitted, and defaults to &quot;localhost&quot;. The environment variable
3370 <code>DISPLAY</code> contains the default display name.
3371 </p>
3372 <p><var>x_offset</var> and <var>y_offset</var> specify the offsets of the grabbed
3373 area with respect to the top-left border of the X11 screen. They
3374 default to 0.
3375 </p>
3376 <p>Check the X11 documentation (e.g. man X) for more detailed information.
3377 </p>
3378 <p>Use the &lsquo;<tt>dpyinfo</tt>&rsquo; program for getting basic information about the
3379 properties of your X11 display (e.g. grep for &quot;name&quot; or &quot;dimensions&quot;).
3380 </p>
3381 <p>For example to grab from &lsquo;<tt>:0.0</tt>&rsquo; using &lsquo;<tt>ffmpeg</tt>&rsquo;:
3382 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f x11grab -r 25 -s cif -i :0.0 out.mpg
3383
3384 # Grab at position 10,20.
3385 ffmpeg -f x11grab -r 25 -s cif -i :0.0+10,20 out.mpg
3386 </pre></td></tr></table>
3387
3388 <a name="follow_005fmouse-AVOption"></a>
3389 <h3 class="subsection"><a href="ffmpeg.html#toc-follow_005fmouse-AVOption">14.13.1 <var>follow_mouse</var> AVOption</a></h3>
3390
3391 <p>The syntax is:
3392 </p><table><tr><td>&nbsp;</td><td><pre class="example">-follow_mouse centered|<var>PIXELS</var>
3393 </pre></td></tr></table>
3394
3395 <p>When it is specified with &quot;centered&quot;, the grabbing region follows the mouse
3396 pointer and keeps the pointer at the center of region; otherwise, the region
3397 follows only when the mouse pointer reaches within <var>PIXELS</var> (greater than
3398 zero) to the edge of region.
3399 </p>
3400 <p>For example:
3401 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f x11grab -follow_mouse centered -r 25 -s cif -i :0.0 out.mpg
3402
3403 # Follows only when the mouse pointer reaches within 100 pixels to edge
3404 ffmpeg -f x11grab -follow_mouse 100 -r 25 -s cif -i :0.0 out.mpg
3405 </pre></td></tr></table>
3406
3407 <a name="show_005fregion-AVOption"></a>
3408 <h3 class="subsection"><a href="ffmpeg.html#toc-show_005fregion-AVOption">14.13.2 <var>show_region</var> AVOption</a></h3>
3409
3410 <p>The syntax is:
3411 </p><table><tr><td>&nbsp;</td><td><pre class="example">-show_region 1
3412 </pre></td></tr></table>
3413
3414 <p>If <var>show_region</var> AVOption is specified with <var>1</var>, then the grabbing
3415 region will be indicated on screen. With this option, it&rsquo;s easy to know what is
3416 being grabbed if only a portion of the screen is grabbed.
3417 </p>
3418 <p>For example:
3419 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f x11grab -show_region 1 -r 25 -s cif -i :0.0+10,20 out.mpg
3420
3421 # With follow_mouse
3422 ffmpeg -f x11grab -follow_mouse centered -show_region 1  -r 25 -s cif -i :0.0 out.mpg
3423 </pre></td></tr></table>
3424
3425 <a name="Output-Devices"></a>
3426 <h1 class="chapter"><a href="ffmpeg.html#toc-Output-Devices">15. Output Devices</a></h1>
3427
3428 <p>Output devices are configured elements in FFmpeg which allow to write
3429 multimedia data to an output device attached to your system.
3430 </p>
3431 <p>When you configure your FFmpeg build, all the supported output devices
3432 are enabled by default. You can list all available ones using the
3433 configure option &quot;&ndash;list-outdevs&quot;.
3434 </p>
3435 <p>You can disable all the output devices using the configure option
3436 &quot;&ndash;disable-outdevs&quot;, and selectively enable an output device using the
3437 option &quot;&ndash;enable-outdev=<var>OUTDEV</var>&quot;, or you can disable a particular
3438 input device using the option &quot;&ndash;disable-outdev=<var>OUTDEV</var>&quot;.
3439 </p>
3440 <p>The option &quot;-formats&quot; of the ff* tools will display the list of
3441 enabled output devices (amongst the muxers).
3442 </p>
3443 <p>A description of the currently available output devices follows.
3444 </p>
3445 <a name="alsa"></a>
3446 <h2 class="section"><a href="ffmpeg.html#toc-alsa">15.1 alsa</a></h2>
3447
3448 <p>ALSA (Advanced Linux Sound Architecture) output device.
3449 </p>
3450 <a name="oss-1"></a>
3451 <h2 class="section"><a href="ffmpeg.html#toc-oss-1">15.2 oss</a></h2>
3452
3453 <p>OSS (Open Sound System) output device.
3454 </p>
3455 <a name="sdl"></a>
3456 <h2 class="section"><a href="ffmpeg.html#toc-sdl">15.3 sdl</a></h2>
3457
3458 <p>SDL (Simple Directmedia Layer) output device.
3459 </p>
3460 <p>This output devices allows to show a video stream in an SDL
3461 window. Only one SDL window is allowed per application, so you can
3462 have only one instance of this output device in an application.
3463 </p>
3464 <p>To enable this output device you need libsdl installed on your system
3465 when configuring your build.
3466 </p>
3467 <p>For more information about SDL, check:
3468 <a href="http://www.libsdl.org/">http://www.libsdl.org/</a>
3469 </p>
3470 <a name="Options-2"></a>
3471 <h3 class="subsection"><a href="ffmpeg.html#toc-Options-2">15.3.1 Options</a></h3>
3472
3473 <dl compact="compact">
3474 <dt> &lsquo;<samp>window_title</samp>&rsquo;</dt>
3475 <dd><p>Set the SDL window title, if not specified default to the filename
3476 specified for the output device.
3477 </p>
3478 </dd>
3479 <dt> &lsquo;<samp>icon_title</samp>&rsquo;</dt>
3480 <dd><p>Set the name of the iconified SDL window, if not specified it is set
3481 to the same value of <var>window_title</var>.
3482 </p>
3483 </dd>
3484 <dt> &lsquo;<samp>window_size</samp>&rsquo;</dt>
3485 <dd><p>Set the SDL window size, can be a string of the form
3486 <var>width</var>x<var>height</var> or a video size abbreviation.
3487 If not specified it defaults to the size of the input video.
3488 </p></dd>
3489 </dl>
3490
3491 <a name="Examples-1"></a>
3492 <h3 class="subsection"><a href="ffmpeg.html#toc-Examples-1">15.3.2 Examples</a></h3>
3493
3494 <p>The following command shows the &lsquo;<tt>ffmpeg</tt>&rsquo; output is an
3495 SDL window, forcing its size to the qcif format:
3496 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -vcodec rawvideo -pix_fmt yuv420p -window_size qcif -f sdl &quot;SDL output&quot;
3497 </pre></td></tr></table>
3498
3499 <a name="sndio-1"></a>
3500 <h2 class="section"><a href="ffmpeg.html#toc-sndio-1">15.4 sndio</a></h2>
3501
3502 <p>sndio audio output device.
3503 </p>
3504 <a name="Protocols"></a>
3505 <h1 class="chapter"><a href="ffmpeg.html#toc-Protocols">16. Protocols</a></h1>
3506
3507 <p>Protocols are configured elements in FFmpeg which allow to access
3508 resources which require the use of a particular protocol.
3509 </p>
3510 <p>When you configure your FFmpeg build, all the supported protocols are
3511 enabled by default. You can list all available ones using the
3512 configure option &quot;&ndash;list-protocols&quot;.
3513 </p>
3514 <p>You can disable all the protocols using the configure option
3515 &quot;&ndash;disable-protocols&quot;, and selectively enable a protocol using the
3516 option &quot;&ndash;enable-protocol=<var>PROTOCOL</var>&quot;, or you can disable a
3517 particular protocol using the option
3518 &quot;&ndash;disable-protocol=<var>PROTOCOL</var>&quot;.
3519 </p>
3520 <p>The option &quot;-protocols&quot; of the ff* tools will display the list of
3521 supported protocols.
3522 </p>
3523 <p>A description of the currently available protocols follows.
3524 </p>
3525 <a name="applehttp"></a>
3526 <h2 class="section"><a href="ffmpeg.html#toc-applehttp">16.1 applehttp</a></h2>
3527
3528 <p>Read Apple HTTP Live Streaming compliant segmented stream as
3529 a uniform one. The M3U8 playlists describing the segments can be
3530 remote HTTP resources or local files, accessed using the standard
3531 file protocol.
3532 HTTP is default, specific protocol can be declared by specifying
3533 &quot;+<var>proto</var>&quot; after the applehttp URI scheme name, where <var>proto</var>
3534 is either &quot;file&quot; or &quot;http&quot;.
3535 </p>
3536 <table><tr><td>&nbsp;</td><td><pre class="example">applehttp://host/path/to/remote/resource.m3u8
3537 applehttp+http://host/path/to/remote/resource.m3u8
3538 applehttp+file://path/to/local/resource.m3u8
3539 </pre></td></tr></table>
3540
3541 <a name="concat"></a>
3542 <h2 class="section"><a href="ffmpeg.html#toc-concat">16.2 concat</a></h2>
3543
3544 <p>Physical concatenation protocol.
3545 </p>
3546 <p>Allow to read and seek from many resource in sequence as if they were
3547 a unique resource.
3548 </p>
3549 <p>A URL accepted by this protocol has the syntax:
3550 </p><table><tr><td>&nbsp;</td><td><pre class="example">concat:<var>URL1</var>|<var>URL2</var>|...|<var>URLN</var>
3551 </pre></td></tr></table>
3552
3553 <p>where <var>URL1</var>, <var>URL2</var>, ..., <var>URLN</var> are the urls of the
3554 resource to be concatenated, each one possibly specifying a distinct
3555 protocol.
3556 </p>
3557 <p>For example to read a sequence of files &lsquo;<tt>split1.mpeg</tt>&rsquo;,
3558 &lsquo;<tt>split2.mpeg</tt>&rsquo;, &lsquo;<tt>split3.mpeg</tt>&rsquo; with &lsquo;<tt>ffplay</tt>&rsquo; use the
3559 command:
3560 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
3561 </pre></td></tr></table>
3562
3563 <p>Note that you may need to escape the character &quot;|&quot; which is special for
3564 many shells.
3565 </p>
3566 <a name="file"></a>
3567 <h2 class="section"><a href="ffmpeg.html#toc-file">16.3 file</a></h2>
3568
3569 <p>File access protocol.
3570 </p>
3571 <p>Allow to read from or read to a file.
3572 </p>
3573 <p>For example to read from a file &lsquo;<tt>input.mpeg</tt>&rsquo; with &lsquo;<tt>ffmpeg</tt>&rsquo;
3574 use the command:
3575 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i file:input.mpeg output.mpeg
3576 </pre></td></tr></table>
3577
3578 <p>The ff* tools default to the file protocol, that is a resource
3579 specified with the name &quot;FILE.mpeg&quot; is interpreted as the URL
3580 &quot;file:FILE.mpeg&quot;.
3581 </p>
3582 <a name="gopher"></a>
3583 <h2 class="section"><a href="ffmpeg.html#toc-gopher">16.4 gopher</a></h2>
3584
3585 <p>Gopher protocol.
3586 </p>
3587 <a name="http"></a>
3588 <h2 class="section"><a href="ffmpeg.html#toc-http">16.5 http</a></h2>
3589
3590 <p>HTTP (Hyper Text Transfer Protocol).
3591 </p>
3592 <a name="mmst"></a>
3593 <h2 class="section"><a href="ffmpeg.html#toc-mmst">16.6 mmst</a></h2>
3594
3595 <p>MMS (Microsoft Media Server) protocol over TCP.
3596 </p>
3597 <a name="mmsh"></a>
3598 <h2 class="section"><a href="ffmpeg.html#toc-mmsh">16.7 mmsh</a></h2>
3599
3600 <p>MMS (Microsoft Media Server) protocol over HTTP.
3601 </p>
3602 <p>The required syntax is:
3603 </p><table><tr><td>&nbsp;</td><td><pre class="example">mmsh://<var>server</var>[:<var>port</var>][/<var>app</var>][/<var>playpath</var>]
3604 </pre></td></tr></table>
3605
3606 <a name="md5"></a>
3607 <h2 class="section"><a href="ffmpeg.html#toc-md5">16.8 md5</a></h2>
3608
3609 <p>MD5 output protocol.
3610 </p>
3611 <p>Computes the MD5 hash of the data to be written, and on close writes
3612 this to the designated output or stdout if none is specified. It can
3613 be used to test muxers without writing an actual file.
3614 </p>
3615 <p>Some examples follow.
3616 </p><table><tr><td>&nbsp;</td><td><pre class="example"># Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
3617 ffmpeg -i input.flv -f avi -y md5:output.avi.md5
3618
3619 # Write the MD5 hash of the encoded AVI file to stdout.
3620 ffmpeg -i input.flv -f avi -y md5:
3621 </pre></td></tr></table>
3622
3623 <p>Note that some formats (typically MOV) require the output protocol to
3624 be seekable, so they will fail with the MD5 output protocol.
3625 </p>
3626 <a name="pipe"></a>
3627 <h2 class="section"><a href="ffmpeg.html#toc-pipe">16.9 pipe</a></h2>
3628
3629 <p>UNIX pipe access protocol.
3630 </p>
3631 <p>Allow to read and write from UNIX pipes.
3632 </p>
3633 <p>The accepted syntax is:
3634 </p><table><tr><td>&nbsp;</td><td><pre class="example">pipe:[<var>number</var>]
3635 </pre></td></tr></table>
3636
3637 <p><var>number</var> is the number corresponding to the file descriptor of the
3638 pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr).  If <var>number</var>
3639 is not specified, by default the stdout file descriptor will be used
3640 for writing, stdin for reading.
3641 </p>
3642 <p>For example to read from stdin with &lsquo;<tt>ffmpeg</tt>&rsquo;:
3643 </p><table><tr><td>&nbsp;</td><td><pre class="example">cat test.wav | ffmpeg -i pipe:0
3644 # ...this is the same as...
3645 cat test.wav | ffmpeg -i pipe:
3646 </pre></td></tr></table>
3647
3648 <p>For writing to stdout with &lsquo;<tt>ffmpeg</tt>&rsquo;:
3649 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i test.wav -f avi pipe:1 | cat &gt; test.avi
3650 # ...this is the same as...
3651 ffmpeg -i test.wav -f avi pipe: | cat &gt; test.avi
3652 </pre></td></tr></table>
3653
3654 <p>Note that some formats (typically MOV), require the output protocol to
3655 be seekable, so they will fail with the pipe output protocol.
3656 </p>
3657 <a name="rtmp"></a>
3658 <h2 class="section"><a href="ffmpeg.html#toc-rtmp">16.10 rtmp</a></h2>
3659
3660 <p>Real-Time Messaging Protocol.
3661 </p>
3662 <p>The Real-Time Messaging Protocol (RTMP) is used for streaming multime‐
3663 dia content across a TCP/IP network.
3664 </p>
3665 <p>The required syntax is:
3666 </p><table><tr><td>&nbsp;</td><td><pre class="example">rtmp://<var>server</var>[:<var>port</var>][/<var>app</var>][/<var>playpath</var>]
3667 </pre></td></tr></table>
3668
3669 <p>The accepted parameters are:
3670 </p><dl compact="compact">
3671 <dt> &lsquo;<samp>server</samp>&rsquo;</dt>
3672 <dd><p>The address of the RTMP server.
3673 </p>
3674 </dd>
3675 <dt> &lsquo;<samp>port</samp>&rsquo;</dt>
3676 <dd><p>The number of the TCP port to use (by default is 1935).
3677 </p>
3678 </dd>
3679 <dt> &lsquo;<samp>app</samp>&rsquo;</dt>
3680 <dd><p>It is the name of the application to access. It usually corresponds to
3681 the path where the application is installed on the RTMP server
3682 (e.g. &lsquo;<tt>/ondemand/</tt>&rsquo;, &lsquo;<tt>/flash/live/</tt>&rsquo;, etc.).
3683 </p>
3684 </dd>
3685 <dt> &lsquo;<samp>playpath</samp>&rsquo;</dt>
3686 <dd><p>It is the path or name of the resource to play with reference to the
3687 application specified in <var>app</var>, may be prefixed by &quot;mp4:&quot;.
3688 </p>
3689 </dd>
3690 </dl>
3691
3692 <p>For example to read with &lsquo;<tt>ffplay</tt>&rsquo; a multimedia resource named
3693 &quot;sample&quot; from the application &quot;vod&quot; from an RTMP server &quot;myserver&quot;:
3694 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffplay rtmp://myserver/vod/sample
3695 </pre></td></tr></table>
3696
3697 <a name="rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte"></a>
3698 <h2 class="section"><a href="ffmpeg.html#toc-rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte">16.11 rtmp, rtmpe, rtmps, rtmpt, rtmpte</a></h2>
3699
3700 <p>Real-Time Messaging Protocol and its variants supported through
3701 librtmp.
3702 </p>
3703 <p>Requires the presence of the librtmp headers and library during
3704 configuration. You need to explicitely configure the build with
3705 &quot;&ndash;enable-librtmp&quot;. If enabled this will replace the native RTMP
3706 protocol.
3707 </p>
3708 <p>This protocol provides most client functions and a few server
3709 functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT),
3710 encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled
3711 variants of these encrypted types (RTMPTE, RTMPTS).
3712 </p>
3713 <p>The required syntax is:
3714 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>rtmp_proto</var>://<var>server</var>[:<var>port</var>][/<var>app</var>][/<var>playpath</var>] <var>options</var>
3715 </pre></td></tr></table>
3716
3717 <p>where <var>rtmp_proto</var> is one of the strings &quot;rtmp&quot;, &quot;rtmpt&quot;, &quot;rtmpe&quot;,
3718 &quot;rtmps&quot;, &quot;rtmpte&quot;, &quot;rtmpts&quot; corresponding to each RTMP variant, and
3719 <var>server</var>, <var>port</var>, <var>app</var> and <var>playpath</var> have the same
3720 meaning as specified for the RTMP native protocol.
3721 <var>options</var> contains a list of space-separated options of the form
3722 <var>key</var>=<var>val</var>.
3723 </p>
3724 <p>See the librtmp manual page (man 3 librtmp) for more information.
3725 </p>
3726 <p>For example, to stream a file in real-time to an RTMP server using
3727 &lsquo;<tt>ffmpeg</tt>&rsquo;:
3728 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
3729 </pre></td></tr></table>
3730
3731 <p>To play the same stream using &lsquo;<tt>ffplay</tt>&rsquo;:
3732 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffplay &quot;rtmp://myserver/live/mystream live=1&quot;
3733 </pre></td></tr></table>
3734
3735 <a name="rtp"></a>
3736 <h2 class="section"><a href="ffmpeg.html#toc-rtp">16.12 rtp</a></h2>
3737
3738 <p>Real-Time Protocol.
3739 </p>
3740 <a name="rtsp"></a>
3741 <h2 class="section"><a href="ffmpeg.html#toc-rtsp">16.13 rtsp</a></h2>
3742
3743 <p>RTSP is not technically a protocol handler in libavformat, it is a demuxer
3744 and muxer. The demuxer supports both normal RTSP (with data transferred
3745 over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with
3746 data transferred over RDT).
3747 </p>
3748 <p>The muxer can be used to send a stream using RTSP ANNOUNCE to a server
3749 supporting it (currently Darwin Streaming Server and Mischa Spiegelmock&rsquo;s
3750 <a href="http://github.com/revmischa/rtsp-server">RTSP server</a>).
3751 </p>
3752 <p>The required syntax for a RTSP url is:
3753 </p><table><tr><td>&nbsp;</td><td><pre class="example">rtsp://<var>hostname</var>[:<var>port</var>]/<var>path</var>[?<var>options</var>]
3754 </pre></td></tr></table>
3755
3756 <p><var>options</var> is a <code>&amp;</code>-separated list. The following options
3757 are supported:
3758 </p>
3759 <dl compact="compact">
3760 <dt> &lsquo;<samp>udp</samp>&rsquo;</dt>
3761 <dd><p>Use UDP as lower transport protocol.
3762 </p>
3763 </dd>
3764 <dt> &lsquo;<samp>tcp</samp>&rsquo;</dt>
3765 <dd><p>Use TCP (interleaving within the RTSP control channel) as lower
3766 transport protocol.
3767 </p>
3768 </dd>
3769 <dt> &lsquo;<samp>multicast</samp>&rsquo;</dt>
3770 <dd><p>Use UDP multicast as lower transport protocol.
3771 </p>
3772 </dd>
3773 <dt> &lsquo;<samp>http</samp>&rsquo;</dt>
3774 <dd><p>Use HTTP tunneling as lower transport protocol, which is useful for
3775 passing proxies.
3776 </p>
3777 </dd>
3778 <dt> &lsquo;<samp>filter_src</samp>&rsquo;</dt>
3779 <dd><p>Accept packets only from negotiated peer address and port.
3780 </p></dd>
3781 </dl>
3782
3783 <p>Multiple lower transport protocols may be specified, in that case they are
3784 tried one at a time (if the setup of one fails, the next one is tried).
3785 For the muxer, only the <code>tcp</code> and <code>udp</code> options are supported.
3786 </p>
3787 <p>When receiving data over UDP, the demuxer tries to reorder received packets
3788 (since they may arrive out of order, or packets may get lost totally). In
3789 order for this to be enabled, a maximum delay must be specified in the
3790 <code>max_delay</code> field of AVFormatContext.
3791 </p>
3792 <p>When watching multi-bitrate Real-RTSP streams with &lsquo;<tt>ffplay</tt>&rsquo;, the
3793 streams to display can be chosen with <code>-vst</code> <var>n</var> and
3794 <code>-ast</code> <var>n</var> for video and audio respectively, and can be switched
3795 on the fly by pressing <code>v</code> and <code>a</code>.
3796 </p>
3797 <p>Example command lines:
3798 </p>
3799 <p>To watch a stream over UDP, with a max reordering delay of 0.5 seconds:
3800 </p>
3801 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay -max_delay 500000 rtsp://server/video.mp4?udp
3802 </pre></td></tr></table>
3803
3804 <p>To watch a stream tunneled over HTTP:
3805 </p>
3806 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay rtsp://server/video.mp4?http
3807 </pre></td></tr></table>
3808
3809 <p>To send a stream in realtime to a RTSP server, for others to watch:
3810 </p>
3811 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i <var>input</var> -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
3812 </pre></td></tr></table>
3813
3814 <a name="sap"></a>
3815 <h2 class="section"><a href="ffmpeg.html#toc-sap">16.14 sap</a></h2>
3816
3817 <p>Session Announcement Protocol (RFC 2974). This is not technically a
3818 protocol handler in libavformat, it is a muxer and demuxer.
3819 It is used for signalling of RTP streams, by announcing the SDP for the
3820 streams regularly on a separate port.
3821 </p>
3822 <a name="Muxer"></a>
3823 <h3 class="subsection"><a href="ffmpeg.html#toc-Muxer">16.14.1 Muxer</a></h3>
3824
3825 <p>The syntax for a SAP url given to the muxer is:
3826 </p><table><tr><td>&nbsp;</td><td><pre class="example">sap://<var>destination</var>[:<var>port</var>][?<var>options</var>]
3827 </pre></td></tr></table>
3828
3829 <p>The RTP packets are sent to <var>destination</var> on port <var>port</var>,
3830 or to port 5004 if no port is specified.
3831 <var>options</var> is a <code>&amp;</code>-separated list. The following options
3832 are supported:
3833 </p>
3834 <dl compact="compact">
3835 <dt> &lsquo;<samp>announce_addr=<var>address</var></samp>&rsquo;</dt>
3836 <dd><p>Specify the destination IP address for sending the announcements to.
3837 If omitted, the announcements are sent to the commonly used SAP
3838 announcement multicast address 224.2.127.254 (sap.mcast.net), or
3839 ff0e::2:7ffe if <var>destination</var> is an IPv6 address.
3840 </p>
3841 </dd>
3842 <dt> &lsquo;<samp>announce_port=<var>port</var></samp>&rsquo;</dt>
3843 <dd><p>Specify the port to send the announcements on, defaults to
3844 9875 if not specified.
3845 </p>
3846 </dd>
3847 <dt> &lsquo;<samp>ttl=<var>ttl</var></samp>&rsquo;</dt>
3848 <dd><p>Specify the time to live value for the announcements and RTP packets,
3849 defaults to 255.
3850 </p>
3851 </dd>
3852 <dt> &lsquo;<samp>same_port=<var>0|1</var></samp>&rsquo;</dt>
3853 <dd><p>If set to 1, send all RTP streams on the same port pair. If zero (the
3854 default), all streams are sent on unique ports, with each stream on a
3855 port 2 numbers higher than the previous.
3856 VLC/Live555 requires this to be set to 1, to be able to receive the stream.
3857 The RTP stack in libavformat for receiving requires all streams to be sent
3858 on unique ports.
3859 </p></dd>
3860 </dl>
3861
3862 <p>Example command lines follow.
3863 </p>
3864 <p>To broadcast a stream on the local subnet, for watching in VLC:
3865 </p>
3866 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i <var>input</var> -f sap sap://224.0.0.255?same_port=1
3867 </pre></td></tr></table>
3868
3869 <p>Similarly, for watching in ffplay:
3870 </p>
3871 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i <var>input</var> -f sap sap://224.0.0.255
3872 </pre></td></tr></table>
3873
3874 <p>And for watching in ffplay, over IPv6:
3875 </p>
3876 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i <var>input</var> -f sap sap://[ff0e::1:2:3:4]
3877 </pre></td></tr></table>
3878
3879 <a name="Demuxer"></a>
3880 <h3 class="subsection"><a href="ffmpeg.html#toc-Demuxer">16.14.2 Demuxer</a></h3>
3881
3882 <p>The syntax for a SAP url given to the demuxer is:
3883 </p><table><tr><td>&nbsp;</td><td><pre class="example">sap://[<var>address</var>][:<var>port</var>]
3884 </pre></td></tr></table>
3885
3886 <p><var>address</var> is the multicast address to listen for announcements on,
3887 if omitted, the default 224.2.127.254 (sap.mcast.net) is used. <var>port</var>
3888 is the port that is listened on, 9875 if omitted.
3889 </p>
3890 <p>The demuxers listens for announcements on the given address and port.
3891 Once an announcement is received, it tries to receive that particular stream.
3892 </p>
3893 <p>Example command lines follow.
3894 </p>
3895 <p>To play back the first stream announced on the normal SAP multicast address:
3896 </p>
3897 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay sap://
3898 </pre></td></tr></table>
3899
3900 <p>To play back the first stream announced on one the default IPv6 SAP multicast address:
3901 </p>
3902 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay sap://[ff0e::2:7ffe]
3903 </pre></td></tr></table>
3904
3905 <a name="tcp"></a>
3906 <h2 class="section"><a href="ffmpeg.html#toc-tcp">16.15 tcp</a></h2>
3907
3908 <p>Trasmission Control Protocol.
3909 </p>
3910 <p>The required syntax for a TCP url is:
3911 </p><table><tr><td>&nbsp;</td><td><pre class="example">tcp://<var>hostname</var>:<var>port</var>[?<var>options</var>]
3912 </pre></td></tr></table>
3913
3914 <dl compact="compact">
3915 <dt> &lsquo;<samp>listen</samp>&rsquo;</dt>
3916 <dd><p>Listen for an incoming connection
3917 </p>
3918 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i <var>input</var> -f <var>format</var> tcp://<var>hostname</var>:<var>port</var>?listen
3919 ffplay tcp://<var>hostname</var>:<var>port</var>
3920 </pre></td></tr></table>
3921
3922 </dd>
3923 </dl>
3924
3925 <a name="udp"></a>
3926 <h2 class="section"><a href="ffmpeg.html#toc-udp">16.16 udp</a></h2>
3927
3928 <p>User Datagram Protocol.
3929 </p>
3930 <p>The required syntax for a UDP url is:
3931 </p><table><tr><td>&nbsp;</td><td><pre class="example">udp://<var>hostname</var>:<var>port</var>[?<var>options</var>]
3932 </pre></td></tr></table>
3933
3934 <p><var>options</var> contains a list of &amp;-seperated options of the form <var>key</var>=<var>val</var>.
3935 Follow the list of supported options.
3936 </p>
3937 <dl compact="compact">
3938 <dt> &lsquo;<samp>buffer_size=<var>size</var></samp>&rsquo;</dt>
3939 <dd><p>set the UDP buffer size in bytes
3940 </p>
3941 </dd>
3942 <dt> &lsquo;<samp>localport=<var>port</var></samp>&rsquo;</dt>
3943 <dd><p>override the local UDP port to bind with
3944 </p>
3945 </dd>
3946 <dt> &lsquo;<samp>pkt_size=<var>size</var></samp>&rsquo;</dt>
3947 <dd><p>set the size in bytes of UDP packets
3948 </p>
3949 </dd>
3950 <dt> &lsquo;<samp>reuse=<var>1|0</var></samp>&rsquo;</dt>
3951 <dd><p>explicitly allow or disallow reusing UDP sockets
3952 </p>
3953 </dd>
3954 <dt> &lsquo;<samp>ttl=<var>ttl</var></samp>&rsquo;</dt>
3955 <dd><p>set the time to live value (for multicast only)
3956 </p>
3957 </dd>
3958 <dt> &lsquo;<samp>connect=<var>1|0</var></samp>&rsquo;</dt>
3959 <dd><p>Initialize the UDP socket with <code>connect()</code>. In this case, the
3960 destination address can&rsquo;t be changed with ff_udp_set_remote_url later.
3961 If the destination address isn&rsquo;t known at the start, this option can
3962 be specified in ff_udp_set_remote_url, too.
3963 This allows finding out the source address for the packets with getsockname,
3964 and makes writes return with AVERROR(ECONNREFUSED) if &quot;destination
3965 unreachable&quot; is received.
3966 For receiving, this gives the benefit of only receiving packets from
3967 the specified peer address/port.
3968 </p></dd>
3969 </dl>
3970
3971 <p>Some usage examples of the udp protocol with &lsquo;<tt>ffmpeg</tt>&rsquo; follow.
3972 </p>
3973 <p>To stream over UDP to a remote endpoint:
3974 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i <var>input</var> -f <var>format</var> udp://<var>hostname</var>:<var>port</var>
3975 </pre></td></tr></table>
3976
3977 <p>To stream in mpegts format over UDP using 188 sized UDP packets, using a large input buffer:
3978 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i <var>input</var> -f mpegts udp://<var>hostname</var>:<var>port</var>?pkt_size=188&amp;buffer_size=65535
3979 </pre></td></tr></table>
3980
3981 <p>To receive over UDP from a remote endpoint:
3982 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i udp://[<var>multicast-address</var>]:<var>port</var>
3983 </pre></td></tr></table>
3984
3985 <a name="Bitstream-Filters"></a>
3986 <h1 class="chapter"><a href="ffmpeg.html#toc-Bitstream-Filters">17. Bitstream Filters</a></h1>
3987
3988 <p>When you configure your FFmpeg build, all the supported bitstream
3989 filters are enabled by default. You can list all available ones using
3990 the configure option <code>--list-bsfs</code>.
3991 </p>
3992 <p>You can disable all the bitstream filters using the configure option
3993 <code>--disable-bsfs</code>, and selectively enable any bitstream filter using
3994 the option <code>--enable-bsf=BSF</code>, or you can disable a particular
3995 bitstream filter using the option <code>--disable-bsf=BSF</code>.
3996 </p>
3997 <p>The option <code>-bsfs</code> of the ff* tools will display the list of
3998 all the supported bitstream filters included in your build.
3999 </p>
4000 <p>Below is a description of the currently available bitstream filters.
4001 </p>
4002 <a name="aac_005fadtstoasc"></a>
4003 <h2 class="section"><a href="ffmpeg.html#toc-aac_005fadtstoasc">17.1 aac_adtstoasc</a></h2>
4004
4005 <a name="chomp"></a>
4006 <h2 class="section"><a href="ffmpeg.html#toc-chomp">17.2 chomp</a></h2>
4007
4008 <a name="dump_005fextradata"></a>
4009 <h2 class="section"><a href="ffmpeg.html#toc-dump_005fextradata">17.3 dump_extradata</a></h2>
4010
4011 <a name="h264_005fmp4toannexb"></a>
4012 <h2 class="section"><a href="ffmpeg.html#toc-h264_005fmp4toannexb">17.4 h264_mp4toannexb</a></h2>
4013
4014 <a name="imx_005fdump_005fheader"></a>
4015 <h2 class="section"><a href="ffmpeg.html#toc-imx_005fdump_005fheader">17.5 imx_dump_header</a></h2>
4016
4017 <a name="mjpeg2jpeg"></a>
4018 <h2 class="section"><a href="ffmpeg.html#toc-mjpeg2jpeg">17.6 mjpeg2jpeg</a></h2>
4019
4020 <p>Convert MJPEG/AVI1 packets to full JPEG/JFIF packets.
4021 </p>
4022 <p>MJPEG is a video codec wherein each video frame is essentially a
4023 JPEG image. The individual frames can be extracted without loss,
4024 e.g. by
4025 </p>
4026 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i ../some_mjpeg.avi -vcodec copy frames_%d.jpg
4027 </pre></td></tr></table>
4028
4029 <p>Unfortunately, these chunks are incomplete JPEG images, because
4030 they lack the DHT segment required for decoding. Quoting from
4031 <a href="http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml">http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml</a>:
4032 </p>
4033 <p>Avery Lee, writing in the rec.video.desktop newsgroup in 2001,
4034 commented that &quot;MJPEG, or at least the MJPEG in AVIs having the
4035 MJPG fourcc, is restricted JPEG with a fixed &ndash; and *omitted* &ndash;
4036 Huffman table. The JPEG must be YCbCr colorspace, it must be 4:2:2,
4037 and it must use basic Huffman encoding, not arithmetic or
4038 progressive. . . . You can indeed extract the MJPEG frames and
4039 decode them with a regular JPEG decoder, but you have to prepend
4040 the DHT segment to them, or else the decoder won&rsquo;t have any idea
4041 how to decompress the data. The exact table necessary is given in
4042 the OpenDML spec.&quot;
4043 </p>
4044 <p>This bitstream filter patches the header of frames extracted from an MJPEG
4045 stream (carrying the AVI1 header ID and lacking a DHT segment) to
4046 produce fully qualified JPEG images.
4047 </p>
4048 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i mjpeg-movie.avi -vcodec copy -vbsf mjpeg2jpeg frame_%d.jpg
4049 exiftran -i -9 frame*.jpg
4050 ffmpeg -i frame_%d.jpg -vcodec copy rotated.avi
4051 </pre></td></tr></table>
4052
4053 <a name="mjpega_005fdump_005fheader"></a>
4054 <h2 class="section"><a href="ffmpeg.html#toc-mjpega_005fdump_005fheader">17.7 mjpega_dump_header</a></h2>
4055
4056 <a name="movsub"></a>
4057 <h2 class="section"><a href="ffmpeg.html#toc-movsub">17.8 movsub</a></h2>
4058
4059 <a name="mp3_005fheader_005fcompress"></a>
4060 <h2 class="section"><a href="ffmpeg.html#toc-mp3_005fheader_005fcompress">17.9 mp3_header_compress</a></h2>
4061
4062 <a name="mp3_005fheader_005fdecompress"></a>
4063 <h2 class="section"><a href="ffmpeg.html#toc-mp3_005fheader_005fdecompress">17.10 mp3_header_decompress</a></h2>
4064
4065 <a name="noise"></a>
4066 <h2 class="section"><a href="ffmpeg.html#toc-noise">17.11 noise</a></h2>
4067
4068 <a name="remove_005fextradata"></a>
4069 <h2 class="section"><a href="ffmpeg.html#toc-remove_005fextradata">17.12 remove_extradata</a></h2>
4070
4071 <a name="Filtergraph-description"></a>
4072 <h1 class="chapter"><a href="ffmpeg.html#toc-Filtergraph-description">18. Filtergraph description</a></h1>
4073
4074 <p>A filtergraph is a directed graph of connected filters. It can contain
4075 cycles, and there can be multiple links between a pair of
4076 filters. Each link has one input pad on one side connecting it to one
4077 filter from which it takes its input, and one output pad on the other
4078 side connecting it to the one filter accepting its output.
4079 </p>
4080 <p>Each filter in a filtergraph is an instance of a filter class
4081 registered in the application, which defines the features and the
4082 number of input and output pads of the filter.
4083 </p>
4084 <p>A filter with no input pads is called a &quot;source&quot;, a filter with no
4085 output pads is called a &quot;sink&quot;.
4086 </p>
4087 <a name="Filtergraph-syntax"></a>
4088 <h2 class="section"><a href="ffmpeg.html#toc-Filtergraph-syntax">18.1 Filtergraph syntax</a></h2>
4089
4090 <p>A filtergraph can be represented using a textual representation, which
4091 is recognized by the <code>-vf</code> and <code>-af</code> options of the ff*
4092 tools, and by the <code>avfilter_graph_parse()</code> function defined in
4093 &lsquo;<tt>libavfilter/avfiltergraph.h</tt>&rsquo;.
4094 </p>
4095 <p>A filterchain consists of a sequence of connected filters, each one
4096 connected to the previous one in the sequence. A filterchain is
4097 represented by a list of &quot;,&quot;-separated filter descriptions.
4098 </p>
4099 <p>A filtergraph consists of a sequence of filterchains. A sequence of
4100 filterchains is represented by a list of &quot;;&quot;-separated filterchain
4101 descriptions.
4102 </p>
4103 <p>A filter is represented by a string of the form:
4104 [<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>]
4105 </p>
4106 <p><var>filter_name</var> is the name of the filter class of which the
4107 described filter is an instance of, and has to be the name of one of
4108 the filter classes registered in the program.
4109 The name of the filter class is optionally followed by a string
4110 &quot;=<var>arguments</var>&quot;.
4111 </p>
4112 <p><var>arguments</var> is a string which contains the parameters used to
4113 initialize the filter instance, and are described in the filter
4114 descriptions below.
4115 </p>
4116 <p>The list of arguments can be quoted using the character &quot;&rsquo;&quot; as initial
4117 and ending mark, and the character &rsquo;\&rsquo; for escaping the characters
4118 within the quoted text; otherwise the argument string is considered
4119 terminated when the next special character (belonging to the set
4120 &quot;[]=;,&quot;) is encountered.
4121 </p>
4122 <p>The name and arguments of the filter are optionally preceded and
4123 followed by a list of link labels.
4124 A link label allows to name a link and associate it to a filter output
4125 or input pad. The preceding labels <var>in_link_1</var>
4126 ... <var>in_link_N</var>, are associated to the filter input pads,
4127 the following labels <var>out_link_1</var> ... <var>out_link_M</var>, are
4128 associated to the output pads.
4129 </p>
4130 <p>When two link labels with the same name are found in the
4131 filtergraph, a link between the corresponding input and output pad is
4132 created.
4133 </p>
4134 <p>If an output pad is not labelled, it is linked by default to the first
4135 unlabelled input pad of the next filter in the filterchain.
4136 For example in the filterchain:
4137 </p><table><tr><td>&nbsp;</td><td><pre class="example">nullsrc, split[L1], [L2]overlay, nullsink
4138 </pre></td></tr></table>
4139 <p>the split filter instance has two output pads, and the overlay filter
4140 instance two input pads. The first output pad of split is labelled
4141 &quot;L1&quot;, the first input pad of overlay is labelled &quot;L2&quot;, and the second
4142 output pad of split is linked to the second input pad of overlay,
4143 which are both unlabelled.
4144 </p>
4145 <p>In a complete filterchain all the unlabelled filter input and output
4146 pads must be connected. A filtergraph is considered valid if all the
4147 filter input and output pads of all the filterchains are connected.
4148 </p>
4149 <p>Follows a BNF description for the filtergraph syntax:
4150 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>NAME</var>             ::= sequence of alphanumeric characters and '_'
4151 <var>LINKLABEL</var>        ::= &quot;[&quot; <var>NAME</var> &quot;]&quot;
4152 <var>LINKLABELS</var>       ::= <var>LINKLABEL</var> [<var>LINKLABELS</var>]
4153 <var>FILTER_ARGUMENTS</var> ::= sequence of chars (eventually quoted)
4154 <var>FILTER</var>           ::= [<var>LINKNAMES</var>] <var>NAME</var> [&quot;=&quot; <var>ARGUMENTS</var>] [<var>LINKNAMES</var>]
4155 <var>FILTERCHAIN</var>      ::= <var>FILTER</var> [,<var>FILTERCHAIN</var>]
4156 <var>FILTERGRAPH</var>      ::= <var>FILTERCHAIN</var> [;<var>FILTERGRAPH</var>]
4157 </pre></td></tr></table>
4158
4159
4160 <a name="Audio-Filters"></a>
4161 <h1 class="chapter"><a href="ffmpeg.html#toc-Audio-Filters">19. Audio Filters</a></h1>
4162
4163 <p>When you configure your FFmpeg build, you can disable any of the
4164 existing filters using &ndash;disable-filters.
4165 The configure output will show the audio filters included in your
4166 build.
4167 </p>
4168 <p>Below is a description of the currently available audio filters.
4169 </p>
4170 <a name="aformat"></a>
4171 <h2 class="section"><a href="ffmpeg.html#toc-aformat">19.1 aformat</a></h2>
4172
4173 <p>Convert the input audio to one of the specified formats. The framework will
4174 negotiate the most appropriate format to minimize conversions.
4175 </p>
4176 <p>The filter accepts three lists of formats, separated by &quot;:&quot;, in the form:
4177 &quot;<var>sample_formats</var>:<var>channel_layouts</var>:<var>packing_formats</var>&quot;.
4178 </p>
4179 <p>Elements in each list are separated by &quot;,&quot; which has to be escaped in the
4180 filtergraph specification.
4181 </p>
4182 <p>The special parameter &quot;all&quot;, in place of a list of elements, signifies all
4183 supported formats.
4184 </p>
4185 <p>Some examples follow:
4186 </p><table><tr><td>&nbsp;</td><td><pre class="example">aformat=u8\\,s16:mono:packed
4187
4188 aformat=s16:mono\\,stereo:all
4189 </pre></td></tr></table>
4190
4191 <a name="anull"></a>
4192 <h2 class="section"><a href="ffmpeg.html#toc-anull">19.2 anull</a></h2>
4193
4194 <p>Pass the audio source unchanged to the output.
4195 </p>
4196 <a name="aresample"></a>
4197 <h2 class="section"><a href="ffmpeg.html#toc-aresample">19.3 aresample</a></h2>
4198
4199 <p>Resample the input audio to the specified sample rate.
4200 </p>
4201 <p>The filter accepts exactly one parameter, the output sample rate. If not
4202 specified then the filter will automatically convert between its input
4203 and output sample rates.
4204 </p>
4205 <p>For example, to resample the input audio to 44100Hz:
4206 </p><table><tr><td>&nbsp;</td><td><pre class="example">aresample=44100
4207 </pre></td></tr></table>
4208
4209 <a name="ashowinfo"></a>
4210 <h2 class="section"><a href="ffmpeg.html#toc-ashowinfo">19.4 ashowinfo</a></h2>
4211
4212 <p>Show a line containing various information for each input audio frame.
4213 The input audio is not modified.
4214 </p>
4215 <p>The shown line contains a sequence of key/value pairs of the form
4216 <var>key</var>:<var>value</var>.
4217 </p>
4218 <p>A description of each shown parameter follows:
4219 </p>
4220 <dl compact="compact">
4221 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
4222 <dd><p>sequential number of the input frame, starting from 0
4223 </p>
4224 </dd>
4225 <dt> &lsquo;<samp>pts</samp>&rsquo;</dt>
4226 <dd><p>presentation TimeStamp of the input frame, expressed as a number of
4227 time base units. The time base unit depends on the filter input pad, and
4228 is usually 1/<var>sample_rate</var>.
4229 </p>
4230 </dd>
4231 <dt> &lsquo;<samp>pts_time</samp>&rsquo;</dt>
4232 <dd><p>presentation TimeStamp of the input frame, expressed as a number of
4233 seconds
4234 </p>
4235 </dd>
4236 <dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
4237 <dd><p>position of the frame in the input stream, -1 if this information in
4238 unavailable and/or meanigless (for example in case of synthetic audio)
4239 </p>
4240 </dd>
4241 <dt> &lsquo;<samp>fmt</samp>&rsquo;</dt>
4242 <dd><p>sample format name
4243 </p>
4244 </dd>
4245 <dt> &lsquo;<samp>chlayout</samp>&rsquo;</dt>
4246 <dd><p>channel layout description
4247 </p>
4248 </dd>
4249 <dt> &lsquo;<samp>nb_samples</samp>&rsquo;</dt>
4250 <dd><p>number of samples (per each channel) contained in the filtered frame
4251 </p>
4252 </dd>
4253 <dt> &lsquo;<samp>rate</samp>&rsquo;</dt>
4254 <dd><p>sample rate for the audio frame
4255 </p>
4256 </dd>
4257 <dt> &lsquo;<samp>planar</samp>&rsquo;</dt>
4258 <dd><p>if the packing format is planar, 0 if packed
4259 </p>
4260 </dd>
4261 <dt> &lsquo;<samp>checksum</samp>&rsquo;</dt>
4262 <dd><p>Adler-32 checksum of all the planes of the input frame
4263 </p>
4264 </dd>
4265 <dt> &lsquo;<samp>plane_checksum</samp>&rsquo;</dt>
4266 <dd><p>Adler-32 checksum for each input frame plane, expressed in the form
4267 &quot;[<var>c0</var> <var>c1</var> <var>c2</var> <var>c3</var> <var>c4</var> <var>c5</var> <var>c6</var> <var>c7</var>]&quot;
4268 </p></dd>
4269 </dl>
4270
4271
4272 <a name="Audio-Sources"></a>
4273 <h1 class="chapter"><a href="ffmpeg.html#toc-Audio-Sources">20. Audio Sources</a></h1>
4274
4275 <p>Below is a description of the currently available audio sources.
4276 </p>
4277 <a name="abuffer"></a>
4278 <h2 class="section"><a href="ffmpeg.html#toc-abuffer">20.1 abuffer</a></h2>
4279
4280 <p>Buffer audio frames, and make them available to the filter chain.
4281 </p>
4282 <p>This source is mainly intended for a programmatic use, in particular
4283 through the interface defined in &lsquo;<tt>libavfilter/asrc_abuffer.h</tt>&rsquo;.
4284 </p>
4285 <p>It accepts the following mandatory parameters:
4286 <var>sample_rate</var>:<var>sample_fmt</var>:<var>channel_layout</var>:<var>packing</var>
4287 </p>
4288 <dl compact="compact">
4289 <dt> &lsquo;<samp>sample_rate</samp>&rsquo;</dt>
4290 <dd><p>The sample rate of the incoming audio buffers.
4291 </p>
4292 </dd>
4293 <dt> &lsquo;<samp>sample_fmt</samp>&rsquo;</dt>
4294 <dd><p>The sample format of the incoming audio buffers.
4295 Either a sample format name or its corresponging integer representation from
4296 the enum AVSampleFormat in &lsquo;<tt>libavutil/samplefmt.h</tt>&rsquo;
4297 </p>
4298 </dd>
4299 <dt> &lsquo;<samp>channel_layout</samp>&rsquo;</dt>
4300 <dd><p>The channel layout of the incoming audio buffers.
4301 Either a channel layout name from channel_layout_map in
4302 &lsquo;<tt>libavutil/audioconvert.c</tt>&rsquo; or its corresponding integer representation
4303 from the AV_CH_LAYOUT_* macros in &lsquo;<tt>libavutil/audioconvert.h</tt>&rsquo;
4304 </p>
4305 </dd>
4306 <dt> &lsquo;<samp>packing</samp>&rsquo;</dt>
4307 <dd><p>Either &quot;packed&quot; or &quot;planar&quot;, or their integer representation: 0 or 1
4308 respectively.
4309 </p>
4310 </dd>
4311 </dl>
4312
4313 <p>For example:
4314 </p><table><tr><td>&nbsp;</td><td><pre class="example">abuffer=44100:s16:stereo:planar
4315 </pre></td></tr></table>
4316
4317 <p>will instruct the source to accept planar 16bit signed stereo at 44100Hz.
4318 Since the sample format with name &quot;s16&quot; corresponds to the number
4319 1 and the &quot;stereo&quot; channel layout corresponds to the value 3, this is
4320 equivalent to:
4321 </p><table><tr><td>&nbsp;</td><td><pre class="example">abuffer=44100:1:3:1
4322 </pre></td></tr></table>
4323
4324 <a name="amovie"></a>
4325 <h2 class="section"><a href="ffmpeg.html#toc-amovie">20.2 amovie</a></h2>
4326
4327 <p>Read an audio stream from a movie container.
4328 </p>
4329 <p>It accepts the syntax: <var>movie_name</var>[:<var>options</var>] where
4330 <var>movie_name</var> is the name of the resource to read (not necessarily
4331 a file but also a device or a stream accessed through some protocol),
4332 and <var>options</var> is an optional sequence of <var>key</var>=<var>value</var>
4333 pairs, separated by &quot;:&quot;.
4334 </p>
4335 <p>The description of the accepted options follows.
4336 </p>
4337 <dl compact="compact">
4338 <dt> &lsquo;<samp>format_name, f</samp>&rsquo;</dt>
4339 <dd><p>Specify the format assumed for the movie to read, and can be either
4340 the name of a container or an input device. If not specified the
4341 format is guessed from <var>movie_name</var> or by probing.
4342 </p>
4343 </dd>
4344 <dt> &lsquo;<samp>seek_point, sp</samp>&rsquo;</dt>
4345 <dd><p>Specify the seek point in seconds, the frames will be output
4346 starting from this seek point, the parameter is evaluated with
4347 <code>av_strtod</code> so the numerical value may be suffixed by an IS
4348 postfix. Default value is &quot;0&quot;.
4349 </p>
4350 </dd>
4351 <dt> &lsquo;<samp>stream_index, si</samp>&rsquo;</dt>
4352 <dd><p>Specify the index of the audio stream to read. If the value is -1,
4353 the best suited audio stream will be automatically selected. Default
4354 value is &quot;-1&quot;.
4355 </p>
4356 </dd>
4357 </dl>
4358
4359 <a name="anullsrc"></a>
4360 <h2 class="section"><a href="ffmpeg.html#toc-anullsrc">20.3 anullsrc</a></h2>
4361
4362 <p>Null audio source, never return audio frames. It is mainly useful as a
4363 template and to be employed in analysis / debugging tools.
4364 </p>
4365 <p>It accepts as optional parameter a string of the form
4366 <var>sample_rate</var>:<var>channel_layout</var>.
4367 </p>
4368 <p><var>sample_rate</var> specify the sample rate, and defaults to 44100.
4369 </p>
4370 <p><var>channel_layout</var> specify the channel layout, and can be either an
4371 integer or a string representing a channel layout. The default value
4372 of <var>channel_layout</var> is 3, which corresponds to CH_LAYOUT_STEREO.
4373 </p>
4374 <p>Check the channel_layout_map definition in
4375 &lsquo;<tt>libavcodec/audioconvert.c</tt>&rsquo; for the mapping between strings and
4376 channel layout values.
4377 </p>
4378 <p>Follow some examples:
4379 </p><table><tr><td>&nbsp;</td><td><pre class="example">#  set the sample rate to 48000 Hz and the channel layout to CH_LAYOUT_MONO.
4380 anullsrc=48000:4
4381
4382 # same as
4383 anullsrc=48000:mono
4384 </pre></td></tr></table>
4385
4386
4387 <a name="Audio-Sinks"></a>
4388 <h1 class="chapter"><a href="ffmpeg.html#toc-Audio-Sinks">21. Audio Sinks</a></h1>
4389
4390 <p>Below is a description of the currently available audio sinks.
4391 </p>
4392 <a name="abuffersink"></a>
4393 <h2 class="section"><a href="ffmpeg.html#toc-abuffersink">21.1 abuffersink</a></h2>
4394
4395 <p>Buffer audio frames, and make them available to the end of filter chain.
4396 </p>
4397 <p>This sink is mainly intended for programmatic use, in particular
4398 through the interface defined in &lsquo;<tt>libavfilter/asink_abuffer.h</tt>&rsquo;.
4399 </p>
4400 <p>It requires a pointer to a ABufferSinkContext structure, which defines the
4401 incoming buffers&rsquo; format, to be passed as the opaque parameter to
4402 <code>avfilter_init_filter</code> for initialization.
4403 </p>
4404 <a name="anullsink"></a>
4405 <h2 class="section"><a href="ffmpeg.html#toc-anullsink">21.2 anullsink</a></h2>
4406
4407 <p>Null audio sink, do absolutely nothing with the input audio. It is
4408 mainly useful as a template and to be employed in analysis / debugging
4409 tools.
4410 </p>
4411
4412 <a name="Video-Filters"></a>
4413 <h1 class="chapter"><a href="ffmpeg.html#toc-Video-Filters">22. Video Filters</a></h1>
4414
4415 <p>When you configure your FFmpeg build, you can disable any of the
4416 existing filters using &ndash;disable-filters.
4417 The configure output will show the video filters included in your
4418 build.
4419 </p>
4420 <p>Below is a description of the currently available video filters.
4421 </p>
4422 <a name="blackframe"></a>
4423 <h2 class="section"><a href="ffmpeg.html#toc-blackframe">22.1 blackframe</a></h2>
4424
4425 <p>Detect frames that are (almost) completely black. Can be useful to
4426 detect chapter transitions or commercials. Output lines consist of
4427 the frame number of the detected frame, the percentage of blackness,
4428 the position in the file if known or -1 and the timestamp in seconds.
4429 </p>
4430 <p>In order to display the output lines, you need to set the loglevel at
4431 least to the AV_LOG_INFO value.
4432 </p>
4433 <p>The filter accepts the syntax:
4434 </p><table><tr><td>&nbsp;</td><td><pre class="example">blackframe[=<var>amount</var>:[<var>threshold</var>]]
4435 </pre></td></tr></table>
4436
4437 <p><var>amount</var> is the percentage of the pixels that have to be below the
4438 threshold, and defaults to 98.
4439 </p>
4440 <p><var>threshold</var> is the threshold below which a pixel value is
4441 considered black, and defaults to 32.
4442 </p>
4443 <a name="boxblur"></a>
4444 <h2 class="section"><a href="ffmpeg.html#toc-boxblur">22.2 boxblur</a></h2>
4445
4446 <p>Apply boxblur algorithm to the input video.
4447 </p>
4448 <p>This filter accepts the parameters:
4449 <var>luma_power</var>:<var>luma_radius</var>:<var>chroma_radius</var>:<var>chroma_power</var>:<var>alpha_radius</var>:<var>alpha_power</var>
4450 </p>
4451 <p>Chroma and alpha parameters are optional, if not specified they default
4452 to the corresponding values set for <var>luma_radius</var> and
4453 <var>luma_power</var>.
4454 </p>
4455 <p><var>luma_radius</var>, <var>chroma_radius</var>, and <var>alpha_radius</var> represent
4456 the radius in pixels of the box used for blurring the corresponding
4457 input plane. They are expressions, and can contain the following
4458 constants:
4459 </p><dl compact="compact">
4460 <dt> &lsquo;<samp>w, h</samp>&rsquo;</dt>
4461 <dd><p>the input width and heigth in pixels
4462 </p>
4463 </dd>
4464 <dt> &lsquo;<samp>cw, ch</samp>&rsquo;</dt>
4465 <dd><p>the input chroma image width and height in pixels
4466 </p>
4467 </dd>
4468 <dt> &lsquo;<samp>hsub, vsub</samp>&rsquo;</dt>
4469 <dd><p>horizontal and vertical chroma subsample values. For example for the
4470 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
4471 </p></dd>
4472 </dl>
4473
4474 <p>The radius must be a non-negative number, and must be not greater than
4475 the value of the expression <code>min(w,h)/2</code> for the luma and alpha planes,
4476 and of <code>min(cw,ch)/2</code> for the chroma planes.
4477 </p>
4478 <p><var>luma_power</var>, <var>chroma_power</var>, and <var>alpha_power</var> represent
4479 how many times the boxblur filter is applied to the corresponding
4480 plane.
4481 </p>
4482 <p>Some examples follow:
4483 </p>
4484 <ul>
4485 <li>
4486 Apply a boxblur filter with luma, chroma, and alpha radius
4487 set to 2:
4488 <table><tr><td>&nbsp;</td><td><pre class="example">boxblur=2:1
4489 </pre></td></tr></table>
4490
4491 </li><li>
4492 Set luma radius to 2, alpha and chroma radius to 0
4493 <table><tr><td>&nbsp;</td><td><pre class="example">boxblur=2:1:0:0:0:0
4494 </pre></td></tr></table>
4495
4496 </li><li>
4497 Set luma and chroma radius to a fraction of the video dimension
4498 <table><tr><td>&nbsp;</td><td><pre class="example">boxblur=min(h\,w)/10:1:min(cw\,ch)/10:1
4499 </pre></td></tr></table>
4500
4501 </li></ul>
4502
4503 <a name="copy"></a>
4504 <h2 class="section"><a href="ffmpeg.html#toc-copy">22.3 copy</a></h2>
4505
4506 <p>Copy the input source unchanged to the output. Mainly useful for
4507 testing purposes.
4508 </p>
4509 <a name="crop"></a>
4510 <h2 class="section"><a href="ffmpeg.html#toc-crop">22.4 crop</a></h2>
4511
4512 <p>Crop the input video to <var>out_w</var>:<var>out_h</var>:<var>x</var>:<var>y</var>.
4513 </p>
4514 <p>The parameters are expressions containing the following constants:
4515 </p>
4516 <dl compact="compact">
4517 <dt> &lsquo;<samp>E, PI, PHI</samp>&rsquo;</dt>
4518 <dd><p>the corresponding mathematical approximated values for e
4519 (euler number), pi (greek PI), PHI (golden ratio)
4520 </p>
4521 </dd>
4522 <dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
4523 <dd><p>the computed values for <var>x</var> and <var>y</var>. They are evaluated for
4524 each new frame.
4525 </p>
4526 </dd>
4527 <dt> &lsquo;<samp>in_w, in_h</samp>&rsquo;</dt>
4528 <dd><p>the input width and heigth
4529 </p>
4530 </dd>
4531 <dt> &lsquo;<samp>iw, ih</samp>&rsquo;</dt>
4532 <dd><p>same as <var>in_w</var> and <var>in_h</var>
4533 </p>
4534 </dd>
4535 <dt> &lsquo;<samp>out_w, out_h</samp>&rsquo;</dt>
4536 <dd><p>the output (cropped) width and heigth
4537 </p>
4538 </dd>
4539 <dt> &lsquo;<samp>ow, oh</samp>&rsquo;</dt>
4540 <dd><p>same as <var>out_w</var> and <var>out_h</var>
4541 </p>
4542 </dd>
4543 <dt> &lsquo;<samp>a</samp>&rsquo;</dt>
4544 <dd><p>same as <var>iw</var> / <var>ih</var>
4545 </p>
4546 </dd>
4547 <dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
4548 <dd><p>input sample aspect ratio
4549 </p>
4550 </dd>
4551 <dt> &lsquo;<samp>dar</samp>&rsquo;</dt>
4552 <dd><p>input display aspect ratio, it is the same as (<var>iw</var> / <var>ih</var>) * <var>sar</var>
4553 </p>
4554 </dd>
4555 <dt> &lsquo;<samp>hsub, vsub</samp>&rsquo;</dt>
4556 <dd><p>horizontal and vertical chroma subsample values. For example for the
4557 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
4558 </p>
4559 </dd>
4560 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
4561 <dd><p>the number of input frame, starting from 0
4562 </p>
4563 </dd>
4564 <dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
4565 <dd><p>the position in the file of the input frame, NAN if unknown
4566 </p>
4567 </dd>
4568 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
4569 <dd><p>timestamp expressed in seconds, NAN if the input timestamp is unknown
4570 </p>
4571 </dd>
4572 </dl>
4573
4574 <p>The <var>out_w</var> and <var>out_h</var> parameters specify the expressions for
4575 the width and height of the output (cropped) video. They are
4576 evaluated just at the configuration of the filter.
4577 </p>
4578 <p>The default value of <var>out_w</var> is &quot;in_w&quot;, and the default value of
4579 <var>out_h</var> is &quot;in_h&quot;.
4580 </p>
4581 <p>The expression for <var>out_w</var> may depend on the value of <var>out_h</var>,
4582 and the expression for <var>out_h</var> may depend on <var>out_w</var>, but they
4583 cannot depend on <var>x</var> and <var>y</var>, as <var>x</var> and <var>y</var> are
4584 evaluated after <var>out_w</var> and <var>out_h</var>.
4585 </p>
4586 <p>The <var>x</var> and <var>y</var> parameters specify the expressions for the
4587 position of the top-left corner of the output (non-cropped) area. They
4588 are evaluated for each frame. If the evaluated value is not valid, it
4589 is approximated to the nearest valid value.
4590 </p>
4591 <p>The default value of <var>x</var> is &quot;(in_w-out_w)/2&quot;, and the default
4592 value for <var>y</var> is &quot;(in_h-out_h)/2&quot;, which set the cropped area at
4593 the center of the input image.
4594 </p>
4595 <p>The expression for <var>x</var> may depend on <var>y</var>, and the expression
4596 for <var>y</var> may depend on <var>x</var>.
4597 </p>
4598 <p>Follow some examples:
4599 </p><table><tr><td>&nbsp;</td><td><pre class="example"># crop the central input area with size 100x100
4600 crop=100:100
4601
4602 # crop the central input area with size 2/3 of the input video
4603 &quot;crop=2/3*in_w:2/3*in_h&quot;
4604
4605 # crop the input video central square
4606 crop=in_h
4607
4608 # delimit the rectangle with the top-left corner placed at position
4609 # 100:100 and the right-bottom corner corresponding to the right-bottom
4610 # corner of the input image.
4611 crop=in_w-100:in_h-100:100:100
4612
4613 # crop 10 pixels from the left and right borders, and 20 pixels from
4614 # the top and bottom borders
4615 &quot;crop=in_w-2*10:in_h-2*20&quot;
4616
4617 # keep only the bottom right quarter of the input image
4618 &quot;crop=in_w/2:in_h/2:in_w/2:in_h/2&quot;
4619
4620 # crop height for getting Greek harmony
4621 &quot;crop=in_w:1/PHI*in_w&quot;
4622
4623 # trembling effect
4624 &quot;crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(n/10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(n/7)&quot;
4625
4626 # erratic camera effect depending on timestamp
4627 &quot;crop=in_w/2:in_h/2:(in_w-out_w)/2+((in_w-out_w)/2)*sin(t*10):(in_h-out_h)/2 +((in_h-out_h)/2)*sin(t*13)&quot;
4628
4629 # set x depending on the value of y
4630 &quot;crop=in_w/2:in_h/2:y:10+10*sin(n/10)&quot;
4631 </pre></td></tr></table>
4632
4633 <a name="cropdetect"></a>
4634 <h2 class="section"><a href="ffmpeg.html#toc-cropdetect">22.5 cropdetect</a></h2>
4635
4636 <p>Auto-detect crop size.
4637 </p>
4638 <p>Calculate necessary cropping parameters and prints the recommended
4639 parameters through the logging system. The detected dimensions
4640 correspond to the non-black area of the input video.
4641 </p>
4642 <p>It accepts the syntax:
4643 </p><table><tr><td>&nbsp;</td><td><pre class="example">cropdetect[=<var>limit</var>[:<var>round</var>[:<var>reset</var>]]]
4644 </pre></td></tr></table>
4645
4646 <dl compact="compact">
4647 <dt> &lsquo;<samp>limit</samp>&rsquo;</dt>
4648 <dd><p>Threshold, which can be optionally specified from nothing (0) to
4649 everything (255), defaults to 24.
4650 </p>
4651 </dd>
4652 <dt> &lsquo;<samp>round</samp>&rsquo;</dt>
4653 <dd><p>Value which the width/height should be divisible by, defaults to
4654 16. The offset is automatically adjusted to center the video. Use 2 to
4655 get only even dimensions (needed for 4:2:2 video). 16 is best when
4656 encoding to most video codecs.
4657 </p>
4658 </dd>
4659 <dt> &lsquo;<samp>reset</samp>&rsquo;</dt>
4660 <dd><p>Counter that determines after how many frames cropdetect will reset
4661 the previously detected largest video area and start over to detect
4662 the current optimal crop area. Defaults to 0.
4663 </p>
4664 <p>This can be useful when channel logos distort the video area. 0
4665 indicates never reset and return the largest area encountered during
4666 playback.
4667 </p></dd>
4668 </dl>
4669
4670 <a name="delogo"></a>
4671 <h2 class="section"><a href="ffmpeg.html#toc-delogo">22.6 delogo</a></h2>
4672
4673 <p>Suppress a TV station logo by a simple interpolation of the surrounding
4674 pixels. Just set a rectangle covering the logo and watch it disappear
4675 (and sometimes something even uglier appear - your mileage may vary).
4676 </p>
4677 <p>The filter accepts parameters as a string of the form
4678 &quot;<var>x</var>:<var>y</var>:<var>w</var>:<var>h</var>:<var>band</var>&quot;, or as a list of
4679 <var>key</var>=<var>value</var> pairs, separated by &quot;:&quot;.
4680 </p>
4681 <p>The description of the accepted parameters follows.
4682 </p>
4683 <dl compact="compact">
4684 <dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
4685 <dd><p>Specify the top left corner coordinates of the logo. They must be
4686 specified.
4687 </p>
4688 </dd>
4689 <dt> &lsquo;<samp>w, h</samp>&rsquo;</dt>
4690 <dd><p>Specify the width and height of the logo to clear. They must be
4691 specified.
4692 </p>
4693 </dd>
4694 <dt> &lsquo;<samp>band, t</samp>&rsquo;</dt>
4695 <dd><p>Specify the thickness of the fuzzy edge of the rectangle (added to
4696 <var>w</var> and <var>h</var>). The default value is 4.
4697 </p>
4698 </dd>
4699 <dt> &lsquo;<samp>show</samp>&rsquo;</dt>
4700 <dd><p>When set to 1, a green rectangle is drawn on the screen to simplify
4701 finding the right <var>x</var>, <var>y</var>, <var>w</var>, <var>h</var> parameters, and
4702 <var>band</var> is set to 4. The default value is 0.
4703 </p>
4704 </dd>
4705 </dl>
4706
4707 <p>Some examples follow.
4708 </p>
4709 <ul>
4710 <li>
4711 Set a rectangle covering the area with top left corner coordinates 0,0
4712 and size 100x77, setting a band of size 10:
4713 <table><tr><td>&nbsp;</td><td><pre class="example">delogo=0:0:100:77:10
4714 </pre></td></tr></table>
4715
4716 </li><li>
4717 As the previous example, but use named options:
4718 <table><tr><td>&nbsp;</td><td><pre class="example">delogo=x=0:y=0:w=100:h=77:band=10
4719 </pre></td></tr></table>
4720
4721 </li></ul>
4722
4723 <a name="drawbox"></a>
4724 <h2 class="section"><a href="ffmpeg.html#toc-drawbox">22.7 drawbox</a></h2>
4725
4726 <p>Draw a colored box on the input image.
4727 </p>
4728 <p>It accepts the syntax:
4729 </p><table><tr><td>&nbsp;</td><td><pre class="example">drawbox=<var>x</var>:<var>y</var>:<var>width</var>:<var>height</var>:<var>color</var>
4730 </pre></td></tr></table>
4731
4732 <dl compact="compact">
4733 <dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
4734 <dd><p>Specify the top left corner coordinates of the box. Default to 0.
4735 </p>
4736 </dd>
4737 <dt> &lsquo;<samp>width, height</samp>&rsquo;</dt>
4738 <dd><p>Specify the width and height of the box, if 0 they are interpreted as
4739 the input width and height. Default to 0.
4740 </p>
4741 </dd>
4742 <dt> &lsquo;<samp>color</samp>&rsquo;</dt>
4743 <dd><p>Specify the color of the box to write, it can be the name of a color
4744 (case insensitive match) or a 0xRRGGBB[AA] sequence.
4745 </p></dd>
4746 </dl>
4747
4748 <p>Follow some examples:
4749 </p><table><tr><td>&nbsp;</td><td><pre class="example"># draw a black box around the edge of the input image
4750 drawbox
4751
4752 # draw a box with color red and an opacity of 50%
4753 drawbox=10:20:200:60:red@0.5&quot;
4754 </pre></td></tr></table>
4755
4756 <a name="drawtext"></a>
4757 <h2 class="section"><a href="ffmpeg.html#toc-drawtext">22.8 drawtext</a></h2>
4758
4759 <p>Draw text string or text from specified file on top of video using the
4760 libfreetype library.
4761 </p>
4762 <p>To enable compilation of this filter you need to configure FFmpeg with
4763 <code>--enable-libfreetype</code>.
4764 </p>
4765 <p>The filter also recognizes strftime() sequences in the provided text
4766 and expands them accordingly. Check the documentation of strftime().
4767 </p>
4768 <p>The filter accepts parameters as a list of <var>key</var>=<var>value</var> pairs,
4769 separated by &quot;:&quot;.
4770 </p>
4771 <p>The description of the accepted parameters follows.
4772 </p>
4773 <dl compact="compact">
4774 <dt> &lsquo;<samp>fontfile</samp>&rsquo;</dt>
4775 <dd><p>The font file to be used for drawing text. Path must be included.
4776 This parameter is mandatory.
4777 </p>
4778 </dd>
4779 <dt> &lsquo;<samp>text</samp>&rsquo;</dt>
4780 <dd><p>The text string to be drawn. The text must be a sequence of UTF-8
4781 encoded characters.
4782 This parameter is mandatory if no file is specified with the parameter
4783 <var>textfile</var>.
4784 </p>
4785 </dd>
4786 <dt> &lsquo;<samp>textfile</samp>&rsquo;</dt>
4787 <dd><p>A text file containing text to be drawn. The text must be a sequence
4788 of UTF-8 encoded characters.
4789 </p>
4790 <p>This parameter is mandatory if no text string is specified with the
4791 parameter <var>text</var>.
4792 </p>
4793 <p>If both text and textfile are specified, an error is thrown.
4794 </p>
4795 </dd>
4796 <dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
4797 <dd><p>The offsets where text will be drawn within the video frame.
4798 Relative to the top/left border of the output image.
4799 </p>
4800 <p>The default value of <var>x</var> and <var>y</var> is 0.
4801 </p>
4802 </dd>
4803 <dt> &lsquo;<samp>fontsize</samp>&rsquo;</dt>
4804 <dd><p>The font size to be used for drawing text.
4805 The default value of <var>fontsize</var> is 16.
4806 </p>
4807 </dd>
4808 <dt> &lsquo;<samp>fontcolor</samp>&rsquo;</dt>
4809 <dd><p>The color to be used for drawing fonts.
4810 Either a string (e.g. &quot;red&quot;) or in 0xRRGGBB[AA] format
4811 (e.g. &quot;0xff000033&quot;), possibly followed by an alpha specifier.
4812 The default value of <var>fontcolor</var> is &quot;black&quot;.
4813 </p>
4814 </dd>
4815 <dt> &lsquo;<samp>boxcolor</samp>&rsquo;</dt>
4816 <dd><p>The color to be used for drawing box around text.
4817 Either a string (e.g. &quot;yellow&quot;) or in 0xRRGGBB[AA] format
4818 (e.g. &quot;0xff00ff&quot;), possibly followed by an alpha specifier.
4819 The default value of <var>boxcolor</var> is &quot;white&quot;.
4820 </p>
4821 </dd>
4822 <dt> &lsquo;<samp>box</samp>&rsquo;</dt>
4823 <dd><p>Used to draw a box around text using background color.
4824 Value should be either 1 (enable) or 0 (disable).
4825 The default value of <var>box</var> is 0.
4826 </p>
4827 </dd>
4828 <dt> &lsquo;<samp>shadowx, shadowy</samp>&rsquo;</dt>
4829 <dd><p>The x and y offsets for the text shadow position with respect to the
4830 position of the text. They can be either positive or negative
4831 values. Default value for both is &quot;0&quot;.
4832 </p>
4833 </dd>
4834 <dt> &lsquo;<samp>shadowcolor</samp>&rsquo;</dt>
4835 <dd><p>The color to be used for drawing a shadow behind the drawn text.  It
4836 can be a color name (e.g. &quot;yellow&quot;) or a string in the 0xRRGGBB[AA]
4837 form (e.g. &quot;0xff00ff&quot;), possibly followed by an alpha specifier.
4838 The default value of <var>shadowcolor</var> is &quot;black&quot;.
4839 </p>
4840 </dd>
4841 <dt> &lsquo;<samp>ft_load_flags</samp>&rsquo;</dt>
4842 <dd><p>Flags to be used for loading the fonts.
4843 </p>
4844 <p>The flags map the corresponding flags supported by libfreetype, and are
4845 a combination of the following values:
4846 </p><dl compact="compact">
4847 <dt> <var>default</var></dt>
4848 <dt> <var>no_scale</var></dt>
4849 <dt> <var>no_hinting</var></dt>
4850 <dt> <var>render</var></dt>
4851 <dt> <var>no_bitmap</var></dt>
4852 <dt> <var>vertical_layout</var></dt>
4853 <dt> <var>force_autohint</var></dt>
4854 <dt> <var>crop_bitmap</var></dt>
4855 <dt> <var>pedantic</var></dt>
4856 <dt> <var>ignore_global_advance_width</var></dt>
4857 <dt> <var>no_recurse</var></dt>
4858 <dt> <var>ignore_transform</var></dt>
4859 <dt> <var>monochrome</var></dt>
4860 <dt> <var>linear_design</var></dt>
4861 <dt> <var>no_autohint</var></dt>
4862 <dt> <var>end table</var></dt>
4863 </dl>
4864
4865 <p>Default value is &quot;render&quot;.
4866 </p>
4867 <p>For more information consult the documentation for the FT_LOAD_*
4868 libfreetype flags.
4869 </p>
4870 </dd>
4871 <dt> &lsquo;<samp>tabsize</samp>&rsquo;</dt>
4872 <dd><p>The size in number of spaces to use for rendering the tab.
4873 Default value is 4.
4874 </p></dd>
4875 </dl>
4876
4877 <p>For example the command:
4878 </p><table><tr><td>&nbsp;</td><td><pre class="example">drawtext=&quot;fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'&quot;
4879 </pre></td></tr></table>
4880
4881 <p>will draw &quot;Test Text&quot; with font FreeSerif, using the default values
4882 for the optional parameters.
4883 </p>
4884 <p>The command:
4885 </p><table><tr><td>&nbsp;</td><td><pre class="example">drawtext=&quot;fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
4886           x=100: y=50: fontsize=24: fontcolor=yellow@0.2: box=1: boxcolor=red@0.2&quot;
4887 </pre></td></tr></table>
4888
4889 <p>will draw &rsquo;Test Text&rsquo; with font FreeSerif of size 24 at position x=100
4890 and y=50 (counting from the top-left corner of the screen), text is
4891 yellow with a red box around it. Both the text and the box have an
4892 opacity of 20%.
4893 </p>
4894 <p>Note that the double quotes are not necessary if spaces are not used
4895 within the parameter list.
4896 </p>
4897 <p>For more information about libfreetype, check:
4898 <a href="http://www.freetype.org/">http://www.freetype.org/</a>.
4899 </p>
4900 <a name="fade"></a>
4901 <h2 class="section"><a href="ffmpeg.html#toc-fade">22.9 fade</a></h2>
4902
4903 <p>Apply fade-in/out effect to input video.
4904 </p>
4905 <p>It accepts the parameters:
4906 <var>type</var>:<var>start_frame</var>:<var>nb_frames</var>
4907 </p>
4908 <p><var>type</var> specifies if the effect type, can be either &quot;in&quot; for
4909 fade-in, or &quot;out&quot; for a fade-out effect.
4910 </p>
4911 <p><var>start_frame</var> specifies the number of the start frame for starting
4912 to apply the fade effect.
4913 </p>
4914 <p><var>nb_frames</var> specifies the number of frames for which the fade
4915 effect has to last. At the end of the fade-in effect the output video
4916 will have the same intensity as the input video, at the end of the
4917 fade-out transition the output video will be completely black.
4918 </p>
4919 <p>A few usage examples follow, usable too as test scenarios.
4920 </p><table><tr><td>&nbsp;</td><td><pre class="example"># fade in first 30 frames of video
4921 fade=in:0:30
4922
4923 # fade out last 45 frames of a 200-frame video
4924 fade=out:155:45
4925
4926 # fade in first 25 frames and fade out last 25 frames of a 1000-frame video
4927 fade=in:0:25, fade=out:975:25
4928
4929 # make first 5 frames black, then fade in from frame 5-24
4930 fade=in:5:20
4931 </pre></td></tr></table>
4932
4933 <a name="fieldorder"></a>
4934 <h2 class="section"><a href="ffmpeg.html#toc-fieldorder">22.10 fieldorder</a></h2>
4935
4936 <p>Transform the field order of the input video.
4937 </p>
4938 <p>It accepts one parameter which specifies the required field order that
4939 the input interlaced video will be transformed to. The parameter can
4940 assume one of the following values:
4941 </p>
4942 <dl compact="compact">
4943 <dt> &lsquo;<samp>0 or bff</samp>&rsquo;</dt>
4944 <dd><p>output bottom field first
4945 </p></dd>
4946 <dt> &lsquo;<samp>1 or tff</samp>&rsquo;</dt>
4947 <dd><p>output top field first
4948 </p></dd>
4949 </dl>
4950
4951 <p>Default value is &quot;tff&quot;.
4952 </p>
4953 <p>Transformation is achieved by shifting the picture content up or down
4954 by one line, and filling the remaining line with appropriate picture content.
4955 This method is consistent with most broadcast field order converters.
4956 </p>
4957 <p>If the input video is not flagged as being interlaced, or it is already
4958 flagged as being of the required output field order then this filter does
4959 not alter the incoming video.
4960 </p>
4961 <p>This filter is very useful when converting to or from PAL DV material,
4962 which is bottom field first.
4963 </p>
4964 <p>For example:
4965 </p><table><tr><td>&nbsp;</td><td><pre class="example">./ffmpeg -i in.vob -vf &quot;fieldorder=bff&quot; out.dv
4966 </pre></td></tr></table>
4967
4968 <a name="fifo"></a>
4969 <h2 class="section"><a href="ffmpeg.html#toc-fifo">22.11 fifo</a></h2>
4970
4971 <p>Buffer input images and send them when they are requested.
4972 </p>
4973 <p>This filter is mainly useful when auto-inserted by the libavfilter
4974 framework.
4975 </p>
4976 <p>The filter does not take parameters.
4977 </p>
4978 <a name="format"></a>
4979 <h2 class="section"><a href="ffmpeg.html#toc-format">22.12 format</a></h2>
4980
4981 <p>Convert the input video to one of the specified pixel formats.
4982 Libavfilter will try to pick one that is supported for the input to
4983 the next filter.
4984 </p>
4985 <p>The filter accepts a list of pixel format names, separated by &quot;:&quot;,
4986 for example &quot;yuv420p:monow:rgb24&quot;.
4987 </p>
4988 <p>Some examples follow:
4989 </p><table><tr><td>&nbsp;</td><td><pre class="example"># convert the input video to the format &quot;yuv420p&quot;
4990 format=yuv420p
4991
4992 # convert the input video to any of the formats in the list
4993 format=yuv420p:yuv444p:yuv410p
4994 </pre></td></tr></table>
4995
4996 <p><a name="frei0r"></a>
4997 </p><a name="frei0r-1"></a>
4998 <h2 class="section"><a href="ffmpeg.html#toc-frei0r-1">22.13 frei0r</a></h2>
4999
5000 <p>Apply a frei0r effect to the input video.
5001 </p>
5002 <p>To enable compilation of this filter you need to install the frei0r
5003 header and configure FFmpeg with &ndash;enable-frei0r.
5004 </p>
5005 <p>The filter supports the syntax:
5006 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>filter_name</var>[{:|=}<var>param1</var>:<var>param2</var>:...:<var>paramN</var>]
5007 </pre></td></tr></table>
5008
5009 <p><var>filter_name</var> is the name to the frei0r effect to load. If the
5010 environment variable <code>FREI0R_PATH</code> is defined, the frei0r effect
5011 is searched in each one of the directories specified by the colon
5012 separated list in <code>FREIOR_PATH</code>, otherwise in the standard frei0r
5013 paths, which are in this order: &lsquo;<tt>HOME/.frei0r-1/lib/</tt>&rsquo;,
5014 &lsquo;<tt>/usr/local/lib/frei0r-1/</tt>&rsquo;, &lsquo;<tt>/usr/lib/frei0r-1/</tt>&rsquo;.
5015 </p>
5016 <p><var>param1</var>, <var>param2</var>, ... , <var>paramN</var> specify the parameters
5017 for the frei0r effect.
5018 </p>
5019 <p>A frei0r effect parameter can be a boolean (whose values are specified
5020 with &quot;y&quot; and &quot;n&quot;), a double, a color (specified by the syntax
5021 <var>R</var>/<var>G</var>/<var>B</var>, <var>R</var>, <var>G</var>, and <var>B</var> being float
5022 numbers from 0.0 to 1.0) or by an <code>av_parse_color()</code> color
5023 description), a position (specified by the syntax <var>X</var>/<var>Y</var>,
5024 <var>X</var> and <var>Y</var> being float numbers) and a string.
5025 </p>
5026 <p>The number and kind of parameters depend on the loaded effect. If an
5027 effect parameter is not specified the default value is set.
5028 </p>
5029 <p>Some examples follow:
5030 </p><table><tr><td>&nbsp;</td><td><pre class="example"># apply the distort0r effect, set the first two double parameters
5031 frei0r=distort0r:0.5:0.01
5032
5033 # apply the colordistance effect, takes a color as first parameter
5034 frei0r=colordistance:0.2/0.3/0.4
5035 frei0r=colordistance:violet
5036 frei0r=colordistance:0x112233
5037
5038 # apply the perspective effect, specify the top left and top right
5039 # image positions
5040 frei0r=perspective:0.2/0.2:0.8/0.2
5041 </pre></td></tr></table>
5042
5043 <p>For more information see:
5044 <a href="http://piksel.org/frei0r">http://piksel.org/frei0r</a>
5045 </p>
5046 <a name="gradfun"></a>
5047 <h2 class="section"><a href="ffmpeg.html#toc-gradfun">22.14 gradfun</a></h2>
5048
5049 <p>Fix the banding artifacts that are sometimes introduced into nearly flat
5050 regions by truncation to 8bit colordepth.
5051 Interpolate the gradients that should go where the bands are, and
5052 dither them.
5053 </p>
5054 <p>This filter is designed for playback only.  Do not use it prior to
5055 lossy compression, because compression tends to lose the dither and
5056 bring back the bands.
5057 </p>
5058 <p>The filter takes two optional parameters, separated by &rsquo;:&rsquo;:
5059 <var>strength</var>:<var>radius</var>
5060 </p>
5061 <p><var>strength</var> is the maximum amount by which the filter will change
5062 any one pixel. Also the threshold for detecting nearly flat
5063 regions. Acceptable values range from .51 to 255, default value is
5064 1.2, out-of-range values will be clipped to the valid range.
5065 </p>
5066 <p><var>radius</var> is the neighborhood to fit the gradient to. A larger
5067 radius makes for smoother gradients, but also prevents the filter from
5068 modifying the pixels near detailed regions. Acceptable values are
5069 8-32, default value is 16, out-of-range values will be clipped to the
5070 valid range.
5071 </p>
5072 <table><tr><td>&nbsp;</td><td><pre class="example"># default parameters
5073 gradfun=1.2:16
5074
5075 # omitting radius
5076 gradfun=1.2
5077 </pre></td></tr></table>
5078
5079 <a name="hflip"></a>
5080 <h2 class="section"><a href="ffmpeg.html#toc-hflip">22.15 hflip</a></h2>
5081
5082 <p>Flip the input video horizontally.
5083 </p>
5084 <p>For example to horizontally flip the video in input with
5085 &lsquo;<tt>ffmpeg</tt>&rsquo;:
5086 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -vf &quot;hflip&quot; out.avi
5087 </pre></td></tr></table>
5088
5089 <a name="hqdn3d"></a>
5090 <h2 class="section"><a href="ffmpeg.html#toc-hqdn3d">22.16 hqdn3d</a></h2>
5091
5092 <p>High precision/quality 3d denoise filter. This filter aims to reduce
5093 image noise producing smooth images and making still images really
5094 still. It should enhance compressibility.
5095 </p>
5096 <p>It accepts the following optional parameters:
5097 <var>luma_spatial</var>:<var>chroma_spatial</var>:<var>luma_tmp</var>:<var>chroma_tmp</var>
5098 </p>
5099 <dl compact="compact">
5100 <dt> &lsquo;<samp>luma_spatial</samp>&rsquo;</dt>
5101 <dd><p>a non-negative float number which specifies spatial luma strength,
5102 defaults to 4.0
5103 </p>
5104 </dd>
5105 <dt> &lsquo;<samp>chroma_spatial</samp>&rsquo;</dt>
5106 <dd><p>a non-negative float number which specifies spatial chroma strength,
5107 defaults to 3.0*<var>luma_spatial</var>/4.0
5108 </p>
5109 </dd>
5110 <dt> &lsquo;<samp>luma_tmp</samp>&rsquo;</dt>
5111 <dd><p>a float number which specifies luma temporal strength, defaults to
5112 6.0*<var>luma_spatial</var>/4.0
5113 </p>
5114 </dd>
5115 <dt> &lsquo;<samp>chroma_tmp</samp>&rsquo;</dt>
5116 <dd><p>a float number which specifies chroma temporal strength, defaults to
5117 <var>luma_tmp</var>*<var>chroma_spatial</var>/<var>luma_spatial</var>
5118 </p></dd>
5119 </dl>
5120
5121 <a name="lut_002c-lutrgb_002c-lutyuv"></a>
5122 <h2 class="section"><a href="ffmpeg.html#toc-lut_002c-lutrgb_002c-lutyuv">22.17 lut, lutrgb, lutyuv</a></h2>
5123
5124 <p>Compute a look-up table for binding each pixel component input value
5125 to an output value, and apply it to input video.
5126 </p>
5127 <p><var>lutyuv</var> applies a lookup table to a YUV input video, <var>lutrgb</var>
5128 to an RGB input video.
5129 </p>
5130 <p>These filters accept in input a &quot;:&quot;-separated list of options, which
5131 specify the expressions used for computing the lookup table for the
5132 corresponding pixel component values.
5133 </p>
5134 <p>The <var>lut</var> filter requires either YUV or RGB pixel formats in
5135 input, and accepts the options:
5136 </p><dl compact="compact">
5137 <dd><p><var>c0</var> (first  pixel component)
5138 <var>c1</var> (second pixel component)
5139 <var>c2</var> (third  pixel component)
5140 <var>c3</var> (fourth pixel component, corresponds to the alpha component)
5141 </p></dd>
5142 </dl>
5143
5144 <p>The exact component associated to each option depends on the format in
5145 input.
5146 </p>
5147 <p>The <var>lutrgb</var> filter requires RGB pixel formats in input, and
5148 accepts the options:
5149 </p><dl compact="compact">
5150 <dd><p><var>r</var> (red component)
5151 <var>g</var> (green component)
5152 <var>b</var> (blue component)
5153 <var>a</var> (alpha component)
5154 </p></dd>
5155 </dl>
5156
5157 <p>The <var>lutyuv</var> filter requires YUV pixel formats in input, and
5158 accepts the options:
5159 </p><dl compact="compact">
5160 <dd><p><var>y</var> (Y/luminance component)
5161 <var>u</var> (U/Cb component)
5162 <var>v</var> (V/Cr component)
5163 <var>a</var> (alpha component)
5164 </p></dd>
5165 </dl>
5166
5167 <p>The expressions can contain the following constants and functions:
5168 </p>
5169 <dl compact="compact">
5170 <dt> &lsquo;<samp>E, PI, PHI</samp>&rsquo;</dt>
5171 <dd><p>the corresponding mathematical approximated values for e
5172 (euler number), pi (greek PI), PHI (golden ratio)
5173 </p>
5174 </dd>
5175 <dt> &lsquo;<samp>w, h</samp>&rsquo;</dt>
5176 <dd><p>the input width and heigth
5177 </p>
5178 </dd>
5179 <dt> &lsquo;<samp>val</samp>&rsquo;</dt>
5180 <dd><p>input value for the pixel component
5181 </p>
5182 </dd>
5183 <dt> &lsquo;<samp>clipval</samp>&rsquo;</dt>
5184 <dd><p>the input value clipped in the <var>minval</var>-<var>maxval</var> range
5185 </p>
5186 </dd>
5187 <dt> &lsquo;<samp>maxval</samp>&rsquo;</dt>
5188 <dd><p>maximum value for the pixel component
5189 </p>
5190 </dd>
5191 <dt> &lsquo;<samp>minval</samp>&rsquo;</dt>
5192 <dd><p>minimum value for the pixel component
5193 </p>
5194 </dd>
5195 <dt> &lsquo;<samp>negval</samp>&rsquo;</dt>
5196 <dd><p>the negated value for the pixel component value clipped in the
5197 <var>minval</var>-<var>maxval</var> range , it corresponds to the expression
5198 &quot;maxval-clipval+minval&quot;
5199 </p>
5200 </dd>
5201 <dt> &lsquo;<samp>clip(val)</samp>&rsquo;</dt>
5202 <dd><p>the computed value in <var>val</var> clipped in the
5203 <var>minval</var>-<var>maxval</var> range
5204 </p>
5205 </dd>
5206 <dt> &lsquo;<samp>gammaval(gamma)</samp>&rsquo;</dt>
5207 <dd><p>the computed gamma correction value of the pixel component value
5208 clipped in the <var>minval</var>-<var>maxval</var> range, corresponds to the
5209 expression
5210 &quot;pow((clipval-minval)/(maxval-minval)\,<var>gamma</var>)*(maxval-minval)+minval&quot;
5211 </p>
5212 </dd>
5213 </dl>
5214
5215 <p>All expressions default to &quot;val&quot;.
5216 </p>
5217 <p>Some examples follow:
5218 </p><table><tr><td>&nbsp;</td><td><pre class="example"># negate input video
5219 lutrgb=&quot;r=maxval+minval-val:g=maxval+minval-val:b=maxval+minval-val&quot;
5220 lutyuv=&quot;y=maxval+minval-val:u=maxval+minval-val:v=maxval+minval-val&quot;
5221
5222 # the above is the same as
5223 lutrgb=&quot;r=negval:g=negval:b=negval&quot;
5224 lutyuv=&quot;y=negval:u=negval:v=negval&quot;
5225
5226 # negate luminance
5227 lutyuv=negval
5228
5229 # remove chroma components, turns the video into a graytone image
5230 lutyuv=&quot;u=128:v=128&quot;
5231
5232 # apply a luma burning effect
5233 lutyuv=&quot;y=2*val&quot;
5234
5235 # remove green and blue components
5236 lutrgb=&quot;g=0:b=0&quot;
5237
5238 # set a constant alpha channel value on input
5239 format=rgba,lutrgb=a=&quot;maxval-minval/2&quot;
5240
5241 # correct luminance gamma by a 0.5 factor
5242 lutyuv=y=gammaval(0.5)
5243 </pre></td></tr></table>
5244
5245 <a name="mp"></a>
5246 <h2 class="section"><a href="ffmpeg.html#toc-mp">22.18 mp</a></h2>
5247
5248 <p>Apply an MPlayer filter to the input video.
5249 </p>
5250 <p>This filter provides a wrapper around most of the filters of
5251 MPlayer/MEncoder.
5252 </p>
5253 <p>This wrapper is considered experimental. Some of the wrapped filters
5254 may not work properly and we may drop support for them, as they will
5255 be implemented natively into FFmpeg. Thus you should avoid
5256 depending on them when writing portable scripts.
5257 </p>
5258 <p>The filters accepts the parameters:
5259 <var>filter_name</var>[:=]<var>filter_params</var>
5260 </p>
5261 <p><var>filter_name</var> is the name of a supported MPlayer filter,
5262 <var>filter_params</var> is a string containing the parameters accepted by
5263 the named filter.
5264 </p>
5265 <p>The list of the currently supported filters follows:
5266 </p><dl compact="compact">
5267 <dt> <var>2xsai</var></dt>
5268 <dt> <var>decimate</var></dt>
5269 <dt> <var>denoise3d</var></dt>
5270 <dt> <var>detc</var></dt>
5271 <dt> <var>dint</var></dt>
5272 <dt> <var>divtc</var></dt>
5273 <dt> <var>down3dright</var></dt>
5274 <dt> <var>dsize</var></dt>
5275 <dt> <var>eq2</var></dt>
5276 <dt> <var>eq</var></dt>
5277 <dt> <var>field</var></dt>
5278 <dt> <var>fil</var></dt>
5279 <dt> <var>fixpts</var></dt>
5280 <dt> <var>framestep</var></dt>
5281 <dt> <var>fspp</var></dt>
5282 <dt> <var>geq</var></dt>
5283 <dt> <var>harddup</var></dt>
5284 <dt> <var>hqdn3d</var></dt>
5285 <dt> <var>hue</var></dt>
5286 <dt> <var>il</var></dt>
5287 <dt> <var>ilpack</var></dt>
5288 <dt> <var>ivtc</var></dt>
5289 <dt> <var>kerndeint</var></dt>
5290 <dt> <var>mcdeint</var></dt>
5291 <dt> <var>mirror</var></dt>
5292 <dt> <var>noise</var></dt>
5293 <dt> <var>ow</var></dt>
5294 <dt> <var>palette</var></dt>
5295 <dt> <var>perspective</var></dt>
5296 <dt> <var>phase</var></dt>
5297 <dt> <var>pp7</var></dt>
5298 <dt> <var>pullup</var></dt>
5299 <dt> <var>qp</var></dt>
5300 <dt> <var>rectangle</var></dt>
5301 <dt> <var>remove-logo</var></dt>
5302 <dt> <var>rotate</var></dt>
5303 <dt> <var>sab</var></dt>
5304 <dt> <var>screenshot</var></dt>
5305 <dt> <var>smartblur</var></dt>
5306 <dt> <var>softpulldown</var></dt>
5307 <dt> <var>softskip</var></dt>
5308 <dt> <var>spp</var></dt>
5309 <dt> <var>swapuv</var></dt>
5310 <dt> <var>telecine</var></dt>
5311 <dt> <var>tile</var></dt>
5312 <dt> <var>tinterlace</var></dt>
5313 <dt> <var>unsharp</var></dt>
5314 <dt> <var>uspp</var></dt>
5315 <dt> <var>yuvcsp</var></dt>
5316 <dt> <var>yvu9</var></dt>
5317 </dl>
5318
5319 <p>The parameter syntax and behavior for the listed filters are the same
5320 of the corresponding MPlayer filters. For detailed instructions check
5321 the &quot;VIDEO FILTERS&quot; section in the MPlayer manual.
5322 </p>
5323 <p>Some examples follow:
5324 </p><table><tr><td>&nbsp;</td><td><pre class="example"># remove a logo by interpolating the surrounding pixels
5325 mp=delogo=200:200:80:20:1
5326
5327 # adjust gamma, brightness, contrast
5328 mp=eq2=1.0:2:0.5
5329
5330 # tweak hue and saturation
5331 mp=hue=100:-10
5332 </pre></td></tr></table>
5333
5334 <p>See also mplayer(1), <a href="http://www.mplayerhq.hu/">http://www.mplayerhq.hu/</a>.
5335 </p>
5336 <a name="negate"></a>
5337 <h2 class="section"><a href="ffmpeg.html#toc-negate">22.19 negate</a></h2>
5338
5339 <p>Negate input video.
5340 </p>
5341 <p>This filter accepts an integer in input, if non-zero it negates the
5342 alpha component (if available). The default value in input is 0.
5343 </p>
5344 <a name="noformat"></a>
5345 <h2 class="section"><a href="ffmpeg.html#toc-noformat">22.20 noformat</a></h2>
5346
5347 <p>Force libavfilter not to use any of the specified pixel formats for the
5348 input to the next filter.
5349 </p>
5350 <p>The filter accepts a list of pixel format names, separated by &quot;:&quot;,
5351 for example &quot;yuv420p:monow:rgb24&quot;.
5352 </p>
5353 <p>Some examples follow:
5354 </p><table><tr><td>&nbsp;</td><td><pre class="example"># force libavfilter to use a format different from &quot;yuv420p&quot; for the
5355 # input to the vflip filter
5356 noformat=yuv420p,vflip
5357
5358 # convert the input video to any of the formats not contained in the list
5359 noformat=yuv420p:yuv444p:yuv410p
5360 </pre></td></tr></table>
5361
5362 <a name="null"></a>
5363 <h2 class="section"><a href="ffmpeg.html#toc-null">22.21 null</a></h2>
5364
5365 <p>Pass the video source unchanged to the output.
5366 </p>
5367 <a name="ocv"></a>
5368 <h2 class="section"><a href="ffmpeg.html#toc-ocv">22.22 ocv</a></h2>
5369
5370 <p>Apply video transform using libopencv.
5371 </p>
5372 <p>To enable this filter install libopencv library and headers and
5373 configure FFmpeg with &ndash;enable-libopencv.
5374 </p>
5375 <p>The filter takes the parameters: <var>filter_name</var>{:=}<var>filter_params</var>.
5376 </p>
5377 <p><var>filter_name</var> is the name of the libopencv filter to apply.
5378 </p>
5379 <p><var>filter_params</var> specifies the parameters to pass to the libopencv
5380 filter. If not specified the default values are assumed.
5381 </p>
5382 <p>Refer to the official libopencv documentation for more precise
5383 informations:
5384 <a href="http://opencv.willowgarage.com/documentation/c/image_filtering.html">http://opencv.willowgarage.com/documentation/c/image_filtering.html</a>
5385 </p>
5386 <p>Follows the list of supported libopencv filters.
5387 </p>
5388 <p><a name="dilate"></a>
5389 </p><a name="dilate-1"></a>
5390 <h3 class="subsection"><a href="ffmpeg.html#toc-dilate-1">22.22.1 dilate</a></h3>
5391
5392 <p>Dilate an image by using a specific structuring element.
5393 This filter corresponds to the libopencv function <code>cvDilate</code>.
5394 </p>
5395 <p>It accepts the parameters: <var>struct_el</var>:<var>nb_iterations</var>.
5396 </p>
5397 <p><var>struct_el</var> represents a structuring element, and has the syntax:
5398 <var>cols</var>x<var>rows</var>+<var>anchor_x</var>x<var>anchor_y</var>/<var>shape</var>
5399 </p>
5400 <p><var>cols</var> and <var>rows</var> represent the number of colums and rows of
5401 the structuring element, <var>anchor_x</var> and <var>anchor_y</var> the anchor
5402 point, and <var>shape</var> the shape for the structuring element, and
5403 can be one of the values &quot;rect&quot;, &quot;cross&quot;, &quot;ellipse&quot;, &quot;custom&quot;.
5404 </p>
5405 <p>If the value for <var>shape</var> is &quot;custom&quot;, it must be followed by a
5406 string of the form &quot;=<var>filename</var>&quot;. The file with name
5407 <var>filename</var> is assumed to represent a binary image, with each
5408 printable character corresponding to a bright pixel. When a custom
5409 <var>shape</var> is used, <var>cols</var> and <var>rows</var> are ignored, the number
5410 or columns and rows of the read file are assumed instead.
5411 </p>
5412 <p>The default value for <var>struct_el</var> is &quot;3x3+0x0/rect&quot;.
5413 </p>
5414 <p><var>nb_iterations</var> specifies the number of times the transform is
5415 applied to the image, and defaults to 1.
5416 </p>
5417 <p>Follow some example:
5418 </p><table><tr><td>&nbsp;</td><td><pre class="example"># use the default values
5419 ocv=dilate
5420
5421 # dilate using a structuring element with a 5x5 cross, iterate two times
5422 ocv=dilate=5x5+2x2/cross:2
5423
5424 # read the shape from the file diamond.shape, iterate two times
5425 # the file diamond.shape may contain a pattern of characters like this:
5426 #   *
5427 #  ***
5428 # *****
5429 #  ***
5430 #   *
5431 # the specified cols and rows are ignored (but not the anchor point coordinates)
5432 ocv=0x0+2x2/custom=diamond.shape:2
5433 </pre></td></tr></table>
5434
5435 <a name="erode"></a>
5436 <h3 class="subsection"><a href="ffmpeg.html#toc-erode">22.22.2 erode</a></h3>
5437
5438 <p>Erode an image by using a specific structuring element.
5439 This filter corresponds to the libopencv function <code>cvErode</code>.
5440 </p>
5441 <p>The filter accepts the parameters: <var>struct_el</var>:<var>nb_iterations</var>,
5442 with the same syntax and semantics as the <a href="#dilate">dilate</a> filter.
5443 </p>
5444 <a name="smooth"></a>
5445 <h3 class="subsection"><a href="ffmpeg.html#toc-smooth">22.22.3 smooth</a></h3>
5446
5447 <p>Smooth the input video.
5448 </p>
5449 <p>The filter takes the following parameters:
5450 <var>type</var>:<var>param1</var>:<var>param2</var>:<var>param3</var>:<var>param4</var>.
5451 </p>
5452 <p><var>type</var> is the type of smooth filter to apply, and can be one of
5453 the following values: &quot;blur&quot;, &quot;blur_no_scale&quot;, &quot;median&quot;, &quot;gaussian&quot;,
5454 &quot;bilateral&quot;. The default value is &quot;gaussian&quot;.
5455 </p>
5456 <p><var>param1</var>, <var>param2</var>, <var>param3</var>, and <var>param4</var> are
5457 parameters whose meanings depend on smooth type. <var>param1</var> and
5458 <var>param2</var> accept integer positive values or 0, <var>param3</var> and
5459 <var>param4</var> accept float values.
5460 </p>
5461 <p>The default value for <var>param1</var> is 3, the default value for the
5462 other parameters is 0.
5463 </p>
5464 <p>These parameters correspond to the parameters assigned to the
5465 libopencv function <code>cvSmooth</code>.
5466 </p>
5467 <a name="overlay"></a>
5468 <h2 class="section"><a href="ffmpeg.html#toc-overlay">22.23 overlay</a></h2>
5469
5470 <p>Overlay one video on top of another.
5471 </p>
5472 <p>It takes two inputs and one output, the first input is the &quot;main&quot;
5473 video on which the second input is overlayed.
5474 </p>
5475 <p>It accepts the parameters: <var>x</var>:<var>y</var>.
5476 </p>
5477 <p><var>x</var> is the x coordinate of the overlayed video on the main video,
5478 <var>y</var> is the y coordinate. The parameters are expressions containing
5479 the following parameters:
5480 </p>
5481 <dl compact="compact">
5482 <dt> &lsquo;<samp>main_w, main_h</samp>&rsquo;</dt>
5483 <dd><p>main input width and height
5484 </p>
5485 </dd>
5486 <dt> &lsquo;<samp>W, H</samp>&rsquo;</dt>
5487 <dd><p>same as <var>main_w</var> and <var>main_h</var>
5488 </p>
5489 </dd>
5490 <dt> &lsquo;<samp>overlay_w, overlay_h</samp>&rsquo;</dt>
5491 <dd><p>overlay input width and height
5492 </p>
5493 </dd>
5494 <dt> &lsquo;<samp>w, h</samp>&rsquo;</dt>
5495 <dd><p>same as <var>overlay_w</var> and <var>overlay_h</var>
5496 </p></dd>
5497 </dl>
5498
5499 <p>Be aware that frames are taken from each input video in timestamp
5500 order, hence, if their initial timestamps differ, it is a a good idea
5501 to pass the two inputs through a <var>setpts=PTS-STARTPTS</var> filter to
5502 have them begin in the same zero timestamp, as it does the example for
5503 the <var>movie</var> filter.
5504 </p>
5505 <p>Follow some examples:
5506 </p><table><tr><td>&nbsp;</td><td><pre class="example"># draw the overlay at 10 pixels from the bottom right
5507 # corner of the main video.
5508 overlay=main_w-overlay_w-10:main_h-overlay_h-10
5509
5510 # insert a transparent PNG logo in the bottom left corner of the input
5511 movie=logo.png [logo];
5512 [in][logo] overlay=10:main_h-overlay_h-10 [out]
5513
5514 # insert 2 different transparent PNG logos (second logo on bottom
5515 # right corner):
5516 movie=logo1.png [logo1];
5517 movie=logo2.png [logo2];
5518 [in][logo1]       overlay=10:H-h-10 [in+logo1];
5519 [in+logo1][logo2] overlay=W-w-10:H-h-10 [out]
5520
5521 # add a transparent color layer on top of the main video,
5522 # WxH specifies the size of the main input to the overlay filter
5523 color=red.3:WxH [over]; [in][over] overlay [out]
5524 </pre></td></tr></table>
5525
5526 <p>You can chain togheter more overlays but the efficiency of such
5527 approach is yet to be tested.
5528 </p>
5529 <a name="pad"></a>
5530 <h2 class="section"><a href="ffmpeg.html#toc-pad">22.24 pad</a></h2>
5531
5532 <p>Add paddings to the input image, and places the original input at the
5533 given coordinates <var>x</var>, <var>y</var>.
5534 </p>
5535 <p>It accepts the following parameters:
5536 <var>width</var>:<var>height</var>:<var>x</var>:<var>y</var>:<var>color</var>.
5537 </p>
5538 <p>The parameters <var>width</var>, <var>height</var>, <var>x</var>, and <var>y</var> are
5539 expressions containing the following constants:
5540 </p>
5541 <dl compact="compact">
5542 <dt> &lsquo;<samp>E, PI, PHI</samp>&rsquo;</dt>
5543 <dd><p>the corresponding mathematical approximated values for e
5544 (euler number), pi (greek PI), phi (golden ratio)
5545 </p>
5546 </dd>
5547 <dt> &lsquo;<samp>in_w, in_h</samp>&rsquo;</dt>
5548 <dd><p>the input video width and heigth
5549 </p>
5550 </dd>
5551 <dt> &lsquo;<samp>iw, ih</samp>&rsquo;</dt>
5552 <dd><p>same as <var>in_w</var> and <var>in_h</var>
5553 </p>
5554 </dd>
5555 <dt> &lsquo;<samp>out_w, out_h</samp>&rsquo;</dt>
5556 <dd><p>the output width and heigth, that is the size of the padded area as
5557 specified by the <var>width</var> and <var>height</var> expressions
5558 </p>
5559 </dd>
5560 <dt> &lsquo;<samp>ow, oh</samp>&rsquo;</dt>
5561 <dd><p>same as <var>out_w</var> and <var>out_h</var>
5562 </p>
5563 </dd>
5564 <dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
5565 <dd><p>x and y offsets as specified by the <var>x</var> and <var>y</var>
5566 expressions, or NAN if not yet specified
5567 </p>
5568 </dd>
5569 <dt> &lsquo;<samp>a</samp>&rsquo;</dt>
5570 <dd><p>same as <var>iw</var> / <var>ih</var>
5571 </p>
5572 </dd>
5573 <dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
5574 <dd><p>input sample aspect ratio
5575 </p>
5576 </dd>
5577 <dt> &lsquo;<samp>dar</samp>&rsquo;</dt>
5578 <dd><p>input display aspect ratio, it is the same as (<var>iw</var> / <var>ih</var>) * <var>sar</var>
5579 </p>
5580 </dd>
5581 <dt> &lsquo;<samp>hsub, vsub</samp>&rsquo;</dt>
5582 <dd><p>horizontal and vertical chroma subsample values. For example for the
5583 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
5584 </p></dd>
5585 </dl>
5586
5587 <p>Follows the description of the accepted parameters.
5588 </p>
5589 <dl compact="compact">
5590 <dt> &lsquo;<samp>width, height</samp>&rsquo;</dt>
5591 <dd>
5592 <p>Specify the size of the output image with the paddings added. If the
5593 value for <var>width</var> or <var>height</var> is 0, the corresponding input size
5594 is used for the output.
5595 </p>
5596 <p>The <var>width</var> expression can reference the value set by the
5597 <var>height</var> expression, and viceversa.
5598 </p>
5599 <p>The default value of <var>width</var> and <var>height</var> is 0.
5600 </p>
5601 </dd>
5602 <dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
5603 <dd>
5604 <p>Specify the offsets where to place the input image in the padded area
5605 with respect to the top/left border of the output image.
5606 </p>
5607 <p>The <var>x</var> expression can reference the value set by the <var>y</var>
5608 expression, and viceversa.
5609 </p>
5610 <p>The default value of <var>x</var> and <var>y</var> is 0.
5611 </p>
5612 </dd>
5613 <dt> &lsquo;<samp>color</samp>&rsquo;</dt>
5614 <dd>
5615 <p>Specify the color of the padded area, it can be the name of a color
5616 (case insensitive match) or a 0xRRGGBB[AA] sequence.
5617 </p>
5618 <p>The default value of <var>color</var> is &quot;black&quot;.
5619 </p>
5620 </dd>
5621 </dl>
5622
5623 <p>Some examples follow:
5624 </p>
5625 <table><tr><td>&nbsp;</td><td><pre class="example"># Add paddings with color &quot;violet&quot; to the input video. Output video
5626 # size is 640x480, the top-left corner of the input video is placed at
5627 # column 0, row 40.
5628 pad=640:480:0:40:violet
5629
5630 # pad the input to get an output with dimensions increased bt 3/2,
5631 # and put the input video at the center of the padded area
5632 pad=&quot;3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2&quot;
5633
5634 # pad the input to get a squared output with size equal to the maximum
5635 # value between the input width and height, and put the input video at
5636 # the center of the padded area
5637 pad=&quot;max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2&quot;
5638
5639 # pad the input to get a final w/h ratio of 16:9
5640 pad=&quot;ih*16/9:ih:(ow-iw)/2:(oh-ih)/2&quot;
5641
5642 # for anamorphic video, in order to set the output display aspect ratio,
5643 # it is necessary to use sar in the expression, according to the relation:
5644 # (ih * X / ih) * sar = output_dar
5645 # X = output_dar / sar
5646 pad=&quot;ih*16/9/sar:ih:(ow-iw)/2:(oh-ih)/2&quot;
5647
5648 # double output size and put the input video in the bottom-right
5649 # corner of the output padded area
5650 pad=&quot;2*iw:2*ih:ow-iw:oh-ih&quot;
5651 </pre></td></tr></table>
5652
5653 <a name="pixdesctest"></a>
5654 <h2 class="section"><a href="ffmpeg.html#toc-pixdesctest">22.25 pixdesctest</a></h2>
5655
5656 <p>Pixel format descriptor test filter, mainly useful for internal
5657 testing. The output video should be equal to the input video.
5658 </p>
5659 <p>For example:
5660 </p><table><tr><td>&nbsp;</td><td><pre class="example">format=monow, pixdesctest
5661 </pre></td></tr></table>
5662
5663 <p>can be used to test the monowhite pixel format descriptor definition.
5664 </p>
5665 <a name="scale"></a>
5666 <h2 class="section"><a href="ffmpeg.html#toc-scale">22.26 scale</a></h2>
5667
5668 <p>Scale the input video to <var>width</var>:<var>height</var> and/or convert the image format.
5669 </p>
5670 <p>The parameters <var>width</var> and <var>height</var> are expressions containing
5671 the following constants:
5672 </p>
5673 <dl compact="compact">
5674 <dt> &lsquo;<samp>E, PI, PHI</samp>&rsquo;</dt>
5675 <dd><p>the corresponding mathematical approximated values for e
5676 (euler number), pi (greek PI), phi (golden ratio)
5677 </p>
5678 </dd>
5679 <dt> &lsquo;<samp>in_w, in_h</samp>&rsquo;</dt>
5680 <dd><p>the input width and heigth
5681 </p>
5682 </dd>
5683 <dt> &lsquo;<samp>iw, ih</samp>&rsquo;</dt>
5684 <dd><p>same as <var>in_w</var> and <var>in_h</var>
5685 </p>
5686 </dd>
5687 <dt> &lsquo;<samp>out_w, out_h</samp>&rsquo;</dt>
5688 <dd><p>the output (cropped) width and heigth
5689 </p>
5690 </dd>
5691 <dt> &lsquo;<samp>ow, oh</samp>&rsquo;</dt>
5692 <dd><p>same as <var>out_w</var> and <var>out_h</var>
5693 </p>
5694 </dd>
5695 <dt> &lsquo;<samp>a</samp>&rsquo;</dt>
5696 <dd><p>same as <var>iw</var> / <var>ih</var>
5697 </p>
5698 </dd>
5699 <dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
5700 <dd><p>input sample aspect ratio
5701 </p>
5702 </dd>
5703 <dt> &lsquo;<samp>dar</samp>&rsquo;</dt>
5704 <dd><p>input display aspect ratio, it is the same as (<var>iw</var> / <var>ih</var>) * <var>sar</var>
5705 </p>
5706 </dd>
5707 <dt> &lsquo;<samp>hsub, vsub</samp>&rsquo;</dt>
5708 <dd><p>horizontal and vertical chroma subsample values. For example for the
5709 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
5710 </p></dd>
5711 </dl>
5712
5713 <p>If the input image format is different from the format requested by
5714 the next filter, the scale filter will convert the input to the
5715 requested format.
5716 </p>
5717 <p>If the value for <var>width</var> or <var>height</var> is 0, the respective input
5718 size is used for the output.
5719 </p>
5720 <p>If the value for <var>width</var> or <var>height</var> is -1, the scale filter will
5721 use, for the respective output size, a value that maintains the aspect
5722 ratio of the input image.
5723 </p>
5724 <p>The default value of <var>width</var> and <var>height</var> is 0.
5725 </p>
5726 <p>Some examples follow:
5727 </p><table><tr><td>&nbsp;</td><td><pre class="example"># scale the input video to a size of 200x100.
5728 scale=200:100
5729
5730 # scale the input to 2x
5731 scale=2*iw:2*ih
5732 # the above is the same as
5733 scale=2*in_w:2*in_h
5734
5735 # scale the input to half size
5736 scale=iw/2:ih/2
5737
5738 # increase the width, and set the height to the same size
5739 scale=3/2*iw:ow
5740
5741 # seek for Greek harmony
5742 scale=iw:1/PHI*iw
5743 scale=ih*PHI:ih
5744
5745 # increase the height, and set the width to 3/2 of the height
5746 scale=3/2*oh:3/5*ih
5747
5748 # increase the size, but make the size a multiple of the chroma
5749 scale=&quot;trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub&quot;
5750
5751 # increase the width to a maximum of 500 pixels, keep the same input aspect ratio
5752 scale='min(500\, iw*3/2):-1'
5753 </pre></td></tr></table>
5754
5755 <a name="select"></a>
5756 <h2 class="section"><a href="ffmpeg.html#toc-select">22.27 select</a></h2>
5757 <p>Select frames to pass in output.
5758 </p>
5759 <p>It accepts in input an expression, which is evaluated for each input
5760 frame. If the expression is evaluated to a non-zero value, the frame
5761 is selected and passed to the output, otherwise it is discarded.
5762 </p>
5763 <p>The expression can contain the following constants:
5764 </p>
5765 <dl compact="compact">
5766 <dt> &lsquo;<samp>PI</samp>&rsquo;</dt>
5767 <dd><p>Greek PI
5768 </p>
5769 </dd>
5770 <dt> &lsquo;<samp>PHI</samp>&rsquo;</dt>
5771 <dd><p>golden ratio
5772 </p>
5773 </dd>
5774 <dt> &lsquo;<samp>E</samp>&rsquo;</dt>
5775 <dd><p>Euler number
5776 </p>
5777 </dd>
5778 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
5779 <dd><p>the sequential number of the filtered frame, starting from 0
5780 </p>
5781 </dd>
5782 <dt> &lsquo;<samp>selected_n</samp>&rsquo;</dt>
5783 <dd><p>the sequential number of the selected frame, starting from 0
5784 </p>
5785 </dd>
5786 <dt> &lsquo;<samp>prev_selected_n</samp>&rsquo;</dt>
5787 <dd><p>the sequential number of the last selected frame, NAN if undefined
5788 </p>
5789 </dd>
5790 <dt> &lsquo;<samp>TB</samp>&rsquo;</dt>
5791 <dd><p>timebase of the input timestamps
5792 </p>
5793 </dd>
5794 <dt> &lsquo;<samp>pts</samp>&rsquo;</dt>
5795 <dd><p>the PTS (Presentation TimeStamp) of the filtered video frame,
5796 expressed in <var>TB</var> units, NAN if undefined
5797 </p>
5798 </dd>
5799 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
5800 <dd><p>the PTS (Presentation TimeStamp) of the filtered video frame,
5801 expressed in seconds, NAN if undefined
5802 </p>
5803 </dd>
5804 <dt> &lsquo;<samp>prev_pts</samp>&rsquo;</dt>
5805 <dd><p>the PTS of the previously filtered video frame, NAN if undefined
5806 </p>
5807 </dd>
5808 <dt> &lsquo;<samp>prev_selected_pts</samp>&rsquo;</dt>
5809 <dd><p>the PTS of the last previously filtered video frame, NAN if undefined
5810 </p>
5811 </dd>
5812 <dt> &lsquo;<samp>prev_selected_t</samp>&rsquo;</dt>
5813 <dd><p>the PTS of the last previously selected video frame, NAN if undefined
5814 </p>
5815 </dd>
5816 <dt> &lsquo;<samp>start_pts</samp>&rsquo;</dt>
5817 <dd><p>the PTS of the first video frame in the video, NAN if undefined
5818 </p>
5819 </dd>
5820 <dt> &lsquo;<samp>start_t</samp>&rsquo;</dt>
5821 <dd><p>the time of the first video frame in the video, NAN if undefined
5822 </p>
5823 </dd>
5824 <dt> &lsquo;<samp>pict_type</samp>&rsquo;</dt>
5825 <dd><p>the picture type of the filtered frame, can assume one of the following
5826 values:
5827 </p><dl compact="compact">
5828 <dt> &lsquo;<samp>PICT_TYPE_I</samp>&rsquo;</dt>
5829 <dt> &lsquo;<samp>PICT_TYPE_P</samp>&rsquo;</dt>
5830 <dt> &lsquo;<samp>PICT_TYPE_B</samp>&rsquo;</dt>
5831 <dt> &lsquo;<samp>PICT_TYPE_S</samp>&rsquo;</dt>
5832 <dt> &lsquo;<samp>PICT_TYPE_SI</samp>&rsquo;</dt>
5833 <dt> &lsquo;<samp>PICT_TYPE_SP</samp>&rsquo;</dt>
5834 <dt> &lsquo;<samp>PICT_TYPE_BI</samp>&rsquo;</dt>
5835 </dl>
5836
5837 </dd>
5838 <dt> &lsquo;<samp>interlace_type</samp>&rsquo;</dt>
5839 <dd><p>the frame interlace type, can assume one of the following values:
5840 </p><dl compact="compact">
5841 <dt> &lsquo;<samp>INTERLACE_TYPE_P</samp>&rsquo;</dt>
5842 <dd><p>the frame is progressive (not interlaced)
5843 </p></dd>
5844 <dt> &lsquo;<samp>INTERLACE_TYPE_T</samp>&rsquo;</dt>
5845 <dd><p>the frame is top-field-first
5846 </p></dd>
5847 <dt> &lsquo;<samp>INTERLACE_TYPE_B</samp>&rsquo;</dt>
5848 <dd><p>the frame is bottom-field-first
5849 </p></dd>
5850 </dl>
5851
5852 </dd>
5853 <dt> &lsquo;<samp>key</samp>&rsquo;</dt>
5854 <dd><p>1 if the filtered frame is a key-frame, 0 otherwise
5855 </p>
5856 </dd>
5857 <dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
5858 <dd><p>the position in the file of the filtered frame, -1 if the information
5859 is not available (e.g. for synthetic video)
5860 </p></dd>
5861 </dl>
5862
5863 <p>The default value of the select expression is &quot;1&quot;.
5864 </p>
5865 <p>Some examples follow:
5866 </p>
5867 <table><tr><td>&nbsp;</td><td><pre class="example"># select all frames in input
5868 select
5869
5870 # the above is the same as:
5871 select=1
5872
5873 # skip all frames:
5874 select=0
5875
5876 # select only I-frames
5877 select='eq(pict_type\,PICT_TYPE_I)'
5878
5879 # select one frame every 100
5880 select='not(mod(n\,100))'
5881
5882 # select only frames contained in the 10-20 time interval
5883 select='gte(t\,10)*lte(t\,20)'
5884
5885 # select only I frames contained in the 10-20 time interval
5886 select='gte(t\,10)*lte(t\,20)*eq(pict_type\,PICT_TYPE_I)'
5887
5888 # select frames with a minimum distance of 10 seconds
5889 select='isnan(prev_selected_t)+gte(t-prev_selected_t\,10)'
5890 </pre></td></tr></table>
5891
5892 <p><a name="setdar"></a>
5893 </p><a name="setdar-1"></a>
5894 <h2 class="section"><a href="ffmpeg.html#toc-setdar-1">22.28 setdar</a></h2>
5895
5896 <p>Set the Display Aspect Ratio for the filter output video.
5897 </p>
5898 <p>This is done by changing the specified Sample (aka Pixel) Aspect
5899 Ratio, according to the following equation:
5900 <em>DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR</em>
5901 </p>
5902 <p>Keep in mind that this filter does not modify the pixel dimensions of
5903 the video frame. Also the display aspect ratio set by this filter may
5904 be changed by later filters in the filterchain, e.g. in case of
5905 scaling or if another &quot;setdar&quot; or a &quot;setsar&quot; filter is applied.
5906 </p>
5907 <p>The filter accepts a parameter string which represents the wanted
5908 display aspect ratio.
5909 The parameter can be a floating point number string, or an expression
5910 of the form <var>num</var>:<var>den</var>, where <var>num</var> and <var>den</var> are the
5911 numerator and denominator of the aspect ratio.
5912 If the parameter is not specified, it is assumed the value &quot;0:1&quot;.
5913 </p>
5914 <p>For example to change the display aspect ratio to 16:9, specify:
5915 </p><table><tr><td>&nbsp;</td><td><pre class="example">setdar=16:9
5916 # the above is equivalent to
5917 setdar=1.77777
5918 </pre></td></tr></table>
5919
5920 <p>See also the <a href="#setsar">setsar</a> filter documentation.
5921 </p>
5922 <a name="setpts"></a>
5923 <h2 class="section"><a href="ffmpeg.html#toc-setpts">22.29 setpts</a></h2>
5924
5925 <p>Change the PTS (presentation timestamp) of the input video frames.
5926 </p>
5927 <p>Accept in input an expression evaluated through the eval API, which
5928 can contain the following constants:
5929 </p>
5930 <dl compact="compact">
5931 <dt> &lsquo;<samp>PTS</samp>&rsquo;</dt>
5932 <dd><p>the presentation timestamp in input
5933 </p>
5934 </dd>
5935 <dt> &lsquo;<samp>PI</samp>&rsquo;</dt>
5936 <dd><p>Greek PI
5937 </p>
5938 </dd>
5939 <dt> &lsquo;<samp>PHI</samp>&rsquo;</dt>
5940 <dd><p>golden ratio
5941 </p>
5942 </dd>
5943 <dt> &lsquo;<samp>E</samp>&rsquo;</dt>
5944 <dd><p>Euler number
5945 </p>
5946 </dd>
5947 <dt> &lsquo;<samp>N</samp>&rsquo;</dt>
5948 <dd><p>the count of the input frame, starting from 0.
5949 </p>
5950 </dd>
5951 <dt> &lsquo;<samp>STARTPTS</samp>&rsquo;</dt>
5952 <dd><p>the PTS of the first video frame
5953 </p>
5954 </dd>
5955 <dt> &lsquo;<samp>INTERLACED</samp>&rsquo;</dt>
5956 <dd><p>tell if the current frame is interlaced
5957 </p>
5958 </dd>
5959 <dt> &lsquo;<samp>POS</samp>&rsquo;</dt>
5960 <dd><p>original position in the file of the frame, or undefined if undefined
5961 for the current frame
5962 </p>
5963 </dd>
5964 <dt> &lsquo;<samp>PREV_INPTS</samp>&rsquo;</dt>
5965 <dd><p>previous input PTS
5966 </p>
5967 </dd>
5968 <dt> &lsquo;<samp>PREV_OUTPTS</samp>&rsquo;</dt>
5969 <dd><p>previous output PTS
5970 </p>
5971 </dd>
5972 </dl>
5973
5974 <p>Some examples follow:
5975 </p>
5976 <table><tr><td>&nbsp;</td><td><pre class="example"># start counting PTS from zero
5977 setpts=PTS-STARTPTS
5978
5979 # fast motion
5980 setpts=0.5*PTS
5981
5982 # slow motion
5983 setpts=2.0*PTS
5984
5985 # fixed rate 25 fps
5986 setpts=N/(25*TB)
5987
5988 # fixed rate 25 fps with some jitter
5989 setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
5990 </pre></td></tr></table>
5991
5992 <p><a name="setsar"></a>
5993 </p><a name="setsar-1"></a>
5994 <h2 class="section"><a href="ffmpeg.html#toc-setsar-1">22.30 setsar</a></h2>
5995
5996 <p>Set the Sample (aka Pixel) Aspect Ratio for the filter output video.
5997 </p>
5998 <p>Note that as a consequence of the application of this filter, the
5999 output display aspect ratio will change according to the following
6000 equation:
6001 <em>DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR</em>
6002 </p>
6003 <p>Keep in mind that the sample aspect ratio set by this filter may be
6004 changed by later filters in the filterchain, e.g. if another &quot;setsar&quot;
6005 or a &quot;setdar&quot; filter is applied.
6006 </p>
6007 <p>The filter accepts a parameter string which represents the wanted
6008 sample aspect ratio.
6009 The parameter can be a floating point number string, or an expression
6010 of the form <var>num</var>:<var>den</var>, where <var>num</var> and <var>den</var> are the
6011 numerator and denominator of the aspect ratio.
6012 If the parameter is not specified, it is assumed the value &quot;0:1&quot;.
6013 </p>
6014 <p>For example to change the sample aspect ratio to 10:11, specify:
6015 </p><table><tr><td>&nbsp;</td><td><pre class="example">setsar=10:11
6016 </pre></td></tr></table>
6017
6018 <a name="settb"></a>
6019 <h2 class="section"><a href="ffmpeg.html#toc-settb">22.31 settb</a></h2>
6020
6021 <p>Set the timebase to use for the output frames timestamps.
6022 It is mainly useful for testing timebase configuration.
6023 </p>
6024 <p>It accepts in input an arithmetic expression representing a rational.
6025 The expression can contain the constants &quot;PI&quot;, &quot;E&quot;, &quot;PHI&quot;, &quot;AVTB&quot; (the
6026 default timebase), and &quot;intb&quot; (the input timebase).
6027 </p>
6028 <p>The default value for the input is &quot;intb&quot;.
6029 </p>
6030 <p>Follow some examples.
6031 </p>
6032 <table><tr><td>&nbsp;</td><td><pre class="example"># set the timebase to 1/25
6033 settb=1/25
6034
6035 # set the timebase to 1/10
6036 settb=0.1
6037
6038 #set the timebase to 1001/1000
6039 settb=1+0.001
6040
6041 #set the timebase to 2*intb
6042 settb=2*intb
6043
6044 #set the default timebase value
6045 settb=AVTB
6046 </pre></td></tr></table>
6047
6048 <a name="showinfo"></a>
6049 <h2 class="section"><a href="ffmpeg.html#toc-showinfo">22.32 showinfo</a></h2>
6050
6051 <p>Show a line containing various information for each input video frame.
6052 The input video is not modified.
6053 </p>
6054 <p>The shown line contains a sequence of key/value pairs of the form
6055 <var>key</var>:<var>value</var>.
6056 </p>
6057 <p>A description of each shown parameter follows:
6058 </p>
6059 <dl compact="compact">
6060 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
6061 <dd><p>sequential number of the input frame, starting from 0
6062 </p>
6063 </dd>
6064 <dt> &lsquo;<samp>pts</samp>&rsquo;</dt>
6065 <dd><p>Presentation TimeStamp of the input frame, expressed as a number of
6066 time base units. The time base unit depends on the filter input pad.
6067 </p>
6068 </dd>
6069 <dt> &lsquo;<samp>pts_time</samp>&rsquo;</dt>
6070 <dd><p>Presentation TimeStamp of the input frame, expressed as a number of
6071 seconds
6072 </p>
6073 </dd>
6074 <dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
6075 <dd><p>position of the frame in the input stream, -1 if this information in
6076 unavailable and/or meanigless (for example in case of synthetic video)
6077 </p>
6078 </dd>
6079 <dt> &lsquo;<samp>fmt</samp>&rsquo;</dt>
6080 <dd><p>pixel format name
6081 </p>
6082 </dd>
6083 <dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
6084 <dd><p>sample aspect ratio of the input frame, expressed in the form
6085 <var>num</var>/<var>den</var>
6086 </p>
6087 </dd>
6088 <dt> &lsquo;<samp>s</samp>&rsquo;</dt>
6089 <dd><p>size of the input frame, expressed in the form
6090 <var>width</var>x<var>height</var>
6091 </p>
6092 </dd>
6093 <dt> &lsquo;<samp>i</samp>&rsquo;</dt>
6094 <dd><p>interlaced mode (&quot;P&quot; for &quot;progressive&quot;, &quot;T&quot; for top field first, &quot;B&quot;
6095 for bottom field first)
6096 </p>
6097 </dd>
6098 <dt> &lsquo;<samp>iskey</samp>&rsquo;</dt>
6099 <dd><p>1 if the frame is a key frame, 0 otherwise
6100 </p>
6101 </dd>
6102 <dt> &lsquo;<samp>type</samp>&rsquo;</dt>
6103 <dd><p>picture type of the input frame (&quot;I&quot; for an I-frame, &quot;P&quot; for a
6104 P-frame, &quot;B&quot; for a B-frame, &quot;?&quot; for unknown type).
6105 Check also the documentation of the <code>AVPictureType</code> enum and of
6106 the <code>av_get_picture_type_char</code> function defined in
6107 &lsquo;<tt>libavutil/avutil.h</tt>&rsquo;.
6108 </p>
6109 </dd>
6110 <dt> &lsquo;<samp>checksum</samp>&rsquo;</dt>
6111 <dd><p>Adler-32 checksum of all the planes of the input frame
6112 </p>
6113 </dd>
6114 <dt> &lsquo;<samp>plane_checksum</samp>&rsquo;</dt>
6115 <dd><p>Adler-32 checksum of each plane of the input frame, expressed in the form
6116 &quot;[<var>c0</var> <var>c1</var> <var>c2</var> <var>c3</var>]&quot;
6117 </p></dd>
6118 </dl>
6119
6120 <a name="slicify"></a>
6121 <h2 class="section"><a href="ffmpeg.html#toc-slicify">22.33 slicify</a></h2>
6122
6123 <p>Pass the images of input video on to next video filter as multiple
6124 slices.
6125 </p>
6126 <table><tr><td>&nbsp;</td><td><pre class="example">./ffmpeg -i in.avi -vf &quot;slicify=32&quot; out.avi
6127 </pre></td></tr></table>
6128
6129 <p>The filter accepts the slice height as parameter. If the parameter is
6130 not specified it will use the default value of 16.
6131 </p>
6132 <p>Adding this in the beginning of filter chains should make filtering
6133 faster due to better use of the memory cache.
6134 </p>
6135 <a name="split"></a>
6136 <h2 class="section"><a href="ffmpeg.html#toc-split">22.34 split</a></h2>
6137
6138 <p>Pass on the input video to two outputs. Both outputs are identical to
6139 the input video.
6140 </p>
6141 <p>For example:
6142 </p><table><tr><td>&nbsp;</td><td><pre class="example">[in] split [splitout1][splitout2];
6143 [splitout1] crop=100:100:0:0    [cropout];
6144 [splitout2] pad=200:200:100:100 [padout];
6145 </pre></td></tr></table>
6146
6147 <p>will create two separate outputs from the same input, one cropped and
6148 one padded.
6149 </p>
6150 <a name="transpose"></a>
6151 <h2 class="section"><a href="ffmpeg.html#toc-transpose">22.35 transpose</a></h2>
6152
6153 <p>Transpose rows with columns in the input video and optionally flip it.
6154 </p>
6155 <p>It accepts a parameter representing an integer, which can assume the
6156 values:
6157 </p>
6158 <dl compact="compact">
6159 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
6160 <dd><p>Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
6161 </p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     L.l
6162 . . -&gt;  . .
6163 l.r     R.r
6164 </pre></td></tr></table>
6165
6166 </dd>
6167 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
6168 <dd><p>Rotate by 90 degrees clockwise, that is:
6169 </p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     l.L
6170 . . -&gt;  . .
6171 l.r     r.R
6172 </pre></td></tr></table>
6173
6174 </dd>
6175 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
6176 <dd><p>Rotate by 90 degrees counterclockwise, that is:
6177 </p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     R.r
6178 . . -&gt;  . .
6179 l.r     L.l
6180 </pre></td></tr></table>
6181
6182 </dd>
6183 <dt> &lsquo;<samp>3</samp>&rsquo;</dt>
6184 <dd><p>Rotate by 90 degrees clockwise and vertically flip, that is:
6185 </p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     r.R
6186 . . -&gt;  . .
6187 l.r     l.L
6188 </pre></td></tr></table>
6189 </dd>
6190 </dl>
6191
6192 <a name="unsharp"></a>
6193 <h2 class="section"><a href="ffmpeg.html#toc-unsharp">22.36 unsharp</a></h2>
6194
6195 <p>Sharpen or blur the input video.
6196 </p>
6197 <p>It accepts the following parameters:
6198 <var>luma_msize_x</var>:<var>luma_msize_y</var>:<var>luma_amount</var>:<var>chroma_msize_x</var>:<var>chroma_msize_y</var>:<var>chroma_amount</var>
6199 </p>
6200 <p>Negative values for the amount will blur the input video, while positive
6201 values will sharpen. All parameters are optional and default to the
6202 equivalent of the string &rsquo;5:5:1.0:5:5:0.0&rsquo;.
6203 </p>
6204 <dl compact="compact">
6205 <dt> &lsquo;<samp>luma_msize_x</samp>&rsquo;</dt>
6206 <dd><p>Set the luma matrix horizontal size. It can be an integer between 3
6207 and 13, default value is 5.
6208 </p>
6209 </dd>
6210 <dt> &lsquo;<samp>luma_msize_y</samp>&rsquo;</dt>
6211 <dd><p>Set the luma matrix vertical size. It can be an integer between 3
6212 and 13, default value is 5.
6213 </p>
6214 </dd>
6215 <dt> &lsquo;<samp>luma_amount</samp>&rsquo;</dt>
6216 <dd><p>Set the luma effect strength. It can be a float number between -2.0
6217 and 5.0, default value is 1.0.
6218 </p>
6219 </dd>
6220 <dt> &lsquo;<samp>chroma_msize_x</samp>&rsquo;</dt>
6221 <dd><p>Set the chroma matrix horizontal size. It can be an integer between 3
6222 and 13, default value is 5.
6223 </p>
6224 </dd>
6225 <dt> &lsquo;<samp>chroma_msize_y</samp>&rsquo;</dt>
6226 <dd><p>Set the chroma matrix vertical size. It can be an integer between 3
6227 and 13, default value is 5.
6228 </p>
6229 </dd>
6230 <dt> &lsquo;<samp>chroma_amount</samp>&rsquo;</dt>
6231 <dd><p>Set the chroma effect strength. It can be a float number between -2.0
6232 and 5.0, default value is 0.0.
6233 </p>
6234 </dd>
6235 </dl>
6236
6237 <table><tr><td>&nbsp;</td><td><pre class="example"># Strong luma sharpen effect parameters
6238 unsharp=7:7:2.5
6239
6240 # Strong blur of both luma and chroma parameters
6241 unsharp=7:7:-2:7:7:-2
6242
6243 # Use the default values with <code>ffmpeg</code>
6244 ./ffmpeg -i in.avi -vf &quot;unsharp&quot; out.mp4
6245 </pre></td></tr></table>
6246
6247 <a name="vflip"></a>
6248 <h2 class="section"><a href="ffmpeg.html#toc-vflip">22.37 vflip</a></h2>
6249
6250 <p>Flip the input video vertically.
6251 </p>
6252 <table><tr><td>&nbsp;</td><td><pre class="example">./ffmpeg -i in.avi -vf &quot;vflip&quot; out.avi
6253 </pre></td></tr></table>
6254
6255 <a name="yadif"></a>
6256 <h2 class="section"><a href="ffmpeg.html#toc-yadif">22.38 yadif</a></h2>
6257
6258 <p>Deinterlace the input video (&quot;yadif&quot; means &quot;yet another deinterlacing
6259 filter&quot;).
6260 </p>
6261 <p>It accepts the optional parameters: <var>mode</var>:<var>parity</var>:<var>auto</var>.
6262 </p>
6263 <p><var>mode</var> specifies the interlacing mode to adopt, accepts one of the
6264 following values:
6265 </p>
6266 <dl compact="compact">
6267 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
6268 <dd><p>output 1 frame for each frame
6269 </p></dd>
6270 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
6271 <dd><p>output 1 frame for each field
6272 </p></dd>
6273 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
6274 <dd><p>like 0 but skips spatial interlacing check
6275 </p></dd>
6276 <dt> &lsquo;<samp>3</samp>&rsquo;</dt>
6277 <dd><p>like 1 but skips spatial interlacing check
6278 </p></dd>
6279 </dl>
6280
6281 <p>Default value is 0.
6282 </p>
6283 <p><var>parity</var> specifies the picture field parity assumed for the input
6284 interlaced video, accepts one of the following values:
6285 </p>
6286 <dl compact="compact">
6287 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
6288 <dd><p>assume top field first
6289 </p></dd>
6290 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
6291 <dd><p>assume bottom field first
6292 </p></dd>
6293 <dt> &lsquo;<samp>-1</samp>&rsquo;</dt>
6294 <dd><p>enable automatic detection
6295 </p></dd>
6296 </dl>
6297
6298 <p>Default value is -1.
6299 If interlacing is unknown or decoder does not export this information,
6300 top field first will be assumed.
6301 </p>
6302 <p><var>auto</var> specifies if deinterlacer should trust the interlaced flag
6303 and only deinterlace frames marked as interlaced
6304 </p>
6305 <dl compact="compact">
6306 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
6307 <dd><p>deinterlace all frames
6308 </p></dd>
6309 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
6310 <dd><p>only deinterlace frames marked as interlaced
6311 </p></dd>
6312 </dl>
6313
6314 <p>Default value is 0.
6315 </p>
6316
6317 <a name="Video-Sources"></a>
6318 <h1 class="chapter"><a href="ffmpeg.html#toc-Video-Sources">23. Video Sources</a></h1>
6319
6320 <p>Below is a description of the currently available video sources.
6321 </p>
6322 <a name="buffer"></a>
6323 <h2 class="section"><a href="ffmpeg.html#toc-buffer">23.1 buffer</a></h2>
6324
6325 <p>Buffer video frames, and make them available to the filter chain.
6326 </p>
6327 <p>This source is mainly intended for a programmatic use, in particular
6328 through the interface defined in &lsquo;<tt>libavfilter/vsrc_buffer.h</tt>&rsquo;.
6329 </p>
6330 <p>It accepts the following parameters:
6331 <var>width</var>:<var>height</var>:<var>pix_fmt_string</var>:<var>timebase_num</var>:<var>timebase_den</var>:<var>sample_aspect_ratio_num</var>:<var>sample_aspect_ratio.den</var>:<var>scale_params</var>
6332 </p>
6333 <p>All the parameters but <var>scale_params</var> need to be explicitely
6334 defined.
6335 </p>
6336 <p>Follows the list of the accepted parameters.
6337 </p>
6338 <dl compact="compact">
6339 <dt> &lsquo;<samp>width, height</samp>&rsquo;</dt>
6340 <dd><p>Specify the width and height of the buffered video frames.
6341 </p>
6342 </dd>
6343 <dt> &lsquo;<samp>pix_fmt_string</samp>&rsquo;</dt>
6344 <dd><p>A string representing the pixel format of the buffered video frames.
6345 It may be a number corresponding to a pixel format, or a pixel format
6346 name.
6347 </p>
6348 </dd>
6349 <dt> &lsquo;<samp>timebase_num, timebase_den</samp>&rsquo;</dt>
6350 <dd><p>Specify numerator and denomitor of the timebase assumed by the
6351 timestamps of the buffered frames.
6352 </p>
6353 </dd>
6354 <dt> &lsquo;<samp>sample_aspect_ratio.num, sample_aspect_ratio.den</samp>&rsquo;</dt>
6355 <dd><p>Specify numerator and denominator of the sample aspect ratio assumed
6356 by the video frames.
6357 </p>
6358 </dd>
6359 <dt> &lsquo;<samp>scale_params</samp>&rsquo;</dt>
6360 <dd><p>Specify the optional parameters to be used for the scale filter which
6361 is automatically inserted when an input change is detected in the
6362 input size or format.
6363 </p></dd>
6364 </dl>
6365
6366 <p>For example:
6367 </p><table><tr><td>&nbsp;</td><td><pre class="example">buffer=320:240:yuv410p:1:24:1:1
6368 </pre></td></tr></table>
6369
6370 <p>will instruct the source to accept video frames with size 320x240 and
6371 with format &quot;yuv410p&quot;, assuming 1/24 as the timestamps timebase and
6372 square pixels (1:1 sample aspect ratio).
6373 Since the pixel format with name &quot;yuv410p&quot; corresponds to the number 6
6374 (check the enum PixelFormat definition in &lsquo;<tt>libavutil/pixfmt.h</tt>&rsquo;),
6375 this example corresponds to:
6376 </p><table><tr><td>&nbsp;</td><td><pre class="example">buffer=320:240:6:1:24:1:1
6377 </pre></td></tr></table>
6378
6379 <a name="color"></a>
6380 <h2 class="section"><a href="ffmpeg.html#toc-color">23.2 color</a></h2>
6381
6382 <p>Provide an uniformly colored input.
6383 </p>
6384 <p>It accepts the following parameters:
6385 <var>color</var>:<var>frame_size</var>:<var>frame_rate</var>
6386 </p>
6387 <p>Follows the description of the accepted parameters.
6388 </p>
6389 <dl compact="compact">
6390 <dt> &lsquo;<samp>color</samp>&rsquo;</dt>
6391 <dd><p>Specify the color of the source. It can be the name of a color (case
6392 insensitive match) or a 0xRRGGBB[AA] sequence, possibly followed by an
6393 alpha specifier. The default value is &quot;black&quot;.
6394 </p>
6395 </dd>
6396 <dt> &lsquo;<samp>frame_size</samp>&rsquo;</dt>
6397 <dd><p>Specify the size of the sourced video, it may be a string of the form
6398 <var>width</var>x<var>heigth</var>, or the name of a size abbreviation. The
6399 default value is &quot;320x240&quot;.
6400 </p>
6401 </dd>
6402 <dt> &lsquo;<samp>frame_rate</samp>&rsquo;</dt>
6403 <dd><p>Specify the frame rate of the sourced video, as the number of frames
6404 generated per second. It has to be a string in the format
6405 <var>frame_rate_num</var>/<var>frame_rate_den</var>, an integer number, a float
6406 number or a valid video frame rate abbreviation. The default value is
6407 &quot;25&quot;.
6408 </p>
6409 </dd>
6410 </dl>
6411
6412 <p>For example the following graph description will generate a red source
6413 with an opacity of 0.2, with size &quot;qcif&quot; and a frame rate of 10
6414 frames per second, which will be overlayed over the source connected
6415 to the pad with identifier &quot;in&quot;.
6416 </p>
6417 <table><tr><td>&nbsp;</td><td><pre class="example">&quot;color=red@0.2:qcif:10 [color]; [in][color] overlay [out]&quot;
6418 </pre></td></tr></table>
6419
6420 <a name="movie"></a>
6421 <h2 class="section"><a href="ffmpeg.html#toc-movie">23.3 movie</a></h2>
6422
6423 <p>Read a video stream from a movie container.
6424 </p>
6425 <p>It accepts the syntax: <var>movie_name</var>[:<var>options</var>] where
6426 <var>movie_name</var> is the name of the resource to read (not necessarily
6427 a file but also a device or a stream accessed through some protocol),
6428 and <var>options</var> is an optional sequence of <var>key</var>=<var>value</var>
6429 pairs, separated by &quot;:&quot;.
6430 </p>
6431 <p>The description of the accepted options follows.
6432 </p>
6433 <dl compact="compact">
6434 <dt> &lsquo;<samp>format_name, f</samp>&rsquo;</dt>
6435 <dd><p>Specifies the format assumed for the movie to read, and can be either
6436 the name of a container or an input device. If not specified the
6437 format is guessed from <var>movie_name</var> or by probing.
6438 </p>
6439 </dd>
6440 <dt> &lsquo;<samp>seek_point, sp</samp>&rsquo;</dt>
6441 <dd><p>Specifies the seek point in seconds, the frames will be output
6442 starting from this seek point, the parameter is evaluated with
6443 <code>av_strtod</code> so the numerical value may be suffixed by an IS
6444 postfix. Default value is &quot;0&quot;.
6445 </p>
6446 </dd>
6447 <dt> &lsquo;<samp>stream_index, si</samp>&rsquo;</dt>
6448 <dd><p>Specifies the index of the video stream to read. If the value is -1,
6449 the best suited video stream will be automatically selected. Default
6450 value is &quot;-1&quot;.
6451 </p>
6452 </dd>
6453 </dl>
6454
6455 <p>This filter allows to overlay a second video on top of main input of
6456 a filtergraph as shown in this graph:
6457 </p><table><tr><td>&nbsp;</td><td><pre class="example">input -----------&gt; deltapts0 --&gt; overlay --&gt; output
6458                                     ^
6459                                     |
6460 movie --&gt; scale--&gt; deltapts1 -------+
6461 </pre></td></tr></table>
6462
6463 <p>Some examples follow:
6464 </p><table><tr><td>&nbsp;</td><td><pre class="example"># skip 3.2 seconds from the start of the avi file in.avi, and overlay it
6465 # on top of the input labelled as &quot;in&quot;.
6466 movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [movie];
6467 [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
6468
6469 # read from a video4linux2 device, and overlay it on top of the input
6470 # labelled as &quot;in&quot;
6471 movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie];
6472 [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
6473
6474 </pre></td></tr></table>
6475
6476 <a name="mptestsrc"></a>
6477 <h2 class="section"><a href="ffmpeg.html#toc-mptestsrc">23.4 mptestsrc</a></h2>
6478
6479 <p>Generate various test patterns, as generated by the MPlayer test filter.
6480 </p>
6481 <p>The size of the generated video is fixed, and is 256x256.
6482 This source is useful in particular for testing encoding features.
6483 </p>
6484 <p>This source accepts an optional sequence of <var>key</var>=<var>value</var> pairs,
6485 separated by &quot;:&quot;. The description of the accepted options follows.
6486 </p>
6487 <dl compact="compact">
6488 <dt> &lsquo;<samp>rate, r</samp>&rsquo;</dt>
6489 <dd><p>Specify the frame rate of the sourced video, as the number of frames
6490 generated per second. It has to be a string in the format
6491 <var>frame_rate_num</var>/<var>frame_rate_den</var>, an integer number, a float
6492 number or a valid video frame rate abbreviation. The default value is
6493 &quot;25&quot;.
6494 </p>
6495 </dd>
6496 <dt> &lsquo;<samp>duration, d</samp>&rsquo;</dt>
6497 <dd><p>Set the video duration of the sourced video. The accepted syntax is:
6498 </p><table><tr><td>&nbsp;</td><td><pre class="example">[-]HH[:MM[:SS[.m...]]]
6499 [-]S+[.m...]
6500 </pre></td></tr></table>
6501 <p>See also the function <code>av_parse_time()</code>.
6502 </p>
6503 <p>If not specified, or the expressed duration is negative, the video is
6504 supposed to be generated forever.
6505 </p>
6506 </dd>
6507 <dt> &lsquo;<samp>test, t</samp>&rsquo;</dt>
6508 <dd>
6509 <p>Set the number or the name of the test to perform. Supported tests are:
6510 </p><dl compact="compact">
6511 <dt> &lsquo;<samp>dc_luma</samp>&rsquo;</dt>
6512 <dt> &lsquo;<samp>dc_chroma</samp>&rsquo;</dt>
6513 <dt> &lsquo;<samp>freq_luma</samp>&rsquo;</dt>
6514 <dt> &lsquo;<samp>freq_chroma</samp>&rsquo;</dt>
6515 <dt> &lsquo;<samp>amp_luma</samp>&rsquo;</dt>
6516 <dt> &lsquo;<samp>amp_chroma</samp>&rsquo;</dt>
6517 <dt> &lsquo;<samp>cbp</samp>&rsquo;</dt>
6518 <dt> &lsquo;<samp>mv</samp>&rsquo;</dt>
6519 <dt> &lsquo;<samp>ring1</samp>&rsquo;</dt>
6520 <dt> &lsquo;<samp>ring2</samp>&rsquo;</dt>
6521 <dt> &lsquo;<samp>all</samp>&rsquo;</dt>
6522 </dl>
6523
6524 <p>Default value is &quot;all&quot;, which will cycle through the list of all tests.
6525 </p></dd>
6526 </dl>
6527
6528 <p>For example the following:
6529 </p><table><tr><td>&nbsp;</td><td><pre class="example">testsrc=t=dc_luma
6530 </pre></td></tr></table>
6531
6532 <p>will generate a &quot;dc_luma&quot; test pattern.
6533 </p>
6534 <a name="nullsrc"></a>
6535 <h2 class="section"><a href="ffmpeg.html#toc-nullsrc">23.5 nullsrc</a></h2>
6536
6537 <p>Null video source, never return images. It is mainly useful as a
6538 template and to be employed in analysis / debugging tools.
6539 </p>
6540 <p>It accepts as optional parameter a string of the form
6541 <var>width</var>:<var>height</var>:<var>timebase</var>.
6542 </p>
6543 <p><var>width</var> and <var>height</var> specify the size of the configured
6544 source. The default values of <var>width</var> and <var>height</var> are
6545 respectively 352 and 288 (corresponding to the CIF size format).
6546 </p>
6547 <p><var>timebase</var> specifies an arithmetic expression representing a
6548 timebase. The expression can contain the constants &quot;PI&quot;, &quot;E&quot;, &quot;PHI&quot;,
6549 &quot;AVTB&quot; (the default timebase), and defaults to the value &quot;AVTB&quot;.
6550 </p>
6551 <a name="frei0r_005fsrc"></a>
6552 <h2 class="section"><a href="ffmpeg.html#toc-frei0r_005fsrc">23.6 frei0r_src</a></h2>
6553
6554 <p>Provide a frei0r source.
6555 </p>
6556 <p>To enable compilation of this filter you need to install the frei0r
6557 header and configure FFmpeg with &ndash;enable-frei0r.
6558 </p>
6559 <p>The source supports the syntax:
6560 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>size</var>:<var>rate</var>:<var>src_name</var>[{=|:}<var>param1</var>:<var>param2</var>:...:<var>paramN</var>]
6561 </pre></td></tr></table>
6562
6563 <p><var>size</var> is the size of the video to generate, may be a string of the
6564 form <var>width</var>x<var>height</var> or a frame size abbreviation.
6565 <var>rate</var> is the rate of the video to generate, may be a string of
6566 the form <var>num</var>/<var>den</var> or a frame rate abbreviation.
6567 <var>src_name</var> is the name to the frei0r source to load. For more
6568 information regarding frei0r and how to set the parameters read the
6569 section <a href="#frei0r">frei0r</a> in the description of the video filters.
6570 </p>
6571 <p>Some examples follow:
6572 </p><table><tr><td>&nbsp;</td><td><pre class="example"># generate a frei0r partik0l source with size 200x200 and framerate 10
6573 # which is overlayed on the overlay filter main input
6574 frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay
6575 </pre></td></tr></table>
6576
6577 <a name="rgbtestsrc_002c-testsrc"></a>
6578 <h2 class="section"><a href="ffmpeg.html#toc-rgbtestsrc_002c-testsrc">23.7 rgbtestsrc, testsrc</a></h2>
6579
6580 <p>The <code>rgbtestsrc</code> source generates an RGB test pattern useful for
6581 detecting RGB vs BGR issues. You should see a red, green and blue
6582 stripe from top to bottom.
6583 </p>
6584 <p>The <code>testsrc</code> source generates a test video pattern, showing a
6585 color pattern, a scrolling gradient and a timestamp. This is mainly
6586 intended for testing purposes.
6587 </p>
6588 <p>Both sources accept an optional sequence of <var>key</var>=<var>value</var> pairs,
6589 separated by &quot;:&quot;. The description of the accepted options follows.
6590 </p>
6591 <dl compact="compact">
6592 <dt> &lsquo;<samp>size, s</samp>&rsquo;</dt>
6593 <dd><p>Specify the size of the sourced video, it may be a string of the form
6594 <var>width</var>x<var>heigth</var>, or the name of a size abbreviation. The
6595 default value is &quot;320x240&quot;.
6596 </p>
6597 </dd>
6598 <dt> &lsquo;<samp>rate, r</samp>&rsquo;</dt>
6599 <dd><p>Specify the frame rate of the sourced video, as the number of frames
6600 generated per second. It has to be a string in the format
6601 <var>frame_rate_num</var>/<var>frame_rate_den</var>, an integer number, a float
6602 number or a valid video frame rate abbreviation. The default value is
6603 &quot;25&quot;.
6604 </p>
6605 </dd>
6606 <dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
6607 <dd><p>Set the sample aspect ratio of the sourced video.
6608 </p>
6609 </dd>
6610 <dt> &lsquo;<samp>duration</samp>&rsquo;</dt>
6611 <dd><p>Set the video duration of the sourced video. The accepted syntax is:
6612 </p><table><tr><td>&nbsp;</td><td><pre class="example">[-]HH[:MM[:SS[.m...]]]
6613 [-]S+[.m...]
6614 </pre></td></tr></table>
6615 <p>See also the function <code>av_parse_time()</code>.
6616 </p>
6617 <p>If not specified, or the expressed duration is negative, the video is
6618 supposed to be generated forever.
6619 </p></dd>
6620 </dl>
6621
6622 <p>For example the following:
6623 </p><table><tr><td>&nbsp;</td><td><pre class="example">testsrc=duration=5.3:size=qcif:rate=10
6624 </pre></td></tr></table>
6625
6626 <p>will generate a video with a duration of 5.3 seconds, with size
6627 176x144 and a framerate of 10 frames per second.
6628 </p>
6629
6630 <a name="Video-Sinks"></a>
6631 <h1 class="chapter"><a href="ffmpeg.html#toc-Video-Sinks">24. Video Sinks</a></h1>
6632
6633 <p>Below is a description of the currently available video sinks.
6634 </p>
6635 <a name="buffersink"></a>
6636 <h2 class="section"><a href="ffmpeg.html#toc-buffersink">24.1 buffersink</a></h2>
6637
6638 <p>Buffer video frames, and make them available to the end of the filter
6639 graph.
6640 </p>
6641 <p>This sink is mainly intended for a programmatic use, in particular
6642 through the interface defined in &lsquo;<tt>libavfilter/vsink_buffer.h</tt>&rsquo;.
6643 </p>
6644 <p>It does not require a string parameter in input, but you need to
6645 specify a pointer to a list of supported pixel formats terminated by
6646 -1 in the opaque parameter provided to <code>avfilter_init_filter</code>
6647 when initializing this sink.
6648 </p>
6649 <a name="nullsink"></a>
6650 <h2 class="section"><a href="ffmpeg.html#toc-nullsink">24.2 nullsink</a></h2>
6651
6652 <p>Null video sink, do absolutely nothing with the input video. It is
6653 mainly useful as a template and to be employed in analysis / debugging
6654 tools.
6655 </p>
6656
6657 <a name="Metadata"></a>
6658 <h1 class="chapter"><a href="ffmpeg.html#toc-Metadata">25. Metadata</a></h1>
6659
6660 <p>FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded
6661 INI-like text file and then load it back using the metadata muxer/demuxer.
6662 </p>
6663 <p>The file format is as follows:
6664 </p><ol>
6665 <li>
6666 A file consists of a header and a number of metadata tags divided into sections,
6667 each on its own line.
6668
6669 </li><li>
6670 The header is a &rsquo;;FFMETADATA&rsquo; string, followed by a version number (now 1).
6671
6672 </li><li>
6673 Metadata tags are of the form &rsquo;key=value&rsquo;
6674
6675 </li><li>
6676 Immediately after header follows global metadata
6677
6678 </li><li>
6679 After global metadata there may be sections with per-stream/per-chapter
6680 metadata.
6681
6682 </li><li>
6683 A section starts with the section name in uppercase (i.e. STREAM or CHAPTER) in
6684 brackets (&rsquo;[&rsquo;, &rsquo;]&rsquo;) and ends with next section or end of file.
6685
6686 </li><li>
6687 At the beginning of a chapter section there may be an optional timebase to be
6688 used for start/end values. It must be in form &rsquo;TIMEBASE=num/den&rsquo;, where num and
6689 den are integers. If the timebase is missing then start/end times are assumed to
6690 be in milliseconds.
6691 Next a chapter section must contain chapter start and end times in form
6692 &rsquo;START=num&rsquo;, &rsquo;END=num&rsquo;, where num is a positive integer.
6693
6694 </li><li>
6695 Empty lines and lines starting with &rsquo;;&rsquo; or &rsquo;#&rsquo; are ignored.
6696
6697 </li><li>
6698 Metadata keys or values containing special characters (&rsquo;=&rsquo;, &rsquo;;&rsquo;, &rsquo;#&rsquo;, &rsquo;\&rsquo; and a
6699 newline) must be escaped with a backslash &rsquo;\&rsquo;.
6700
6701 </li><li>
6702 Note that whitespace in metadata (e.g. foo = bar) is considered to be a part of
6703 the tag (in the example above key is &rsquo;foo &rsquo;, value is &rsquo; bar&rsquo;).
6704 </li></ol>
6705
6706 <p>A ffmetadata file might look like this:
6707 </p><table><tr><td>&nbsp;</td><td><pre class="example">;FFMETADATA1
6708 title=bike\\shed
6709 ;this is a comment
6710 artist=FFmpeg troll team
6711
6712 [CHAPTER]
6713 TIMEBASE=1/1000
6714 START=0
6715 #chapter ends at 0:01:00
6716 END=60000
6717 title=chapter \#1
6718 [STREAM]
6719 title=multi\
6720 line
6721 </pre></td></tr></table>
6722
6723
6724 <hr size="1">
6725 <p>
6726  <font size="-1">
6727   This document was generated by <em>Kyle Schwarz</em> on <em>September 2, 2011</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
6728  </font>
6729  <br>
6730
6731 </p>
6732 </body>
6733 </html>