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