]> git.sesse.net Git - casparcg/blob - ffmpeg 0.7/doc/ffmpeg.html
Added ffmpeg 0.7 RC
[casparcg] / ffmpeg 0.7 / 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 May 18, 2011 by texi2html 1.82
4 texi2html was written by: 
5             Lionel Cons <Lionel.Cons@cern.ch> (original author)
6             Karl Berry  <karl@freefriends.org>
7             Olaf Bachmann <obachman@mathematik.uni-kl.de>
8             and many others.
9 Maintained by: Many creative people.
10 Send bugs and suggestions to <texi2html-bug@nongnu.org>
11 -->
12 <head>
13 <title>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" href="#Options">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-Main-options" href="#Main-options">3.2 Main options</a></li>
58     <li><a name="toc-Video-Options" href="#Video-Options">3.3 Video Options</a></li>
59     <li><a name="toc-Advanced-Video-Options" href="#Advanced-Video-Options">3.4 Advanced Video Options</a></li>
60     <li><a name="toc-Audio-Options" href="#Audio-Options">3.5 Audio Options</a></li>
61     <li><a name="toc-Advanced-Audio-options_003a" href="#Advanced-Audio-options_003a">3.6 Advanced Audio options:</a></li>
62     <li><a name="toc-Subtitle-options_003a" href="#Subtitle-options_003a">3.7 Subtitle options:</a></li>
63     <li><a name="toc-Audio_002fVideo-grab-options" href="#Audio_002fVideo-grab-options">3.8 Audio/Video grab options</a></li>
64     <li><a name="toc-Advanced-options" href="#Advanced-options">3.9 Advanced options</a></li>
65     <li><a name="toc-Preset-files" href="#Preset-files">3.10 Preset files</a></li>
66   </ul></li>
67   <li><a name="toc-Tips" href="#Tips">4. Tips</a></li>
68   <li><a name="toc-Examples" href="#Examples">5. Examples</a>
69   <ul class="toc">
70     <li><a name="toc-Video-and-Audio-grabbing" href="#Video-and-Audio-grabbing">5.1 Video and Audio grabbing</a></li>
71     <li><a name="toc-X11-grabbing" href="#X11-grabbing">5.2 X11 grabbing</a></li>
72     <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>
73   </ul></li>
74   <li><a name="toc-Expression-Evaluation" href="#Expression-Evaluation">6. Expression Evaluation</a></li>
75   <li><a name="toc-Encoders" href="#Encoders">7. Encoders</a>
76   <ul class="toc">
77     <li><a name="toc-Audio-Encoders" href="#Audio-Encoders">7.1 Audio Encoders</a>
78     <ul class="toc">
79       <li><a name="toc-ac3-and-ac3_005ffixed" href="#ac3-and-ac3_005ffixed">7.1.1 ac3 and ac3_fixed</a></li>
80     </ul>
81 </li>
82   </ul></li>
83   <li><a name="toc-Demuxers" href="#Demuxers">8. Demuxers</a>
84   <ul class="toc">
85     <li><a name="toc-image2-1" href="#image2-1">8.1 image2</a></li>
86     <li><a name="toc-applehttp-1" href="#applehttp-1">8.2 applehttp</a></li>
87   </ul></li>
88   <li><a name="toc-Muxers" href="#Muxers">9. Muxers</a>
89   <ul class="toc">
90     <li><a name="toc-crc-1" href="#crc-1">9.1 crc</a></li>
91     <li><a name="toc-framecrc-1" href="#framecrc-1">9.2 framecrc</a></li>
92     <li><a name="toc-image2" href="#image2">9.3 image2</a></li>
93     <li><a name="toc-mpegts" href="#mpegts">9.4 mpegts</a></li>
94     <li><a name="toc-null" href="#null">9.5 null</a></li>
95   </ul></li>
96   <li><a name="toc-Input-Devices" href="#Input-Devices">10. Input Devices</a>
97   <ul class="toc">
98     <li><a name="toc-alsa" href="#alsa">10.1 alsa</a></li>
99     <li><a name="toc-bktr" href="#bktr">10.2 bktr</a></li>
100     <li><a name="toc-dv1394" href="#dv1394">10.3 dv1394</a></li>
101     <li><a name="toc-fbdev" href="#fbdev">10.4 fbdev</a></li>
102     <li><a name="toc-jack" href="#jack">10.5 jack</a></li>
103     <li><a name="toc-libdc1394" href="#libdc1394">10.6 libdc1394</a></li>
104     <li><a name="toc-oss" href="#oss">10.7 oss</a></li>
105     <li><a name="toc-sndio-1" href="#sndio-1">10.8 sndio</a></li>
106     <li><a name="toc-video4linux-and-video4linux2" href="#video4linux-and-video4linux2">10.9 video4linux and video4linux2</a></li>
107     <li><a name="toc-vfwcap" href="#vfwcap">10.10 vfwcap</a></li>
108     <li><a name="toc-x11grab" href="#x11grab">10.11 x11grab</a></li>
109   </ul></li>
110   <li><a name="toc-Output-Devices" href="#Output-Devices">11. Output Devices</a>
111   <ul class="toc">
112     <li><a name="toc-alsa-1" href="#alsa-1">11.1 alsa</a></li>
113     <li><a name="toc-oss-1" href="#oss-1">11.2 oss</a></li>
114     <li><a name="toc-sndio" href="#sndio">11.3 sndio</a></li>
115   </ul></li>
116   <li><a name="toc-Protocols" href="#Protocols">12. Protocols</a>
117   <ul class="toc">
118     <li><a name="toc-applehttp" href="#applehttp">12.1 applehttp</a></li>
119     <li><a name="toc-concat" href="#concat">12.2 concat</a></li>
120     <li><a name="toc-file" href="#file">12.3 file</a></li>
121     <li><a name="toc-gopher" href="#gopher">12.4 gopher</a></li>
122     <li><a name="toc-http" href="#http">12.5 http</a></li>
123     <li><a name="toc-mmst" href="#mmst">12.6 mmst</a></li>
124     <li><a name="toc-mmsh" href="#mmsh">12.7 mmsh</a></li>
125     <li><a name="toc-md5" href="#md5">12.8 md5</a></li>
126     <li><a name="toc-pipe" href="#pipe">12.9 pipe</a></li>
127     <li><a name="toc-rtmp" href="#rtmp">12.10 rtmp</a></li>
128     <li><a name="toc-rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte" href="#rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte">12.11 rtmp, rtmpe, rtmps, rtmpt, rtmpte</a></li>
129     <li><a name="toc-rtp" href="#rtp">12.12 rtp</a></li>
130     <li><a name="toc-rtsp" href="#rtsp">12.13 rtsp</a></li>
131     <li><a name="toc-sap" href="#sap">12.14 sap</a>
132     <ul class="toc">
133       <li><a name="toc-Muxer" href="#Muxer">12.14.1 Muxer</a></li>
134       <li><a name="toc-Demuxer" href="#Demuxer">12.14.2 Demuxer</a></li>
135     </ul></li>
136     <li><a name="toc-tcp" href="#tcp">12.15 tcp</a></li>
137     <li><a name="toc-udp" href="#udp">12.16 udp</a></li>
138   </ul></li>
139   <li><a name="toc-Bitstream-Filters" href="#Bitstream-Filters">13. Bitstream Filters</a>
140   <ul class="toc">
141     <li><a name="toc-aac_005fadtstoasc" href="#aac_005fadtstoasc">13.1 aac_adtstoasc</a></li>
142     <li><a name="toc-chomp" href="#chomp">13.2 chomp</a></li>
143     <li><a name="toc-dump_005fextradata" href="#dump_005fextradata">13.3 dump_extradata</a></li>
144     <li><a name="toc-h264_005fmp4toannexb" href="#h264_005fmp4toannexb">13.4 h264_mp4toannexb</a></li>
145     <li><a name="toc-imx_005fdump_005fheader" href="#imx_005fdump_005fheader">13.5 imx_dump_header</a></li>
146     <li><a name="toc-mjpeg2jpeg" href="#mjpeg2jpeg">13.6 mjpeg2jpeg</a></li>
147     <li><a name="toc-mjpega_005fdump_005fheader" href="#mjpega_005fdump_005fheader">13.7 mjpega_dump_header</a></li>
148     <li><a name="toc-movsub" href="#movsub">13.8 movsub</a></li>
149     <li><a name="toc-mp3_005fheader_005fcompress" href="#mp3_005fheader_005fcompress">13.9 mp3_header_compress</a></li>
150     <li><a name="toc-mp3_005fheader_005fdecompress" href="#mp3_005fheader_005fdecompress">13.10 mp3_header_decompress</a></li>
151     <li><a name="toc-noise" href="#noise">13.11 noise</a></li>
152     <li><a name="toc-remove_005fextradata" href="#remove_005fextradata">13.12 remove_extradata</a></li>
153   </ul></li>
154   <li><a name="toc-Filtergraph-description" href="#Filtergraph-description">14. Filtergraph description</a>
155   <ul class="toc">
156     <li><a name="toc-Filtergraph-syntax" href="#Filtergraph-syntax">14.1 Filtergraph syntax</a></li>
157   </ul></li>
158   <li><a name="toc-Audio-Filters" href="#Audio-Filters">15. Audio Filters</a>
159   <ul class="toc">
160     <li><a name="toc-anull" href="#anull">15.1 anull</a></li>
161   </ul></li>
162   <li><a name="toc-Audio-Sources" href="#Audio-Sources">16. Audio Sources</a>
163   <ul class="toc">
164     <li><a name="toc-anullsrc" href="#anullsrc">16.1 anullsrc</a></li>
165   </ul></li>
166   <li><a name="toc-Audio-Sinks" href="#Audio-Sinks">17. Audio Sinks</a>
167   <ul class="toc">
168     <li><a name="toc-anullsink" href="#anullsink">17.1 anullsink</a></li>
169   </ul></li>
170   <li><a name="toc-Video-Filters" href="#Video-Filters">18. Video Filters</a>
171   <ul class="toc">
172     <li><a name="toc-blackframe" href="#blackframe">18.1 blackframe</a></li>
173     <li><a name="toc-copy" href="#copy">18.2 copy</a></li>
174     <li><a name="toc-crop" href="#crop">18.3 crop</a></li>
175     <li><a name="toc-cropdetect" href="#cropdetect">18.4 cropdetect</a></li>
176     <li><a name="toc-drawbox" href="#drawbox">18.5 drawbox</a></li>
177     <li><a name="toc-drawtext" href="#drawtext">18.6 drawtext</a></li>
178     <li><a name="toc-fade" href="#fade">18.7 fade</a></li>
179     <li><a name="toc-fieldorder" href="#fieldorder">18.8 fieldorder</a></li>
180     <li><a name="toc-fifo" href="#fifo">18.9 fifo</a></li>
181     <li><a name="toc-format" href="#format">18.10 format</a></li>
182     <li><a name="toc-frei0r-1" href="#frei0r-1">18.11 frei0r</a></li>
183     <li><a name="toc-gradfun" href="#gradfun">18.12 gradfun</a></li>
184     <li><a name="toc-hflip" href="#hflip">18.13 hflip</a></li>
185     <li><a name="toc-hqdn3d" href="#hqdn3d">18.14 hqdn3d</a></li>
186     <li><a name="toc-mp" href="#mp">18.15 mp</a></li>
187     <li><a name="toc-noformat" href="#noformat">18.16 noformat</a></li>
188     <li><a name="toc-null-1" href="#null-1">18.17 null</a></li>
189     <li><a name="toc-ocv" href="#ocv">18.18 ocv</a>
190     <ul class="toc">
191       <li><a name="toc-dilate-1" href="#dilate-1">18.18.1 dilate</a></li>
192       <li><a name="toc-erode" href="#erode">18.18.2 erode</a></li>
193       <li><a name="toc-smooth" href="#smooth">18.18.3 smooth</a></li>
194     </ul></li>
195     <li><a name="toc-overlay" href="#overlay">18.19 overlay</a></li>
196     <li><a name="toc-pad" href="#pad">18.20 pad</a></li>
197     <li><a name="toc-pixdesctest" href="#pixdesctest">18.21 pixdesctest</a></li>
198     <li><a name="toc-scale" href="#scale">18.22 scale</a></li>
199     <li><a name="toc-setdar-1" href="#setdar-1">18.23 setdar</a></li>
200     <li><a name="toc-setpts" href="#setpts">18.24 setpts</a></li>
201     <li><a name="toc-setsar-1" href="#setsar-1">18.25 setsar</a></li>
202     <li><a name="toc-settb" href="#settb">18.26 settb</a></li>
203     <li><a name="toc-showinfo" href="#showinfo">18.27 showinfo</a></li>
204     <li><a name="toc-slicify" href="#slicify">18.28 slicify</a></li>
205     <li><a name="toc-transpose" href="#transpose">18.29 transpose</a></li>
206     <li><a name="toc-unsharp" href="#unsharp">18.30 unsharp</a></li>
207     <li><a name="toc-vflip" href="#vflip">18.31 vflip</a></li>
208     <li><a name="toc-yadif" href="#yadif">18.32 yadif</a></li>
209   </ul></li>
210   <li><a name="toc-Video-Sources" href="#Video-Sources">19. Video Sources</a>
211   <ul class="toc">
212     <li><a name="toc-buffer" href="#buffer">19.1 buffer</a></li>
213     <li><a name="toc-color" href="#color">19.2 color</a></li>
214     <li><a name="toc-movie" href="#movie">19.3 movie</a></li>
215     <li><a name="toc-nullsrc" href="#nullsrc">19.4 nullsrc</a></li>
216     <li><a name="toc-frei0r_005fsrc" href="#frei0r_005fsrc">19.5 frei0r_src</a></li>
217   </ul></li>
218   <li><a name="toc-Video-Sinks" href="#Video-Sinks">20. Video Sinks</a>
219   <ul class="toc">
220     <li><a name="toc-nullsink" href="#nullsink">20.1 nullsink</a></li>
221   </ul></li>
222   <li><a name="toc-Metadata" href="#Metadata">21. Metadata</a></li>
223 </ul>
224 </div>
225
226 <hr size="1">
227 <a name="Synopsis"></a>
228 <h1 class="chapter"><a href="ffmpeg.html#toc-Synopsis">1. Synopsis</a></h1>
229
230 <p>The generic syntax is:
231 </p>
232 <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>}...
233 </pre></td></tr></table>
234
235 <a name="Description"></a>
236 <h1 class="chapter"><a href="ffmpeg.html#toc-Description">2. Description</a></h1>
237
238 <p>ffmpeg is a very fast video and audio converter that can also grab from
239 a live audio/video source. It can also convert between arbitrary sample
240 rates and resize video on the fly with a high quality polyphase filter.
241 </p>
242 <p>The command line interface is designed to be intuitive, in the sense
243 that ffmpeg tries to figure out all parameters that can possibly be
244 derived automatically. You usually only have to specify the target
245 bitrate you want.
246 </p>
247 <p>As a general rule, options are applied to the next specified
248 file. Therefore, order is important, and you can have the same
249 option on the command line multiple times. Each occurrence is
250 then applied to the next input or output file.
251 </p>
252 <ul>
253 <li>
254 To set the video bitrate of the output file to 64kbit/s:
255 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i input.avi -b 64k output.avi
256 </pre></td></tr></table>
257
258 </li><li>
259 To force the frame rate of the output file to 24 fps:
260 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i input.avi -r 24 output.avi
261 </pre></td></tr></table>
262
263 </li><li>
264 To force the frame rate of the input file (valid for raw formats only)
265 to 1 fps and the frame rate of the output file to 24 fps:
266 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -r 1 -i input.m2v -r 24 output.avi
267 </pre></td></tr></table>
268 </li></ul>
269
270 <p>The format option may be needed for raw input files.
271 </p>
272 <p>By default ffmpeg tries to convert as losslessly as possible: It
273 uses the same audio and video parameters for the outputs as the one
274 specified for the inputs.
275 </p>
276
277 <a name="Options"></a>
278 <h1 class="chapter"><a href="ffmpeg.html#toc-Options">3. Options</a></h1>
279
280 <p>All the numerical options, if not specified otherwise, accept in input
281 a string representing a number, which may contain one of the
282 International System number postfixes, for example &rsquo;K&rsquo;, &rsquo;M&rsquo;, &rsquo;G&rsquo;.
283 If &rsquo;i&rsquo; is appended after the postfix, powers of 2 are used instead of
284 powers of 10. The &rsquo;B&rsquo; postfix multiplies the value for 8, and can be
285 appended after another postfix or used alone. This allows using for
286 example &rsquo;KB&rsquo;, &rsquo;MiB&rsquo;, &rsquo;G&rsquo; and &rsquo;B&rsquo; as postfix.
287 </p>
288 <p>Options which do not take arguments are boolean options, and set the
289 corresponding value to true. They can be set to false by prefixing
290 with &quot;no&quot; the option name, for example using &quot;-nofoo&quot; in the
291 commandline will set to false the boolean option with name &quot;foo&quot;.
292 </p>
293 <a name="Generic-options"></a>
294 <h2 class="section"><a href="ffmpeg.html#toc-Generic-options">3.1 Generic options</a></h2>
295
296 <p>These options are shared amongst the ff* tools.
297 </p>
298 <dl compact="compact">
299 <dt> &lsquo;<samp>-L</samp>&rsquo;</dt>
300 <dd><p>Show license.
301 </p>
302 </dd>
303 <dt> &lsquo;<samp>-h, -?, -help, --help</samp>&rsquo;</dt>
304 <dd><p>Show help.
305 </p>
306 </dd>
307 <dt> &lsquo;<samp>-version</samp>&rsquo;</dt>
308 <dd><p>Show version.
309 </p>
310 </dd>
311 <dt> &lsquo;<samp>-formats</samp>&rsquo;</dt>
312 <dd><p>Show available formats.
313 </p>
314 <p>The fields preceding the format names have the following meanings:
315 </p><dl compact="compact">
316 <dt> &lsquo;<samp>D</samp>&rsquo;</dt>
317 <dd><p>Decoding available
318 </p></dd>
319 <dt> &lsquo;<samp>E</samp>&rsquo;</dt>
320 <dd><p>Encoding available
321 </p></dd>
322 </dl>
323
324 </dd>
325 <dt> &lsquo;<samp>-codecs</samp>&rsquo;</dt>
326 <dd><p>Show available codecs.
327 </p>
328 <p>The fields preceding the codec names have the following meanings:
329 </p><dl compact="compact">
330 <dt> &lsquo;<samp>D</samp>&rsquo;</dt>
331 <dd><p>Decoding available
332 </p></dd>
333 <dt> &lsquo;<samp>E</samp>&rsquo;</dt>
334 <dd><p>Encoding available
335 </p></dd>
336 <dt> &lsquo;<samp>V/A/S</samp>&rsquo;</dt>
337 <dd><p>Video/audio/subtitle codec
338 </p></dd>
339 <dt> &lsquo;<samp>S</samp>&rsquo;</dt>
340 <dd><p>Codec supports slices
341 </p></dd>
342 <dt> &lsquo;<samp>D</samp>&rsquo;</dt>
343 <dd><p>Codec supports direct rendering
344 </p></dd>
345 <dt> &lsquo;<samp>T</samp>&rsquo;</dt>
346 <dd><p>Codec can handle input truncated at random locations instead of only at frame boundaries
347 </p></dd>
348 </dl>
349
350 </dd>
351 <dt> &lsquo;<samp>-bsfs</samp>&rsquo;</dt>
352 <dd><p>Show available bitstream filters.
353 </p>
354 </dd>
355 <dt> &lsquo;<samp>-protocols</samp>&rsquo;</dt>
356 <dd><p>Show available protocols.
357 </p>
358 </dd>
359 <dt> &lsquo;<samp>-filters</samp>&rsquo;</dt>
360 <dd><p>Show available libavfilter filters.
361 </p>
362 </dd>
363 <dt> &lsquo;<samp>-pix_fmts</samp>&rsquo;</dt>
364 <dd><p>Show available pixel formats.
365 </p>
366 </dd>
367 <dt> &lsquo;<samp>-loglevel <var>loglevel</var></samp>&rsquo;</dt>
368 <dd><p>Set the logging level used by the library.
369 <var>loglevel</var> is a number or a string containing one of the following values:
370 </p><dl compact="compact">
371 <dt> &lsquo;<samp>quiet</samp>&rsquo;</dt>
372 <dt> &lsquo;<samp>panic</samp>&rsquo;</dt>
373 <dt> &lsquo;<samp>fatal</samp>&rsquo;</dt>
374 <dt> &lsquo;<samp>error</samp>&rsquo;</dt>
375 <dt> &lsquo;<samp>warning</samp>&rsquo;</dt>
376 <dt> &lsquo;<samp>info</samp>&rsquo;</dt>
377 <dt> &lsquo;<samp>verbose</samp>&rsquo;</dt>
378 <dt> &lsquo;<samp>debug</samp>&rsquo;</dt>
379 </dl>
380
381 <p>By default the program logs to stderr, if coloring is supported by the
382 terminal, colors are used to mark errors and warnings. Log coloring
383 can be disabled setting the environment variable
384 <code>FFMPEG_FORCE_NOCOLOR</code> or <code>NO_COLOR</code>, or can be forced setting
385 the environment variable <code>FFMPEG_FORCE_COLOR</code>.
386 The use of the environment variable <code>NO_COLOR</code> is deprecated and
387 will be dropped in a following FFmpeg version.
388 </p>
389 </dd>
390 </dl>
391
392 <a name="Main-options"></a>
393 <h2 class="section"><a href="ffmpeg.html#toc-Main-options">3.2 Main options</a></h2>
394
395 <dl compact="compact">
396 <dt> &lsquo;<samp>-f <var>fmt</var></samp>&rsquo;</dt>
397 <dd><p>Force format.
398 </p>
399 </dd>
400 <dt> &lsquo;<samp>-i <var>filename</var></samp>&rsquo;</dt>
401 <dd><p>input file name
402 </p>
403 </dd>
404 <dt> &lsquo;<samp>-y</samp>&rsquo;</dt>
405 <dd><p>Overwrite output files.
406 </p>
407 </dd>
408 <dt> &lsquo;<samp>-t <var>duration</var></samp>&rsquo;</dt>
409 <dd><p>Restrict the transcoded/captured video sequence
410 to the duration specified in seconds.
411 <code>hh:mm:ss[.xxx]</code> syntax is also supported.
412 </p>
413 </dd>
414 <dt> &lsquo;<samp>-fs <var>limit_size</var></samp>&rsquo;</dt>
415 <dd><p>Set the file size limit.
416 </p>
417 </dd>
418 <dt> &lsquo;<samp>-ss <var>position</var></samp>&rsquo;</dt>
419 <dd><p>Seek to given time position in seconds.
420 <code>hh:mm:ss[.xxx]</code> syntax is also supported.
421 </p>
422 </dd>
423 <dt> &lsquo;<samp>-itsoffset <var>offset</var></samp>&rsquo;</dt>
424 <dd><p>Set the input time offset in seconds.
425 <code>[-]hh:mm:ss[.xxx]</code> syntax is also supported.
426 This option affects all the input files that follow it.
427 The offset is added to the timestamps of the input files.
428 Specifying a positive offset means that the corresponding
429 streams are delayed by &rsquo;offset&rsquo; seconds.
430 </p>
431 </dd>
432 <dt> &lsquo;<samp>-timestamp <var>time</var></samp>&rsquo;</dt>
433 <dd><p>Set the recording timestamp in the container.
434 The syntax for <var>time</var> is:
435 </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])
436 </pre></td></tr></table>
437 <p>If the value is &quot;now&quot; it takes the current time.
438 Time is local time unless &rsquo;Z&rsquo; or &rsquo;z&rsquo; is appended, in which case it is
439 interpreted as UTC.
440 If the year-month-day part is not specified it takes the current
441 year-month-day.
442 </p>
443 </dd>
444 <dt> &lsquo;<samp>-metadata <var>key</var>=<var>value</var></samp>&rsquo;</dt>
445 <dd><p>Set a metadata key/value pair.
446 </p>
447 <p>For example, for setting the title in the output file:
448 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -metadata title=&quot;my title&quot; out.flv
449 </pre></td></tr></table>
450
451 </dd>
452 <dt> &lsquo;<samp>-v <var>number</var></samp>&rsquo;</dt>
453 <dd><p>Set the logging verbosity level.
454 </p>
455 </dd>
456 <dt> &lsquo;<samp>-target <var>type</var></samp>&rsquo;</dt>
457 <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;,
458 &quot;ntsc-svcd&quot;, ... ). All the format options (bitrate, codecs,
459 buffer sizes) are then set automatically. You can just type:
460 </p>
461 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
462 </pre></td></tr></table>
463
464 <p>Nevertheless you can specify additional options as long as you know
465 they do not conflict with the standard, as in:
466 </p>
467 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
468 </pre></td></tr></table>
469
470 </dd>
471 <dt> &lsquo;<samp>-dframes <var>number</var></samp>&rsquo;</dt>
472 <dd><p>Set the number of data frames to record.
473 </p>
474 </dd>
475 <dt> &lsquo;<samp>-scodec <var>codec</var></samp>&rsquo;</dt>
476 <dd><p>Force subtitle codec (&rsquo;copy&rsquo; to copy stream).
477 </p>
478 </dd>
479 <dt> &lsquo;<samp>-newsubtitle</samp>&rsquo;</dt>
480 <dd><p>Add a new subtitle stream to the current output stream.
481 </p>
482 </dd>
483 <dt> &lsquo;<samp>-slang <var>code</var></samp>&rsquo;</dt>
484 <dd><p>Set the ISO 639 language code (3 letters) of the current subtitle stream.
485 </p>
486 </dd>
487 </dl>
488
489 <a name="Video-Options"></a>
490 <h2 class="section"><a href="ffmpeg.html#toc-Video-Options">3.3 Video Options</a></h2>
491
492 <dl compact="compact">
493 <dt> &lsquo;<samp>-b <var>bitrate</var></samp>&rsquo;</dt>
494 <dd><p>Set the video bitrate in bit/s (default = 200 kb/s).
495 </p></dd>
496 <dt> &lsquo;<samp>-vframes <var>number</var></samp>&rsquo;</dt>
497 <dd><p>Set the number of video frames to record.
498 </p></dd>
499 <dt> &lsquo;<samp>-r <var>fps</var></samp>&rsquo;</dt>
500 <dd><p>Set frame rate (Hz value, fraction or abbreviation), (default = 25).
501 </p></dd>
502 <dt> &lsquo;<samp>-s <var>size</var></samp>&rsquo;</dt>
503 <dd><p>Set frame size. The format is &lsquo;<samp>wxh</samp>&rsquo; (ffserver default = 160x128).
504 There is no default for input streams,
505 for output streams it is set by default to the size of the source stream.
506 If the input file has video streams with different resolutions, the behaviour is undefined.
507 The following abbreviations are recognized:
508 </p><dl compact="compact">
509 <dt> &lsquo;<samp>sqcif</samp>&rsquo;</dt>
510 <dd><p>128x96
511 </p></dd>
512 <dt> &lsquo;<samp>qcif</samp>&rsquo;</dt>
513 <dd><p>176x144
514 </p></dd>
515 <dt> &lsquo;<samp>cif</samp>&rsquo;</dt>
516 <dd><p>352x288
517 </p></dd>
518 <dt> &lsquo;<samp>4cif</samp>&rsquo;</dt>
519 <dd><p>704x576
520 </p></dd>
521 <dt> &lsquo;<samp>16cif</samp>&rsquo;</dt>
522 <dd><p>1408x1152
523 </p></dd>
524 <dt> &lsquo;<samp>qqvga</samp>&rsquo;</dt>
525 <dd><p>160x120
526 </p></dd>
527 <dt> &lsquo;<samp>qvga</samp>&rsquo;</dt>
528 <dd><p>320x240
529 </p></dd>
530 <dt> &lsquo;<samp>vga</samp>&rsquo;</dt>
531 <dd><p>640x480
532 </p></dd>
533 <dt> &lsquo;<samp>svga</samp>&rsquo;</dt>
534 <dd><p>800x600
535 </p></dd>
536 <dt> &lsquo;<samp>xga</samp>&rsquo;</dt>
537 <dd><p>1024x768
538 </p></dd>
539 <dt> &lsquo;<samp>uxga</samp>&rsquo;</dt>
540 <dd><p>1600x1200
541 </p></dd>
542 <dt> &lsquo;<samp>qxga</samp>&rsquo;</dt>
543 <dd><p>2048x1536
544 </p></dd>
545 <dt> &lsquo;<samp>sxga</samp>&rsquo;</dt>
546 <dd><p>1280x1024
547 </p></dd>
548 <dt> &lsquo;<samp>qsxga</samp>&rsquo;</dt>
549 <dd><p>2560x2048
550 </p></dd>
551 <dt> &lsquo;<samp>hsxga</samp>&rsquo;</dt>
552 <dd><p>5120x4096
553 </p></dd>
554 <dt> &lsquo;<samp>wvga</samp>&rsquo;</dt>
555 <dd><p>852x480
556 </p></dd>
557 <dt> &lsquo;<samp>wxga</samp>&rsquo;</dt>
558 <dd><p>1366x768
559 </p></dd>
560 <dt> &lsquo;<samp>wsxga</samp>&rsquo;</dt>
561 <dd><p>1600x1024
562 </p></dd>
563 <dt> &lsquo;<samp>wuxga</samp>&rsquo;</dt>
564 <dd><p>1920x1200
565 </p></dd>
566 <dt> &lsquo;<samp>woxga</samp>&rsquo;</dt>
567 <dd><p>2560x1600
568 </p></dd>
569 <dt> &lsquo;<samp>wqsxga</samp>&rsquo;</dt>
570 <dd><p>3200x2048
571 </p></dd>
572 <dt> &lsquo;<samp>wquxga</samp>&rsquo;</dt>
573 <dd><p>3840x2400
574 </p></dd>
575 <dt> &lsquo;<samp>whsxga</samp>&rsquo;</dt>
576 <dd><p>6400x4096
577 </p></dd>
578 <dt> &lsquo;<samp>whuxga</samp>&rsquo;</dt>
579 <dd><p>7680x4800
580 </p></dd>
581 <dt> &lsquo;<samp>cga</samp>&rsquo;</dt>
582 <dd><p>320x200
583 </p></dd>
584 <dt> &lsquo;<samp>ega</samp>&rsquo;</dt>
585 <dd><p>640x350
586 </p></dd>
587 <dt> &lsquo;<samp>hd480</samp>&rsquo;</dt>
588 <dd><p>852x480
589 </p></dd>
590 <dt> &lsquo;<samp>hd720</samp>&rsquo;</dt>
591 <dd><p>1280x720
592 </p></dd>
593 <dt> &lsquo;<samp>hd1080</samp>&rsquo;</dt>
594 <dd><p>1920x1080
595 </p></dd>
596 </dl>
597
598 </dd>
599 <dt> &lsquo;<samp>-aspect <var>aspect</var></samp>&rsquo;</dt>
600 <dd><p>Set the video display aspect ratio specified by <var>aspect</var>.
601 </p>
602 <p><var>aspect</var> can be a floating point number string, or a string of the
603 form <var>num</var>:<var>den</var>, where <var>num</var> and <var>den</var> are the
604 numerator and denominator of the aspect ratio. For example &quot;4:3&quot;,
605 &quot;16:9&quot;, &quot;1.3333&quot;, and &quot;1.7777&quot; are valid argument values.
606 </p>
607 </dd>
608 <dt> &lsquo;<samp>-croptop <var>size</var></samp>&rsquo;</dt>
609 <dt> &lsquo;<samp>-cropbottom <var>size</var></samp>&rsquo;</dt>
610 <dt> &lsquo;<samp>-cropleft <var>size</var></samp>&rsquo;</dt>
611 <dt> &lsquo;<samp>-cropright <var>size</var></samp>&rsquo;</dt>
612 <dd><p>All the crop options have been removed. Use -vf
613 crop=width:height:x:y instead.
614 </p>
615 </dd>
616 <dt> &lsquo;<samp>-padtop <var>size</var></samp>&rsquo;</dt>
617 <dt> &lsquo;<samp>-padbottom <var>size</var></samp>&rsquo;</dt>
618 <dt> &lsquo;<samp>-padleft <var>size</var></samp>&rsquo;</dt>
619 <dt> &lsquo;<samp>-padright <var>size</var></samp>&rsquo;</dt>
620 <dt> &lsquo;<samp>-padcolor <var>hex_color</var></samp>&rsquo;</dt>
621 <dd><p>All the pad options have been removed. Use -vf
622 pad=width:height:x:y:color instead.
623 </p></dd>
624 <dt> &lsquo;<samp>-vn</samp>&rsquo;</dt>
625 <dd><p>Disable video recording.
626 </p></dd>
627 <dt> &lsquo;<samp>-bt <var>tolerance</var></samp>&rsquo;</dt>
628 <dd><p>Set video bitrate tolerance (in bits, default 4000k).
629 Has a minimum value of: (target_bitrate/target_framerate).
630 In 1-pass mode, bitrate tolerance specifies how far ratecontrol is
631 willing to deviate from the target average bitrate value. This is
632 not related to min/max bitrate. Lowering tolerance too much has
633 an adverse effect on quality.
634 </p></dd>
635 <dt> &lsquo;<samp>-maxrate <var>bitrate</var></samp>&rsquo;</dt>
636 <dd><p>Set max video bitrate (in bit/s).
637 Requires -bufsize to be set.
638 </p></dd>
639 <dt> &lsquo;<samp>-minrate <var>bitrate</var></samp>&rsquo;</dt>
640 <dd><p>Set min video bitrate (in bit/s).
641 Most useful in setting up a CBR encode:
642 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
643 </pre></td></tr></table>
644 <p>It is of little use elsewise.
645 </p></dd>
646 <dt> &lsquo;<samp>-bufsize <var>size</var></samp>&rsquo;</dt>
647 <dd><p>Set video buffer verifier buffer size (in bits).
648 </p></dd>
649 <dt> &lsquo;<samp>-vcodec <var>codec</var></samp>&rsquo;</dt>
650 <dd><p>Force video codec to <var>codec</var>. Use the <code>copy</code> special value to
651 tell that the raw codec data must be copied as is.
652 </p></dd>
653 <dt> &lsquo;<samp>-sameq</samp>&rsquo;</dt>
654 <dd><p>Use same quantizer as source (implies VBR).
655 </p>
656 </dd>
657 <dt> &lsquo;<samp>-pass <var>n</var></samp>&rsquo;</dt>
658 <dd><p>Select the pass number (1 or 2). It is used to do two-pass
659 video encoding. The statistics of the video are recorded in the first
660 pass into a log file (see also the option -passlogfile),
661 and in the second pass that log file is used to generate the video
662 at the exact requested bitrate.
663 On pass 1, you may just deactivate audio and set output to null,
664 examples for Windows and Unix:
665 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y NUL
666 ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y /dev/null
667 </pre></td></tr></table>
668
669 </dd>
670 <dt> &lsquo;<samp>-passlogfile <var>prefix</var></samp>&rsquo;</dt>
671 <dd><p>Set two-pass log file name prefix to <var>prefix</var>, the default file name
672 prefix is &ldquo;ffmpeg2pass&rdquo;. The complete file name will be
673 &lsquo;<tt>PREFIX-N.log</tt>&rsquo;, where N is a number specific to the output
674 stream.
675 </p>
676 </dd>
677 <dt> &lsquo;<samp>-newvideo</samp>&rsquo;</dt>
678 <dd><p>Add a new video stream to the current output stream.
679 </p>
680 </dd>
681 <dt> &lsquo;<samp>-vlang <var>code</var></samp>&rsquo;</dt>
682 <dd><p>Set the ISO 639 language code (3 letters) of the current video stream.
683 </p>
684 </dd>
685 <dt> &lsquo;<samp>-vf <var>filter_graph</var></samp>&rsquo;</dt>
686 <dd><p><var>filter_graph</var> is a description of the filter graph to apply to
687 the input video.
688 Use the option &quot;-filters&quot; to show all the available filters (including
689 also sources and sinks).
690 </p>
691 </dd>
692 </dl>
693
694 <a name="Advanced-Video-Options"></a>
695 <h2 class="section"><a href="ffmpeg.html#toc-Advanced-Video-Options">3.4 Advanced Video Options</a></h2>
696
697 <dl compact="compact">
698 <dt> &lsquo;<samp>-pix_fmt <var>format</var></samp>&rsquo;</dt>
699 <dd><p>Set pixel format. Use &rsquo;list&rsquo; as parameter to show all the supported
700 pixel formats.
701 </p></dd>
702 <dt> &lsquo;<samp>-sws_flags <var>flags</var></samp>&rsquo;</dt>
703 <dd><p>Set SwScaler flags.
704 </p></dd>
705 <dt> &lsquo;<samp>-g <var>gop_size</var></samp>&rsquo;</dt>
706 <dd><p>Set the group of pictures size.
707 </p></dd>
708 <dt> &lsquo;<samp>-intra</samp>&rsquo;</dt>
709 <dd><p>Use only intra frames.
710 </p></dd>
711 <dt> &lsquo;<samp>-vdt <var>n</var></samp>&rsquo;</dt>
712 <dd><p>Discard threshold.
713 </p></dd>
714 <dt> &lsquo;<samp>-qscale <var>q</var></samp>&rsquo;</dt>
715 <dd><p>Use fixed video quantizer scale (VBR).
716 </p></dd>
717 <dt> &lsquo;<samp>-qmin <var>q</var></samp>&rsquo;</dt>
718 <dd><p>minimum video quantizer scale (VBR)
719 </p></dd>
720 <dt> &lsquo;<samp>-qmax <var>q</var></samp>&rsquo;</dt>
721 <dd><p>maximum video quantizer scale (VBR)
722 </p></dd>
723 <dt> &lsquo;<samp>-qdiff <var>q</var></samp>&rsquo;</dt>
724 <dd><p>maximum difference between the quantizer scales (VBR)
725 </p></dd>
726 <dt> &lsquo;<samp>-qblur <var>blur</var></samp>&rsquo;</dt>
727 <dd><p>video quantizer scale blur (VBR) (range 0.0 - 1.0)
728 </p></dd>
729 <dt> &lsquo;<samp>-qcomp <var>compression</var></samp>&rsquo;</dt>
730 <dd><p>video quantizer scale compression (VBR) (default 0.5).
731 Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0
732 </p>
733 </dd>
734 <dt> &lsquo;<samp>-lmin <var>lambda</var></samp>&rsquo;</dt>
735 <dd><p>minimum video lagrange factor (VBR)
736 </p></dd>
737 <dt> &lsquo;<samp>-lmax <var>lambda</var></samp>&rsquo;</dt>
738 <dd><p>max video lagrange factor (VBR)
739 </p></dd>
740 <dt> &lsquo;<samp>-mblmin <var>lambda</var></samp>&rsquo;</dt>
741 <dd><p>minimum macroblock quantizer scale (VBR)
742 </p></dd>
743 <dt> &lsquo;<samp>-mblmax <var>lambda</var></samp>&rsquo;</dt>
744 <dd><p>maximum macroblock quantizer scale (VBR)
745 </p>
746 <p>These four options (lmin, lmax, mblmin, mblmax) use &rsquo;lambda&rsquo; units,
747 but you may use the QP2LAMBDA constant to easily convert from &rsquo;q&rsquo; units:
748 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
749 </pre></td></tr></table>
750
751 </dd>
752 <dt> &lsquo;<samp>-rc_init_cplx <var>complexity</var></samp>&rsquo;</dt>
753 <dd><p>initial complexity for single pass encoding
754 </p></dd>
755 <dt> &lsquo;<samp>-b_qfactor <var>factor</var></samp>&rsquo;</dt>
756 <dd><p>qp factor between P- and B-frames
757 </p></dd>
758 <dt> &lsquo;<samp>-i_qfactor <var>factor</var></samp>&rsquo;</dt>
759 <dd><p>qp factor between P- and I-frames
760 </p></dd>
761 <dt> &lsquo;<samp>-b_qoffset <var>offset</var></samp>&rsquo;</dt>
762 <dd><p>qp offset between P- and B-frames
763 </p></dd>
764 <dt> &lsquo;<samp>-i_qoffset <var>offset</var></samp>&rsquo;</dt>
765 <dd><p>qp offset between P- and I-frames
766 </p></dd>
767 <dt> &lsquo;<samp>-rc_eq <var>equation</var></samp>&rsquo;</dt>
768 <dd><p>Set rate control equation (see section &quot;Expression Evaluation&quot;)
769 (default = <code>tex^qComp</code>).
770 </p>
771 <p>When computing the rate control equation expression, besides the
772 standard functions defined in the section &quot;Expression Evaluation&quot;, the
773 following functions are available:
774 </p><dl compact="compact">
775 <dt> <var>bits2qp(bits)</var></dt>
776 <dt> <var>qp2bits(qp)</var></dt>
777 </dl>
778
779 <p>and the following constants are available:
780 </p><dl compact="compact">
781 <dt> <var>iTex</var></dt>
782 <dt> <var>pTex</var></dt>
783 <dt> <var>tex</var></dt>
784 <dt> <var>mv</var></dt>
785 <dt> <var>fCode</var></dt>
786 <dt> <var>iCount</var></dt>
787 <dt> <var>mcVar</var></dt>
788 <dt> <var>var</var></dt>
789 <dt> <var>isI</var></dt>
790 <dt> <var>isP</var></dt>
791 <dt> <var>isB</var></dt>
792 <dt> <var>avgQP</var></dt>
793 <dt> <var>qComp</var></dt>
794 <dt> <var>avgIITex</var></dt>
795 <dt> <var>avgPITex</var></dt>
796 <dt> <var>avgPPTex</var></dt>
797 <dt> <var>avgBPTex</var></dt>
798 <dt> <var>avgTex</var></dt>
799 </dl>
800
801 </dd>
802 <dt> &lsquo;<samp>-rc_override <var>override</var></samp>&rsquo;</dt>
803 <dd><p>rate control override for specific intervals
804 </p></dd>
805 <dt> &lsquo;<samp>-me_method <var>method</var></samp>&rsquo;</dt>
806 <dd><p>Set motion estimation method to <var>method</var>.
807 Available methods are (from lowest to best quality):
808 </p><dl compact="compact">
809 <dt> &lsquo;<samp>zero</samp>&rsquo;</dt>
810 <dd><p>Try just the (0, 0) vector.
811 </p></dd>
812 <dt> &lsquo;<samp>phods</samp>&rsquo;</dt>
813 <dt> &lsquo;<samp>log</samp>&rsquo;</dt>
814 <dt> &lsquo;<samp>x1</samp>&rsquo;</dt>
815 <dt> &lsquo;<samp>hex</samp>&rsquo;</dt>
816 <dt> &lsquo;<samp>umh</samp>&rsquo;</dt>
817 <dt> &lsquo;<samp>epzs</samp>&rsquo;</dt>
818 <dd><p>(default method)
819 </p></dd>
820 <dt> &lsquo;<samp>full</samp>&rsquo;</dt>
821 <dd><p>exhaustive search (slow and marginally better than epzs)
822 </p></dd>
823 </dl>
824
825 </dd>
826 <dt> &lsquo;<samp>-dct_algo <var>algo</var></samp>&rsquo;</dt>
827 <dd><p>Set DCT algorithm to <var>algo</var>. Available values are:
828 </p><dl compact="compact">
829 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
830 <dd><p>FF_DCT_AUTO (default)
831 </p></dd>
832 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
833 <dd><p>FF_DCT_FASTINT
834 </p></dd>
835 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
836 <dd><p>FF_DCT_INT
837 </p></dd>
838 <dt> &lsquo;<samp>3</samp>&rsquo;</dt>
839 <dd><p>FF_DCT_MMX
840 </p></dd>
841 <dt> &lsquo;<samp>4</samp>&rsquo;</dt>
842 <dd><p>FF_DCT_MLIB
843 </p></dd>
844 <dt> &lsquo;<samp>5</samp>&rsquo;</dt>
845 <dd><p>FF_DCT_ALTIVEC
846 </p></dd>
847 </dl>
848
849 </dd>
850 <dt> &lsquo;<samp>-idct_algo <var>algo</var></samp>&rsquo;</dt>
851 <dd><p>Set IDCT algorithm to <var>algo</var>. Available values are:
852 </p><dl compact="compact">
853 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
854 <dd><p>FF_IDCT_AUTO (default)
855 </p></dd>
856 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
857 <dd><p>FF_IDCT_INT
858 </p></dd>
859 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
860 <dd><p>FF_IDCT_SIMPLE
861 </p></dd>
862 <dt> &lsquo;<samp>3</samp>&rsquo;</dt>
863 <dd><p>FF_IDCT_SIMPLEMMX
864 </p></dd>
865 <dt> &lsquo;<samp>4</samp>&rsquo;</dt>
866 <dd><p>FF_IDCT_LIBMPEG2MMX
867 </p></dd>
868 <dt> &lsquo;<samp>5</samp>&rsquo;</dt>
869 <dd><p>FF_IDCT_PS2
870 </p></dd>
871 <dt> &lsquo;<samp>6</samp>&rsquo;</dt>
872 <dd><p>FF_IDCT_MLIB
873 </p></dd>
874 <dt> &lsquo;<samp>7</samp>&rsquo;</dt>
875 <dd><p>FF_IDCT_ARM
876 </p></dd>
877 <dt> &lsquo;<samp>8</samp>&rsquo;</dt>
878 <dd><p>FF_IDCT_ALTIVEC
879 </p></dd>
880 <dt> &lsquo;<samp>9</samp>&rsquo;</dt>
881 <dd><p>FF_IDCT_SH4
882 </p></dd>
883 <dt> &lsquo;<samp>10</samp>&rsquo;</dt>
884 <dd><p>FF_IDCT_SIMPLEARM
885 </p></dd>
886 </dl>
887
888 </dd>
889 <dt> &lsquo;<samp>-er <var>n</var></samp>&rsquo;</dt>
890 <dd><p>Set error resilience to <var>n</var>.
891 </p><dl compact="compact">
892 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
893 <dd><p>FF_ER_CAREFUL (default)
894 </p></dd>
895 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
896 <dd><p>FF_ER_COMPLIANT
897 </p></dd>
898 <dt> &lsquo;<samp>3</samp>&rsquo;</dt>
899 <dd><p>FF_ER_AGGRESSIVE
900 </p></dd>
901 <dt> &lsquo;<samp>4</samp>&rsquo;</dt>
902 <dd><p>FF_ER_VERY_AGGRESSIVE
903 </p></dd>
904 </dl>
905
906 </dd>
907 <dt> &lsquo;<samp>-ec <var>bit_mask</var></samp>&rsquo;</dt>
908 <dd><p>Set error concealment to <var>bit_mask</var>. <var>bit_mask</var> is a bit mask of
909 the following values:
910 </p><dl compact="compact">
911 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
912 <dd><p>FF_EC_GUESS_MVS (default = enabled)
913 </p></dd>
914 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
915 <dd><p>FF_EC_DEBLOCK (default = enabled)
916 </p></dd>
917 </dl>
918
919 </dd>
920 <dt> &lsquo;<samp>-bf <var>frames</var></samp>&rsquo;</dt>
921 <dd><p>Use &rsquo;frames&rsquo; B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
922 </p></dd>
923 <dt> &lsquo;<samp>-mbd <var>mode</var></samp>&rsquo;</dt>
924 <dd><p>macroblock decision
925 </p><dl compact="compact">
926 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
927 <dd><p>FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in ffmpeg).
928 </p></dd>
929 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
930 <dd><p>FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
931 </p></dd>
932 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
933 <dd><p>FF_MB_DECISION_RD: rate distortion
934 </p></dd>
935 </dl>
936
937 </dd>
938 <dt> &lsquo;<samp>-4mv</samp>&rsquo;</dt>
939 <dd><p>Use four motion vector by macroblock (MPEG-4 only).
940 </p></dd>
941 <dt> &lsquo;<samp>-part</samp>&rsquo;</dt>
942 <dd><p>Use data partitioning (MPEG-4 only).
943 </p></dd>
944 <dt> &lsquo;<samp>-bug <var>param</var></samp>&rsquo;</dt>
945 <dd><p>Work around encoder bugs that are not auto-detected.
946 </p></dd>
947 <dt> &lsquo;<samp>-strict <var>strictness</var></samp>&rsquo;</dt>
948 <dd><p>How strictly to follow the standards.
949 </p></dd>
950 <dt> &lsquo;<samp>-aic</samp>&rsquo;</dt>
951 <dd><p>Enable Advanced intra coding (h263+).
952 </p></dd>
953 <dt> &lsquo;<samp>-umv</samp>&rsquo;</dt>
954 <dd><p>Enable Unlimited Motion Vector (h263+)
955 </p>
956 </dd>
957 <dt> &lsquo;<samp>-deinterlace</samp>&rsquo;</dt>
958 <dd><p>Deinterlace pictures.
959 </p></dd>
960 <dt> &lsquo;<samp>-ilme</samp>&rsquo;</dt>
961 <dd><p>Force interlacing support in encoder (MPEG-2 and MPEG-4 only).
962 Use this option if your input file is interlaced and you want
963 to keep the interlaced format for minimum losses.
964 The alternative is to deinterlace the input stream with
965 &lsquo;<samp>-deinterlace</samp>&rsquo;, but deinterlacing introduces losses.
966 </p></dd>
967 <dt> &lsquo;<samp>-psnr</samp>&rsquo;</dt>
968 <dd><p>Calculate PSNR of compressed frames.
969 </p></dd>
970 <dt> &lsquo;<samp>-vstats</samp>&rsquo;</dt>
971 <dd><p>Dump video coding statistics to &lsquo;<tt>vstats_HHMMSS.log</tt>&rsquo;.
972 </p></dd>
973 <dt> &lsquo;<samp>-vstats_file <var>file</var></samp>&rsquo;</dt>
974 <dd><p>Dump video coding statistics to <var>file</var>.
975 </p></dd>
976 <dt> &lsquo;<samp>-top <var>n</var></samp>&rsquo;</dt>
977 <dd><p>top=1/bottom=0/auto=-1 field first
978 </p></dd>
979 <dt> &lsquo;<samp>-dc <var>precision</var></samp>&rsquo;</dt>
980 <dd><p>Intra_dc_precision.
981 </p></dd>
982 <dt> &lsquo;<samp>-vtag <var>fourcc/tag</var></samp>&rsquo;</dt>
983 <dd><p>Force video tag/fourcc.
984 </p></dd>
985 <dt> &lsquo;<samp>-qphist</samp>&rsquo;</dt>
986 <dd><p>Show QP histogram.
987 </p></dd>
988 <dt> &lsquo;<samp>-vbsf <var>bitstream_filter</var></samp>&rsquo;</dt>
989 <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;.
990 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i h264.mp4 -vcodec copy -vbsf h264_mp4toannexb -an out.h264
991 </pre></td></tr></table>
992 </dd>
993 <dt> &lsquo;<samp>-force_key_frames <var>time</var>[,<var>time</var>...]</samp>&rsquo;</dt>
994 <dd><p>Force key frames at the specified timestamps, more precisely at the first
995 frames after each specified time.
996 This option can be useful to ensure that a seek point is present at a
997 chapter mark or any other designated place in the output file.
998 The timestamps must be specified in ascending order.
999 </p></dd>
1000 </dl>
1001
1002 <a name="Audio-Options"></a>
1003 <h2 class="section"><a href="ffmpeg.html#toc-Audio-Options">3.5 Audio Options</a></h2>
1004
1005 <dl compact="compact">
1006 <dt> &lsquo;<samp>-aframes <var>number</var></samp>&rsquo;</dt>
1007 <dd><p>Set the number of audio frames to record.
1008 </p></dd>
1009 <dt> &lsquo;<samp>-ar <var>freq</var></samp>&rsquo;</dt>
1010 <dd><p>Set the audio sampling frequency. For input streams it is set by
1011 default to 44100 Hz, for output streams it is set by default to the
1012 frequency of the input stream. If the input file has audio streams
1013 with different frequencies, the behaviour is undefined.
1014 </p></dd>
1015 <dt> &lsquo;<samp>-ab <var>bitrate</var></samp>&rsquo;</dt>
1016 <dd><p>Set the audio bitrate in bit/s (default = 64k).
1017 </p></dd>
1018 <dt> &lsquo;<samp>-aq <var>q</var></samp>&rsquo;</dt>
1019 <dd><p>Set the audio quality (codec-specific, VBR).
1020 </p></dd>
1021 <dt> &lsquo;<samp>-ac <var>channels</var></samp>&rsquo;</dt>
1022 <dd><p>Set the number of audio channels. For input streams it is set by
1023 default to 1, for output streams it is set by default to the same
1024 number of audio channels in input. If the input file has audio streams
1025 with different channel count, the behaviour is undefined.
1026 </p></dd>
1027 <dt> &lsquo;<samp>-an</samp>&rsquo;</dt>
1028 <dd><p>Disable audio recording.
1029 </p></dd>
1030 <dt> &lsquo;<samp>-acodec <var>codec</var></samp>&rsquo;</dt>
1031 <dd><p>Force audio codec to <var>codec</var>. Use the <code>copy</code> special value to
1032 specify that the raw codec data must be copied as is.
1033 </p></dd>
1034 <dt> &lsquo;<samp>-newaudio</samp>&rsquo;</dt>
1035 <dd><p>Add a new audio track to the output file. If you want to specify parameters,
1036 do so before <code>-newaudio</code> (<code>-acodec</code>, <code>-ab</code>, etc..).
1037 </p>
1038 <p>Mapping will be done automatically, if the number of output streams is equal to
1039 the number of input streams, else it will pick the first one that matches. You
1040 can override the mapping using <code>-map</code> as usual.
1041 </p>
1042 <p>Example:
1043 </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
1044 </pre></td></tr></table>
1045 </dd>
1046 <dt> &lsquo;<samp>-alang <var>code</var></samp>&rsquo;</dt>
1047 <dd><p>Set the ISO 639 language code (3 letters) of the current audio stream.
1048 </p></dd>
1049 </dl>
1050
1051 <a name="Advanced-Audio-options_003a"></a>
1052 <h2 class="section"><a href="ffmpeg.html#toc-Advanced-Audio-options_003a">3.6 Advanced Audio options:</a></h2>
1053
1054 <dl compact="compact">
1055 <dt> &lsquo;<samp>-atag <var>fourcc/tag</var></samp>&rsquo;</dt>
1056 <dd><p>Force audio tag/fourcc.
1057 </p></dd>
1058 <dt> &lsquo;<samp>-audio_service_type <var>type</var></samp>&rsquo;</dt>
1059 <dd><p>Set the type of service that the audio stream contains.
1060 </p><dl compact="compact">
1061 <dt> &lsquo;<samp>ma</samp>&rsquo;</dt>
1062 <dd><p>Main Audio Service (default)
1063 </p></dd>
1064 <dt> &lsquo;<samp>ef</samp>&rsquo;</dt>
1065 <dd><p>Effects
1066 </p></dd>
1067 <dt> &lsquo;<samp>vi</samp>&rsquo;</dt>
1068 <dd><p>Visually Impaired
1069 </p></dd>
1070 <dt> &lsquo;<samp>hi</samp>&rsquo;</dt>
1071 <dd><p>Hearing Impaired
1072 </p></dd>
1073 <dt> &lsquo;<samp>di</samp>&rsquo;</dt>
1074 <dd><p>Dialogue
1075 </p></dd>
1076 <dt> &lsquo;<samp>co</samp>&rsquo;</dt>
1077 <dd><p>Commentary
1078 </p></dd>
1079 <dt> &lsquo;<samp>em</samp>&rsquo;</dt>
1080 <dd><p>Emergency
1081 </p></dd>
1082 <dt> &lsquo;<samp>vo</samp>&rsquo;</dt>
1083 <dd><p>Voice Over
1084 </p></dd>
1085 <dt> &lsquo;<samp>ka</samp>&rsquo;</dt>
1086 <dd><p>Karaoke
1087 </p></dd>
1088 </dl>
1089 </dd>
1090 <dt> &lsquo;<samp>-absf <var>bitstream_filter</var></samp>&rsquo;</dt>
1091 <dd><p>Bitstream filters available are &quot;dump_extra&quot;, &quot;remove_extra&quot;, &quot;noise&quot;, &quot;mp3comp&quot;, &quot;mp3decomp&quot;.
1092 </p></dd>
1093 </dl>
1094
1095 <a name="Subtitle-options_003a"></a>
1096 <h2 class="section"><a href="ffmpeg.html#toc-Subtitle-options_003a">3.7 Subtitle options:</a></h2>
1097
1098 <dl compact="compact">
1099 <dt> &lsquo;<samp>-scodec <var>codec</var></samp>&rsquo;</dt>
1100 <dd><p>Force subtitle codec (&rsquo;copy&rsquo; to copy stream).
1101 </p></dd>
1102 <dt> &lsquo;<samp>-newsubtitle</samp>&rsquo;</dt>
1103 <dd><p>Add a new subtitle stream to the current output stream.
1104 </p></dd>
1105 <dt> &lsquo;<samp>-slang <var>code</var></samp>&rsquo;</dt>
1106 <dd><p>Set the ISO 639 language code (3 letters) of the current subtitle stream.
1107 </p></dd>
1108 <dt> &lsquo;<samp>-sn</samp>&rsquo;</dt>
1109 <dd><p>Disable subtitle recording.
1110 </p></dd>
1111 <dt> &lsquo;<samp>-sbsf <var>bitstream_filter</var></samp>&rsquo;</dt>
1112 <dd><p>Bitstream filters available are &quot;mov2textsub&quot;, &quot;text2movsub&quot;.
1113 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i file.mov -an -vn -sbsf mov2textsub -scodec copy -f rawvideo sub.txt
1114 </pre></td></tr></table>
1115 </dd>
1116 </dl>
1117
1118 <a name="Audio_002fVideo-grab-options"></a>
1119 <h2 class="section"><a href="ffmpeg.html#toc-Audio_002fVideo-grab-options">3.8 Audio/Video grab options</a></h2>
1120
1121 <dl compact="compact">
1122 <dt> &lsquo;<samp>-vc <var>channel</var></samp>&rsquo;</dt>
1123 <dd><p>Set video grab channel (DV1394 only).
1124 </p></dd>
1125 <dt> &lsquo;<samp>-tvstd <var>standard</var></samp>&rsquo;</dt>
1126 <dd><p>Set television standard (NTSC, PAL (SECAM)).
1127 </p></dd>
1128 <dt> &lsquo;<samp>-isync</samp>&rsquo;</dt>
1129 <dd><p>Synchronize read on input.
1130 </p></dd>
1131 </dl>
1132
1133 <a name="Advanced-options"></a>
1134 <h2 class="section"><a href="ffmpeg.html#toc-Advanced-options">3.9 Advanced options</a></h2>
1135
1136 <dl compact="compact">
1137 <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>
1138 <dd>
1139 <p>Designate an input stream as a source for the output file. Each input
1140 stream is identified by the input file index <var>input_file_id</var> and
1141 the input stream index <var>input_stream_id</var> within the input
1142 file. Both indexes start at 0. If specified,
1143 <var>sync_file_id</var>.<var>sync_stream_id</var> sets which input stream
1144 is used as a presentation sync reference.
1145 </p>
1146 <p>The <code>-map</code> options must be specified just after the output file.
1147 If any <code>-map</code> options are used, the number of <code>-map</code> options
1148 on the command line must match the number of streams in the output
1149 file. The first <code>-map</code> option on the command line specifies the
1150 source for output stream 0, the second <code>-map</code> option specifies
1151 the source for output stream 1, etc.
1152 </p>
1153 <p>For example, if you have two audio streams in the first input file,
1154 these streams are identified by &quot;0.0&quot; and &quot;0.1&quot;. You can use
1155 <code>-map</code> to select which stream to place in an output file. For
1156 example:
1157 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT out.wav -map 0.1
1158 </pre></td></tr></table>
1159 <p>will map the input stream in &lsquo;<tt>INPUT</tt>&rsquo; identified by &quot;0.1&quot; to
1160 the (single) output stream in &lsquo;<tt>out.wav</tt>&rsquo;.
1161 </p>
1162 <p>For example, to select the stream with index 2 from input file
1163 &lsquo;<tt>a.mov</tt>&rsquo; (specified by the identifier &quot;0.2&quot;), and stream with
1164 index 6 from input &lsquo;<tt>b.mov</tt>&rsquo; (specified by the identifier &quot;1.6&quot;),
1165 and copy them to the output file &lsquo;<tt>out.mov</tt>&rsquo;:
1166 </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
1167 </pre></td></tr></table>
1168
1169 <p>To add more streams to the output file, you can use the
1170 <code>-newaudio</code>, <code>-newvideo</code>, <code>-newsubtitle</code> options.
1171 </p>
1172 </dd>
1173 <dt> &lsquo;<samp>-map_meta_data <var>outfile</var>[,<var>metadata</var>]:<var>infile</var>[,<var>metadata</var>]</samp>&rsquo;</dt>
1174 <dd><p>Deprecated, use <var>-map_metadata</var> instead.
1175 </p>
1176 </dd>
1177 <dt> &lsquo;<samp>-map_metadata <var>outfile</var>[,<var>metadata</var>]:<var>infile</var>[,<var>metadata</var>]</samp>&rsquo;</dt>
1178 <dd><p>Set metadata information of <var>outfile</var> from <var>infile</var>. Note that those
1179 are file indices (zero-based), not filenames.
1180 Optional <var>metadata</var> parameters specify, which metadata to copy - (g)lobal
1181 (i.e. metadata that applies to the whole file), per-(s)tream, per-(c)hapter or
1182 per-(p)rogram. All metadata specifiers other than global must be followed by the
1183 stream/chapter/program number. If metadata specifier is omitted, it defaults to
1184 global.
1185 </p>
1186 <p>By default, global metadata is copied from the first input file to all output files,
1187 per-stream and per-chapter metadata is copied along with streams/chapters. These
1188 default mappings are disabled by creating any mapping of the relevant type. A negative
1189 file index can be used to create a dummy mapping that just disables automatic copying.
1190 </p>
1191 <p>For example to copy metadata from the first stream of the input file to global metadata
1192 of the output file:
1193 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.ogg -map_metadata 0:0,s0 out.mp3
1194 </pre></td></tr></table>
1195 </dd>
1196 <dt> &lsquo;<samp>-map_chapters <var>outfile</var>:<var>infile</var></samp>&rsquo;</dt>
1197 <dd><p>Copy chapters from <var>infile</var> to <var>outfile</var>. If no chapter mapping is specified,
1198 then chapters are copied from the first input file with at least one chapter to all
1199 output files. Use a negative file index to disable any chapter copying.
1200 </p></dd>
1201 <dt> &lsquo;<samp>-debug</samp>&rsquo;</dt>
1202 <dd><p>Print specific debug info.
1203 </p></dd>
1204 <dt> &lsquo;<samp>-benchmark</samp>&rsquo;</dt>
1205 <dd><p>Show benchmarking information at the end of an encode.
1206 Shows CPU time used and maximum memory consumption.
1207 Maximum memory consumption is not supported on all systems,
1208 it will usually display as 0 if not supported.
1209 </p></dd>
1210 <dt> &lsquo;<samp>-dump</samp>&rsquo;</dt>
1211 <dd><p>Dump each input packet.
1212 </p></dd>
1213 <dt> &lsquo;<samp>-hex</samp>&rsquo;</dt>
1214 <dd><p>When dumping packets, also dump the payload.
1215 </p></dd>
1216 <dt> &lsquo;<samp>-bitexact</samp>&rsquo;</dt>
1217 <dd><p>Only use bit exact algorithms (for codec testing).
1218 </p></dd>
1219 <dt> &lsquo;<samp>-ps <var>size</var></samp>&rsquo;</dt>
1220 <dd><p>Set RTP payload size in bytes.
1221 </p></dd>
1222 <dt> &lsquo;<samp>-re</samp>&rsquo;</dt>
1223 <dd><p>Read input at native frame rate. Mainly used to simulate a grab device.
1224 </p></dd>
1225 <dt> &lsquo;<samp>-loop_input</samp>&rsquo;</dt>
1226 <dd><p>Loop over the input stream. Currently it works only for image
1227 streams. This option is used for automatic FFserver testing.
1228 </p></dd>
1229 <dt> &lsquo;<samp>-loop_output <var>number_of_times</var></samp>&rsquo;</dt>
1230 <dd><p>Repeatedly loop output for formats that support looping such as animated GIF
1231 (0 will loop the output infinitely).
1232 </p></dd>
1233 <dt> &lsquo;<samp>-threads <var>count</var></samp>&rsquo;</dt>
1234 <dd><p>Thread count.
1235 </p></dd>
1236 <dt> &lsquo;<samp>-vsync <var>parameter</var></samp>&rsquo;</dt>
1237 <dd><p>Video sync method.
1238 </p>
1239 <dl compact="compact">
1240 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
1241 <dd><p>Each frame is passed with its timestamp from the demuxer to the muxer.
1242 </p></dd>
1243 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
1244 <dd><p>Frames will be duplicated and dropped to achieve exactly the requested
1245 constant framerate.
1246 </p></dd>
1247 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
1248 <dd><p>Frames are passed through with their timestamp or dropped so as to
1249 prevent 2 frames from having the same timestamp.
1250 </p></dd>
1251 <dt> &lsquo;<samp>-1</samp>&rsquo;</dt>
1252 <dd><p>Chooses between 1 and 2 depending on muxer capabilities. This is the
1253 default method.
1254 </p></dd>
1255 </dl>
1256
1257 <p>With -map you can select from which stream the timestamps should be
1258 taken. You can leave either video or audio unchanged and sync the
1259 remaining stream(s) to the unchanged one.
1260 </p>
1261 </dd>
1262 <dt> &lsquo;<samp>-async <var>samples_per_second</var></samp>&rsquo;</dt>
1263 <dd><p>Audio sync method. &quot;Stretches/squeezes&quot; the audio stream to match the timestamps,
1264 the parameter is the maximum samples per second by which the audio is changed.
1265 -async 1 is a special case where only the start of the audio stream is corrected
1266 without any later correction.
1267 </p></dd>
1268 <dt> &lsquo;<samp>-copyts</samp>&rsquo;</dt>
1269 <dd><p>Copy timestamps from input to output.
1270 </p></dd>
1271 <dt> &lsquo;<samp>-copytb</samp>&rsquo;</dt>
1272 <dd><p>Copy input stream time base from input to output when stream copying.
1273 </p></dd>
1274 <dt> &lsquo;<samp>-shortest</samp>&rsquo;</dt>
1275 <dd><p>Finish encoding when the shortest input stream ends.
1276 </p></dd>
1277 <dt> &lsquo;<samp>-dts_delta_threshold</samp>&rsquo;</dt>
1278 <dd><p>Timestamp discontinuity delta threshold.
1279 </p></dd>
1280 <dt> &lsquo;<samp>-muxdelay <var>seconds</var></samp>&rsquo;</dt>
1281 <dd><p>Set the maximum demux-decode delay.
1282 </p></dd>
1283 <dt> &lsquo;<samp>-muxpreload <var>seconds</var></samp>&rsquo;</dt>
1284 <dd><p>Set the initial demux-decode delay.
1285 </p></dd>
1286 <dt> &lsquo;<samp>-streamid <var>output-stream-index</var>:<var>new-value</var></samp>&rsquo;</dt>
1287 <dd><p>Assign a new stream-id value to an output stream. This option should be
1288 specified prior to the output filename to which it applies.
1289 For the situation where multiple output files exist, a streamid
1290 may be reassigned to a different value.
1291 </p>
1292 <p>For example, to set the stream 0 PID to 33 and the stream 1 PID to 36 for
1293 an output mpegts file:
1294 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i infile -streamid 0:33 -streamid 1:36 out.ts
1295 </pre></td></tr></table>
1296 </dd>
1297 </dl>
1298
1299 <a name="Preset-files"></a>
1300 <h2 class="section"><a href="ffmpeg.html#toc-Preset-files">3.10 Preset files</a></h2>
1301
1302 <p>A preset file contains a sequence of <var>option</var>=<var>value</var> pairs,
1303 one for each line, specifying a sequence of options which would be
1304 awkward to specify on the command line. Lines starting with the hash
1305 (&rsquo;#&rsquo;) character are ignored and are used to provide comments. Check
1306 the &lsquo;<tt>ffpresets</tt>&rsquo; directory in the FFmpeg source tree for examples.
1307 </p>
1308 <p>Preset files are specified with the <code>vpre</code>, <code>apre</code>,
1309 <code>spre</code>, and <code>fpre</code> options. The <code>fpre</code> option takes the
1310 filename of the preset instead of a preset name as input and can be
1311 used for any kind of codec. For the <code>vpre</code>, <code>apre</code>, and
1312 <code>spre</code> options, the options specified in a preset file are
1313 applied to the currently selected codec of the same type as the preset
1314 option.
1315 </p>
1316 <p>The argument passed to the <code>vpre</code>, <code>apre</code>, and <code>spre</code>
1317 preset options identifies the preset file to use according to the
1318 following rules:
1319 </p>
1320 <p>First ffmpeg searches for a file named <var>arg</var>.ffpreset in the
1321 directories &lsquo;<tt>$FFMPEG_DATADIR</tt>&rsquo; (if set), and &lsquo;<tt>$HOME/.ffmpeg</tt>&rsquo;, and in
1322 the datadir defined at configuration time (usually &lsquo;<tt>PREFIX/share/ffmpeg</tt>&rsquo;)
1323 in that order. For example, if the argument is <code>libx264-max</code>, it will
1324 search for the file &lsquo;<tt>libx264-max.ffpreset</tt>&rsquo;.
1325 </p>
1326 <p>If no such file is found, then ffmpeg will search for a file named
1327 <var>codec_name</var>-<var>arg</var>.ffpreset in the above-mentioned
1328 directories, where <var>codec_name</var> is the name of the codec to which
1329 the preset file options will be applied. For example, if you select
1330 the video codec with <code>-vcodec libx264</code> and use <code>-vpre max</code>,
1331 then it will search for the file &lsquo;<tt>libx264-max.ffpreset</tt>&rsquo;.
1332 </p>
1333 <a name="Tips"></a>
1334 <h1 class="chapter"><a href="ffmpeg.html#toc-Tips">4. Tips</a></h1>
1335
1336 <ul>
1337 <li>
1338 For streaming at very low bitrate application, use a low frame rate
1339 and a small GOP size. This is especially true for RealVideo where
1340 the Linux player does not seem to be very fast, so it can miss
1341 frames. An example is:
1342
1343 <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
1344 </pre></td></tr></table>
1345
1346 </li><li>
1347 The parameter &rsquo;q&rsquo; which is displayed while encoding is the current
1348 quantizer. The value 1 indicates that a very good quality could
1349 be achieved. The value 31 indicates the worst quality. If q=31 appears
1350 too often, it means that the encoder cannot compress enough to meet
1351 your bitrate. You must either increase the bitrate, decrease the
1352 frame rate or decrease the frame size.
1353
1354 </li><li>
1355 If your computer is not fast enough, you can speed up the
1356 compression at the expense of the compression ratio. You can use
1357 &rsquo;-me zero&rsquo; to speed up motion estimation, and &rsquo;-intra&rsquo; to disable
1358 motion estimation completely (you have only I-frames, which means it
1359 is about as good as JPEG compression).
1360
1361 </li><li>
1362 To have very low audio bitrates, reduce the sampling frequency
1363 (down to 22050 Hz for MPEG audio, 22050 or 11025 for AC-3).
1364
1365 </li><li>
1366 To have a constant quality (but a variable bitrate), use the option
1367 &rsquo;-qscale n&rsquo; when &rsquo;n&rsquo; is between 1 (excellent quality) and 31 (worst
1368 quality).
1369
1370 </li><li>
1371 When converting video files, you can use the &rsquo;-sameq&rsquo; option which
1372 uses the same quality factor in the encoder as in the decoder.
1373 It allows almost lossless encoding.
1374
1375 </li></ul>
1376
1377 <a name="Examples"></a>
1378 <h1 class="chapter"><a href="ffmpeg.html#toc-Examples">5. Examples</a></h1>
1379
1380 <a name="Video-and-Audio-grabbing"></a>
1381 <h2 class="section"><a href="ffmpeg.html#toc-Video-and-Audio-grabbing">5.1 Video and Audio grabbing</a></h2>
1382
1383 <p>If you specify the input format and device then ffmpeg can grab video
1384 and audio directly.
1385 </p>
1386 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg
1387 </pre></td></tr></table>
1388
1389 <p>Note that you must activate the right video source and channel before
1390 launching ffmpeg with any TV viewer such as xawtv
1391 (<a href="http://linux.bytesex.org/xawtv/">http://linux.bytesex.org/xawtv/</a>) by Gerd Knorr. You also
1392 have to set the audio recording levels correctly with a
1393 standard mixer.
1394 </p>
1395 <a name="X11-grabbing"></a>
1396 <h2 class="section"><a href="ffmpeg.html#toc-X11-grabbing">5.2 X11 grabbing</a></h2>
1397
1398 <p>Grab the X11 display with ffmpeg via
1399 </p>
1400 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f x11grab -s cif -r 25 -i :0.0 /tmp/out.mpg
1401 </pre></td></tr></table>
1402
1403 <p>0.0 is display.screen number of your X11 server, same as
1404 the DISPLAY environment variable.
1405 </p>
1406 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f x11grab -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg
1407 </pre></td></tr></table>
1408
1409 <p>0.0 is display.screen number of your X11 server, same as the DISPLAY environment
1410 variable. 10 is the x-offset and 20 the y-offset for the grabbing.
1411 </p>
1412 <a name="Video-and-Audio-file-format-conversion"></a>
1413 <h2 class="section"><a href="ffmpeg.html#toc-Video-and-Audio-file-format-conversion">5.3 Video and Audio file format conversion</a></h2>
1414
1415 <p>Any supported file format and protocol can serve as input to ffmpeg:
1416 </p>
1417 <p>Examples:
1418 </p><ul>
1419 <li>
1420 You can use YUV files as input:
1421
1422 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
1423 </pre></td></tr></table>
1424
1425 <p>It will use the files:
1426 </p><table><tr><td>&nbsp;</td><td><pre class="example">/tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
1427 /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
1428 </pre></td></tr></table>
1429
1430 <p>The Y files use twice the resolution of the U and V files. They are
1431 raw files, without header. They can be generated by all decent video
1432 decoders. You must specify the size of the image with the &lsquo;<samp>-s</samp>&rsquo; option
1433 if ffmpeg cannot guess it.
1434 </p>
1435 </li><li>
1436 You can input from a raw YUV420P file:
1437
1438 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i /tmp/test.yuv /tmp/out.avi
1439 </pre></td></tr></table>
1440
1441 <p>test.yuv is a file containing raw YUV planar data. Each frame is composed
1442 of the Y plane followed by the U and V planes at half vertical and
1443 horizontal resolution.
1444 </p>
1445 </li><li>
1446 You can output to a raw YUV420P file:
1447
1448 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i mydivx.avi hugefile.yuv
1449 </pre></td></tr></table>
1450
1451 </li><li>
1452 You can set several input files and output files:
1453
1454 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
1455 </pre></td></tr></table>
1456
1457 <p>Converts the audio file a.wav and the raw YUV video file a.yuv
1458 to MPEG file a.mpg.
1459 </p>
1460 </li><li>
1461 You can also do audio and video conversions at the same time:
1462
1463 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
1464 </pre></td></tr></table>
1465
1466 <p>Converts a.wav to MPEG audio at 22050 Hz sample rate.
1467 </p>
1468 </li><li>
1469 You can encode to several formats at the same time and define a
1470 mapping from input stream to output streams:
1471
1472 <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
1473 </pre></td></tr></table>
1474
1475 <p>Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. &rsquo;-map
1476 file:index&rsquo; specifies which input stream is used for each output
1477 stream, in the order of the definition of output streams.
1478 </p>
1479 </li><li>
1480 You can transcode decrypted VOBs:
1481
1482 <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
1483 </pre></td></tr></table>
1484
1485 <p>This is a typical DVD ripping example; the input is a VOB file, the
1486 output an AVI file with MPEG-4 video and MP3 audio. Note that in this
1487 command we use B-frames so the MPEG-4 stream is DivX5 compatible, and
1488 GOP size is 300 which means one intra frame every 10 seconds for 29.97fps
1489 input video. Furthermore, the audio stream is MP3-encoded so you need
1490 to enable LAME support by passing <code>--enable-libmp3lame</code> to configure.
1491 The mapping is particularly useful for DVD transcoding
1492 to get the desired audio language.
1493 </p>
1494 <p>NOTE: To see the supported input formats, use <code>ffmpeg -formats</code>.
1495 </p>
1496 </li><li>
1497 You can extract images from a video, or create a video from many images:
1498
1499 <p>For extracting images from a video:
1500 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
1501 </pre></td></tr></table>
1502
1503 <p>This will extract one video frame per second from the video and will
1504 output them in files named &lsquo;<tt>foo-001.jpeg</tt>&rsquo;, &lsquo;<tt>foo-002.jpeg</tt>&rsquo;,
1505 etc. Images will be rescaled to fit the new WxH values.
1506 </p>
1507 <p>If you want to extract just a limited number of frames, you can use the
1508 above command in combination with the -vframes or -t option, or in
1509 combination with -ss to start extracting from a certain point in time.
1510 </p>
1511 <p>For creating a video from many images:
1512 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi
1513 </pre></td></tr></table>
1514
1515 <p>The syntax <code>foo-%03d.jpeg</code> specifies to use a decimal number
1516 composed of three digits padded with zeroes to express the sequence
1517 number. It is the same syntax supported by the C printf function, but
1518 only formats accepting a normal integer are suitable.
1519 </p>
1520 </li><li>
1521 You can put many streams of the same type in the output:
1522
1523 <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
1524 </pre></td></tr></table>
1525
1526 <p>In addition to the first video and audio streams, the resulting
1527 output file &lsquo;<tt>test12.avi</tt>&rsquo; will contain the second video
1528 and the second audio stream found in the input streams list.
1529 </p>
1530 <p>The <code>-newvideo</code>, <code>-newaudio</code> and <code>-newsubtitle</code>
1531 options have to be specified immediately after the name of the output
1532 file to which you want to add them.
1533 </p>
1534 </li></ul>
1535
1536 <a name="Expression-Evaluation"></a>
1537 <h1 class="chapter"><a href="ffmpeg.html#toc-Expression-Evaluation">6. Expression Evaluation</a></h1>
1538
1539 <p>When evaluating an arithemetic expression, FFmpeg uses an internal
1540 formula evaluator, implemented through the &lsquo;<tt>libavutil/eval.h</tt>&rsquo;
1541 interface.
1542 </p>
1543 <p>An expression may contain unary, binary operators, constants, and
1544 functions.
1545 </p>
1546 <p>Two expressions <var>expr1</var> and <var>expr2</var> can be combined to form
1547 another expression &quot;<var>expr1</var>;<var>expr2</var>&quot;.
1548 <var>expr1</var> and <var>expr2</var> are evaluated in turn, and the new
1549 expression evaluates to the value of <var>expr2</var>.
1550 </p>
1551 <p>The following binary operators are available: <code>+</code>, <code>-</code>,
1552 <code>*</code>, <code>/</code>, <code>^</code>.
1553 </p>
1554 <p>The following unary operators are available: <code>+</code>, <code>-</code>.
1555 </p>
1556 <p>The following functions are available:
1557 </p><dl compact="compact">
1558 <dt> &lsquo;<samp>sinh(x)</samp>&rsquo;</dt>
1559 <dt> &lsquo;<samp>cosh(x)</samp>&rsquo;</dt>
1560 <dt> &lsquo;<samp>tanh(x)</samp>&rsquo;</dt>
1561 <dt> &lsquo;<samp>sin(x)</samp>&rsquo;</dt>
1562 <dt> &lsquo;<samp>cos(x)</samp>&rsquo;</dt>
1563 <dt> &lsquo;<samp>tan(x)</samp>&rsquo;</dt>
1564 <dt> &lsquo;<samp>atan(x)</samp>&rsquo;</dt>
1565 <dt> &lsquo;<samp>asin(x)</samp>&rsquo;</dt>
1566 <dt> &lsquo;<samp>acos(x)</samp>&rsquo;</dt>
1567 <dt> &lsquo;<samp>exp(x)</samp>&rsquo;</dt>
1568 <dt> &lsquo;<samp>log(x)</samp>&rsquo;</dt>
1569 <dt> &lsquo;<samp>abs(x)</samp>&rsquo;</dt>
1570 <dt> &lsquo;<samp>squish(x)</samp>&rsquo;</dt>
1571 <dt> &lsquo;<samp>gauss(x)</samp>&rsquo;</dt>
1572 <dt> &lsquo;<samp>isnan(x)</samp>&rsquo;</dt>
1573 <dd><p>Return 1.0 if <var>x</var> is NAN, 0.0 otherwise.
1574 </p>
1575 </dd>
1576 <dt> &lsquo;<samp>mod(x, y)</samp>&rsquo;</dt>
1577 <dt> &lsquo;<samp>max(x, y)</samp>&rsquo;</dt>
1578 <dt> &lsquo;<samp>min(x, y)</samp>&rsquo;</dt>
1579 <dt> &lsquo;<samp>eq(x, y)</samp>&rsquo;</dt>
1580 <dt> &lsquo;<samp>gte(x, y)</samp>&rsquo;</dt>
1581 <dt> &lsquo;<samp>gt(x, y)</samp>&rsquo;</dt>
1582 <dt> &lsquo;<samp>lte(x, y)</samp>&rsquo;</dt>
1583 <dt> &lsquo;<samp>lt(x, y)</samp>&rsquo;</dt>
1584 <dt> &lsquo;<samp>st(var, expr)</samp>&rsquo;</dt>
1585 <dd><p>Allow to store the value of the expression <var>expr</var> in an internal
1586 variable. <var>var</var> specifies the number of the variable where to
1587 store the value, and it is a value ranging from 0 to 9. The function
1588 returns the value stored in the internal variable.
1589 </p>
1590 </dd>
1591 <dt> &lsquo;<samp>ld(var)</samp>&rsquo;</dt>
1592 <dd><p>Allow to load the value of the internal variable with number
1593 <var>var</var>, which was previosly stored with st(<var>var</var>, <var>expr</var>).
1594 The function returns the loaded value.
1595 </p>
1596 </dd>
1597 <dt> &lsquo;<samp>while(cond, expr)</samp>&rsquo;</dt>
1598 <dd><p>Evaluate expression <var>expr</var> while the expression <var>cond</var> is
1599 non-zero, and returns the value of the last <var>expr</var> evaluation, or
1600 NAN if <var>cond</var> was always false.
1601 </p>
1602 </dd>
1603 <dt> &lsquo;<samp>ceil(expr)</samp>&rsquo;</dt>
1604 <dd><p>Round the value of expression <var>expr</var> upwards to the nearest
1605 integer. For example, &quot;ceil(1.5)&quot; is &quot;2.0&quot;.
1606 </p>
1607 </dd>
1608 <dt> &lsquo;<samp>floor(expr)</samp>&rsquo;</dt>
1609 <dd><p>Round the value of expression <var>expr</var> downwards to the nearest
1610 integer. For example, &quot;floor(-1.5)&quot; is &quot;-2.0&quot;.
1611 </p>
1612 </dd>
1613 <dt> &lsquo;<samp>trunc(expr)</samp>&rsquo;</dt>
1614 <dd><p>Round the value of expression <var>expr</var> towards zero to the nearest
1615 integer. For example, &quot;trunc(-1.5)&quot; is &quot;-1.0&quot;.
1616 </p>
1617 </dd>
1618 <dt> &lsquo;<samp>sqrt(expr)</samp>&rsquo;</dt>
1619 <dd><p>Compute the square root of <var>expr</var>. This is equivalent to
1620 &quot;(<var>expr</var>)^.5&quot;.
1621 </p></dd>
1622 </dl>
1623
1624 <p>Note that:
1625 </p>
1626 <p><code>*</code> works like AND
1627 </p>
1628 <p><code>+</code> works like OR
1629 </p>
1630 <p>thus
1631 </p><table><tr><td>&nbsp;</td><td><pre class="example">if A then B else C
1632 </pre></td></tr></table>
1633 <p>is equivalent to
1634 </p><table><tr><td>&nbsp;</td><td><pre class="example">A*B + not(A)*C
1635 </pre></td></tr></table>
1636
1637 <p>When A evaluates to either 1 or 0, that is the same as
1638 </p><table><tr><td>&nbsp;</td><td><pre class="example">A*B + eq(A,0)*C
1639 </pre></td></tr></table>
1640
1641 <p>In your C code, you can extend the list of unary and binary functions,
1642 and define recognized constants, so that they are available for your
1643 expressions.
1644 </p>
1645 <p>The evaluator also recognizes the International System number
1646 postfixes. If &rsquo;i&rsquo; is appended after the postfix, powers of 2 are used
1647 instead of powers of 10. The &rsquo;B&rsquo; postfix multiplies the value for 8,
1648 and can be appended after another postfix or used alone. This allows
1649 using for example &rsquo;KB&rsquo;, &rsquo;MiB&rsquo;, &rsquo;G&rsquo; and &rsquo;B&rsquo; as postfix.
1650 </p>
1651 <p>Follows the list of available International System postfixes, with
1652 indication of the corresponding powers of 10 and of 2.
1653 </p><dl compact="compact">
1654 <dt> &lsquo;<samp>y</samp>&rsquo;</dt>
1655 <dd><p>-24 / -80
1656 </p></dd>
1657 <dt> &lsquo;<samp>z</samp>&rsquo;</dt>
1658 <dd><p>-21 / -70
1659 </p></dd>
1660 <dt> &lsquo;<samp>a</samp>&rsquo;</dt>
1661 <dd><p>-18 / -60
1662 </p></dd>
1663 <dt> &lsquo;<samp>f</samp>&rsquo;</dt>
1664 <dd><p>-15 / -50
1665 </p></dd>
1666 <dt> &lsquo;<samp>p</samp>&rsquo;</dt>
1667 <dd><p>-12 / -40
1668 </p></dd>
1669 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
1670 <dd><p>-9 / -30
1671 </p></dd>
1672 <dt> &lsquo;<samp>u</samp>&rsquo;</dt>
1673 <dd><p>-6 / -20
1674 </p></dd>
1675 <dt> &lsquo;<samp>m</samp>&rsquo;</dt>
1676 <dd><p>-3 / -10
1677 </p></dd>
1678 <dt> &lsquo;<samp>c</samp>&rsquo;</dt>
1679 <dd><p>-2
1680 </p></dd>
1681 <dt> &lsquo;<samp>d</samp>&rsquo;</dt>
1682 <dd><p>-1
1683 </p></dd>
1684 <dt> &lsquo;<samp>h</samp>&rsquo;</dt>
1685 <dd><p>2
1686 </p></dd>
1687 <dt> &lsquo;<samp>k</samp>&rsquo;</dt>
1688 <dd><p>3 / 10
1689 </p></dd>
1690 <dt> &lsquo;<samp>K</samp>&rsquo;</dt>
1691 <dd><p>3 / 10
1692 </p></dd>
1693 <dt> &lsquo;<samp>M</samp>&rsquo;</dt>
1694 <dd><p>6 / 20
1695 </p></dd>
1696 <dt> &lsquo;<samp>G</samp>&rsquo;</dt>
1697 <dd><p>9 / 30
1698 </p></dd>
1699 <dt> &lsquo;<samp>T</samp>&rsquo;</dt>
1700 <dd><p>12 / 40
1701 </p></dd>
1702 <dt> &lsquo;<samp>P</samp>&rsquo;</dt>
1703 <dd><p>15 / 40
1704 </p></dd>
1705 <dt> &lsquo;<samp>E</samp>&rsquo;</dt>
1706 <dd><p>18 / 50
1707 </p></dd>
1708 <dt> &lsquo;<samp>Z</samp>&rsquo;</dt>
1709 <dd><p>21 / 60
1710 </p></dd>
1711 <dt> &lsquo;<samp>Y</samp>&rsquo;</dt>
1712 <dd><p>24 / 70
1713 </p></dd>
1714 </dl>
1715
1716 <a name="Encoders"></a>
1717 <h1 class="chapter"><a href="ffmpeg.html#toc-Encoders">7. Encoders</a></h1>
1718
1719 <p>Encoders are configured elements in FFmpeg which allow the encoding of
1720 multimedia streams.
1721 </p>
1722 <p>When you configure your FFmpeg build, all the supported native encoders
1723 are enabled by default. Encoders requiring an external library must be enabled
1724 manually via the corresponding <code>--enable-lib</code> option. You can list all
1725 available encoders using the configure option <code>--list-encoders</code>.
1726 </p>
1727 <p>You can disable all the encoders with the configure option
1728 <code>--disable-encoders</code> and selectively enable / disable single encoders
1729 with the options <code>--enable-encoder=<var>ENCODER</var></code> /
1730 <code>--disable-encoder=<var>ENCODER</var></code>.
1731 </p>
1732 <p>The option <code>-codecs</code> of the ff* tools will display the list of
1733 enabled encoders.
1734 </p>
1735 <p>A description of some of the currently available encoders follows.
1736 </p>
1737 <a name="Audio-Encoders"></a>
1738 <h2 class="section"><a href="ffmpeg.html#toc-Audio-Encoders">7.1 Audio Encoders</a></h2>
1739
1740 <a name="ac3-and-ac3_005ffixed"></a>
1741 <h3 class="subsection"><a href="ffmpeg.html#toc-ac3-and-ac3_005ffixed">7.1.1 ac3 and ac3_fixed</a></h3>
1742
1743 <p>AC-3 audio encoders.
1744 </p>
1745 <p>These encoders implement part of ATSC A/52:2010 and ETSI TS 102 366, as well as
1746 the undocumented RealAudio 3 (a.k.a. dnet).
1747 </p>
1748 <p>The <var>ac3</var> encoder uses floating-point math, while the <var>ac3_fixed</var>
1749 encoder only uses fixed-point integer math. This does not mean that one is
1750 always faster, just that one or the other may be better suited to a
1751 particular system. The floating-point encoder will generally produce better
1752 quality audio for a given bitrate. The <var>ac3_fixed</var> encoder is not the
1753 default codec for any of the output formats, so it must be specified explicitly
1754 using the option <code>-acodec ac3_fixed</code> in order to use it.
1755 </p>
1756 <a name="AC_002d3-Metadata"></a>
1757 <h3 class="subheading">AC-3 Metadata</h3>
1758
1759 <p>The AC-3 metadata options are used to set parameters that describe the audio,
1760 but in most cases do not affect the audio encoding itself. Some of the options
1761 do directly affect or influence the decoding and playback of the resulting
1762 bitstream, while others are just for informational purposes. A few of the
1763 options will add bits to the output stream that could otherwise be used for
1764 audio data, and will thus affect the quality of the output. Those will be
1765 indicated accordingly with a note in the option list below.
1766 </p>
1767 <p>These parameters are described in detail in several publicly-available
1768 documents.
1769 </p><ul>
1770 <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>
1771 </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>
1772 </li><li> <a href="http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/18_Metadata.Guide.pdf">Dolby Metadata Guide</a>
1773 </li><li> <a href="http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/46_DDEncodingGuidelines.pdf">Dolby Digital Professional Encoding Guidelines</a>
1774 </li></ul>
1775
1776 <a name="Metadata-Control-Options"></a>
1777 <h4 class="subsubheading">Metadata Control Options</h4>
1778
1779 <dl compact="compact">
1780 <dt> &lsquo;<samp>-per_frame_metadata <var>boolean</var></samp>&rsquo;</dt>
1781 <dd><p>Allow Per-Frame Metadata. Specifies if the encoder should check for changing
1782 metadata for each frame.
1783 </p><dl compact="compact">
1784 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
1785 <dd><p>The metadata values set at initialization will be used for every frame in the
1786 stream. (default)
1787 </p></dd>
1788 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
1789 <dd><p>Metadata values can be changed before encoding each frame.
1790 </p></dd>
1791 </dl>
1792
1793 </dd>
1794 </dl>
1795
1796 <a name="Downmix-Levels"></a>
1797 <h4 class="subsubheading">Downmix Levels</h4>
1798
1799 <dl compact="compact">
1800 <dt> &lsquo;<samp>-center_mixlev <var>level</var></samp>&rsquo;</dt>
1801 <dd><p>Center Mix Level. The amount of gain the decoder should apply to the center
1802 channel when downmixing to stereo. This field will only be written to the
1803 bitstream if a center channel is present. The value is specified as a scale
1804 factor. There are 3 valid values:
1805 </p><dl compact="compact">
1806 <dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
1807 <dd><p>Apply -3dB gain
1808 </p></dd>
1809 <dt> &lsquo;<samp>0.595</samp>&rsquo;</dt>
1810 <dd><p>Apply -4.5dB gain (default)
1811 </p></dd>
1812 <dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
1813 <dd><p>Apply -6dB gain
1814 </p></dd>
1815 </dl>
1816
1817 </dd>
1818 <dt> &lsquo;<samp>-surround_mixlev <var>level</var></samp>&rsquo;</dt>
1819 <dd><p>Surround Mix Level. The amount of gain the decoder should apply to the surround
1820 channel(s) when downmixing to stereo. This field will only be written to the
1821 bitstream if one or more surround channels are present. The value is specified
1822 as a scale factor.  There are 3 valid values:
1823 </p><dl compact="compact">
1824 <dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
1825 <dd><p>Apply -3dB gain
1826 </p></dd>
1827 <dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
1828 <dd><p>Apply -6dB gain (default)
1829 </p></dd>
1830 <dt> &lsquo;<samp>0.000</samp>&rsquo;</dt>
1831 <dd><p>Silence Surround Channel(s)
1832 </p></dd>
1833 </dl>
1834
1835 </dd>
1836 </dl>
1837
1838 <a name="Audio-Production-Information"></a>
1839 <h4 class="subsubheading">Audio Production Information</h4>
1840 <p>Audio Production Information is optional information describing the mixing
1841 environment.  Either none or both of the fields are written to the bitstream.
1842 </p>
1843 <dl compact="compact">
1844 <dt> &lsquo;<samp>-mixing_level <var>number</var></samp>&rsquo;</dt>
1845 <dd><p>Mixing Level. Specifies peak sound pressure level (SPL) in the production
1846 environment when the mix was mastered. Valid values are 80 to 111, or -1 for
1847 unknown or not indicated. The default value is -1, but that value cannot be
1848 used if the Audio Production Information is written to the bitstream. Therefore,
1849 if the <code>room_type</code> option is not the default value, the <code>mixing_level</code>
1850 option must not be -1.
1851 </p>
1852 </dd>
1853 <dt> &lsquo;<samp>-room_type <var>type</var></samp>&rsquo;</dt>
1854 <dd><p>Room Type. Describes the equalization used during the final mixing session at
1855 the studio or on the dubbing stage. A large room is a dubbing stage with the
1856 industry standard X-curve equalization; a small room has flat equalization.
1857 This field will not be written to the bitstream if both the <code>mixing_level</code>
1858 option and the <code>room_type</code> option have the default values.
1859 </p><dl compact="compact">
1860 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
1861 <dt> &lsquo;<samp>notindicated</samp>&rsquo;</dt>
1862 <dd><p>Not Indicated (default)
1863 </p></dd>
1864 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
1865 <dt> &lsquo;<samp>large</samp>&rsquo;</dt>
1866 <dd><p>Large Room
1867 </p></dd>
1868 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
1869 <dt> &lsquo;<samp>small</samp>&rsquo;</dt>
1870 <dd><p>Small Room
1871 </p></dd>
1872 </dl>
1873
1874 </dd>
1875 </dl>
1876
1877 <a name="Other-Metadata-Options"></a>
1878 <h4 class="subsubheading">Other Metadata Options</h4>
1879
1880 <dl compact="compact">
1881 <dt> &lsquo;<samp>-copyright <var>boolean</var></samp>&rsquo;</dt>
1882 <dd><p>Copyright Indicator. Specifies whether a copyright exists for this audio.
1883 </p><dl compact="compact">
1884 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
1885 <dt> &lsquo;<samp>off</samp>&rsquo;</dt>
1886 <dd><p>No Copyright Exists (default)
1887 </p></dd>
1888 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
1889 <dt> &lsquo;<samp>on</samp>&rsquo;</dt>
1890 <dd><p>Copyright Exists
1891 </p></dd>
1892 </dl>
1893
1894 </dd>
1895 <dt> &lsquo;<samp>-dialnorm <var>value</var></samp>&rsquo;</dt>
1896 <dd><p>Dialogue Normalization. Indicates how far the average dialogue level of the
1897 program is below digital 100% full scale (0 dBFS). This parameter determines a
1898 level shift during audio reproduction that sets the average volume of the
1899 dialogue to a preset level. The goal is to match volume level between program
1900 sources. A value of -31dB will result in no volume level change, relative to
1901 the source volume, during audio reproduction. Valid values are whole numbers in
1902 the range -31 to -1, with -31 being the default.
1903 </p>
1904 </dd>
1905 <dt> &lsquo;<samp>-dsur_mode <var>mode</var></samp>&rsquo;</dt>
1906 <dd><p>Dolby Surround Mode. Specifies whether the stereo signal uses Dolby Surround
1907 (Pro Logic). This field will only be written to the bitstream if the audio
1908 stream is stereo. Using this option does <b>NOT</b> mean the encoder will actually
1909 apply Dolby Surround processing.
1910 </p><dl compact="compact">
1911 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
1912 <dt> &lsquo;<samp>notindicated</samp>&rsquo;</dt>
1913 <dd><p>Not Indicated (default)
1914 </p></dd>
1915 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
1916 <dt> &lsquo;<samp>off</samp>&rsquo;</dt>
1917 <dd><p>Not Dolby Surround Encoded
1918 </p></dd>
1919 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
1920 <dt> &lsquo;<samp>on</samp>&rsquo;</dt>
1921 <dd><p>Dolby Surround Encoded
1922 </p></dd>
1923 </dl>
1924
1925 </dd>
1926 <dt> &lsquo;<samp>-original <var>boolean</var></samp>&rsquo;</dt>
1927 <dd><p>Original Bit Stream Indicator. Specifies whether this audio is from the
1928 original source and not a copy.
1929 </p><dl compact="compact">
1930 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
1931 <dt> &lsquo;<samp>off</samp>&rsquo;</dt>
1932 <dd><p>Not Original Source
1933 </p></dd>
1934 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
1935 <dt> &lsquo;<samp>on</samp>&rsquo;</dt>
1936 <dd><p>Original Source (default)
1937 </p></dd>
1938 </dl>
1939
1940 </dd>
1941 </dl>
1942
1943 <a name="Extended-Bitstream-Information"></a>
1944 <h4 class="subsubheading">Extended Bitstream Information</h4>
1945 <p>The extended bitstream options are part of the Alternate Bit Stream Syntax as
1946 specified in Annex D of the A/52:2010 standard. It is grouped into 2 parts.
1947 If any one parameter in a group is specified, all values in that group will be
1948 written to the bitstream.  Default values are used for those that are written
1949 but have not been specified.  If the mixing levels are written, the decoder
1950 will use these values instead of the ones specified in the <code>center_mixlev</code>
1951 and <code>surround_mixlev</code> options if it supports the Alternate Bit Stream
1952 Syntax.
1953 </p>
1954 <a name="Extended-Bitstream-Information-_002d-Part-1"></a>
1955 <h4 class="subsubheading">Extended Bitstream Information - Part 1</h4>
1956
1957 <dl compact="compact">
1958 <dt> &lsquo;<samp>-dmix_mode <var>mode</var></samp>&rsquo;</dt>
1959 <dd><p>Preferred Stereo Downmix Mode. Allows the user to select either Lt/Rt
1960 (Dolby Surround) or Lo/Ro (normal stereo) as the preferred stereo downmix mode.
1961 </p><dl compact="compact">
1962 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
1963 <dt> &lsquo;<samp>notindicated</samp>&rsquo;</dt>
1964 <dd><p>Not Indicated (default)
1965 </p></dd>
1966 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
1967 <dt> &lsquo;<samp>ltrt</samp>&rsquo;</dt>
1968 <dd><p>Lt/Rt Downmix Preferred
1969 </p></dd>
1970 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
1971 <dt> &lsquo;<samp>loro</samp>&rsquo;</dt>
1972 <dd><p>Lo/Ro Downmix Preferred
1973 </p></dd>
1974 </dl>
1975
1976 </dd>
1977 <dt> &lsquo;<samp>-ltrt_cmixlev <var>level</var></samp>&rsquo;</dt>
1978 <dd><p>Lt/Rt Center Mix Level. The amount of gain the decoder should apply to the
1979 center channel when downmixing to stereo in Lt/Rt mode.
1980 </p><dl compact="compact">
1981 <dt> &lsquo;<samp>1.414</samp>&rsquo;</dt>
1982 <dd><p>Apply +3dB gain
1983 </p></dd>
1984 <dt> &lsquo;<samp>1.189</samp>&rsquo;</dt>
1985 <dd><p>Apply +1.5dB gain
1986 </p></dd>
1987 <dt> &lsquo;<samp>1.000</samp>&rsquo;</dt>
1988 <dd><p>Apply 0dB gain
1989 </p></dd>
1990 <dt> &lsquo;<samp>0.841</samp>&rsquo;</dt>
1991 <dd><p>Apply -1.5dB gain
1992 </p></dd>
1993 <dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
1994 <dd><p>Apply -3.0dB gain
1995 </p></dd>
1996 <dt> &lsquo;<samp>0.595</samp>&rsquo;</dt>
1997 <dd><p>Apply -4.5dB gain (default)
1998 </p></dd>
1999 <dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
2000 <dd><p>Apply -6.0dB gain
2001 </p></dd>
2002 <dt> &lsquo;<samp>0.000</samp>&rsquo;</dt>
2003 <dd><p>Silence Center Channel
2004 </p></dd>
2005 </dl>
2006
2007 </dd>
2008 <dt> &lsquo;<samp>-ltrt_surmixlev <var>level</var></samp>&rsquo;</dt>
2009 <dd><p>Lt/Rt Surround Mix Level. The amount of gain the decoder should apply to the
2010 surround channel(s) when downmixing to stereo in Lt/Rt mode.
2011 </p><dl compact="compact">
2012 <dt> &lsquo;<samp>0.841</samp>&rsquo;</dt>
2013 <dd><p>Apply -1.5dB gain
2014 </p></dd>
2015 <dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
2016 <dd><p>Apply -3.0dB gain
2017 </p></dd>
2018 <dt> &lsquo;<samp>0.595</samp>&rsquo;</dt>
2019 <dd><p>Apply -4.5dB gain
2020 </p></dd>
2021 <dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
2022 <dd><p>Apply -6.0dB gain (default)
2023 </p></dd>
2024 <dt> &lsquo;<samp>0.000</samp>&rsquo;</dt>
2025 <dd><p>Silence Surround Channel(s)
2026 </p></dd>
2027 </dl>
2028
2029 </dd>
2030 <dt> &lsquo;<samp>-loro_cmixlev <var>level</var></samp>&rsquo;</dt>
2031 <dd><p>Lo/Ro Center Mix Level. The amount of gain the decoder should apply to the
2032 center channel when downmixing to stereo in Lo/Ro mode.
2033 </p><dl compact="compact">
2034 <dt> &lsquo;<samp>1.414</samp>&rsquo;</dt>
2035 <dd><p>Apply +3dB gain
2036 </p></dd>
2037 <dt> &lsquo;<samp>1.189</samp>&rsquo;</dt>
2038 <dd><p>Apply +1.5dB gain
2039 </p></dd>
2040 <dt> &lsquo;<samp>1.000</samp>&rsquo;</dt>
2041 <dd><p>Apply 0dB gain
2042 </p></dd>
2043 <dt> &lsquo;<samp>0.841</samp>&rsquo;</dt>
2044 <dd><p>Apply -1.5dB gain
2045 </p></dd>
2046 <dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
2047 <dd><p>Apply -3.0dB gain
2048 </p></dd>
2049 <dt> &lsquo;<samp>0.595</samp>&rsquo;</dt>
2050 <dd><p>Apply -4.5dB gain (default)
2051 </p></dd>
2052 <dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
2053 <dd><p>Apply -6.0dB gain
2054 </p></dd>
2055 <dt> &lsquo;<samp>0.000</samp>&rsquo;</dt>
2056 <dd><p>Silence Center Channel
2057 </p></dd>
2058 </dl>
2059
2060 </dd>
2061 <dt> &lsquo;<samp>-loro_surmixlev <var>level</var></samp>&rsquo;</dt>
2062 <dd><p>Lo/Ro Surround Mix Level. The amount of gain the decoder should apply to the
2063 surround channel(s) when downmixing to stereo in Lo/Ro mode.
2064 </p><dl compact="compact">
2065 <dt> &lsquo;<samp>0.841</samp>&rsquo;</dt>
2066 <dd><p>Apply -1.5dB gain
2067 </p></dd>
2068 <dt> &lsquo;<samp>0.707</samp>&rsquo;</dt>
2069 <dd><p>Apply -3.0dB gain
2070 </p></dd>
2071 <dt> &lsquo;<samp>0.595</samp>&rsquo;</dt>
2072 <dd><p>Apply -4.5dB gain
2073 </p></dd>
2074 <dt> &lsquo;<samp>0.500</samp>&rsquo;</dt>
2075 <dd><p>Apply -6.0dB gain (default)
2076 </p></dd>
2077 <dt> &lsquo;<samp>0.000</samp>&rsquo;</dt>
2078 <dd><p>Silence Surround Channel(s)
2079 </p></dd>
2080 </dl>
2081
2082 </dd>
2083 </dl>
2084
2085 <a name="Extended-Bitstream-Information-_002d-Part-2"></a>
2086 <h4 class="subsubheading">Extended Bitstream Information - Part 2</h4>
2087
2088 <dl compact="compact">
2089 <dt> &lsquo;<samp>-dsurex_mode <var>mode</var></samp>&rsquo;</dt>
2090 <dd><p>Dolby Surround EX Mode. Indicates whether the stream uses Dolby Surround EX
2091 (7.1 matrixed to 5.1). Using this option does <b>NOT</b> mean the encoder will actually
2092 apply Dolby Surround EX processing.
2093 </p><dl compact="compact">
2094 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
2095 <dt> &lsquo;<samp>notindicated</samp>&rsquo;</dt>
2096 <dd><p>Not Indicated (default)
2097 </p></dd>
2098 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
2099 <dt> &lsquo;<samp>on</samp>&rsquo;</dt>
2100 <dd><p>Dolby Surround EX On
2101 </p></dd>
2102 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
2103 <dt> &lsquo;<samp>off</samp>&rsquo;</dt>
2104 <dd><p>Dolby Surround EX Off
2105 </p></dd>
2106 </dl>
2107
2108 </dd>
2109 <dt> &lsquo;<samp>-dheadphone_mode <var>mode</var></samp>&rsquo;</dt>
2110 <dd><p>Dolby Headphone Mode. Indicates whether the stream uses Dolby Headphone
2111 encoding (multi-channel matrixed to 2.0 for use with headphones). Using this
2112 option does <b>NOT</b> mean the encoder will actually apply Dolby Headphone
2113 processing.
2114 </p><dl compact="compact">
2115 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
2116 <dt> &lsquo;<samp>notindicated</samp>&rsquo;</dt>
2117 <dd><p>Not Indicated (default)
2118 </p></dd>
2119 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
2120 <dt> &lsquo;<samp>on</samp>&rsquo;</dt>
2121 <dd><p>Dolby Headphone On
2122 </p></dd>
2123 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
2124 <dt> &lsquo;<samp>off</samp>&rsquo;</dt>
2125 <dd><p>Dolby Headphone Off
2126 </p></dd>
2127 </dl>
2128
2129 </dd>
2130 <dt> &lsquo;<samp>-ad_conv_type <var>type</var></samp>&rsquo;</dt>
2131 <dd><p>A/D Converter Type. Indicates whether the audio has passed through HDCD A/D
2132 conversion.
2133 </p><dl compact="compact">
2134 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
2135 <dt> &lsquo;<samp>standard</samp>&rsquo;</dt>
2136 <dd><p>Standard A/D Converter (default)
2137 </p></dd>
2138 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
2139 <dt> &lsquo;<samp>hdcd</samp>&rsquo;</dt>
2140 <dd><p>HDCD A/D Converter
2141 </p></dd>
2142 </dl>
2143
2144 </dd>
2145 </dl>
2146
2147 <a name="Other-AC_002d3-Encoding-Options"></a>
2148 <h3 class="subheading">Other AC-3 Encoding Options</h3>
2149
2150 <dl compact="compact">
2151 <dt> &lsquo;<samp>-stereo_rematrixing <var>boolean</var></samp>&rsquo;</dt>
2152 <dd><p>Stereo Rematrixing. Enables/Disables use of rematrixing for stereo input. This
2153 is an optional AC-3 feature that increases quality by selectively encoding
2154 the left/right channels as mid/side. This option is enabled by default, and it
2155 is highly recommended that it be left as enabled except for testing purposes.
2156 </p>
2157 </dd>
2158 </dl>
2159
2160 <a name="Demuxers"></a>
2161 <h1 class="chapter"><a href="ffmpeg.html#toc-Demuxers">8. Demuxers</a></h1>
2162
2163 <p>Demuxers are configured elements in FFmpeg which allow to read the
2164 multimedia streams from a particular type of file.
2165 </p>
2166 <p>When you configure your FFmpeg build, all the supported demuxers
2167 are enabled by default. You can list all available ones using the
2168 configure option &quot;&ndash;list-demuxers&quot;.
2169 </p>
2170 <p>You can disable all the demuxers using the configure option
2171 &quot;&ndash;disable-demuxers&quot;, and selectively enable a single demuxer with
2172 the option &quot;&ndash;enable-demuxer=<var>DEMUXER</var>&quot;, or disable it
2173 with the option &quot;&ndash;disable-demuxer=<var>DEMUXER</var>&quot;.
2174 </p>
2175 <p>The option &quot;-formats&quot; of the ff* tools will display the list of
2176 enabled demuxers.
2177 </p>
2178 <p>The description of some of the currently available demuxers follows.
2179 </p>
2180 <a name="image2-1"></a>
2181 <h2 class="section"><a href="ffmpeg.html#toc-image2-1">8.1 image2</a></h2>
2182
2183 <p>Image file demuxer.
2184 </p>
2185 <p>This demuxer reads from a list of image files specified by a pattern.
2186 </p>
2187 <p>The pattern may contain the string &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, which
2188 specifies the position of the characters representing a sequential
2189 number in each filename matched by the pattern. If the form
2190 &quot;%d0<var>N</var>d&quot; is used, the string representing the number in each
2191 filename is 0-padded and <var>N</var> is the total number of 0-padded
2192 digits representing the number. The literal character &rsquo;%&rsquo; can be
2193 specified in the pattern with the string &quot;%%&quot;.
2194 </p>
2195 <p>If the pattern contains &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, the first filename of
2196 the file list specified by the pattern must contain a number
2197 inclusively contained between 0 and 4, all the following numbers must
2198 be sequential. This limitation may be hopefully fixed.
2199 </p>
2200 <p>The pattern may contain a suffix which is used to automatically
2201 determine the format of the images contained in the files.
2202 </p>
2203 <p>For example the pattern &quot;img-%03d.bmp&quot; will match a sequence of
2204 filenames of the form &lsquo;<tt>img-001.bmp</tt>&rsquo;, &lsquo;<tt>img-002.bmp</tt>&rsquo;, ...,
2205 &lsquo;<tt>img-010.bmp</tt>&rsquo;, etc.; the pattern &quot;i%%m%%g-%d.jpg&quot; will match a
2206 sequence of filenames of the form &lsquo;<tt>i%m%g-1.jpg</tt>&rsquo;,
2207 &lsquo;<tt>i%m%g-2.jpg</tt>&rsquo;, ..., &lsquo;<tt>i%m%g-10.jpg</tt>&rsquo;, etc.
2208 </p>
2209 <p>The size, the pixel format, and the format of each image must be the
2210 same for all the files in the sequence.
2211 </p>
2212 <p>The following example shows how to use &lsquo;<tt>ffmpeg</tt>&rsquo; for creating a
2213 video from the images in the file sequence &lsquo;<tt>img-001.jpeg</tt>&rsquo;,
2214 &lsquo;<tt>img-002.jpeg</tt>&rsquo;, ..., assuming an input framerate of 10 frames per
2215 second:
2216 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -r 10 -f image2 -i 'img-%03d.jpeg' out.avi
2217 </pre></td></tr></table>
2218
2219 <p>Note that the pattern must not necessarily contain &quot;%d&quot; or
2220 &quot;%0<var>N</var>d&quot;, for example to convert a single image file
2221 &lsquo;<tt>img.jpeg</tt>&rsquo; you can employ the command:
2222 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f image2 -i img.jpeg img.png
2223 </pre></td></tr></table>
2224
2225 <a name="applehttp-1"></a>
2226 <h2 class="section"><a href="ffmpeg.html#toc-applehttp-1">8.2 applehttp</a></h2>
2227
2228 <p>Apple HTTP Live Streaming demuxer.
2229 </p>
2230 <p>This demuxer presents all AVStreams from all variant streams.
2231 The id field is set to the bitrate variant index number. By setting
2232 the discard flags on AVStreams (by pressing &rsquo;a&rsquo; or &rsquo;v&rsquo; in ffplay),
2233 the caller can decide which variant streams to actually receive.
2234 The total bitrate of the variant that the stream belongs to is
2235 available in a metadata key named &quot;variant_bitrate&quot;.
2236 </p>
2237 <a name="Muxers"></a>
2238 <h1 class="chapter"><a href="ffmpeg.html#toc-Muxers">9. Muxers</a></h1>
2239
2240 <p>Muxers are configured elements in FFmpeg which allow writing
2241 multimedia streams to a particular type of file.
2242 </p>
2243 <p>When you configure your FFmpeg build, all the supported muxers
2244 are enabled by default. You can list all available muxers using the
2245 configure option <code>--list-muxers</code>.
2246 </p>
2247 <p>You can disable all the muxers with the configure option
2248 <code>--disable-muxers</code> and selectively enable / disable single muxers
2249 with the options <code>--enable-muxer=<var>MUXER</var></code> /
2250 <code>--disable-muxer=<var>MUXER</var></code>.
2251 </p>
2252 <p>The option <code>-formats</code> of the ff* tools will display the list of
2253 enabled muxers.
2254 </p>
2255 <p>A description of some of the currently available muxers follows.
2256 </p>
2257 <p><a name="crc"></a>
2258 </p><a name="crc-1"></a>
2259 <h2 class="section"><a href="ffmpeg.html#toc-crc-1">9.1 crc</a></h2>
2260
2261 <p>CRC (Cyclic Redundancy Check) testing format.
2262 </p>
2263 <p>This muxer computes and prints the Adler-32 CRC of all the input audio
2264 and video frames. By default audio frames are converted to signed
2265 16-bit raw audio and video frames to raw video before computing the
2266 CRC.
2267 </p>
2268 <p>The output of the muxer consists of a single line of the form:
2269 CRC=0x<var>CRC</var>, where <var>CRC</var> is a hexadecimal number 0-padded to
2270 8 digits containing the CRC for all the decoded input frames.
2271 </p>
2272 <p>For example to compute the CRC of the input, and store it in the file
2273 &lsquo;<tt>out.crc</tt>&rsquo;:
2274 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f crc out.crc
2275 </pre></td></tr></table>
2276
2277 <p>You can print the CRC to stdout with the command:
2278 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f crc -
2279 </pre></td></tr></table>
2280
2281 <p>You can select the output format of each frame with &lsquo;<tt>ffmpeg</tt>&rsquo; by
2282 specifying the audio and video codec and format. For example to
2283 compute the CRC of the input audio converted to PCM unsigned 8-bit
2284 and the input video converted to MPEG-2 video, use the command:
2285 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -acodec pcm_u8 -vcodec mpeg2video -f crc -
2286 </pre></td></tr></table>
2287
2288 <p>See also the <code>framecrc</code> muxer (see <a href="#framecrc">framecrc</a>).
2289 </p>
2290 <p><a name="framecrc"></a>
2291 </p><a name="framecrc-1"></a>
2292 <h2 class="section"><a href="ffmpeg.html#toc-framecrc-1">9.2 framecrc</a></h2>
2293
2294 <p>Per-frame CRC (Cyclic Redundancy Check) testing format.
2295 </p>
2296 <p>This muxer computes and prints the Adler-32 CRC for each decoded audio
2297 and video frame. By default audio frames are converted to signed
2298 16-bit raw audio and video frames to raw video before computing the
2299 CRC.
2300 </p>
2301 <p>The output of the muxer consists of a line for each audio and video
2302 frame of the form: <var>stream_index</var>, <var>frame_dts</var>,
2303 <var>frame_size</var>, 0x<var>CRC</var>, where <var>CRC</var> is a hexadecimal
2304 number 0-padded to 8 digits containing the CRC of the decoded frame.
2305 </p>
2306 <p>For example to compute the CRC of each decoded frame in the input, and
2307 store it in the file &lsquo;<tt>out.crc</tt>&rsquo;:
2308 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f framecrc out.crc
2309 </pre></td></tr></table>
2310
2311 <p>You can print the CRC of each decoded frame to stdout with the command:
2312 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -f framecrc -
2313 </pre></td></tr></table>
2314
2315 <p>You can select the output format of each frame with &lsquo;<tt>ffmpeg</tt>&rsquo; by
2316 specifying the audio and video codec and format. For example, to
2317 compute the CRC of each decoded input audio frame converted to PCM
2318 unsigned 8-bit and of each decoded input video frame converted to
2319 MPEG-2 video, use the command:
2320 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i INPUT -acodec pcm_u8 -vcodec mpeg2video -f framecrc -
2321 </pre></td></tr></table>
2322
2323 <p>See also the <code>crc</code> muxer (see <a href="#crc">crc</a>).
2324 </p>
2325 <a name="image2"></a>
2326 <h2 class="section"><a href="ffmpeg.html#toc-image2">9.3 image2</a></h2>
2327
2328 <p>Image file muxer.
2329 </p>
2330 <p>The image file muxer writes video frames to image files.
2331 </p>
2332 <p>The output filenames are specified by a pattern, which can be used to
2333 produce sequentially numbered series of files.
2334 The pattern may contain the string &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, this string
2335 specifies the position of the characters representing a numbering in
2336 the filenames. If the form &quot;%0<var>N</var>d&quot; is used, the string
2337 representing the number in each filename is 0-padded to <var>N</var>
2338 digits. The literal character &rsquo;%&rsquo; can be specified in the pattern with
2339 the string &quot;%%&quot;.
2340 </p>
2341 <p>If the pattern contains &quot;%d&quot; or &quot;%0<var>N</var>d&quot;, the first filename of
2342 the file list specified will contain the number 1, all the following
2343 numbers will be sequential.
2344 </p>
2345 <p>The pattern may contain a suffix which is used to automatically
2346 determine the format of the image files to write.
2347 </p>
2348 <p>For example the pattern &quot;img-%03d.bmp&quot; will specify a sequence of
2349 filenames of the form &lsquo;<tt>img-001.bmp</tt>&rsquo;, &lsquo;<tt>img-002.bmp</tt>&rsquo;, ...,
2350 &lsquo;<tt>img-010.bmp</tt>&rsquo;, etc.
2351 The pattern &quot;img%%-%d.jpg&quot; will specify a sequence of filenames of the
2352 form &lsquo;<tt>img%-1.jpg</tt>&rsquo;, &lsquo;<tt>img%-2.jpg</tt>&rsquo;, ..., &lsquo;<tt>img%-10.jpg</tt>&rsquo;,
2353 etc.
2354 </p>
2355 <p>The following example shows how to use &lsquo;<tt>ffmpeg</tt>&rsquo; for creating a
2356 sequence of files &lsquo;<tt>img-001.jpeg</tt>&rsquo;, &lsquo;<tt>img-002.jpeg</tt>&rsquo;, ...,
2357 taking one image every second from the input video:
2358 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -r 1 -f image2 'img-%03d.jpeg'
2359 </pre></td></tr></table>
2360
2361 <p>Note that with &lsquo;<tt>ffmpeg</tt>&rsquo;, if the format is not specified with the
2362 <code>-f</code> option and the output filename specifies an image file
2363 format, the image2 muxer is automatically selected, so the previous
2364 command can be written as:
2365 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -r 1 'img-%03d.jpeg'
2366 </pre></td></tr></table>
2367
2368 <p>Note also that the pattern must not necessarily contain &quot;%d&quot; or
2369 &quot;%0<var>N</var>d&quot;, for example to create a single image file
2370 &lsquo;<tt>img.jpeg</tt>&rsquo; from the input video you can employ the command:
2371 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -f image2 -vframes 1 img.jpeg
2372 </pre></td></tr></table>
2373
2374 <p>The image muxer supports the .Y.U.V image file format. This format is
2375 special in that that each image frame consists of three files, for
2376 each of the YUV420P components. To read or write this image file format,
2377 specify the name of the &rsquo;.Y&rsquo; file. The muxer will automatically open the
2378 &rsquo;.U&rsquo; and &rsquo;.V&rsquo; files as required.
2379 </p>
2380 <a name="mpegts"></a>
2381 <h2 class="section"><a href="ffmpeg.html#toc-mpegts">9.4 mpegts</a></h2>
2382
2383 <p>MPEG transport stream muxer.
2384 </p>
2385 <p>This muxer implements ISO 13818-1 and part of ETSI EN 300 468.
2386 </p>
2387 <p>The muxer options are:
2388 </p>
2389 <dl compact="compact">
2390 <dt> &lsquo;<samp>-mpegts_original_network_id <var>number</var></samp>&rsquo;</dt>
2391 <dd><p>Set the original_network_id (default 0x0001). This is unique identifier
2392 of a network in DVB. Its main use is in the unique identification of a
2393 service through the path Original_Network_ID, Transport_Stream_ID.
2394 </p></dd>
2395 <dt> &lsquo;<samp>-mpegts_transport_stream_id <var>number</var></samp>&rsquo;</dt>
2396 <dd><p>Set the transport_stream_id (default 0x0001). This identifies a
2397 transponder in DVB.
2398 </p></dd>
2399 <dt> &lsquo;<samp>-mpegts_service_id <var>number</var></samp>&rsquo;</dt>
2400 <dd><p>Set the service_id (default 0x0001) also known as program in DVB.
2401 </p></dd>
2402 <dt> &lsquo;<samp>-mpegts_pmt_start_pid <var>number</var></samp>&rsquo;</dt>
2403 <dd><p>Set the first PID for PMT (default 0x1000, max 0x1f00).
2404 </p></dd>
2405 <dt> &lsquo;<samp>-mpegts_start_pid <var>number</var></samp>&rsquo;</dt>
2406 <dd><p>Set the first PID for data packets (default 0x0100, max 0x0f00).
2407 </p></dd>
2408 </dl>
2409
2410 <p>The recognized metadata settings in mpegts muxer are <code>service_provider</code>
2411 and <code>service_name</code>. If they are not set the default for
2412 <code>service_provider</code> is &quot;FFmpeg&quot; and the default for
2413 <code>service_name</code> is &quot;Service01&quot;.
2414 </p>
2415 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i file.mpg -acodec copy -vcodec copy \
2416      -mpegts_original_network_id 0x1122 \
2417      -mpegts_transport_stream_id 0x3344 \
2418      -mpegts_service_id 0x5566 \
2419      -mpegts_pmt_start_pid 0x1500 \
2420      -mpegts_start_pid 0x150 \
2421      -metadata service_provider=&quot;Some provider&quot; \
2422      -metadata service_name=&quot;Some Channel&quot; \
2423      -y out.ts
2424 </pre></td></tr></table>
2425
2426 <a name="null"></a>
2427 <h2 class="section"><a href="ffmpeg.html#toc-null">9.5 null</a></h2>
2428
2429 <p>Null muxer.
2430 </p>
2431 <p>This muxer does not generate any output file, it is mainly useful for
2432 testing or benchmarking purposes.
2433 </p>
2434 <p>For example to benchmark decoding with &lsquo;<tt>ffmpeg</tt>&rsquo; you can use the
2435 command:
2436 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -benchmark -i INPUT -f null out.null
2437 </pre></td></tr></table>
2438
2439 <p>Note that the above command does not read or write the &lsquo;<tt>out.null</tt>&rsquo;
2440 file, but specifying the output file is required by the &lsquo;<tt>ffmpeg</tt>&rsquo;
2441 syntax.
2442 </p>
2443 <p>Alternatively you can write the command as:
2444 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -benchmark -i INPUT -f null -
2445 </pre></td></tr></table>
2446
2447 <a name="Input-Devices"></a>
2448 <h1 class="chapter"><a href="ffmpeg.html#toc-Input-Devices">10. Input Devices</a></h1>
2449
2450 <p>Input devices are configured elements in FFmpeg which allow to access
2451 the data coming from a multimedia device attached to your system.
2452 </p>
2453 <p>When you configure your FFmpeg build, all the supported input devices
2454 are enabled by default. You can list all available ones using the
2455 configure option &quot;&ndash;list-indevs&quot;.
2456 </p>
2457 <p>You can disable all the input devices using the configure option
2458 &quot;&ndash;disable-indevs&quot;, and selectively enable an input device using the
2459 option &quot;&ndash;enable-indev=<var>INDEV</var>&quot;, or you can disable a particular
2460 input device using the option &quot;&ndash;disable-indev=<var>INDEV</var>&quot;.
2461 </p>
2462 <p>The option &quot;-formats&quot; of the ff* tools will display the list of
2463 supported input devices (amongst the demuxers).
2464 </p>
2465 <p>A description of the currently available input devices follows.
2466 </p>
2467 <a name="alsa"></a>
2468 <h2 class="section"><a href="ffmpeg.html#toc-alsa">10.1 alsa</a></h2>
2469
2470 <p>ALSA (Advanced Linux Sound Architecture) input device.
2471 </p>
2472 <p>To enable this input device during configuration you need libasound
2473 installed on your system.
2474 </p>
2475 <p>This device allows capturing from an ALSA device. The name of the
2476 device to capture has to be an ALSA card identifier.
2477 </p>
2478 <p>An ALSA identifier has the syntax:
2479 </p><table><tr><td>&nbsp;</td><td><pre class="example">hw:<var>CARD</var>[,<var>DEV</var>[,<var>SUBDEV</var>]]
2480 </pre></td></tr></table>
2481
2482 <p>where the <var>DEV</var> and <var>SUBDEV</var> components are optional.
2483 </p>
2484 <p>The three arguments (in order: <var>CARD</var>,<var>DEV</var>,<var>SUBDEV</var>)
2485 specify card number or identifier, device number and subdevice number
2486 (-1 means any).
2487 </p>
2488 <p>To see the list of cards currently recognized by your system check the
2489 files &lsquo;<tt>/proc/asound/cards</tt>&rsquo; and &lsquo;<tt>/proc/asound/devices</tt>&rsquo;.
2490 </p>
2491 <p>For example to capture with &lsquo;<tt>ffmpeg</tt>&rsquo; from an ALSA device with
2492 card id 0, you may run the command:
2493 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f alsa -i hw:0 alsaout.wav
2494 </pre></td></tr></table>
2495
2496 <p>For more information see:
2497 <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>
2498 </p>
2499 <a name="bktr"></a>
2500 <h2 class="section"><a href="ffmpeg.html#toc-bktr">10.2 bktr</a></h2>
2501
2502 <p>BSD video input device.
2503 </p>
2504 <a name="dv1394"></a>
2505 <h2 class="section"><a href="ffmpeg.html#toc-dv1394">10.3 dv1394</a></h2>
2506
2507 <p>Linux DV 1394 input device.
2508 </p>
2509 <a name="fbdev"></a>
2510 <h2 class="section"><a href="ffmpeg.html#toc-fbdev">10.4 fbdev</a></h2>
2511
2512 <p>Linux framebuffer input device.
2513 </p>
2514 <p>The Linux framebuffer is a graphic hardware-independent abstraction
2515 layer to show graphics on a computer monitor, typically on the
2516 console. It is accessed through a file device node, usually
2517 &lsquo;<tt>/dev/fb0</tt>&rsquo;.
2518 </p>
2519 <p>For more detailed information read the file
2520 Documentation/fb/framebuffer.txt included in the Linux source tree.
2521 </p>
2522 <p>To record from the framebuffer device &lsquo;<tt>/dev/fb0</tt>&rsquo; with
2523 &lsquo;<tt>ffmpeg</tt>&rsquo;:
2524 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f fbdev -r 10 -i /dev/fb0 out.avi
2525 </pre></td></tr></table>
2526
2527 <p>You can take a single screenshot image with the command:
2528 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f fbdev -vframes 1 -r 1 -i /dev/fb0 screenshot.jpeg
2529 </pre></td></tr></table>
2530
2531 <p>See also <a href="http://linux-fbdev.sourceforge.net/">http://linux-fbdev.sourceforge.net/</a>, and fbset(1).
2532 </p>
2533 <a name="jack"></a>
2534 <h2 class="section"><a href="ffmpeg.html#toc-jack">10.5 jack</a></h2>
2535
2536 <p>JACK input device.
2537 </p>
2538 <p>To enable this input device during configuration you need libjack
2539 installed on your system.
2540 </p>
2541 <p>A JACK input device creates one or more JACK writable clients, one for
2542 each audio channel, with name <var>client_name</var>:input_<var>N</var>, where
2543 <var>client_name</var> is the name provided by the application, and <var>N</var>
2544 is a number which identifies the channel.
2545 Each writable client will send the acquired data to the FFmpeg input
2546 device.
2547 </p>
2548 <p>Once you have created one or more JACK readable clients, you need to
2549 connect them to one or more JACK writable clients.
2550 </p>
2551 <p>To connect or disconnect JACK clients you can use the
2552 &lsquo;<tt>jack_connect</tt>&rsquo; and &lsquo;<tt>jack_disconnect</tt>&rsquo; programs, or do it
2553 through a graphical interface, for example with &lsquo;<tt>qjackctl</tt>&rsquo;.
2554 </p>
2555 <p>To list the JACK clients and their properties you can invoke the command
2556 &lsquo;<tt>jack_lsp</tt>&rsquo;.
2557 </p>
2558 <p>Follows an example which shows how to capture a JACK readable client
2559 with &lsquo;<tt>ffmpeg</tt>&rsquo;.
2560 </p><table><tr><td>&nbsp;</td><td><pre class="example"># Create a JACK writable client with name &quot;ffmpeg&quot;.
2561 $ ffmpeg -f jack -i ffmpeg -y out.wav
2562
2563 # Start the sample jack_metro readable client.
2564 $ jack_metro -b 120 -d 0.2 -f 4000
2565
2566 # List the current JACK clients.
2567 $ jack_lsp -c
2568 system:capture_1
2569 system:capture_2
2570 system:playback_1
2571 system:playback_2
2572 ffmpeg:input_1
2573 metro:120_bpm
2574
2575 # Connect metro to the ffmpeg writable client.
2576 $ jack_connect metro:120_bpm ffmpeg:input_1
2577 </pre></td></tr></table>
2578
2579 <p>For more information read:
2580 <a href="http://jackaudio.org/">http://jackaudio.org/</a>
2581 </p>
2582 <a name="libdc1394"></a>
2583 <h2 class="section"><a href="ffmpeg.html#toc-libdc1394">10.6 libdc1394</a></h2>
2584
2585 <p>IIDC1394 input device, based on libdc1394 and libraw1394.
2586 </p>
2587 <a name="oss"></a>
2588 <h2 class="section"><a href="ffmpeg.html#toc-oss">10.7 oss</a></h2>
2589
2590 <p>Open Sound System input device.
2591 </p>
2592 <p>The filename to provide to the input device is the device node
2593 representing the OSS input device, and is usually set to
2594 &lsquo;<tt>/dev/dsp</tt>&rsquo;.
2595 </p>
2596 <p>For example to grab from &lsquo;<tt>/dev/dsp</tt>&rsquo; using &lsquo;<tt>ffmpeg</tt>&rsquo; use the
2597 command:
2598 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
2599 </pre></td></tr></table>
2600
2601 <p>For more information about OSS see:
2602 <a href="http://manuals.opensound.com/usersguide/dsp.html">http://manuals.opensound.com/usersguide/dsp.html</a>
2603 </p>
2604 <a name="sndio-1"></a>
2605 <h2 class="section"><a href="ffmpeg.html#toc-sndio-1">10.8 sndio</a></h2>
2606
2607 <p>sndio input device.
2608 </p>
2609 <p>To enable this input device during configuration you need libsndio
2610 installed on your system.
2611 </p>
2612 <p>The filename to provide to the input device is the device node
2613 representing the sndio input device, and is usually set to
2614 &lsquo;<tt>/dev/audio0</tt>&rsquo;.
2615 </p>
2616 <p>For example to grab from &lsquo;<tt>/dev/audio0</tt>&rsquo; using &lsquo;<tt>ffmpeg</tt>&rsquo; use the
2617 command:
2618 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav
2619 </pre></td></tr></table>
2620
2621 <a name="video4linux-and-video4linux2"></a>
2622 <h2 class="section"><a href="ffmpeg.html#toc-video4linux-and-video4linux2">10.9 video4linux and video4linux2</a></h2>
2623
2624 <p>Video4Linux and Video4Linux2 input video devices.
2625 </p>
2626 <p>The name of the device to grab is a file device node, usually Linux
2627 systems tend to automatically create such nodes when the device
2628 (e.g. an USB webcam) is plugged into the system, and has a name of the
2629 kind &lsquo;<tt>/dev/video<var>N</var></tt>&rsquo;, where <var>N</var> is a number associated to
2630 the device.
2631 </p>
2632 <p>Video4Linux and Video4Linux2 devices only support a limited set of
2633 <var>width</var>x<var>height</var> sizes and framerates. You can check which are
2634 supported for example with the command &lsquo;<tt>dov4l</tt>&rsquo; for Video4Linux
2635 devices and the command &lsquo;<tt>v4l-info</tt>&rsquo; for Video4Linux2 devices.
2636 </p>
2637 <p>If the size for the device is set to 0x0, the input device will
2638 try to autodetect the size to use.
2639 Only for the video4linux2 device, if the frame rate is set to 0/0 the
2640 input device will use the frame rate value already set in the driver.
2641 </p>
2642 <p>Video4Linux support is deprecated since Linux 2.6.30, and will be
2643 dropped in later versions.
2644 </p>
2645 <p>Follow some usage examples of the video4linux devices with the ff*
2646 tools.
2647 </p><table><tr><td>&nbsp;</td><td><pre class="example"># Grab and show the input of a video4linux device, frame rate is set
2648 # to the default of 25/1.
2649 ffplay -s 320x240 -f video4linux /dev/video0
2650
2651 # Grab and show the input of a video4linux2 device, autoadjust size.
2652 ffplay -f video4linux2 /dev/video0
2653
2654 # Grab and record the input of a video4linux2 device, autoadjust size,
2655 # frame rate value defaults to 0/0 so it is read from the video4linux2
2656 # driver.
2657 ffmpeg -f video4linux2 -i /dev/video0 out.mpeg
2658 </pre></td></tr></table>
2659
2660 <a name="vfwcap"></a>
2661 <h2 class="section"><a href="ffmpeg.html#toc-vfwcap">10.10 vfwcap</a></h2>
2662
2663 <p>VfW (Video for Windows) capture input device.
2664 </p>
2665 <p>The filename passed as input is the capture driver number, ranging from
2666 0 to 9. You may use &quot;list&quot; as filename to print a list of drivers. Any
2667 other filename will be interpreted as device number 0.
2668 </p>
2669 <a name="x11grab"></a>
2670 <h2 class="section"><a href="ffmpeg.html#toc-x11grab">10.11 x11grab</a></h2>
2671
2672 <p>X11 video input device.
2673 </p>
2674 <p>This device allows to capture a region of an X11 display.
2675 </p>
2676 <p>The filename passed as input has the syntax:
2677 </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>]
2678 </pre></td></tr></table>
2679
2680 <p><var>hostname</var>:<var>display_number</var>.<var>screen_number</var> specifies the
2681 X11 display name of the screen to grab from. <var>hostname</var> can be
2682 ommitted, and defaults to &quot;localhost&quot;. The environment variable
2683 <code>DISPLAY</code> contains the default display name.
2684 </p>
2685 <p><var>x_offset</var> and <var>y_offset</var> specify the offsets of the grabbed
2686 area with respect to the top-left border of the X11 screen. They
2687 default to 0.
2688 </p>
2689 <p>Check the X11 documentation (e.g. man X) for more detailed information.
2690 </p>
2691 <p>Use the &lsquo;<tt>dpyinfo</tt>&rsquo; program for getting basic information about the
2692 properties of your X11 display (e.g. grep for &quot;name&quot; or &quot;dimensions&quot;).
2693 </p>
2694 <p>For example to grab from &lsquo;<tt>:0.0</tt>&rsquo; using &lsquo;<tt>ffmpeg</tt>&rsquo;:
2695 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -f x11grab -r 25 -s cif -i :0.0 out.mpg
2696
2697 # Grab at position 10,20.
2698 ffmpeg -f x11grab -25 -s cif -i :0.0+10,20 out.mpg
2699 </pre></td></tr></table>
2700
2701 <a name="Output-Devices"></a>
2702 <h1 class="chapter"><a href="ffmpeg.html#toc-Output-Devices">11. Output Devices</a></h1>
2703
2704 <p>Output devices are configured elements in FFmpeg which allow to write
2705 multimedia data to an output device attached to your system.
2706 </p>
2707 <p>When you configure your FFmpeg build, all the supported output devices
2708 are enabled by default. You can list all available ones using the
2709 configure option &quot;&ndash;list-outdevs&quot;.
2710 </p>
2711 <p>You can disable all the output devices using the configure option
2712 &quot;&ndash;disable-outdevs&quot;, and selectively enable an output device using the
2713 option &quot;&ndash;enable-outdev=<var>OUTDEV</var>&quot;, or you can disable a particular
2714 input device using the option &quot;&ndash;disable-outdev=<var>OUTDEV</var>&quot;.
2715 </p>
2716 <p>The option &quot;-formats&quot; of the ff* tools will display the list of
2717 enabled output devices (amongst the muxers).
2718 </p>
2719 <p>A description of the currently available output devices follows.
2720 </p>
2721 <a name="alsa-1"></a>
2722 <h2 class="section"><a href="ffmpeg.html#toc-alsa-1">11.1 alsa</a></h2>
2723
2724 <p>ALSA (Advanced Linux Sound Architecture) output device.
2725 </p>
2726 <a name="oss-1"></a>
2727 <h2 class="section"><a href="ffmpeg.html#toc-oss-1">11.2 oss</a></h2>
2728
2729 <p>OSS (Open Sound System) output device.
2730 </p>
2731 <a name="sndio"></a>
2732 <h2 class="section"><a href="ffmpeg.html#toc-sndio">11.3 sndio</a></h2>
2733
2734 <p>sndio audio output device.
2735 </p>
2736 <a name="Protocols"></a>
2737 <h1 class="chapter"><a href="ffmpeg.html#toc-Protocols">12. Protocols</a></h1>
2738
2739 <p>Protocols are configured elements in FFmpeg which allow to access
2740 resources which require the use of a particular protocol.
2741 </p>
2742 <p>When you configure your FFmpeg build, all the supported protocols are
2743 enabled by default. You can list all available ones using the
2744 configure option &quot;&ndash;list-protocols&quot;.
2745 </p>
2746 <p>You can disable all the protocols using the configure option
2747 &quot;&ndash;disable-protocols&quot;, and selectively enable a protocol using the
2748 option &quot;&ndash;enable-protocol=<var>PROTOCOL</var>&quot;, or you can disable a
2749 particular protocol using the option
2750 &quot;&ndash;disable-protocol=<var>PROTOCOL</var>&quot;.
2751 </p>
2752 <p>The option &quot;-protocols&quot; of the ff* tools will display the list of
2753 supported protocols.
2754 </p>
2755 <p>A description of the currently available protocols follows.
2756 </p>
2757 <a name="applehttp"></a>
2758 <h2 class="section"><a href="ffmpeg.html#toc-applehttp">12.1 applehttp</a></h2>
2759
2760 <p>Read Apple HTTP Live Streaming compliant segmented stream as
2761 a uniform one. The M3U8 playlists describing the segments can be
2762 remote HTTP resources or local files, accessed using the standard
2763 file protocol.
2764 HTTP is default, specific protocol can be declared by specifying
2765 &quot;+<var>proto</var>&quot; after the applehttp URI scheme name, where <var>proto</var>
2766 is either &quot;file&quot; or &quot;http&quot;.
2767 </p>
2768 <table><tr><td>&nbsp;</td><td><pre class="example">applehttp://host/path/to/remote/resource.m3u8
2769 applehttp+http://host/path/to/remote/resource.m3u8
2770 applehttp+file://path/to/local/resource.m3u8
2771 </pre></td></tr></table>
2772
2773 <a name="concat"></a>
2774 <h2 class="section"><a href="ffmpeg.html#toc-concat">12.2 concat</a></h2>
2775
2776 <p>Physical concatenation protocol.
2777 </p>
2778 <p>Allow to read and seek from many resource in sequence as if they were
2779 a unique resource.
2780 </p>
2781 <p>A URL accepted by this protocol has the syntax:
2782 </p><table><tr><td>&nbsp;</td><td><pre class="example">concat:<var>URL1</var>|<var>URL2</var>|...|<var>URLN</var>
2783 </pre></td></tr></table>
2784
2785 <p>where <var>URL1</var>, <var>URL2</var>, ..., <var>URLN</var> are the urls of the
2786 resource to be concatenated, each one possibly specifying a distinct
2787 protocol.
2788 </p>
2789 <p>For example to read a sequence of files &lsquo;<tt>split1.mpeg</tt>&rsquo;,
2790 &lsquo;<tt>split2.mpeg</tt>&rsquo;, &lsquo;<tt>split3.mpeg</tt>&rsquo; with &lsquo;<tt>ffplay</tt>&rsquo; use the
2791 command:
2792 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
2793 </pre></td></tr></table>
2794
2795 <p>Note that you may need to escape the character &quot;|&quot; which is special for
2796 many shells.
2797 </p>
2798 <a name="file"></a>
2799 <h2 class="section"><a href="ffmpeg.html#toc-file">12.3 file</a></h2>
2800
2801 <p>File access protocol.
2802 </p>
2803 <p>Allow to read from or read to a file.
2804 </p>
2805 <p>For example to read from a file &lsquo;<tt>input.mpeg</tt>&rsquo; with &lsquo;<tt>ffmpeg</tt>&rsquo;
2806 use the command:
2807 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i file:input.mpeg output.mpeg
2808 </pre></td></tr></table>
2809
2810 <p>The ff* tools default to the file protocol, that is a resource
2811 specified with the name &quot;FILE.mpeg&quot; is interpreted as the URL
2812 &quot;file:FILE.mpeg&quot;.
2813 </p>
2814 <a name="gopher"></a>
2815 <h2 class="section"><a href="ffmpeg.html#toc-gopher">12.4 gopher</a></h2>
2816
2817 <p>Gopher protocol.
2818 </p>
2819 <a name="http"></a>
2820 <h2 class="section"><a href="ffmpeg.html#toc-http">12.5 http</a></h2>
2821
2822 <p>HTTP (Hyper Text Transfer Protocol).
2823 </p>
2824 <a name="mmst"></a>
2825 <h2 class="section"><a href="ffmpeg.html#toc-mmst">12.6 mmst</a></h2>
2826
2827 <p>MMS (Microsoft Media Server) protocol over TCP.
2828 </p>
2829 <a name="mmsh"></a>
2830 <h2 class="section"><a href="ffmpeg.html#toc-mmsh">12.7 mmsh</a></h2>
2831
2832 <p>MMS (Microsoft Media Server) protocol over HTTP.
2833 </p>
2834 <p>The required syntax is:
2835 </p><table><tr><td>&nbsp;</td><td><pre class="example">mmsh://<var>server</var>[:<var>port</var>][/<var>app</var>][/<var>playpath</var>]
2836 </pre></td></tr></table>
2837
2838 <a name="md5"></a>
2839 <h2 class="section"><a href="ffmpeg.html#toc-md5">12.8 md5</a></h2>
2840
2841 <p>MD5 output protocol.
2842 </p>
2843 <p>Computes the MD5 hash of the data to be written, and on close writes
2844 this to the designated output or stdout if none is specified. It can
2845 be used to test muxers without writing an actual file.
2846 </p>
2847 <p>Some examples follow.
2848 </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.
2849 ffmpeg -i input.flv -f avi -y md5:output.avi.md5
2850
2851 # Write the MD5 hash of the encoded AVI file to stdout.
2852 ffmpeg -i input.flv -f avi -y md5:
2853 </pre></td></tr></table>
2854
2855 <p>Note that some formats (typically MOV) require the output protocol to
2856 be seekable, so they will fail with the MD5 output protocol.
2857 </p>
2858 <a name="pipe"></a>
2859 <h2 class="section"><a href="ffmpeg.html#toc-pipe">12.9 pipe</a></h2>
2860
2861 <p>UNIX pipe access protocol.
2862 </p>
2863 <p>Allow to read and write from UNIX pipes.
2864 </p>
2865 <p>The accepted syntax is:
2866 </p><table><tr><td>&nbsp;</td><td><pre class="example">pipe:[<var>number</var>]
2867 </pre></td></tr></table>
2868
2869 <p><var>number</var> is the number corresponding to the file descriptor of the
2870 pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr).  If <var>number</var>
2871 is not specified, by default the stdout file descriptor will be used
2872 for writing, stdin for reading.
2873 </p>
2874 <p>For example to read from stdin with &lsquo;<tt>ffmpeg</tt>&rsquo;:
2875 </p><table><tr><td>&nbsp;</td><td><pre class="example">cat test.wav | ffmpeg -i pipe:0
2876 # ...this is the same as...
2877 cat test.wav | ffmpeg -i pipe:
2878 </pre></td></tr></table>
2879
2880 <p>For writing to stdout with &lsquo;<tt>ffmpeg</tt>&rsquo;:
2881 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i test.wav -f avi pipe:1 | cat &gt; test.avi
2882 # ...this is the same as...
2883 ffmpeg -i test.wav -f avi pipe: | cat &gt; test.avi
2884 </pre></td></tr></table>
2885
2886 <p>Note that some formats (typically MOV), require the output protocol to
2887 be seekable, so they will fail with the pipe output protocol.
2888 </p>
2889 <a name="rtmp"></a>
2890 <h2 class="section"><a href="ffmpeg.html#toc-rtmp">12.10 rtmp</a></h2>
2891
2892 <p>Real-Time Messaging Protocol.
2893 </p>
2894 <p>The Real-Time Messaging Protocol (RTMP) is used for streaming multime‐
2895 dia content across a TCP/IP network.
2896 </p>
2897 <p>The required syntax is:
2898 </p><table><tr><td>&nbsp;</td><td><pre class="example">rtmp://<var>server</var>[:<var>port</var>][/<var>app</var>][/<var>playpath</var>]
2899 </pre></td></tr></table>
2900
2901 <p>The accepted parameters are:
2902 </p><dl compact="compact">
2903 <dt> &lsquo;<samp>server</samp>&rsquo;</dt>
2904 <dd><p>The address of the RTMP server.
2905 </p>
2906 </dd>
2907 <dt> &lsquo;<samp>port</samp>&rsquo;</dt>
2908 <dd><p>The number of the TCP port to use (by default is 1935).
2909 </p>
2910 </dd>
2911 <dt> &lsquo;<samp>app</samp>&rsquo;</dt>
2912 <dd><p>It is the name of the application to access. It usually corresponds to
2913 the path where the application is installed on the RTMP server
2914 (e.g. &lsquo;<tt>/ondemand/</tt>&rsquo;, &lsquo;<tt>/flash/live/</tt>&rsquo;, etc.).
2915 </p>
2916 </dd>
2917 <dt> &lsquo;<samp>playpath</samp>&rsquo;</dt>
2918 <dd><p>It is the path or name of the resource to play with reference to the
2919 application specified in <var>app</var>, may be prefixed by &quot;mp4:&quot;.
2920 </p>
2921 </dd>
2922 </dl>
2923
2924 <p>For example to read with &lsquo;<tt>ffplay</tt>&rsquo; a multimedia resource named
2925 &quot;sample&quot; from the application &quot;vod&quot; from an RTMP server &quot;myserver&quot;:
2926 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffplay rtmp://myserver/vod/sample
2927 </pre></td></tr></table>
2928
2929 <a name="rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte"></a>
2930 <h2 class="section"><a href="ffmpeg.html#toc-rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte">12.11 rtmp, rtmpe, rtmps, rtmpt, rtmpte</a></h2>
2931
2932 <p>Real-Time Messaging Protocol and its variants supported through
2933 librtmp.
2934 </p>
2935 <p>Requires the presence of the librtmp headers and library during
2936 configuration. You need to explicitely configure the build with
2937 &quot;&ndash;enable-librtmp&quot;. If enabled this will replace the native RTMP
2938 protocol.
2939 </p>
2940 <p>This protocol provides most client functions and a few server
2941 functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT),
2942 encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled
2943 variants of these encrypted types (RTMPTE, RTMPTS).
2944 </p>
2945 <p>The required syntax is:
2946 </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>
2947 </pre></td></tr></table>
2948
2949 <p>where <var>rtmp_proto</var> is one of the strings &quot;rtmp&quot;, &quot;rtmpt&quot;, &quot;rtmpe&quot;,
2950 &quot;rtmps&quot;, &quot;rtmpte&quot;, &quot;rtmpts&quot; corresponding to each RTMP variant, and
2951 <var>server</var>, <var>port</var>, <var>app</var> and <var>playpath</var> have the same
2952 meaning as specified for the RTMP native protocol.
2953 <var>options</var> contains a list of space-separated options of the form
2954 <var>key</var>=<var>val</var>.
2955 </p>
2956 <p>See the librtmp manual page (man 3 librtmp) for more information.
2957 </p>
2958 <p>For example, to stream a file in real-time to an RTMP server using
2959 &lsquo;<tt>ffmpeg</tt>&rsquo;:
2960 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
2961 </pre></td></tr></table>
2962
2963 <p>To play the same stream using &lsquo;<tt>ffplay</tt>&rsquo;:
2964 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffplay &quot;rtmp://myserver/live/mystream live=1&quot;
2965 </pre></td></tr></table>
2966
2967 <a name="rtp"></a>
2968 <h2 class="section"><a href="ffmpeg.html#toc-rtp">12.12 rtp</a></h2>
2969
2970 <p>Real-Time Protocol.
2971 </p>
2972 <a name="rtsp"></a>
2973 <h2 class="section"><a href="ffmpeg.html#toc-rtsp">12.13 rtsp</a></h2>
2974
2975 <p>RTSP is not technically a protocol handler in libavformat, it is a demuxer
2976 and muxer. The demuxer supports both normal RTSP (with data transferred
2977 over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with
2978 data transferred over RDT).
2979 </p>
2980 <p>The muxer can be used to send a stream using RTSP ANNOUNCE to a server
2981 supporting it (currently Darwin Streaming Server and Mischa Spiegelmock&rsquo;s
2982 RTSP server, <a href="http://github.com/revmischa/rtsp-server">http://github.com/revmischa/rtsp-server</a>).
2983 </p>
2984 <p>The required syntax for a RTSP url is:
2985 </p><table><tr><td>&nbsp;</td><td><pre class="example">rtsp://<var>hostname</var>[:<var>port</var>]/<var>path</var>[?<var>options</var>]
2986 </pre></td></tr></table>
2987
2988 <p><var>options</var> is a <code>&amp;</code>-separated list. The following options
2989 are supported:
2990 </p>
2991 <dl compact="compact">
2992 <dt> &lsquo;<samp>udp</samp>&rsquo;</dt>
2993 <dd><p>Use UDP as lower transport protocol.
2994 </p>
2995 </dd>
2996 <dt> &lsquo;<samp>tcp</samp>&rsquo;</dt>
2997 <dd><p>Use TCP (interleaving within the RTSP control channel) as lower
2998 transport protocol.
2999 </p>
3000 </dd>
3001 <dt> &lsquo;<samp>multicast</samp>&rsquo;</dt>
3002 <dd><p>Use UDP multicast as lower transport protocol.
3003 </p>
3004 </dd>
3005 <dt> &lsquo;<samp>http</samp>&rsquo;</dt>
3006 <dd><p>Use HTTP tunneling as lower transport protocol, which is useful for
3007 passing proxies.
3008 </p>
3009 </dd>
3010 <dt> &lsquo;<samp>filter_src</samp>&rsquo;</dt>
3011 <dd><p>Accept packets only from negotiated peer address and port.
3012 </p></dd>
3013 </dl>
3014
3015 <p>Multiple lower transport protocols may be specified, in that case they are
3016 tried one at a time (if the setup of one fails, the next one is tried).
3017 For the muxer, only the <code>tcp</code> and <code>udp</code> options are supported.
3018 </p>
3019 <p>When receiving data over UDP, the demuxer tries to reorder received packets
3020 (since they may arrive out of order, or packets may get lost totally). In
3021 order for this to be enabled, a maximum delay must be specified in the
3022 <code>max_delay</code> field of AVFormatContext.
3023 </p>
3024 <p>When watching multi-bitrate Real-RTSP streams with &lsquo;<tt>ffplay</tt>&rsquo;, the
3025 streams to display can be chosen with <code>-vst</code> <var>n</var> and
3026 <code>-ast</code> <var>n</var> for video and audio respectively, and can be switched
3027 on the fly by pressing <code>v</code> and <code>a</code>.
3028 </p>
3029 <p>Example command lines:
3030 </p>
3031 <p>To watch a stream over UDP, with a max reordering delay of 0.5 seconds:
3032 </p>
3033 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay -max_delay 500000 rtsp://server/video.mp4?udp
3034 </pre></td></tr></table>
3035
3036 <p>To watch a stream tunneled over HTTP:
3037 </p>
3038 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay rtsp://server/video.mp4?http
3039 </pre></td></tr></table>
3040
3041 <p>To send a stream in realtime to a RTSP server, for others to watch:
3042 </p>
3043 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i <var>input</var> -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
3044 </pre></td></tr></table>
3045
3046 <a name="sap"></a>
3047 <h2 class="section"><a href="ffmpeg.html#toc-sap">12.14 sap</a></h2>
3048
3049 <p>Session Announcement Protocol (RFC 2974). This is not technically a
3050 protocol handler in libavformat, it is a muxer and demuxer.
3051 It is used for signalling of RTP streams, by announcing the SDP for the
3052 streams regularly on a separate port.
3053 </p>
3054 <a name="Muxer"></a>
3055 <h3 class="subsection"><a href="ffmpeg.html#toc-Muxer">12.14.1 Muxer</a></h3>
3056
3057 <p>The syntax for a SAP url given to the muxer is:
3058 </p><table><tr><td>&nbsp;</td><td><pre class="example">sap://<var>destination</var>[:<var>port</var>][?<var>options</var>]
3059 </pre></td></tr></table>
3060
3061 <p>The RTP packets are sent to <var>destination</var> on port <var>port</var>,
3062 or to port 5004 if no port is specified.
3063 <var>options</var> is a <code>&amp;</code>-separated list. The following options
3064 are supported:
3065 </p>
3066 <dl compact="compact">
3067 <dt> &lsquo;<samp>announce_addr=<var>address</var></samp>&rsquo;</dt>
3068 <dd><p>Specify the destination IP address for sending the announcements to.
3069 If omitted, the announcements are sent to the commonly used SAP
3070 announcement multicast address 224.2.127.254 (sap.mcast.net), or
3071 ff0e::2:7ffe if <var>destination</var> is an IPv6 address.
3072 </p>
3073 </dd>
3074 <dt> &lsquo;<samp>announce_port=<var>port</var></samp>&rsquo;</dt>
3075 <dd><p>Specify the port to send the announcements on, defaults to
3076 9875 if not specified.
3077 </p>
3078 </dd>
3079 <dt> &lsquo;<samp>ttl=<var>ttl</var></samp>&rsquo;</dt>
3080 <dd><p>Specify the time to live value for the announcements and RTP packets,
3081 defaults to 255.
3082 </p>
3083 </dd>
3084 <dt> &lsquo;<samp>same_port=<var>0|1</var></samp>&rsquo;</dt>
3085 <dd><p>If set to 1, send all RTP streams on the same port pair. If zero (the
3086 default), all streams are sent on unique ports, with each stream on a
3087 port 2 numbers higher than the previous.
3088 VLC/Live555 requires this to be set to 1, to be able to receive the stream.
3089 The RTP stack in libavformat for receiving requires all streams to be sent
3090 on unique ports.
3091 </p></dd>
3092 </dl>
3093
3094 <p>Example command lines follow.
3095 </p>
3096 <p>To broadcast a stream on the local subnet, for watching in VLC:
3097 </p>
3098 <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
3099 </pre></td></tr></table>
3100
3101 <p>Similarly, for watching in ffplay:
3102 </p>
3103 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i <var>input</var> -f sap sap://224.0.0.255
3104 </pre></td></tr></table>
3105
3106 <p>And for watching in ffplay, over IPv6:
3107 </p>
3108 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i <var>input</var> -f sap sap://[ff0e::1:2:3:4]
3109 </pre></td></tr></table>
3110
3111 <a name="Demuxer"></a>
3112 <h3 class="subsection"><a href="ffmpeg.html#toc-Demuxer">12.14.2 Demuxer</a></h3>
3113
3114 <p>The syntax for a SAP url given to the demuxer is:
3115 </p><table><tr><td>&nbsp;</td><td><pre class="example">sap://[<var>address</var>][:<var>port</var>]
3116 </pre></td></tr></table>
3117
3118 <p><var>address</var> is the multicast address to listen for announcements on,
3119 if omitted, the default 224.2.127.254 (sap.mcast.net) is used. <var>port</var>
3120 is the port that is listened on, 9875 if omitted.
3121 </p>
3122 <p>The demuxers listens for announcements on the given address and port.
3123 Once an announcement is received, it tries to receive that particular stream.
3124 </p>
3125 <p>Example command lines follow.
3126 </p>
3127 <p>To play back the first stream announced on the normal SAP multicast address:
3128 </p>
3129 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay sap://
3130 </pre></td></tr></table>
3131
3132 <p>To play back the first stream announced on one the default IPv6 SAP multicast address:
3133 </p>
3134 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay sap://[ff0e::2:7ffe]
3135 </pre></td></tr></table>
3136
3137 <a name="tcp"></a>
3138 <h2 class="section"><a href="ffmpeg.html#toc-tcp">12.15 tcp</a></h2>
3139
3140 <p>Trasmission Control Protocol.
3141 </p>
3142 <p>The required syntax for a TCP url is:
3143 </p><table><tr><td>&nbsp;</td><td><pre class="example">tcp://<var>hostname</var>:<var>port</var>[?<var>options</var>]
3144 </pre></td></tr></table>
3145
3146 <dl compact="compact">
3147 <dt> &lsquo;<samp>listen</samp>&rsquo;</dt>
3148 <dd><p>Listen for an incoming connection
3149 </p>
3150 <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
3151 ffplay tcp://<var>hostname</var>:<var>port</var>
3152 </pre></td></tr></table>
3153
3154 </dd>
3155 </dl>
3156
3157 <a name="udp"></a>
3158 <h2 class="section"><a href="ffmpeg.html#toc-udp">12.16 udp</a></h2>
3159
3160 <p>User Datagram Protocol.
3161 </p>
3162 <p>The required syntax for a UDP url is:
3163 </p><table><tr><td>&nbsp;</td><td><pre class="example">udp://<var>hostname</var>:<var>port</var>[?<var>options</var>]
3164 </pre></td></tr></table>
3165
3166 <p><var>options</var> contains a list of &amp;-seperated options of the form <var>key</var>=<var>val</var>.
3167 Follow the list of supported options.
3168 </p>
3169 <dl compact="compact">
3170 <dt> &lsquo;<samp>buffer_size=<var>size</var></samp>&rsquo;</dt>
3171 <dd><p>set the UDP buffer size in bytes
3172 </p>
3173 </dd>
3174 <dt> &lsquo;<samp>localport=<var>port</var></samp>&rsquo;</dt>
3175 <dd><p>override the local UDP port to bind with
3176 </p>
3177 </dd>
3178 <dt> &lsquo;<samp>pkt_size=<var>size</var></samp>&rsquo;</dt>
3179 <dd><p>set the size in bytes of UDP packets
3180 </p>
3181 </dd>
3182 <dt> &lsquo;<samp>reuse=<var>1|0</var></samp>&rsquo;</dt>
3183 <dd><p>explicitly allow or disallow reusing UDP sockets
3184 </p>
3185 </dd>
3186 <dt> &lsquo;<samp>ttl=<var>ttl</var></samp>&rsquo;</dt>
3187 <dd><p>set the time to live value (for multicast only)
3188 </p>
3189 </dd>
3190 <dt> &lsquo;<samp>connect=<var>1|0</var></samp>&rsquo;</dt>
3191 <dd><p>Initialize the UDP socket with <code>connect()</code>. In this case, the
3192 destination address can&rsquo;t be changed with ff_udp_set_remote_url later.
3193 If the destination address isn&rsquo;t known at the start, this option can
3194 be specified in ff_udp_set_remote_url, too.
3195 This allows finding out the source address for the packets with getsockname,
3196 and makes writes return with AVERROR(ECONNREFUSED) if &quot;destination
3197 unreachable&quot; is received.
3198 For receiving, this gives the benefit of only receiving packets from
3199 the specified peer address/port.
3200 </p></dd>
3201 </dl>
3202
3203 <p>Some usage examples of the udp protocol with &lsquo;<tt>ffmpeg</tt>&rsquo; follow.
3204 </p>
3205 <p>To stream over UDP to a remote endpoint:
3206 </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>
3207 </pre></td></tr></table>
3208
3209 <p>To stream in mpegts format over UDP using 188 sized UDP packets, using a large input buffer:
3210 </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
3211 </pre></td></tr></table>
3212
3213 <p>To receive over UDP from a remote endpoint:
3214 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i udp://[<var>multicast-address</var>]:<var>port</var>
3215 </pre></td></tr></table>
3216
3217 <a name="Bitstream-Filters"></a>
3218 <h1 class="chapter"><a href="ffmpeg.html#toc-Bitstream-Filters">13. Bitstream Filters</a></h1>
3219
3220 <p>When you configure your FFmpeg build, all the supported bitstream
3221 filters are enabled by default. You can list all available ones using
3222 the configure option <code>--list-bsfs</code>.
3223 </p>
3224 <p>You can disable all the bitstream filters using the configure option
3225 <code>--disable-bsfs</code>, and selectively enable any bitstream filter using
3226 the option <code>--enable-bsf=BSF</code>, or you can disable a particular
3227 bitstream filter using the option <code>--disable-bsf=BSF</code>.
3228 </p>
3229 <p>The option <code>-bsfs</code> of the ff* tools will display the list of
3230 all the supported bitstream filters included in your build.
3231 </p>
3232 <p>Below is a description of the currently available bitstream filters.
3233 </p>
3234 <a name="aac_005fadtstoasc"></a>
3235 <h2 class="section"><a href="ffmpeg.html#toc-aac_005fadtstoasc">13.1 aac_adtstoasc</a></h2>
3236
3237 <a name="chomp"></a>
3238 <h2 class="section"><a href="ffmpeg.html#toc-chomp">13.2 chomp</a></h2>
3239
3240 <a name="dump_005fextradata"></a>
3241 <h2 class="section"><a href="ffmpeg.html#toc-dump_005fextradata">13.3 dump_extradata</a></h2>
3242
3243 <a name="h264_005fmp4toannexb"></a>
3244 <h2 class="section"><a href="ffmpeg.html#toc-h264_005fmp4toannexb">13.4 h264_mp4toannexb</a></h2>
3245
3246 <a name="imx_005fdump_005fheader"></a>
3247 <h2 class="section"><a href="ffmpeg.html#toc-imx_005fdump_005fheader">13.5 imx_dump_header</a></h2>
3248
3249 <a name="mjpeg2jpeg"></a>
3250 <h2 class="section"><a href="ffmpeg.html#toc-mjpeg2jpeg">13.6 mjpeg2jpeg</a></h2>
3251
3252 <p>Convert MJPEG/AVI1 packets to full JPEG/JFIF packets.
3253 </p>
3254 <p>MJPEG is a video codec wherein each video frame is essentially a
3255 JPEG image. The individual frames can be extracted without loss,
3256 e.g. by
3257 </p>
3258 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i ../some_mjpeg.avi -vcodec copy frames_%d.jpg
3259 </pre></td></tr></table>
3260
3261 <p>Unfortunately, these chunks are incomplete JPEG images, because
3262 they lack the DHT segment required for decoding. Quoting from
3263 <a href="http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml">http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml</a>:
3264 </p>
3265 <p>Avery Lee, writing in the rec.video.desktop newsgroup in 2001,
3266 commented that &quot;MJPEG, or at least the MJPEG in AVIs having the
3267 MJPG fourcc, is restricted JPEG with a fixed &ndash; and *omitted* &ndash;
3268 Huffman table. The JPEG must be YCbCr colorspace, it must be 4:2:2,
3269 and it must use basic Huffman encoding, not arithmetic or
3270 progressive. . . . You can indeed extract the MJPEG frames and
3271 decode them with a regular JPEG decoder, but you have to prepend
3272 the DHT segment to them, or else the decoder won&rsquo;t have any idea
3273 how to decompress the data. The exact table necessary is given in
3274 the OpenDML spec.&quot;
3275 </p>
3276 <p>This bitstream filter patches the header of frames extracted from an MJPEG
3277 stream (carrying the AVI1 header ID and lacking a DHT segment) to
3278 produce fully qualified JPEG images.
3279 </p>
3280 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i mjpeg-movie.avi -vcodec copy -vbsf mjpeg2jpeg frame_%d.jpg
3281 exiftran -i -9 frame*.jpg
3282 ffmpeg -i frame_%d.jpg -vcodec copy rotated.avi
3283 </pre></td></tr></table>
3284
3285 <a name="mjpega_005fdump_005fheader"></a>
3286 <h2 class="section"><a href="ffmpeg.html#toc-mjpega_005fdump_005fheader">13.7 mjpega_dump_header</a></h2>
3287
3288 <a name="movsub"></a>
3289 <h2 class="section"><a href="ffmpeg.html#toc-movsub">13.8 movsub</a></h2>
3290
3291 <a name="mp3_005fheader_005fcompress"></a>
3292 <h2 class="section"><a href="ffmpeg.html#toc-mp3_005fheader_005fcompress">13.9 mp3_header_compress</a></h2>
3293
3294 <a name="mp3_005fheader_005fdecompress"></a>
3295 <h2 class="section"><a href="ffmpeg.html#toc-mp3_005fheader_005fdecompress">13.10 mp3_header_decompress</a></h2>
3296
3297 <a name="noise"></a>
3298 <h2 class="section"><a href="ffmpeg.html#toc-noise">13.11 noise</a></h2>
3299
3300 <a name="remove_005fextradata"></a>
3301 <h2 class="section"><a href="ffmpeg.html#toc-remove_005fextradata">13.12 remove_extradata</a></h2>
3302
3303 <a name="Filtergraph-description"></a>
3304 <h1 class="chapter"><a href="ffmpeg.html#toc-Filtergraph-description">14. Filtergraph description</a></h1>
3305
3306 <p>A filtergraph is a directed graph of connected filters. It can contain
3307 cycles, and there can be multiple links between a pair of
3308 filters. Each link has one input pad on one side connecting it to one
3309 filter from which it takes its input, and one output pad on the other
3310 side connecting it to the one filter accepting its output.
3311 </p>
3312 <p>Each filter in a filtergraph is an instance of a filter class
3313 registered in the application, which defines the features and the
3314 number of input and output pads of the filter.
3315 </p>
3316 <p>A filter with no input pads is called a &quot;source&quot;, a filter with no
3317 output pads is called a &quot;sink&quot;.
3318 </p>
3319 <a name="Filtergraph-syntax"></a>
3320 <h2 class="section"><a href="ffmpeg.html#toc-Filtergraph-syntax">14.1 Filtergraph syntax</a></h2>
3321
3322 <p>A filtergraph can be represented using a textual representation, which
3323 is recognized by the <code>-vf</code> and <code>-af</code> options of the ff*
3324 tools, and by the <code>av_parse_graph()</code> function defined in
3325 &lsquo;<tt>libavfilter/avfiltergraph</tt>&rsquo;.
3326 </p>
3327 <p>A filterchain consists of a sequence of connected filters, each one
3328 connected to the previous one in the sequence. A filterchain is
3329 represented by a list of &quot;,&quot;-separated filter descriptions.
3330 </p>
3331 <p>A filtergraph consists of a sequence of filterchains. A sequence of
3332 filterchains is represented by a list of &quot;;&quot;-separated filterchain
3333 descriptions.
3334 </p>
3335 <p>A filter is represented by a string of the form:
3336 [<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>]
3337 </p>
3338 <p><var>filter_name</var> is the name of the filter class of which the
3339 described filter is an instance of, and has to be the name of one of
3340 the filter classes registered in the program.
3341 The name of the filter class is optionally followed by a string
3342 &quot;=<var>arguments</var>&quot;.
3343 </p>
3344 <p><var>arguments</var> is a string which contains the parameters used to
3345 initialize the filter instance, and are described in the filter
3346 descriptions below.
3347 </p>
3348 <p>The list of arguments can be quoted using the character &quot;&rsquo;&quot; as initial
3349 and ending mark, and the character &rsquo;\&rsquo; for escaping the characters
3350 within the quoted text; otherwise the argument string is considered
3351 terminated when the next special character (belonging to the set
3352 &quot;[]=;,&quot;) is encountered.
3353 </p>
3354 <p>The name and arguments of the filter are optionally preceded and
3355 followed by a list of link labels.
3356 A link label allows to name a link and associate it to a filter output
3357 or input pad. The preceding labels <var>in_link_1</var>
3358 ... <var>in_link_N</var>, are associated to the filter input pads,
3359 the following labels <var>out_link_1</var> ... <var>out_link_M</var>, are
3360 associated to the output pads.
3361 </p>
3362 <p>When two link labels with the same name are found in the
3363 filtergraph, a link between the corresponding input and output pad is
3364 created.
3365 </p>
3366 <p>If an output pad is not labelled, it is linked by default to the first
3367 unlabelled input pad of the next filter in the filterchain.
3368 For example in the filterchain:
3369 </p><table><tr><td>&nbsp;</td><td><pre class="example">nullsrc, split[L1], [L2]overlay, nullsink
3370 </pre></td></tr></table>
3371 <p>the split filter instance has two output pads, and the overlay filter
3372 instance two input pads. The first output pad of split is labelled
3373 &quot;L1&quot;, the first input pad of overlay is labelled &quot;L2&quot;, and the second
3374 output pad of split is linked to the second input pad of overlay,
3375 which are both unlabelled.
3376 </p>
3377 <p>In a complete filterchain all the unlabelled filter input and output
3378 pads must be connected. A filtergraph is considered valid if all the
3379 filter input and output pads of all the filterchains are connected.
3380 </p>
3381 <p>Follows a BNF description for the filtergraph syntax:
3382 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>NAME</var>             ::= sequence of alphanumeric characters and '_'
3383 <var>LINKLABEL</var>        ::= &quot;[&quot; <var>NAME</var> &quot;]&quot;
3384 <var>LINKLABELS</var>       ::= <var>LINKLABEL</var> [<var>LINKLABELS</var>]
3385 <var>FILTER_ARGUMENTS</var> ::= sequence of chars (eventually quoted)
3386 <var>FILTER</var>           ::= [<var>LINKNAMES</var>] <var>NAME</var> [&quot;=&quot; <var>ARGUMENTS</var>] [<var>LINKNAMES</var>]
3387 <var>FILTERCHAIN</var>      ::= <var>FILTER</var> [,<var>FILTERCHAIN</var>]
3388 <var>FILTERGRAPH</var>      ::= <var>FILTERCHAIN</var> [;<var>FILTERGRAPH</var>]
3389 </pre></td></tr></table>
3390
3391
3392 <a name="Audio-Filters"></a>
3393 <h1 class="chapter"><a href="ffmpeg.html#toc-Audio-Filters">15. Audio Filters</a></h1>
3394
3395 <p>When you configure your FFmpeg build, you can disable any of the
3396 existing filters using &ndash;disable-filters.
3397 The configure output will show the audio filters included in your
3398 build.
3399 </p>
3400 <p>Below is a description of the currently available audio filters.
3401 </p>
3402 <a name="anull"></a>
3403 <h2 class="section"><a href="ffmpeg.html#toc-anull">15.1 anull</a></h2>
3404
3405 <p>Pass the audio source unchanged to the output.
3406 </p>
3407
3408 <a name="Audio-Sources"></a>
3409 <h1 class="chapter"><a href="ffmpeg.html#toc-Audio-Sources">16. Audio Sources</a></h1>
3410
3411 <p>Below is a description of the currently available audio sources.
3412 </p>
3413 <a name="anullsrc"></a>
3414 <h2 class="section"><a href="ffmpeg.html#toc-anullsrc">16.1 anullsrc</a></h2>
3415
3416 <p>Null audio source, never return audio frames. It is mainly useful as a
3417 template and to be employed in analysis / debugging tools.
3418 </p>
3419 <p>It accepts as optional parameter a string of the form
3420 <var>sample_rate</var>:<var>channel_layout</var>.
3421 </p>
3422 <p><var>sample_rate</var> specify the sample rate, and defaults to 44100.
3423 </p>
3424 <p><var>channel_layout</var> specify the channel layout, and can be either an
3425 integer or a string representing a channel layout. The default value
3426 of <var>channel_layout</var> is 3, which corresponds to CH_LAYOUT_STEREO.
3427 </p>
3428 <p>Check the channel_layout_map definition in
3429 &lsquo;<tt>libavcodec/audioconvert.c</tt>&rsquo; for the mapping between strings and
3430 channel layout values.
3431 </p>
3432 <p>Follow some examples:
3433 </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.
3434 anullsrc=48000:4
3435
3436 # same as
3437 anullsrc=48000:mono
3438 </pre></td></tr></table>
3439
3440
3441 <a name="Audio-Sinks"></a>
3442 <h1 class="chapter"><a href="ffmpeg.html#toc-Audio-Sinks">17. Audio Sinks</a></h1>
3443
3444 <p>Below is a description of the currently available audio sinks.
3445 </p>
3446 <a name="anullsink"></a>
3447 <h2 class="section"><a href="ffmpeg.html#toc-anullsink">17.1 anullsink</a></h2>
3448
3449 <p>Null audio sink, do absolutely nothing with the input audio. It is
3450 mainly useful as a template and to be employed in analysis / debugging
3451 tools.
3452 </p>
3453
3454 <a name="Video-Filters"></a>
3455 <h1 class="chapter"><a href="ffmpeg.html#toc-Video-Filters">18. Video Filters</a></h1>
3456
3457 <p>When you configure your FFmpeg build, you can disable any of the
3458 existing filters using &ndash;disable-filters.
3459 The configure output will show the video filters included in your
3460 build.
3461 </p>
3462 <p>Below is a description of the currently available video filters.
3463 </p>
3464 <a name="blackframe"></a>
3465 <h2 class="section"><a href="ffmpeg.html#toc-blackframe">18.1 blackframe</a></h2>
3466
3467 <p>Detect frames that are (almost) completely black. Can be useful to
3468 detect chapter transitions or commercials. Output lines consist of
3469 the frame number of the detected frame, the percentage of blackness,
3470 the position in the file if known or -1 and the timestamp in seconds.
3471 </p>
3472 <p>In order to display the output lines, you need to set the loglevel at
3473 least to the AV_LOG_INFO value.
3474 </p>
3475 <p>The filter accepts the syntax:
3476 </p><table><tr><td>&nbsp;</td><td><pre class="example">blackframe[=<var>amount</var>:[<var>threshold</var>]]
3477 </pre></td></tr></table>
3478
3479 <p><var>amount</var> is the percentage of the pixels that have to be below the
3480 threshold, and defaults to 98.
3481 </p>
3482 <p><var>threshold</var> is the threshold below which a pixel value is
3483 considered black, and defaults to 32.
3484 </p>
3485 <a name="copy"></a>
3486 <h2 class="section"><a href="ffmpeg.html#toc-copy">18.2 copy</a></h2>
3487
3488 <p>Copy the input source unchanged to the output. Mainly useful for
3489 testing purposes.
3490 </p>
3491 <a name="crop"></a>
3492 <h2 class="section"><a href="ffmpeg.html#toc-crop">18.3 crop</a></h2>
3493
3494 <p>Crop the input video to <var>out_w</var>:<var>out_h</var>:<var>x</var>:<var>y</var>.
3495 </p>
3496 <p>The parameters are expressions containing the following constants:
3497 </p>
3498 <dl compact="compact">
3499 <dt> &lsquo;<samp>E, PI, PHI</samp>&rsquo;</dt>
3500 <dd><p>the corresponding mathematical approximated values for e
3501 (euler number), pi (greek PI), PHI (golden ratio)
3502 </p>
3503 </dd>
3504 <dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
3505 <dd><p>the computed values for <var>x</var> and <var>y</var>. They are evaluated for
3506 each new frame.
3507 </p>
3508 </dd>
3509 <dt> &lsquo;<samp>in_w, in_h</samp>&rsquo;</dt>
3510 <dd><p>the input width and heigth
3511 </p>
3512 </dd>
3513 <dt> &lsquo;<samp>iw, ih</samp>&rsquo;</dt>
3514 <dd><p>same as <var>in_w</var> and <var>in_h</var>
3515 </p>
3516 </dd>
3517 <dt> &lsquo;<samp>out_w, out_h</samp>&rsquo;</dt>
3518 <dd><p>the output (cropped) width and heigth
3519 </p>
3520 </dd>
3521 <dt> &lsquo;<samp>ow, oh</samp>&rsquo;</dt>
3522 <dd><p>same as <var>out_w</var> and <var>out_h</var>
3523 </p>
3524 </dd>
3525 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
3526 <dd><p>the number of input frame, starting from 0
3527 </p>
3528 </dd>
3529 <dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
3530 <dd><p>the position in the file of the input frame, NAN if unknown
3531 </p>
3532 </dd>
3533 <dt> &lsquo;<samp>t</samp>&rsquo;</dt>
3534 <dd><p>timestamp expressed in seconds, NAN if the input timestamp is unknown
3535 </p>
3536 </dd>
3537 </dl>
3538
3539 <p>The <var>out_w</var> and <var>out_h</var> parameters specify the expressions for
3540 the width and height of the output (cropped) video. They are
3541 evaluated just at the configuration of the filter.
3542 </p>
3543 <p>The default value of <var>out_w</var> is &quot;in_w&quot;, and the default value of
3544 <var>out_h</var> is &quot;in_h&quot;.
3545 </p>
3546 <p>The expression for <var>out_w</var> may depend on the value of <var>out_h</var>,
3547 and the expression for <var>out_h</var> may depend on <var>out_w</var>, but they
3548 cannot depend on <var>x</var> and <var>y</var>, as <var>x</var> and <var>y</var> are
3549 evaluated after <var>out_w</var> and <var>out_h</var>.
3550 </p>
3551 <p>The <var>x</var> and <var>y</var> parameters specify the expressions for the
3552 position of the top-left corner of the output (non-cropped) area. They
3553 are evaluated for each frame. If the evaluated value is not valid, it
3554 is approximated to the nearest valid value.
3555 </p>
3556 <p>The default value of <var>x</var> is &quot;(in_w-out_w)/2&quot;, and the default
3557 value for <var>y</var> is &quot;(in_h-out_h)/2&quot;, which set the cropped area at
3558 the center of the input image.
3559 </p>
3560 <p>The expression for <var>x</var> may depend on <var>y</var>, and the expression
3561 for <var>y</var> may depend on <var>x</var>.
3562 </p>
3563 <p>Follow some examples:
3564 </p><table><tr><td>&nbsp;</td><td><pre class="example"># crop the central input area with size 100x100
3565 crop=100:100
3566
3567 # crop the central input area with size 2/3 of the input video
3568 &quot;crop=2/3*in_w:2/3*in_h&quot;
3569
3570 # crop the input video central square
3571 crop=in_h
3572
3573 # delimit the rectangle with the top-left corner placed at position
3574 # 100:100 and the right-bottom corner corresponding to the right-bottom
3575 # corner of the input image.
3576 crop=in_w-100:in_h-100:100:100
3577
3578 # crop 10 pixels from the left and right borders, and 20 pixels from
3579 # the top and bottom borders
3580 &quot;crop=in_w-2*10:in_h-2*20&quot;
3581
3582 # keep only the bottom right quarter of the input image
3583 &quot;crop=in_w/2:in_h/2:in_w/2:in_h/2&quot;
3584
3585 # crop height for getting Greek harmony
3586 &quot;crop=in_w:1/PHI*in_w&quot;
3587
3588 # trembling effect
3589 &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;
3590
3591 # erratic camera effect depending on timestamp
3592 &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;
3593
3594 # set x depending on the value of y
3595 &quot;crop=in_w/2:in_h/2:y:10+10*sin(n/10)&quot;
3596 </pre></td></tr></table>
3597
3598 <a name="cropdetect"></a>
3599 <h2 class="section"><a href="ffmpeg.html#toc-cropdetect">18.4 cropdetect</a></h2>
3600
3601 <p>Auto-detect crop size.
3602 </p>
3603 <p>Calculate necessary cropping parameters and prints the recommended
3604 parameters through the logging system. The detected dimensions
3605 correspond to the non-black area of the input video.
3606 </p>
3607 <p>It accepts the syntax:
3608 </p><table><tr><td>&nbsp;</td><td><pre class="example">cropdetect[=<var>limit</var>[:<var>round</var>[:<var>reset</var>]]]
3609 </pre></td></tr></table>
3610
3611 <dl compact="compact">
3612 <dt> &lsquo;<samp>limit</samp>&rsquo;</dt>
3613 <dd><p>Threshold, which can be optionally specified from nothing (0) to
3614 everything (255), defaults to 24.
3615 </p>
3616 </dd>
3617 <dt> &lsquo;<samp>round</samp>&rsquo;</dt>
3618 <dd><p>Value which the width/height should be divisible by, defaults to
3619 16. The offset is automatically adjusted to center the video. Use 2 to
3620 get only even dimensions (needed for 4:2:2 video). 16 is best when
3621 encoding to most video codecs.
3622 </p>
3623 </dd>
3624 <dt> &lsquo;<samp>reset</samp>&rsquo;</dt>
3625 <dd><p>Counter that determines after how many frames cropdetect will reset
3626 the previously detected largest video area and start over to detect
3627 the current optimal crop area. Defaults to 0.
3628 </p>
3629 <p>This can be useful when channel logos distort the video area. 0
3630 indicates never reset and return the largest area encountered during
3631 playback.
3632 </p></dd>
3633 </dl>
3634
3635 <a name="drawbox"></a>
3636 <h2 class="section"><a href="ffmpeg.html#toc-drawbox">18.5 drawbox</a></h2>
3637
3638 <p>Draw a colored box on the input image.
3639 </p>
3640 <p>It accepts the syntax:
3641 </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>
3642 </pre></td></tr></table>
3643
3644 <dl compact="compact">
3645 <dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
3646 <dd><p>Specify the top left corner coordinates of the box. Default to 0.
3647 </p>
3648 </dd>
3649 <dt> &lsquo;<samp>width, height</samp>&rsquo;</dt>
3650 <dd><p>Specify the width and height of the box, if 0 they are interpreted as
3651 the input width and height. Default to 0.
3652 </p>
3653 </dd>
3654 <dt> &lsquo;<samp>color</samp>&rsquo;</dt>
3655 <dd><p>Specify the color of the box to write, it can be the name of a color
3656 (case insensitive match) or a 0xRRGGBB[AA] sequence.
3657 </p></dd>
3658 </dl>
3659
3660 <p>Follow some examples:
3661 </p><table><tr><td>&nbsp;</td><td><pre class="example"># draw a black box around the edge of the input image
3662 drawbox
3663
3664 # draw a box with color red and an opacity of 50%
3665 drawbox=10:20:200:60:red@0.5&quot;
3666 </pre></td></tr></table>
3667
3668 <a name="drawtext"></a>
3669 <h2 class="section"><a href="ffmpeg.html#toc-drawtext">18.6 drawtext</a></h2>
3670
3671 <p>Draw text string or text from specified file on top of video using the
3672 libfreetype library.
3673 </p>
3674 <p>To enable compilation of this filter you need to configure FFmpeg with
3675 <code>--enable-libfreetype</code>.
3676 </p>
3677 <p>The filter also recognizes strftime() sequences in the provided text
3678 and expands them accordingly. Check the documentation of strftime().
3679 </p>
3680 <p>The filter accepts parameters as a list of <var>key</var>=<var>value</var> pairs,
3681 separated by &quot;:&quot;.
3682 </p>
3683 <p>The description of the accepted parameters follows.
3684 </p>
3685 <dl compact="compact">
3686 <dt> &lsquo;<samp>fontfile</samp>&rsquo;</dt>
3687 <dd><p>The font file to be used for drawing text. Path must be included.
3688 This parameter is mandatory.
3689 </p>
3690 </dd>
3691 <dt> &lsquo;<samp>text</samp>&rsquo;</dt>
3692 <dd><p>The text string to be drawn. The text must be a sequence of UTF-8
3693 encoded characters.
3694 This parameter is mandatory if no file is specified with the parameter
3695 <var>textfile</var>.
3696 </p>
3697 </dd>
3698 <dt> &lsquo;<samp>textfile</samp>&rsquo;</dt>
3699 <dd><p>A text file containing text to be drawn. The text must be a sequence
3700 of UTF-8 encoded characters.
3701 </p>
3702 <p>This parameter is mandatory if no text string is specified with the
3703 parameter <var>text</var>.
3704 </p>
3705 <p>If both text and textfile are specified, an error is thrown.
3706 </p>
3707 </dd>
3708 <dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
3709 <dd><p>The offsets where text will be drawn within the video frame.
3710 Relative to the top/left border of the output image.
3711 </p>
3712 <p>The default value of <var>x</var> and <var>y</var> is 0.
3713 </p>
3714 </dd>
3715 <dt> &lsquo;<samp>fontsize</samp>&rsquo;</dt>
3716 <dd><p>The font size to be used for drawing text.
3717 The default value of <var>fontsize</var> is 16.
3718 </p>
3719 </dd>
3720 <dt> &lsquo;<samp>fontcolor</samp>&rsquo;</dt>
3721 <dd><p>The color to be used for drawing fonts.
3722 Either a string (e.g. &quot;red&quot;) or in 0xRRGGBB[AA] format
3723 (e.g. &quot;0xff000033&quot;), possibly followed by an alpha specifier.
3724 The default value of <var>fontcolor</var> is &quot;black&quot;.
3725 </p>
3726 </dd>
3727 <dt> &lsquo;<samp>boxcolor</samp>&rsquo;</dt>
3728 <dd><p>The color to be used for drawing box around text.
3729 Either a string (e.g. &quot;yellow&quot;) or in 0xRRGGBB[AA] format
3730 (e.g. &quot;0xff00ff&quot;), possibly followed by an alpha specifier.
3731 The default value of <var>boxcolor</var> is &quot;white&quot;.
3732 </p>
3733 </dd>
3734 <dt> &lsquo;<samp>box</samp>&rsquo;</dt>
3735 <dd><p>Used to draw a box around text using background color.
3736 Value should be either 1 (enable) or 0 (disable).
3737 The default value of <var>box</var> is 0.
3738 </p>
3739 </dd>
3740 <dt> &lsquo;<samp>shadowx, shadowy</samp>&rsquo;</dt>
3741 <dd><p>The x and y offsets for the text shadow position with respect to the
3742 position of the text. They can be either positive or negative
3743 values. Default value for both is &quot;0&quot;.
3744 </p>
3745 </dd>
3746 <dt> &lsquo;<samp>shadowcolor</samp>&rsquo;</dt>
3747 <dd><p>The color to be used for drawing a shadow behind the drawn text.  It
3748 can be a color name (e.g. &quot;yellow&quot;) or a string in the 0xRRGGBB[AA]
3749 form (e.g. &quot;0xff00ff&quot;), possibly followed by an alpha specifier.
3750 The default value of <var>shadowcolor</var> is &quot;black&quot;.
3751 </p>
3752 </dd>
3753 <dt> &lsquo;<samp>ft_load_flags</samp>&rsquo;</dt>
3754 <dd><p>Flags to be used for loading the fonts.
3755 </p>
3756 <p>The flags map the corresponding flags supported by libfreetype, and are
3757 a combination of the following values:
3758 </p><dl compact="compact">
3759 <dt> <var>default</var></dt>
3760 <dt> <var>no_scale</var></dt>
3761 <dt> <var>no_hinting</var></dt>
3762 <dt> <var>render</var></dt>
3763 <dt> <var>no_bitmap</var></dt>
3764 <dt> <var>vertical_layout</var></dt>
3765 <dt> <var>force_autohint</var></dt>
3766 <dt> <var>crop_bitmap</var></dt>
3767 <dt> <var>pedantic</var></dt>
3768 <dt> <var>ignore_global_advance_width</var></dt>
3769 <dt> <var>no_recurse</var></dt>
3770 <dt> <var>ignore_transform</var></dt>
3771 <dt> <var>monochrome</var></dt>
3772 <dt> <var>linear_design</var></dt>
3773 <dt> <var>no_autohint</var></dt>
3774 <dt> <var>end table</var></dt>
3775 </dl>
3776
3777 <p>Default value is &quot;render&quot;.
3778 </p>
3779 <p>For more information consult the documentation for the FT_LOAD_*
3780 libfreetype flags.
3781 </p>
3782 </dd>
3783 <dt> &lsquo;<samp>tabsize</samp>&rsquo;</dt>
3784 <dd><p>The size in number of spaces to use for rendering the tab.
3785 Default value is 4.
3786 </p></dd>
3787 </dl>
3788
3789 <p>For example the command:
3790 </p><table><tr><td>&nbsp;</td><td><pre class="example">drawtext=&quot;fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'&quot;
3791 </pre></td></tr></table>
3792
3793 <p>will draw &quot;Test Text&quot; with font FreeSerif, using the default values
3794 for the optional parameters.
3795 </p>
3796 <p>The command:
3797 </p><table><tr><td>&nbsp;</td><td><pre class="example">drawtext=&quot;fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
3798           x=100: y=50: fontsize=24: fontcolor=yellow@0.2: box=1: boxcolor=red@0.2&quot;
3799 </pre></td></tr></table>
3800
3801 <p>will draw &rsquo;Test Text&rsquo; with font FreeSerif of size 24 at position x=100
3802 and y=50 (counting from the top-left corner of the screen), text is
3803 yellow with a red box around it. Both the text and the box have an
3804 opacity of 20%.
3805 </p>
3806 <p>Note that the double quotes are not necessary if spaces are not used
3807 within the parameter list.
3808 </p>
3809 <p>For more information about libfreetype, check:
3810 <a href="http://www.freetype.org/">http://www.freetype.org/</a>.
3811 </p>
3812 <a name="fade"></a>
3813 <h2 class="section"><a href="ffmpeg.html#toc-fade">18.7 fade</a></h2>
3814
3815 <p>Apply fade-in/out effect to input video.
3816 </p>
3817 <p>It accepts the parameters:
3818 <var>type</var>:<var>start_frame</var>:<var>nb_frames</var>
3819 </p>
3820 <p><var>type</var> specifies if the effect type, can be either &quot;in&quot; for
3821 fade-in, or &quot;out&quot; for a fade-out effect.
3822 </p>
3823 <p><var>start_frame</var> specifies the number of the start frame for starting
3824 to apply the fade effect.
3825 </p>
3826 <p><var>nb_frames</var> specifies the number of frames for which the fade
3827 effect has to last. At the end of the fade-in effect the output video
3828 will have the same intensity as the input video, at the end of the
3829 fade-out transition the output video will be completely black.
3830 </p>
3831 <p>A few usage examples follow, usable too as test scenarios.
3832 </p><table><tr><td>&nbsp;</td><td><pre class="example"># fade in first 30 frames of video
3833 fade=in:0:30
3834
3835 # fade out last 45 frames of a 200-frame video
3836 fade=out:155:45
3837
3838 # fade in first 25 frames and fade out last 25 frames of a 1000-frame video
3839 fade=in:0:25, fade=out:975:25
3840
3841 # make first 5 frames black, then fade in from frame 5-24
3842 fade=in:5:20
3843 </pre></td></tr></table>
3844
3845 <a name="fieldorder"></a>
3846 <h2 class="section"><a href="ffmpeg.html#toc-fieldorder">18.8 fieldorder</a></h2>
3847
3848 <p>Transform the field order of the input video.
3849 </p>
3850 <p>It accepts one parameter which specifies the required field order that
3851 the input interlaced video will be transformed to. The parameter can
3852 assume one of the following values:
3853 </p>
3854 <dl compact="compact">
3855 <dt> &lsquo;<samp>0 or bff</samp>&rsquo;</dt>
3856 <dd><p>output bottom field first
3857 </p></dd>
3858 <dt> &lsquo;<samp>1 or tff</samp>&rsquo;</dt>
3859 <dd><p>output top field first
3860 </p></dd>
3861 </dl>
3862
3863 <p>Default value is &quot;tff&quot;.
3864 </p>
3865 <p>Transformation is achieved by shifting the picture content up or down
3866 by one line, and filling the remaining line with appropriate picture content.
3867 This method is consistent with most broadcast field order converters.
3868 </p>
3869 <p>If the input video is not flagged as being interlaced, or it is already
3870 flagged as being of the required output field order then this filter does
3871 not alter the incoming video.
3872 </p>
3873 <p>This filter is very useful when converting to or from PAL DV material,
3874 which is bottom field first.
3875 </p>
3876 <p>For example:
3877 </p><table><tr><td>&nbsp;</td><td><pre class="example">./ffmpeg -i in.vob -vf &quot;fieldorder=bff&quot; out.dv
3878 </pre></td></tr></table>
3879
3880 <a name="fifo"></a>
3881 <h2 class="section"><a href="ffmpeg.html#toc-fifo">18.9 fifo</a></h2>
3882
3883 <p>Buffer input images and send them when they are requested.
3884 </p>
3885 <p>This filter is mainly useful when auto-inserted by the libavfilter
3886 framework.
3887 </p>
3888 <p>The filter does not take parameters.
3889 </p>
3890 <a name="format"></a>
3891 <h2 class="section"><a href="ffmpeg.html#toc-format">18.10 format</a></h2>
3892
3893 <p>Convert the input video to one of the specified pixel formats.
3894 Libavfilter will try to pick one that is supported for the input to
3895 the next filter.
3896 </p>
3897 <p>The filter accepts a list of pixel format names, separated by &quot;:&quot;,
3898 for example &quot;yuv420p:monow:rgb24&quot;.
3899 </p>
3900 <p>Some examples follow:
3901 </p><table><tr><td>&nbsp;</td><td><pre class="example"># convert the input video to the format &quot;yuv420p&quot;
3902 format=yuv420p
3903
3904 # convert the input video to any of the formats in the list
3905 format=yuv420p:yuv444p:yuv410p
3906 </pre></td></tr></table>
3907
3908 <p><a name="frei0r"></a>
3909 </p><a name="frei0r-1"></a>
3910 <h2 class="section"><a href="ffmpeg.html#toc-frei0r-1">18.11 frei0r</a></h2>
3911
3912 <p>Apply a frei0r effect to the input video.
3913 </p>
3914 <p>To enable compilation of this filter you need to install the frei0r
3915 header and configure FFmpeg with &ndash;enable-frei0r.
3916 </p>
3917 <p>The filter supports the syntax:
3918 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>filter_name</var>[{:|=}<var>param1</var>:<var>param2</var>:...:<var>paramN</var>]
3919 </pre></td></tr></table>
3920
3921 <p><var>filter_name</var> is the name to the frei0r effect to load. If the
3922 environment variable <code>FREI0R_PATH</code> is defined, the frei0r effect
3923 is searched in each one of the directories specified by the colon
3924 separated list in <code>FREIOR_PATH</code>, otherwise in the standard frei0r
3925 paths, which are in this order: &lsquo;<tt>HOME/.frei0r-1/lib/</tt>&rsquo;,
3926 &lsquo;<tt>/usr/local/lib/frei0r-1/</tt>&rsquo;, &lsquo;<tt>/usr/lib/frei0r-1/</tt>&rsquo;.
3927 </p>
3928 <p><var>param1</var>, <var>param2</var>, ... , <var>paramN</var> specify the parameters
3929 for the frei0r effect.
3930 </p>
3931 <p>A frei0r effect parameter can be a boolean (whose values are specified
3932 with &quot;y&quot; and &quot;n&quot;), a double, a color (specified by the syntax
3933 <var>R</var>/<var>G</var>/<var>B</var>, <var>R</var>, <var>G</var>, and <var>B</var> being float
3934 numbers from 0.0 to 1.0) or by an <code>av_parse_color()</code> color
3935 description), a position (specified by the syntax <var>X</var>/<var>Y</var>,
3936 <var>X</var> and <var>Y</var> being float numbers) and a string.
3937 </p>
3938 <p>The number and kind of parameters depend on the loaded effect. If an
3939 effect parameter is not specified the default value is set.
3940 </p>
3941 <p>Some examples follow:
3942 </p><table><tr><td>&nbsp;</td><td><pre class="example"># apply the distort0r effect, set the first two double parameters
3943 frei0r=distort0r:0.5:0.01
3944
3945 # apply the colordistance effect, takes a color as first parameter
3946 frei0r=colordistance:0.2/0.3/0.4
3947 frei0r=colordistance:violet
3948 frei0r=colordistance:0x112233
3949
3950 # apply the perspective effect, specify the top left and top right
3951 # image positions
3952 frei0r=perspective:0.2/0.2:0.8/0.2
3953 </pre></td></tr></table>
3954
3955 <p>For more information see:
3956 <a href="http://piksel.org/frei0r">http://piksel.org/frei0r</a>
3957 </p>
3958 <a name="gradfun"></a>
3959 <h2 class="section"><a href="ffmpeg.html#toc-gradfun">18.12 gradfun</a></h2>
3960
3961 <p>Fix the banding artifacts that are sometimes introduced into nearly flat
3962 regions by truncation to 8bit colordepth.
3963 Interpolate the gradients that should go where the bands are, and
3964 dither them.
3965 </p>
3966 <p>This filter is designed for playback only.  Do not use it prior to
3967 lossy compression, because compression tends to lose the dither and
3968 bring back the bands.
3969 </p>
3970 <p>The filter takes two optional parameters, separated by &rsquo;:&rsquo;:
3971 <var>strength</var>:<var>radius</var>
3972 </p>
3973 <p><var>strength</var> is the maximum amount by which the filter will change
3974 any one pixel. Also the threshold for detecting nearly flat
3975 regions. Acceptable values range from .51 to 255, default value is
3976 1.2, out-of-range values will be clipped to the valid range.
3977 </p>
3978 <p><var>radius</var> is the neighborhood to fit the gradient to. A larger
3979 radius makes for smoother gradients, but also prevents the filter from
3980 modifying the pixels near detailed regions. Acceptable values are
3981 8-32, default value is 16, out-of-range values will be clipped to the
3982 valid range.
3983 </p>
3984 <table><tr><td>&nbsp;</td><td><pre class="example"># default parameters
3985 gradfun=1.2:16
3986
3987 # omitting radius
3988 gradfun=1.2
3989 </pre></td></tr></table>
3990
3991 <a name="hflip"></a>
3992 <h2 class="section"><a href="ffmpeg.html#toc-hflip">18.13 hflip</a></h2>
3993
3994 <p>Flip the input video horizontally.
3995 </p>
3996 <p>For example to horizontally flip the video in input with
3997 &lsquo;<tt>ffmpeg</tt>&rsquo;:
3998 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i in.avi -vf &quot;hflip&quot; out.avi
3999 </pre></td></tr></table>
4000
4001 <a name="hqdn3d"></a>
4002 <h2 class="section"><a href="ffmpeg.html#toc-hqdn3d">18.14 hqdn3d</a></h2>
4003
4004 <p>High precision/quality 3d denoise filter. This filter aims to reduce
4005 image noise producing smooth images and making still images really
4006 still. It should enhance compressibility.
4007 </p>
4008 <p>It accepts the following optional parameters:
4009 <var>luma_spatial</var>:<var>chroma_spatial</var>:<var>luma_tmp</var>:<var>chroma_tmp</var>
4010 </p>
4011 <dl compact="compact">
4012 <dt> &lsquo;<samp>luma_spatial</samp>&rsquo;</dt>
4013 <dd><p>a non-negative float number which specifies spatial luma strength,
4014 defaults to 4.0
4015 </p>
4016 </dd>
4017 <dt> &lsquo;<samp>chroma_spatial</samp>&rsquo;</dt>
4018 <dd><p>a non-negative float number which specifies spatial chroma strength,
4019 defaults to 3.0*<var>luma_spatial</var>/4.0
4020 </p>
4021 </dd>
4022 <dt> &lsquo;<samp>luma_tmp</samp>&rsquo;</dt>
4023 <dd><p>a float number which specifies luma temporal strength, defaults to
4024 6.0*<var>luma_spatial</var>/4.0
4025 </p>
4026 </dd>
4027 <dt> &lsquo;<samp>chroma_tmp</samp>&rsquo;</dt>
4028 <dd><p>a float number which specifies chroma temporal strength, defaults to
4029 <var>luma_tmp</var>*<var>chroma_spatial</var>/<var>luma_spatial</var>
4030 </p></dd>
4031 </dl>
4032
4033 <a name="mp"></a>
4034 <h2 class="section"><a href="ffmpeg.html#toc-mp">18.15 mp</a></h2>
4035
4036 <p>Apply an MPlayer filter to the input video.
4037 </p>
4038 <p>This filter provides a wrapper around most of the filters of
4039 MPlayer/MEncoder.
4040 </p>
4041 <p>This wrapper is considered experimental. Some of the wrapped filters
4042 may not work properly and we may drop support for them, as they will
4043 be implemented natively into FFmpeg. Thus you should avoid
4044 depending on them when writing portable scripts.
4045 </p>
4046 <p>The filters accepts the parameters:
4047 <var>filter_name</var>[:=]<var>filter_params</var>
4048 </p>
4049 <p><var>filter_name</var> is the name of a supported MPlayer filter,
4050 <var>filter_params</var> is a string containing the parameters accepted by
4051 the named filter.
4052 </p>
4053 <p>The list of the currently supported filters follows:
4054 </p><dl compact="compact">
4055 <dt> <var>2xsai</var></dt>
4056 <dt> <var>blackframe</var></dt>
4057 <dt> <var>boxblur</var></dt>
4058 <dt> <var>cropdetect</var></dt>
4059 <dt> <var>decimate</var></dt>
4060 <dt> <var>delogo</var></dt>
4061 <dt> <var>denoise3d</var></dt>
4062 <dt> <var>detc</var></dt>
4063 <dt> <var>dint</var></dt>
4064 <dt> <var>divtc</var></dt>
4065 <dt> <var>down3dright</var></dt>
4066 <dt> <var>dsize</var></dt>
4067 <dt> <var>eq2</var></dt>
4068 <dt> <var>eq</var></dt>
4069 <dt> <var>field</var></dt>
4070 <dt> <var>fil</var></dt>
4071 <dt> <var>fixpts</var></dt>
4072 <dt> <var>framestep</var></dt>
4073 <dt> <var>fspp</var></dt>
4074 <dt> <var>geq</var></dt>
4075 <dt> <var>gradfun</var></dt>
4076 <dt> <var>harddup</var></dt>
4077 <dt> <var>hqdn3d</var></dt>
4078 <dt> <var>hue</var></dt>
4079 <dt> <var>il</var></dt>
4080 <dt> <var>ilpack</var></dt>
4081 <dt> <var>ivtc</var></dt>
4082 <dt> <var>kerndeint</var></dt>
4083 <dt> <var>mcdeint</var></dt>
4084 <dt> <var>mirror</var></dt>
4085 <dt> <var>noise</var></dt>
4086 <dt> <var>ow</var></dt>
4087 <dt> <var>palette</var></dt>
4088 <dt> <var>perspective</var></dt>
4089 <dt> <var>phase</var></dt>
4090 <dt> <var>pp7</var></dt>
4091 <dt> <var>pullup</var></dt>
4092 <dt> <var>qp</var></dt>
4093 <dt> <var>rectangle</var></dt>
4094 <dt> <var>remove_logo</var></dt>
4095 <dt> <var>rgbtest</var></dt>
4096 <dt> <var>rotate</var></dt>
4097 <dt> <var>sab</var></dt>
4098 <dt> <var>screenshot</var></dt>
4099 <dt> <var>smartblur</var></dt>
4100 <dt> <var>softpulldown</var></dt>
4101 <dt> <var>softskip</var></dt>
4102 <dt> <var>spp</var></dt>
4103 <dt> <var>swapuv</var></dt>
4104 <dt> <var>telecine</var></dt>
4105 <dt> <var>test</var></dt>
4106 <dt> <var>tile</var></dt>
4107 <dt> <var>tinterlace</var></dt>
4108 <dt> <var>unsharp</var></dt>
4109 <dt> <var>uspp</var></dt>
4110 <dt> <var>yuvcsp</var></dt>
4111 <dt> <var>yvu9</var></dt>
4112 </dl>
4113
4114 <p>The parameter syntax and behavior for the listed filters are the same
4115 of the corresponding MPlayer filters. For detailed instructions check
4116 the &quot;VIDEO FILTERS&quot; section in the MPlayer manual.
4117 </p>
4118 <p>Some examples follow:
4119 </p><table><tr><td>&nbsp;</td><td><pre class="example"># remove a logo by interpolating the surrounding pixels
4120 mp=delogo=200:200:80:20:1
4121
4122 # adjust gamma, brightness, contrast
4123 mp=eq2=1.0:2:0.5
4124
4125 # tweak hue and saturation
4126 mp=hue=100:-10
4127 </pre></td></tr></table>
4128
4129 <p>See also mplayer(1), <a href="http://www.mplayerhq.hu/">http://www.mplayerhq.hu/</a>.
4130 </p>
4131 <a name="noformat"></a>
4132 <h2 class="section"><a href="ffmpeg.html#toc-noformat">18.16 noformat</a></h2>
4133
4134 <p>Force libavfilter not to use any of the specified pixel formats for the
4135 input to the next filter.
4136 </p>
4137 <p>The filter accepts a list of pixel format names, separated by &quot;:&quot;,
4138 for example &quot;yuv420p:monow:rgb24&quot;.
4139 </p>
4140 <p>Some examples follow:
4141 </p><table><tr><td>&nbsp;</td><td><pre class="example"># force libavfilter to use a format different from &quot;yuv420p&quot; for the
4142 # input to the vflip filter
4143 noformat=yuv420p,vflip
4144
4145 # convert the input video to any of the formats not contained in the list
4146 noformat=yuv420p:yuv444p:yuv410p
4147 </pre></td></tr></table>
4148
4149 <a name="null-1"></a>
4150 <h2 class="section"><a href="ffmpeg.html#toc-null-1">18.17 null</a></h2>
4151
4152 <p>Pass the video source unchanged to the output.
4153 </p>
4154 <a name="ocv"></a>
4155 <h2 class="section"><a href="ffmpeg.html#toc-ocv">18.18 ocv</a></h2>
4156
4157 <p>Apply video transform using libopencv.
4158 </p>
4159 <p>To enable this filter install libopencv library and headers and
4160 configure FFmpeg with &ndash;enable-libopencv.
4161 </p>
4162 <p>The filter takes the parameters: <var>filter_name</var>{:=}<var>filter_params</var>.
4163 </p>
4164 <p><var>filter_name</var> is the name of the libopencv filter to apply.
4165 </p>
4166 <p><var>filter_params</var> specifies the parameters to pass to the libopencv
4167 filter. If not specified the default values are assumed.
4168 </p>
4169 <p>Refer to the official libopencv documentation for more precise
4170 informations:
4171 <a href="http://opencv.willowgarage.com/documentation/c/image_filtering.html">http://opencv.willowgarage.com/documentation/c/image_filtering.html</a>
4172 </p>
4173 <p>Follows the list of supported libopencv filters.
4174 </p>
4175 <p><a name="dilate"></a>
4176 </p><a name="dilate-1"></a>
4177 <h3 class="subsection"><a href="ffmpeg.html#toc-dilate-1">18.18.1 dilate</a></h3>
4178
4179 <p>Dilate an image by using a specific structuring element.
4180 This filter corresponds to the libopencv function <code>cvDilate</code>.
4181 </p>
4182 <p>It accepts the parameters: <var>struct_el</var>:<var>nb_iterations</var>.
4183 </p>
4184 <p><var>struct_el</var> represents a structuring element, and has the syntax:
4185 <var>cols</var>x<var>rows</var>+<var>anchor_x</var>x<var>anchor_y</var>/<var>shape</var>
4186 </p>
4187 <p><var>cols</var> and <var>rows</var> represent the number of colums and rows of
4188 the structuring element, <var>anchor_x</var> and <var>anchor_y</var> the anchor
4189 point, and <var>shape</var> the shape for the structuring element, and
4190 can be one of the values &quot;rect&quot;, &quot;cross&quot;, &quot;ellipse&quot;, &quot;custom&quot;.
4191 </p>
4192 <p>If the value for <var>shape</var> is &quot;custom&quot;, it must be followed by a
4193 string of the form &quot;=<var>filename</var>&quot;. The file with name
4194 <var>filename</var> is assumed to represent a binary image, with each
4195 printable character corresponding to a bright pixel. When a custom
4196 <var>shape</var> is used, <var>cols</var> and <var>rows</var> are ignored, the number
4197 or columns and rows of the read file are assumed instead.
4198 </p>
4199 <p>The default value for <var>struct_el</var> is &quot;3x3+0x0/rect&quot;.
4200 </p>
4201 <p><var>nb_iterations</var> specifies the number of times the transform is
4202 applied to the image, and defaults to 1.
4203 </p>
4204 <p>Follow some example:
4205 </p><table><tr><td>&nbsp;</td><td><pre class="example"># use the default values
4206 ocv=dilate
4207
4208 # dilate using a structuring element with a 5x5 cross, iterate two times
4209 ocv=dilate=5x5+2x2/cross:2
4210
4211 # read the shape from the file diamond.shape, iterate two times
4212 # the file diamond.shape may contain a pattern of characters like this:
4213 #   *
4214 #  ***
4215 # *****
4216 #  ***
4217 #   *
4218 # the specified cols and rows are ignored (but not the anchor point coordinates)
4219 ocv=0x0+2x2/custom=diamond.shape:2
4220 </pre></td></tr></table>
4221
4222 <a name="erode"></a>
4223 <h3 class="subsection"><a href="ffmpeg.html#toc-erode">18.18.2 erode</a></h3>
4224
4225 <p>Erode an image by using a specific structuring element.
4226 This filter corresponds to the libopencv function <code>cvErode</code>.
4227 </p>
4228 <p>The filter accepts the parameters: <var>struct_el</var>:<var>nb_iterations</var>,
4229 with the same meaning and use of those of the dilate filter
4230 (see <a href="#dilate">dilate</a>).
4231 </p>
4232 <a name="smooth"></a>
4233 <h3 class="subsection"><a href="ffmpeg.html#toc-smooth">18.18.3 smooth</a></h3>
4234
4235 <p>Smooth the input video.
4236 </p>
4237 <p>The filter takes the following parameters:
4238 <var>type</var>:<var>param1</var>:<var>param2</var>:<var>param3</var>:<var>param4</var>.
4239 </p>
4240 <p><var>type</var> is the type of smooth filter to apply, and can be one of
4241 the following values: &quot;blur&quot;, &quot;blur_no_scale&quot;, &quot;median&quot;, &quot;gaussian&quot;,
4242 &quot;bilateral&quot;. The default value is &quot;gaussian&quot;.
4243 </p>
4244 <p><var>param1</var>, <var>param2</var>, <var>param3</var>, and <var>param4</var> are
4245 parameters whose meanings depend on smooth type. <var>param1</var> and
4246 <var>param2</var> accept integer positive values or 0, <var>param3</var> and
4247 <var>param4</var> accept float values.
4248 </p>
4249 <p>The default value for <var>param1</var> is 3, the default value for the
4250 other parameters is 0.
4251 </p>
4252 <p>These parameters correspond to the parameters assigned to the
4253 libopencv function <code>cvSmooth</code>.
4254 </p>
4255 <a name="overlay"></a>
4256 <h2 class="section"><a href="ffmpeg.html#toc-overlay">18.19 overlay</a></h2>
4257
4258 <p>Overlay one video on top of another.
4259 </p>
4260 <p>It takes two inputs and one output, the first input is the &quot;main&quot;
4261 video on which the second input is overlayed.
4262 </p>
4263 <p>It accepts the parameters: <var>x</var>:<var>y</var>.
4264 </p>
4265 <p><var>x</var> is the x coordinate of the overlayed video on the main video,
4266 <var>y</var> is the y coordinate. The parameters are expressions containing
4267 the following parameters:
4268 </p>
4269 <dl compact="compact">
4270 <dt> &lsquo;<samp>main_w, main_h</samp>&rsquo;</dt>
4271 <dd><p>main input width and height
4272 </p>
4273 </dd>
4274 <dt> &lsquo;<samp>W, H</samp>&rsquo;</dt>
4275 <dd><p>same as <var>main_w</var> and <var>main_h</var>
4276 </p>
4277 </dd>
4278 <dt> &lsquo;<samp>overlay_w, overlay_h</samp>&rsquo;</dt>
4279 <dd><p>overlay input width and height
4280 </p>
4281 </dd>
4282 <dt> &lsquo;<samp>w, h</samp>&rsquo;</dt>
4283 <dd><p>same as <var>overlay_w</var> and <var>overlay_h</var>
4284 </p></dd>
4285 </dl>
4286
4287 <p>Be aware that frames are taken from each input video in timestamp
4288 order, hence, if their initial timestamps differ, it is a a good idea
4289 to pass the two inputs through a <var>setpts=PTS-STARTPTS</var> filter to
4290 have them begin in the same zero timestamp, as it does the example for
4291 the <var>movie</var> filter.
4292 </p>
4293 <p>Follow some examples:
4294 </p><table><tr><td>&nbsp;</td><td><pre class="example"># draw the overlay at 10 pixels from the bottom right
4295 # corner of the main video.
4296 overlay=main_w-overlay_w-10:main_h-overlay_h-10
4297
4298 # insert a transparent PNG logo in the bottom left corner of the input
4299 movie=logo.png [logo];
4300 [in][logo] overlay=10:main_h-overlay_h-10 [out]
4301
4302 # insert 2 different transparent PNG logos (second logo on bottom
4303 # right corner):
4304 movie=logo1.png [logo1];
4305 movie=logo2.png [logo2];
4306 [in][logo1]       overlay=10:H-h-10 [in+logo1];
4307 [in+logo1][logo2] overlay=W-w-10:H-h-10 [out]
4308
4309 # add a transparent color layer on top of the main video,
4310 # WxH specifies the size of the main input to the overlay filter
4311 color=red.3:WxH [over]; [in][over] overlay [out]
4312 </pre></td></tr></table>
4313
4314 <p>You can chain togheter more overlays but the efficiency of such
4315 approach is yet to be tested.
4316 </p>
4317 <a name="pad"></a>
4318 <h2 class="section"><a href="ffmpeg.html#toc-pad">18.20 pad</a></h2>
4319
4320 <p>Add paddings to the input image, and places the original input at the
4321 given coordinates <var>x</var>, <var>y</var>.
4322 </p>
4323 <p>It accepts the following parameters:
4324 <var>width</var>:<var>height</var>:<var>x</var>:<var>y</var>:<var>color</var>.
4325 </p>
4326 <p>The parameters <var>width</var>, <var>height</var>, <var>x</var>, and <var>y</var> are
4327 expressions containing the following constants:
4328 </p>
4329 <dl compact="compact">
4330 <dt> &lsquo;<samp>E, PI, PHI</samp>&rsquo;</dt>
4331 <dd><p>the corresponding mathematical approximated values for e
4332 (euler number), pi (greek PI), phi (golden ratio)
4333 </p>
4334 </dd>
4335 <dt> &lsquo;<samp>in_w, in_h</samp>&rsquo;</dt>
4336 <dd><p>the input video width and heigth
4337 </p>
4338 </dd>
4339 <dt> &lsquo;<samp>iw, ih</samp>&rsquo;</dt>
4340 <dd><p>same as <var>in_w</var> and <var>in_h</var>
4341 </p>
4342 </dd>
4343 <dt> &lsquo;<samp>out_w, out_h</samp>&rsquo;</dt>
4344 <dd><p>the output width and heigth, that is the size of the padded area as
4345 specified by the <var>width</var> and <var>height</var> expressions
4346 </p>
4347 </dd>
4348 <dt> &lsquo;<samp>ow, oh</samp>&rsquo;</dt>
4349 <dd><p>same as <var>out_w</var> and <var>out_h</var>
4350 </p>
4351 </dd>
4352 <dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
4353 <dd><p>x and y offsets as specified by the <var>x</var> and <var>y</var>
4354 expressions, or NAN if not yet specified
4355 </p>
4356 </dd>
4357 <dt> &lsquo;<samp>a</samp>&rsquo;</dt>
4358 <dd><p>input display aspect ratio, same as <var>iw</var> / <var>ih</var>
4359 </p>
4360 </dd>
4361 <dt> &lsquo;<samp>hsub, vsub</samp>&rsquo;</dt>
4362 <dd><p>horizontal and vertical chroma subsample values. For example for the
4363 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
4364 </p></dd>
4365 </dl>
4366
4367 <p>Follows the description of the accepted parameters.
4368 </p>
4369 <dl compact="compact">
4370 <dt> &lsquo;<samp>width, height</samp>&rsquo;</dt>
4371 <dd>
4372 <p>Specify the size of the output image with the paddings added. If the
4373 value for <var>width</var> or <var>height</var> is 0, the corresponding input size
4374 is used for the output.
4375 </p>
4376 <p>The <var>width</var> expression can reference the value set by the
4377 <var>height</var> expression, and viceversa.
4378 </p>
4379 <p>The default value of <var>width</var> and <var>height</var> is 0.
4380 </p>
4381 </dd>
4382 <dt> &lsquo;<samp>x, y</samp>&rsquo;</dt>
4383 <dd>
4384 <p>Specify the offsets where to place the input image in the padded area
4385 with respect to the top/left border of the output image.
4386 </p>
4387 <p>The <var>x</var> expression can reference the value set by the <var>y</var>
4388 expression, and viceversa.
4389 </p>
4390 <p>The default value of <var>x</var> and <var>y</var> is 0.
4391 </p>
4392 </dd>
4393 <dt> &lsquo;<samp>color</samp>&rsquo;</dt>
4394 <dd>
4395 <p>Specify the color of the padded area, it can be the name of a color
4396 (case insensitive match) or a 0xRRGGBB[AA] sequence.
4397 </p>
4398 <p>The default value of <var>color</var> is &quot;black&quot;.
4399 </p>
4400 </dd>
4401 </dl>
4402
4403 <p>Some examples follow:
4404 </p>
4405 <table><tr><td>&nbsp;</td><td><pre class="example"># Add paddings with color &quot;violet&quot; to the input video. Output video
4406 # size is 640x480, the top-left corner of the input video is placed at
4407 # column 0, row 40.
4408 pad=640:480:0:40:violet
4409
4410 # pad the input to get an output with dimensions increased bt 3/2,
4411 # and put the input video at the center of the padded area
4412 pad=&quot;3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2&quot;
4413
4414 # pad the input to get a squared output with size equal to the maximum
4415 # value between the input width and height, and put the input video at
4416 # the center of the padded area
4417 pad=&quot;max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2&quot;
4418
4419 # pad the input to get a final w/h ratio of 16:9
4420 pad=&quot;ih*16/9:ih:(ow-iw)/2:(oh-ih)/2&quot;
4421
4422 # double output size and put the input video in the bottom-right
4423 # corner of the output padded area
4424 pad=&quot;2*iw:2*ih:ow-iw:oh-ih&quot;
4425 </pre></td></tr></table>
4426
4427 <a name="pixdesctest"></a>
4428 <h2 class="section"><a href="ffmpeg.html#toc-pixdesctest">18.21 pixdesctest</a></h2>
4429
4430 <p>Pixel format descriptor test filter, mainly useful for internal
4431 testing. The output video should be equal to the input video.
4432 </p>
4433 <p>For example:
4434 </p><table><tr><td>&nbsp;</td><td><pre class="example">format=monow, pixdesctest
4435 </pre></td></tr></table>
4436
4437 <p>can be used to test the monowhite pixel format descriptor definition.
4438 </p>
4439 <a name="scale"></a>
4440 <h2 class="section"><a href="ffmpeg.html#toc-scale">18.22 scale</a></h2>
4441
4442 <p>Scale the input video to <var>width</var>:<var>height</var> and/or convert the image format.
4443 </p>
4444 <p>The parameters <var>width</var> and <var>height</var> are expressions containing
4445 the following constants:
4446 </p>
4447 <dl compact="compact">
4448 <dt> &lsquo;<samp>E, PI, PHI</samp>&rsquo;</dt>
4449 <dd><p>the corresponding mathematical approximated values for e
4450 (euler number), pi (greek PI), phi (golden ratio)
4451 </p>
4452 </dd>
4453 <dt> &lsquo;<samp>in_w, in_h</samp>&rsquo;</dt>
4454 <dd><p>the input width and heigth
4455 </p>
4456 </dd>
4457 <dt> &lsquo;<samp>iw, ih</samp>&rsquo;</dt>
4458 <dd><p>same as <var>in_w</var> and <var>in_h</var>
4459 </p>
4460 </dd>
4461 <dt> &lsquo;<samp>out_w, out_h</samp>&rsquo;</dt>
4462 <dd><p>the output (cropped) width and heigth
4463 </p>
4464 </dd>
4465 <dt> &lsquo;<samp>ow, oh</samp>&rsquo;</dt>
4466 <dd><p>same as <var>out_w</var> and <var>out_h</var>
4467 </p>
4468 </dd>
4469 <dt> &lsquo;<samp>a</samp>&rsquo;</dt>
4470 <dd><p>input display aspect ratio, same as <var>iw</var> / <var>ih</var>
4471 </p>
4472 </dd>
4473 <dt> &lsquo;<samp>hsub, vsub</samp>&rsquo;</dt>
4474 <dd><p>horizontal and vertical chroma subsample values. For example for the
4475 pixel format &quot;yuv422p&quot; <var>hsub</var> is 2 and <var>vsub</var> is 1.
4476 </p></dd>
4477 </dl>
4478
4479 <p>If the input image format is different from the format requested by
4480 the next filter, the scale filter will convert the input to the
4481 requested format.
4482 </p>
4483 <p>If the value for <var>width</var> or <var>height</var> is 0, the respective input
4484 size is used for the output.
4485 </p>
4486 <p>If the value for <var>width</var> or <var>height</var> is -1, the scale filter will
4487 use, for the respective output size, a value that maintains the aspect
4488 ratio of the input image.
4489 </p>
4490 <p>The default value of <var>width</var> and <var>height</var> is 0.
4491 </p>
4492 <p>Some examples follow:
4493 </p><table><tr><td>&nbsp;</td><td><pre class="example"># scale the input video to a size of 200x100.
4494 scale=200:100
4495
4496 # scale the input to 2x
4497 scale=2*iw:2*ih
4498 # the above is the same as
4499 scale=2*in_w:2*in_h
4500
4501 # scale the input to half size
4502 scale=iw/2:ih/2
4503
4504 # increase the width, and set the height to the same size
4505 scale=3/2*iw:ow
4506
4507 # seek for Greek harmony
4508 scale=iw:1/PHI*iw
4509 scale=ih*PHI:ih
4510
4511 # increase the height, and set the width to 3/2 of the height
4512 scale=3/2*oh:3/5*ih
4513
4514 # increase the size, but make the size a multiple of the chroma
4515 scale=&quot;trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub&quot;
4516
4517 # increase the width to a maximum of 500 pixels, keep the same input aspect ratio
4518 scale='min(500\, iw*3/2):-1'
4519 </pre></td></tr></table>
4520
4521 <p><a name="setdar"></a>
4522 </p><a name="setdar-1"></a>
4523 <h2 class="section"><a href="ffmpeg.html#toc-setdar-1">18.23 setdar</a></h2>
4524
4525 <p>Set the Display Aspect Ratio for the filter output video.
4526 </p>
4527 <p>This is done by changing the specified Sample (aka Pixel) Aspect
4528 Ratio, according to the following equation:
4529 <em>DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR</em>
4530 </p>
4531 <p>Keep in mind that this filter does not modify the pixel dimensions of
4532 the video frame. Also the display aspect ratio set by this filter may
4533 be changed by later filters in the filterchain, e.g. in case of
4534 scaling or if another &quot;setdar&quot; or a &quot;setsar&quot; filter is applied.
4535 </p>
4536 <p>The filter accepts a parameter string which represents the wanted
4537 display aspect ratio.
4538 The parameter can be a floating point number string, or an expression
4539 of the form <var>num</var>:<var>den</var>, where <var>num</var> and <var>den</var> are the
4540 numerator and denominator of the aspect ratio.
4541 If the parameter is not specified, it is assumed the value &quot;0:1&quot;.
4542 </p>
4543 <p>For example to change the display aspect ratio to 16:9, specify:
4544 </p><table><tr><td>&nbsp;</td><td><pre class="example">setdar=16:9
4545 # the above is equivalent to
4546 setdar=1.77777
4547 </pre></td></tr></table>
4548
4549 <p>See also the &quot;setsar&quot; filter documentation (see <a href="#setsar">setsar</a>).
4550 </p>
4551 <a name="setpts"></a>
4552 <h2 class="section"><a href="ffmpeg.html#toc-setpts">18.24 setpts</a></h2>
4553
4554 <p>Change the PTS (presentation timestamp) of the input video frames.
4555 </p>
4556 <p>Accept in input an expression evaluated through the eval API, which
4557 can contain the following constants:
4558 </p>
4559 <dl compact="compact">
4560 <dt> &lsquo;<samp>PTS</samp>&rsquo;</dt>
4561 <dd><p>the presentation timestamp in input
4562 </p>
4563 </dd>
4564 <dt> &lsquo;<samp>PI</samp>&rsquo;</dt>
4565 <dd><p>Greek PI
4566 </p>
4567 </dd>
4568 <dt> &lsquo;<samp>PHI</samp>&rsquo;</dt>
4569 <dd><p>golden ratio
4570 </p>
4571 </dd>
4572 <dt> &lsquo;<samp>E</samp>&rsquo;</dt>
4573 <dd><p>Euler number
4574 </p>
4575 </dd>
4576 <dt> &lsquo;<samp>N</samp>&rsquo;</dt>
4577 <dd><p>the count of the input frame, starting from 0.
4578 </p>
4579 </dd>
4580 <dt> &lsquo;<samp>STARTPTS</samp>&rsquo;</dt>
4581 <dd><p>the PTS of the first video frame
4582 </p>
4583 </dd>
4584 <dt> &lsquo;<samp>INTERLACED</samp>&rsquo;</dt>
4585 <dd><p>tell if the current frame is interlaced
4586 </p>
4587 </dd>
4588 <dt> &lsquo;<samp>POS</samp>&rsquo;</dt>
4589 <dd><p>original position in the file of the frame, or undefined if undefined
4590 for the current frame
4591 </p>
4592 </dd>
4593 <dt> &lsquo;<samp>PREV_INPTS</samp>&rsquo;</dt>
4594 <dd><p>previous input PTS
4595 </p>
4596 </dd>
4597 <dt> &lsquo;<samp>PREV_OUTPTS</samp>&rsquo;</dt>
4598 <dd><p>previous output PTS
4599 </p>
4600 </dd>
4601 </dl>
4602
4603 <p>Some examples follow:
4604 </p>
4605 <table><tr><td>&nbsp;</td><td><pre class="example"># start counting PTS from zero
4606 setpts=PTS-STARTPTS
4607
4608 # fast motion
4609 setpts=0.5*PTS
4610
4611 # slow motion
4612 setpts=2.0*PTS
4613
4614 # fixed rate 25 fps
4615 setpts=N/(25*TB)
4616
4617 # fixed rate 25 fps with some jitter
4618 setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
4619 </pre></td></tr></table>
4620
4621 <p><a name="setsar"></a>
4622 </p><a name="setsar-1"></a>
4623 <h2 class="section"><a href="ffmpeg.html#toc-setsar-1">18.25 setsar</a></h2>
4624
4625 <p>Set the Sample (aka Pixel) Aspect Ratio for the filter output video.
4626 </p>
4627 <p>Note that as a consequence of the application of this filter, the
4628 output display aspect ratio will change according to the following
4629 equation:
4630 <em>DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR</em>
4631 </p>
4632 <p>Keep in mind that the sample aspect ratio set by this filter may be
4633 changed by later filters in the filterchain, e.g. if another &quot;setsar&quot;
4634 or a &quot;setdar&quot; filter is applied.
4635 </p>
4636 <p>The filter accepts a parameter string which represents the wanted
4637 sample aspect ratio.
4638 The parameter can be a floating point number string, or an expression
4639 of the form <var>num</var>:<var>den</var>, where <var>num</var> and <var>den</var> are the
4640 numerator and denominator of the aspect ratio.
4641 If the parameter is not specified, it is assumed the value &quot;0:1&quot;.
4642 </p>
4643 <p>For example to change the sample aspect ratio to 10:11, specify:
4644 </p><table><tr><td>&nbsp;</td><td><pre class="example">setsar=10:11
4645 </pre></td></tr></table>
4646
4647 <a name="settb"></a>
4648 <h2 class="section"><a href="ffmpeg.html#toc-settb">18.26 settb</a></h2>
4649
4650 <p>Set the timebase to use for the output frames timestamps.
4651 It is mainly useful for testing timebase configuration.
4652 </p>
4653 <p>It accepts in input an arithmetic expression representing a rational.
4654 The expression can contain the constants &quot;PI&quot;, &quot;E&quot;, &quot;PHI&quot;, &quot;AVTB&quot; (the
4655 default timebase), and &quot;intb&quot; (the input timebase).
4656 </p>
4657 <p>The default value for the input is &quot;intb&quot;.
4658 </p>
4659 <p>Follow some examples.
4660 </p>
4661 <table><tr><td>&nbsp;</td><td><pre class="example"># set the timebase to 1/25
4662 settb=1/25
4663
4664 # set the timebase to 1/10
4665 settb=0.1
4666
4667 #set the timebase to 1001/1000
4668 settb=1+0.001
4669
4670 #set the timebase to 2*intb
4671 settb=2*intb
4672
4673 #set the default timebase value
4674 settb=AVTB
4675 </pre></td></tr></table>
4676
4677 <a name="showinfo"></a>
4678 <h2 class="section"><a href="ffmpeg.html#toc-showinfo">18.27 showinfo</a></h2>
4679
4680 <p>Show a line containing various information for each input video frame.
4681 The input video is not modified.
4682 </p>
4683 <p>The shown line contains a sequence of key/value pairs of the form
4684 <var>key</var>:<var>value</var>.
4685 </p>
4686 <p>A description of each shown parameter follows:
4687 </p>
4688 <dl compact="compact">
4689 <dt> &lsquo;<samp>n</samp>&rsquo;</dt>
4690 <dd><p>sequential number of the input frame, starting from 0
4691 </p>
4692 </dd>
4693 <dt> &lsquo;<samp>pts</samp>&rsquo;</dt>
4694 <dd><p>Presentation TimeStamp of the input frame, expressed as a number of
4695 time base units. The time base unit depends on the filter input pad.
4696 </p>
4697 </dd>
4698 <dt> &lsquo;<samp>pts_time</samp>&rsquo;</dt>
4699 <dd><p>Presentation TimeStamp of the input frame, expressed as a number of
4700 seconds
4701 </p>
4702 </dd>
4703 <dt> &lsquo;<samp>pos</samp>&rsquo;</dt>
4704 <dd><p>position of the frame in the input stream, -1 if this information in
4705 unavailable and/or meanigless (for example in case of synthetic video)
4706 </p>
4707 </dd>
4708 <dt> &lsquo;<samp>fmt</samp>&rsquo;</dt>
4709 <dd><p>pixel format name
4710 </p>
4711 </dd>
4712 <dt> &lsquo;<samp>sar</samp>&rsquo;</dt>
4713 <dd><p>sample aspect ratio of the input frame, expressed in the form
4714 <var>num</var>/<var>den</var>
4715 </p>
4716 </dd>
4717 <dt> &lsquo;<samp>s</samp>&rsquo;</dt>
4718 <dd><p>size of the input frame, expressed in the form
4719 <var>width</var>x<var>height</var>
4720 </p>
4721 </dd>
4722 <dt> &lsquo;<samp>i</samp>&rsquo;</dt>
4723 <dd><p>interlaced mode (&quot;P&quot; for &quot;progressive&quot;, &quot;T&quot; for top field first, &quot;B&quot;
4724 for bottom field first)
4725 </p>
4726 </dd>
4727 <dt> &lsquo;<samp>iskey</samp>&rsquo;</dt>
4728 <dd><p>1 if the frame is a key frame, 0 otherwise
4729 </p>
4730 </dd>
4731 <dt> &lsquo;<samp>type</samp>&rsquo;</dt>
4732 <dd><p>picture type of the input frame (&quot;I&quot; for an I-frame, &quot;P&quot; for a
4733 P-frame, &quot;B&quot; for a B-frame, &quot;?&quot; for unknown type).
4734 Check also the documentation of the <code>AVPictureType</code> enum and of
4735 the <code>av_get_picture_type_char</code> function defined in
4736 &lsquo;<tt>libavutil/avutil.h</tt>&rsquo;.
4737 </p>
4738 </dd>
4739 <dt> &lsquo;<samp>checksum</samp>&rsquo;</dt>
4740 <dd><p>Adler-32 checksum of all the planes of the input frame
4741 </p>
4742 </dd>
4743 <dt> &lsquo;<samp>plane_checksum</samp>&rsquo;</dt>
4744 <dd><p>Adler-32 checksum of each plane of the input frame, expressed in the form
4745 &quot;[<var>c0</var> <var>c1</var> <var>c2</var> <var>c3</var>]&quot;
4746 </p></dd>
4747 </dl>
4748
4749 <a name="slicify"></a>
4750 <h2 class="section"><a href="ffmpeg.html#toc-slicify">18.28 slicify</a></h2>
4751
4752 <p>Pass the images of input video on to next video filter as multiple
4753 slices.
4754 </p>
4755 <table><tr><td>&nbsp;</td><td><pre class="example">./ffmpeg -i in.avi -vf &quot;slicify=32&quot; out.avi
4756 </pre></td></tr></table>
4757
4758 <p>The filter accepts the slice height as parameter. If the parameter is
4759 not specified it will use the default value of 16.
4760 </p>
4761 <p>Adding this in the beginning of filter chains should make filtering
4762 faster due to better use of the memory cache.
4763 </p>
4764 <a name="transpose"></a>
4765 <h2 class="section"><a href="ffmpeg.html#toc-transpose">18.29 transpose</a></h2>
4766
4767 <p>Transpose rows with columns in the input video and optionally flip it.
4768 </p>
4769 <p>It accepts a parameter representing an integer, which can assume the
4770 values:
4771 </p>
4772 <dl compact="compact">
4773 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
4774 <dd><p>Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
4775 </p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     L.l
4776 . . -&gt;  . .
4777 l.r     R.r
4778 </pre></td></tr></table>
4779
4780 </dd>
4781 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
4782 <dd><p>Rotate by 90 degrees clockwise, that is:
4783 </p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     l.L
4784 . . -&gt;  . .
4785 l.r     r.R
4786 </pre></td></tr></table>
4787
4788 </dd>
4789 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
4790 <dd><p>Rotate by 90 degrees counterclockwise, that is:
4791 </p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     R.r
4792 . . -&gt;  . .
4793 l.r     L.l
4794 </pre></td></tr></table>
4795
4796 </dd>
4797 <dt> &lsquo;<samp>3</samp>&rsquo;</dt>
4798 <dd><p>Rotate by 90 degrees clockwise and vertically flip, that is:
4799 </p><table><tr><td>&nbsp;</td><td><pre class="example">L.R     r.R
4800 . . -&gt;  . .
4801 l.r     l.L
4802 </pre></td></tr></table>
4803 </dd>
4804 </dl>
4805
4806 <a name="unsharp"></a>
4807 <h2 class="section"><a href="ffmpeg.html#toc-unsharp">18.30 unsharp</a></h2>
4808
4809 <p>Sharpen or blur the input video.
4810 </p>
4811 <p>It accepts the following parameters:
4812 <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>
4813 </p>
4814 <p>Negative values for the amount will blur the input video, while positive
4815 values will sharpen. All parameters are optional and default to the
4816 equivalent of the string &rsquo;5:5:1.0:0:0:0.0&rsquo;.
4817 </p>
4818 <dl compact="compact">
4819 <dt> &lsquo;<samp>luma_msize_x</samp>&rsquo;</dt>
4820 <dd><p>Set the luma matrix horizontal size. It can be an integer between 3
4821 and 13, default value is 5.
4822 </p>
4823 </dd>
4824 <dt> &lsquo;<samp>luma_msize_y</samp>&rsquo;</dt>
4825 <dd><p>Set the luma matrix vertical size. It can be an integer between 3
4826 and 13, default value is 5.
4827 </p>
4828 </dd>
4829 <dt> &lsquo;<samp>luma_amount</samp>&rsquo;</dt>
4830 <dd><p>Set the luma effect strength. It can be a float number between -2.0
4831 and 5.0, default value is 1.0.
4832 </p>
4833 </dd>
4834 <dt> &lsquo;<samp>chroma_msize_x</samp>&rsquo;</dt>
4835 <dd><p>Set the chroma matrix horizontal size. It can be an integer between 3
4836 and 13, default value is 0.
4837 </p>
4838 </dd>
4839 <dt> &lsquo;<samp>chroma_msize_y</samp>&rsquo;</dt>
4840 <dd><p>Set the chroma matrix vertical size. It can be an integer between 3
4841 and 13, default value is 0.
4842 </p>
4843 </dd>
4844 <dt> &lsquo;<samp>luma_amount</samp>&rsquo;</dt>
4845 <dd><p>Set the chroma effect strength. It can be a float number between -2.0
4846 and 5.0, default value is 0.0.
4847 </p>
4848 </dd>
4849 </dl>
4850
4851 <table><tr><td>&nbsp;</td><td><pre class="example"># Strong luma sharpen effect parameters
4852 unsharp=7:7:2.5
4853
4854 # Strong blur of both luma and chroma parameters
4855 unsharp=7:7:-2:7:7:-2
4856
4857 # Use the default values with <code>ffmpeg</code>
4858 ./ffmpeg -i in.avi -vf &quot;unsharp&quot; out.mp4
4859 </pre></td></tr></table>
4860
4861 <a name="vflip"></a>
4862 <h2 class="section"><a href="ffmpeg.html#toc-vflip">18.31 vflip</a></h2>
4863
4864 <p>Flip the input video vertically.
4865 </p>
4866 <table><tr><td>&nbsp;</td><td><pre class="example">./ffmpeg -i in.avi -vf &quot;vflip&quot; out.avi
4867 </pre></td></tr></table>
4868
4869 <a name="yadif"></a>
4870 <h2 class="section"><a href="ffmpeg.html#toc-yadif">18.32 yadif</a></h2>
4871
4872 <p>Deinterlace the input video (&quot;yadif&quot; means &quot;yet another deinterlacing
4873 filter&quot;).
4874 </p>
4875 <p>It accepts the optional parameters: <var>mode</var>:<var>parity</var>.
4876 </p>
4877 <p><var>mode</var> specifies the interlacing mode to adopt, accepts one of the
4878 following values:
4879 </p>
4880 <dl compact="compact">
4881 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
4882 <dd><p>output 1 frame for each frame
4883 </p></dd>
4884 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
4885 <dd><p>output 1 frame for each field
4886 </p></dd>
4887 <dt> &lsquo;<samp>2</samp>&rsquo;</dt>
4888 <dd><p>like 0 but skips spatial interlacing check
4889 </p></dd>
4890 <dt> &lsquo;<samp>3</samp>&rsquo;</dt>
4891 <dd><p>like 1 but skips spatial interlacing check
4892 </p></dd>
4893 </dl>
4894
4895 <p>Default value is 0.
4896 </p>
4897 <p><var>parity</var> specifies the picture field parity assumed for the input
4898 interlaced video, accepts one of the following values:
4899 </p>
4900 <dl compact="compact">
4901 <dt> &lsquo;<samp>0</samp>&rsquo;</dt>
4902 <dd><p>assume bottom field first
4903 </p></dd>
4904 <dt> &lsquo;<samp>1</samp>&rsquo;</dt>
4905 <dd><p>assume top field first
4906 </p></dd>
4907 <dt> &lsquo;<samp>-1</samp>&rsquo;</dt>
4908 <dd><p>enable automatic detection
4909 </p></dd>
4910 </dl>
4911
4912 <p>Default value is -1.
4913 If interlacing is unknown or decoder does not export this information,
4914 top field first will be assumed.
4915 </p>
4916
4917 <a name="Video-Sources"></a>
4918 <h1 class="chapter"><a href="ffmpeg.html#toc-Video-Sources">19. Video Sources</a></h1>
4919
4920 <p>Below is a description of the currently available video sources.
4921 </p>
4922 <a name="buffer"></a>
4923 <h2 class="section"><a href="ffmpeg.html#toc-buffer">19.1 buffer</a></h2>
4924
4925 <p>Buffer video frames, and make them available to the filter chain.
4926 </p>
4927 <p>This source is mainly intended for a programmatic use, in particular
4928 through the interface defined in &lsquo;<tt>libavfilter/vsrc_buffer.h</tt>&rsquo;.
4929 </p>
4930 <p>It accepts the following parameters:
4931 <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>
4932 </p>
4933 <p>All the parameters need to be explicitely defined.
4934 </p>
4935 <p>Follows the list of the accepted parameters.
4936 </p>
4937 <dl compact="compact">
4938 <dt> &lsquo;<samp>width, height</samp>&rsquo;</dt>
4939 <dd><p>Specify the width and height of the buffered video frames.
4940 </p>
4941 </dd>
4942 <dt> &lsquo;<samp>pix_fmt_string</samp>&rsquo;</dt>
4943 <dd><p>A string representing the pixel format of the buffered video frames.
4944 It may be a number corresponding to a pixel format, or a pixel format
4945 name.
4946 </p>
4947 </dd>
4948 <dt> &lsquo;<samp>timebase_num, timebase_den</samp>&rsquo;</dt>
4949 <dd><p>Specify numerator and denomitor of the timebase assumed by the
4950 timestamps of the buffered frames.
4951 </p>
4952 </dd>
4953 <dt> &lsquo;<samp>sample_aspect_ratio.num, sample_aspect_ratio.den</samp>&rsquo;</dt>
4954 <dd><p>Specify numerator and denominator of the sample aspect ratio assumed
4955 by the video frames.
4956 </p></dd>
4957 </dl>
4958
4959 <p>For example:
4960 </p><table><tr><td>&nbsp;</td><td><pre class="example">buffer=320:240:yuv410p:1:24:1:1
4961 </pre></td></tr></table>
4962
4963 <p>will instruct the source to accept video frames with size 320x240 and
4964 with format &quot;yuv410p&quot;, assuming 1/24 as the timestamps timebase and
4965 square pixels (1:1 sample aspect ratio).
4966 Since the pixel format with name &quot;yuv410p&quot; corresponds to the number 6
4967 (check the enum PixelFormat definition in &lsquo;<tt>libavutil/pixfmt.h</tt>&rsquo;),
4968 this example corresponds to:
4969 </p><table><tr><td>&nbsp;</td><td><pre class="example">buffer=320:240:6:1:24
4970 </pre></td></tr></table>
4971
4972 <a name="color"></a>
4973 <h2 class="section"><a href="ffmpeg.html#toc-color">19.2 color</a></h2>
4974
4975 <p>Provide an uniformly colored input.
4976 </p>
4977 <p>It accepts the following parameters:
4978 <var>color</var>:<var>frame_size</var>:<var>frame_rate</var>
4979 </p>
4980 <p>Follows the description of the accepted parameters.
4981 </p>
4982 <dl compact="compact">
4983 <dt> &lsquo;<samp>color</samp>&rsquo;</dt>
4984 <dd><p>Specify the color of the source. It can be the name of a color (case
4985 insensitive match) or a 0xRRGGBB[AA] sequence, possibly followed by an
4986 alpha specifier. The default value is &quot;black&quot;.
4987 </p>
4988 </dd>
4989 <dt> &lsquo;<samp>frame_size</samp>&rsquo;</dt>
4990 <dd><p>Specify the size of the sourced video, it may be a string of the form
4991 <var>width</var>x<var>heigth</var>, or the name of a size abbreviation. The
4992 default value is &quot;320x240&quot;.
4993 </p>
4994 </dd>
4995 <dt> &lsquo;<samp>frame_rate</samp>&rsquo;</dt>
4996 <dd><p>Specify the frame rate of the sourced video, as the number of frames
4997 generated per second. It has to be a string in the format
4998 <var>frame_rate_num</var>/<var>frame_rate_den</var>, an integer number, a float
4999 number or a valid video frame rate abbreviation. The default value is
5000 &quot;25&quot;.
5001 </p>
5002 </dd>
5003 </dl>
5004
5005 <p>For example the following graph description will generate a red source
5006 with an opacity of 0.2, with size &quot;qcif&quot; and a frame rate of 10
5007 frames per second, which will be overlayed over the source connected
5008 to the pad with identifier &quot;in&quot;.
5009 </p>
5010 <table><tr><td>&nbsp;</td><td><pre class="example">&quot;color=red@0.2:qcif:10 [color]; [in][color] overlay [out]&quot;
5011 </pre></td></tr></table>
5012
5013 <a name="movie"></a>
5014 <h2 class="section"><a href="ffmpeg.html#toc-movie">19.3 movie</a></h2>
5015
5016 <p>Read a video stream from a movie container.
5017 </p>
5018 <p>It accepts the syntax: <var>movie_name</var>[:<var>options</var>] where
5019 <var>movie_name</var> is the name of the resource to read (not necessarily
5020 a file but also a device or a stream accessed through some protocol),
5021 and <var>options</var> is an optional sequence of <var>key</var>=<var>value</var>
5022 pairs, separated by &quot;:&quot;.
5023 </p>
5024 <p>The description of the accepted options follows.
5025 </p>
5026 <dl compact="compact">
5027 <dt> &lsquo;<samp>format_name, f</samp>&rsquo;</dt>
5028 <dd><p>Specifies the format assumed for the movie to read, and can be either
5029 the name of a container or an input device. If not specified the
5030 format is guessed from <var>movie_name</var> or by probing.
5031 </p>
5032 </dd>
5033 <dt> &lsquo;<samp>seek_point, sp</samp>&rsquo;</dt>
5034 <dd><p>Specifies the seek point in seconds, the frames will be output
5035 starting from this seek point, the parameter is evaluated with
5036 <code>av_strtod</code> so the numerical value may be suffixed by an IS
5037 postfix. Default value is &quot;0&quot;.
5038 </p>
5039 </dd>
5040 <dt> &lsquo;<samp>stream_index, si</samp>&rsquo;</dt>
5041 <dd><p>Specifies the index of the video stream to read. If the value is -1,
5042 the best suited video stream will be automatically selected. Default
5043 value is &quot;-1&quot;.
5044 </p>
5045 </dd>
5046 </dl>
5047
5048 <p>This filter allows to overlay a second video on top of main input of
5049 a filtergraph as shown in this graph:
5050 </p><table><tr><td>&nbsp;</td><td><pre class="example">input -----------&gt; deltapts0 --&gt; overlay --&gt; output
5051                                     ^
5052                                     |
5053 movie --&gt; scale--&gt; deltapts1 -------+
5054 </pre></td></tr></table>
5055
5056 <p>Some examples follow:
5057 </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
5058 # on top of the input labelled as &quot;in&quot;.
5059 movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [movie];
5060 [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
5061
5062 # read from a video4linux2 device, and overlay it on top of the input
5063 # labelled as &quot;in&quot;
5064 movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie];
5065 [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
5066
5067 </pre></td></tr></table>
5068
5069 <a name="nullsrc"></a>
5070 <h2 class="section"><a href="ffmpeg.html#toc-nullsrc">19.4 nullsrc</a></h2>
5071
5072 <p>Null video source, never return images. It is mainly useful as a
5073 template and to be employed in analysis / debugging tools.
5074 </p>
5075 <p>It accepts as optional parameter a string of the form
5076 <var>width</var>:<var>height</var>:<var>timebase</var>.
5077 </p>
5078 <p><var>width</var> and <var>height</var> specify the size of the configured
5079 source. The default values of <var>width</var> and <var>height</var> are
5080 respectively 352 and 288 (corresponding to the CIF size format).
5081 </p>
5082 <p><var>timebase</var> specifies an arithmetic expression representing a
5083 timebase. The expression can contain the constants &quot;PI&quot;, &quot;E&quot;, &quot;PHI&quot;,
5084 &quot;AVTB&quot; (the default timebase), and defaults to the value &quot;AVTB&quot;.
5085 </p>
5086 <a name="frei0r_005fsrc"></a>
5087 <h2 class="section"><a href="ffmpeg.html#toc-frei0r_005fsrc">19.5 frei0r_src</a></h2>
5088
5089 <p>Provide a frei0r source.
5090 </p>
5091 <p>To enable compilation of this filter you need to install the frei0r
5092 header and configure FFmpeg with &ndash;enable-frei0r.
5093 </p>
5094 <p>The source supports the syntax:
5095 </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>]
5096 </pre></td></tr></table>
5097
5098 <p><var>size</var> is the size of the video to generate, may be a string of the
5099 form <var>width</var>x<var>height</var> or a frame size abbreviation.
5100 <var>rate</var> is the rate of the video to generate, may be a string of
5101 the form <var>num</var>/<var>den</var> or a frame rate abbreviation.
5102 <var>src_name</var> is the name to the frei0r source to load. For more
5103 information regarding frei0r and how to set the parameters read the
5104 section &quot;frei0r&quot; (see <a href="#frei0r">frei0r</a>) in the description of the video
5105 filters.
5106 </p>
5107 <p>Some examples follow:
5108 </p><table><tr><td>&nbsp;</td><td><pre class="example"># generate a frei0r partik0l source with size 200x200 and framerate 10
5109 # which is overlayed on the overlay filter main input
5110 frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay
5111 </pre></td></tr></table>
5112
5113
5114 <a name="Video-Sinks"></a>
5115 <h1 class="chapter"><a href="ffmpeg.html#toc-Video-Sinks">20. Video Sinks</a></h1>
5116
5117 <p>Below is a description of the currently available video sinks.
5118 </p>
5119 <a name="nullsink"></a>
5120 <h2 class="section"><a href="ffmpeg.html#toc-nullsink">20.1 nullsink</a></h2>
5121
5122 <p>Null video sink, do absolutely nothing with the input video. It is
5123 mainly useful as a template and to be employed in analysis / debugging
5124 tools.
5125 </p>
5126
5127 <a name="Metadata"></a>
5128 <h1 class="chapter"><a href="ffmpeg.html#toc-Metadata">21. Metadata</a></h1>
5129
5130 <p>FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded
5131 INI-like text file and then load it back using the metadata muxer/demuxer.
5132 </p>
5133 <p>The file format is as follows:
5134 </p><ol>
5135 <li>
5136 A file consists of a header and a number of metadata tags divided into sections,
5137 each on its own line.
5138
5139 </li><li>
5140 The header is a &rsquo;;FFMETADATA&rsquo; string, followed by a version number (now 1).
5141
5142 </li><li>
5143 Metadata tags are of the form &rsquo;key=value&rsquo;
5144
5145 </li><li>
5146 Immediately after header follows global metadata
5147
5148 </li><li>
5149 After global metadata there may be sections with per-stream/per-chapter
5150 metadata.
5151
5152 </li><li>
5153 A section starts with the section name in uppercase (i.e. STREAM or CHAPTER) in
5154 brackets (&rsquo;[&rsquo;, &rsquo;]&rsquo;) and ends with next section or end of file.
5155
5156 </li><li>
5157 At the beginning of a chapter section there may be an optional timebase to be
5158 used for start/end values. It must be in form &rsquo;TIMEBASE=num/den&rsquo;, where num and
5159 den are integers. If the timebase is missing then start/end times are assumed to
5160 be in milliseconds.
5161 Next a chapter section must contain chapter start and end times in form
5162 &rsquo;START=num&rsquo;, &rsquo;END=num&rsquo;, where num is a positive integer.
5163
5164 </li><li>
5165 Empty lines and lines starting with &rsquo;;&rsquo; or &rsquo;#&rsquo; are ignored.
5166
5167 </li><li>
5168 Metadata keys or values containing special characters (&rsquo;=&rsquo;, &rsquo;;&rsquo;, &rsquo;#&rsquo;, &rsquo;\&rsquo; and a
5169 newline) must be escaped with a backslash &rsquo;\&rsquo;.
5170
5171 </li><li>
5172 Note that whitespace in metadata (e.g. foo = bar) is considered to be a part of
5173 the tag (in the example above key is &rsquo;foo &rsquo;, value is &rsquo; bar&rsquo;).
5174 </li></ol>
5175
5176 <p>A ffmetadata file might look like this:
5177 </p><table><tr><td>&nbsp;</td><td><pre class="example">;FFMETADATA1
5178 title=bike\\shed
5179 ;this is a comment
5180 artist=FFmpeg troll team
5181
5182 [CHAPTER]
5183 TIMEBASE=1/1000
5184 START=0
5185 #chapter ends at 0:01:00
5186 END=60000
5187 title=chapter \#1
5188 [STREAM]
5189 title=multi\
5190 line
5191 </pre></td></tr></table>
5192
5193
5194 <hr size="1">
5195 <p>
5196  <font size="-1">
5197   This document was generated by <em>Kyle Schwarz</em> on <em>May 18, 2011</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
5198  </font>
5199  <br>
5200
5201 </p>
5202 </body>
5203 </html>