1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
3 <!-- Created on May 18, 2011 by texi2html 1.82
4 texi2html was written by:
5 Lionel Cons <Lionel.Cons@cern.ch> (original author)
6 Karl Berry <karl@freefriends.org>
7 Olaf Bachmann <obachman@mathematik.uni-kl.de>
9 Maintained by: Many creative people.
10 Send bugs and suggestions to <texi2html-bug@nongnu.org>
13 <title>ffmpeg Documentation</title>
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">
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}
42 <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
44 <a name="SEC_Top"></a>
45 <h1 class="settitle">ffmpeg Documentation</h1>
47 <a name="SEC_Contents"></a>
48 <h1>Table of Contents</h1>
49 <div class="contents">
52 <li><a name="toc-Synopsis" href="#Synopsis">1. Synopsis</a></li>
53 <li><a name="toc-Description" href="#Description">2. Description</a></li>
54 <li><a name="toc-Options" href="#Options">3. Options</a>
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>
67 <li><a name="toc-Tips" href="#Tips">4. Tips</a></li>
68 <li><a name="toc-Examples" href="#Examples">5. Examples</a>
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>
74 <li><a name="toc-Expression-Evaluation" href="#Expression-Evaluation">6. Expression Evaluation</a></li>
75 <li><a name="toc-Encoders" href="#Encoders">7. Encoders</a>
77 <li><a name="toc-Audio-Encoders" href="#Audio-Encoders">7.1 Audio Encoders</a>
79 <li><a name="toc-ac3-and-ac3_005ffixed" href="#ac3-and-ac3_005ffixed">7.1.1 ac3 and ac3_fixed</a></li>
83 <li><a name="toc-Demuxers" href="#Demuxers">8. Demuxers</a>
85 <li><a name="toc-image2-1" href="#image2-1">8.1 image2</a></li>
86 <li><a name="toc-applehttp-1" href="#applehttp-1">8.2 applehttp</a></li>
88 <li><a name="toc-Muxers" href="#Muxers">9. Muxers</a>
90 <li><a name="toc-crc-1" href="#crc-1">9.1 crc</a></li>
91 <li><a name="toc-framecrc-1" href="#framecrc-1">9.2 framecrc</a></li>
92 <li><a name="toc-image2" href="#image2">9.3 image2</a></li>
93 <li><a name="toc-mpegts" href="#mpegts">9.4 mpegts</a></li>
94 <li><a name="toc-null" href="#null">9.5 null</a></li>
96 <li><a name="toc-Input-Devices" href="#Input-Devices">10. Input Devices</a>
98 <li><a name="toc-alsa" href="#alsa">10.1 alsa</a></li>
99 <li><a name="toc-bktr" href="#bktr">10.2 bktr</a></li>
100 <li><a name="toc-dv1394" href="#dv1394">10.3 dv1394</a></li>
101 <li><a name="toc-fbdev" href="#fbdev">10.4 fbdev</a></li>
102 <li><a name="toc-jack" href="#jack">10.5 jack</a></li>
103 <li><a name="toc-libdc1394" href="#libdc1394">10.6 libdc1394</a></li>
104 <li><a name="toc-oss" href="#oss">10.7 oss</a></li>
105 <li><a name="toc-sndio-1" href="#sndio-1">10.8 sndio</a></li>
106 <li><a name="toc-video4linux-and-video4linux2" href="#video4linux-and-video4linux2">10.9 video4linux and video4linux2</a></li>
107 <li><a name="toc-vfwcap" href="#vfwcap">10.10 vfwcap</a></li>
108 <li><a name="toc-x11grab" href="#x11grab">10.11 x11grab</a></li>
110 <li><a name="toc-Output-Devices" href="#Output-Devices">11. Output Devices</a>
112 <li><a name="toc-alsa-1" href="#alsa-1">11.1 alsa</a></li>
113 <li><a name="toc-oss-1" href="#oss-1">11.2 oss</a></li>
114 <li><a name="toc-sndio" href="#sndio">11.3 sndio</a></li>
116 <li><a name="toc-Protocols" href="#Protocols">12. Protocols</a>
118 <li><a name="toc-applehttp" href="#applehttp">12.1 applehttp</a></li>
119 <li><a name="toc-concat" href="#concat">12.2 concat</a></li>
120 <li><a name="toc-file" href="#file">12.3 file</a></li>
121 <li><a name="toc-gopher" href="#gopher">12.4 gopher</a></li>
122 <li><a name="toc-http" href="#http">12.5 http</a></li>
123 <li><a name="toc-mmst" href="#mmst">12.6 mmst</a></li>
124 <li><a name="toc-mmsh" href="#mmsh">12.7 mmsh</a></li>
125 <li><a name="toc-md5" href="#md5">12.8 md5</a></li>
126 <li><a name="toc-pipe" href="#pipe">12.9 pipe</a></li>
127 <li><a name="toc-rtmp" href="#rtmp">12.10 rtmp</a></li>
128 <li><a name="toc-rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte" href="#rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte">12.11 rtmp, rtmpe, rtmps, rtmpt, rtmpte</a></li>
129 <li><a name="toc-rtp" href="#rtp">12.12 rtp</a></li>
130 <li><a name="toc-rtsp" href="#rtsp">12.13 rtsp</a></li>
131 <li><a name="toc-sap" href="#sap">12.14 sap</a>
133 <li><a name="toc-Muxer" href="#Muxer">12.14.1 Muxer</a></li>
134 <li><a name="toc-Demuxer" href="#Demuxer">12.14.2 Demuxer</a></li>
136 <li><a name="toc-tcp" href="#tcp">12.15 tcp</a></li>
137 <li><a name="toc-udp" href="#udp">12.16 udp</a></li>
139 <li><a name="toc-Bitstream-Filters" href="#Bitstream-Filters">13. Bitstream Filters</a>
141 <li><a name="toc-aac_005fadtstoasc" href="#aac_005fadtstoasc">13.1 aac_adtstoasc</a></li>
142 <li><a name="toc-chomp" href="#chomp">13.2 chomp</a></li>
143 <li><a name="toc-dump_005fextradata" href="#dump_005fextradata">13.3 dump_extradata</a></li>
144 <li><a name="toc-h264_005fmp4toannexb" href="#h264_005fmp4toannexb">13.4 h264_mp4toannexb</a></li>
145 <li><a name="toc-imx_005fdump_005fheader" href="#imx_005fdump_005fheader">13.5 imx_dump_header</a></li>
146 <li><a name="toc-mjpeg2jpeg" href="#mjpeg2jpeg">13.6 mjpeg2jpeg</a></li>
147 <li><a name="toc-mjpega_005fdump_005fheader" href="#mjpega_005fdump_005fheader">13.7 mjpega_dump_header</a></li>
148 <li><a name="toc-movsub" href="#movsub">13.8 movsub</a></li>
149 <li><a name="toc-mp3_005fheader_005fcompress" href="#mp3_005fheader_005fcompress">13.9 mp3_header_compress</a></li>
150 <li><a name="toc-mp3_005fheader_005fdecompress" href="#mp3_005fheader_005fdecompress">13.10 mp3_header_decompress</a></li>
151 <li><a name="toc-noise" href="#noise">13.11 noise</a></li>
152 <li><a name="toc-remove_005fextradata" href="#remove_005fextradata">13.12 remove_extradata</a></li>
154 <li><a name="toc-Filtergraph-description" href="#Filtergraph-description">14. Filtergraph description</a>
156 <li><a name="toc-Filtergraph-syntax" href="#Filtergraph-syntax">14.1 Filtergraph syntax</a></li>
158 <li><a name="toc-Audio-Filters" href="#Audio-Filters">15. Audio Filters</a>
160 <li><a name="toc-anull" href="#anull">15.1 anull</a></li>
162 <li><a name="toc-Audio-Sources" href="#Audio-Sources">16. Audio Sources</a>
164 <li><a name="toc-anullsrc" href="#anullsrc">16.1 anullsrc</a></li>
166 <li><a name="toc-Audio-Sinks" href="#Audio-Sinks">17. Audio Sinks</a>
168 <li><a name="toc-anullsink" href="#anullsink">17.1 anullsink</a></li>
170 <li><a name="toc-Video-Filters" href="#Video-Filters">18. Video Filters</a>
172 <li><a name="toc-blackframe" href="#blackframe">18.1 blackframe</a></li>
173 <li><a name="toc-copy" href="#copy">18.2 copy</a></li>
174 <li><a name="toc-crop" href="#crop">18.3 crop</a></li>
175 <li><a name="toc-cropdetect" href="#cropdetect">18.4 cropdetect</a></li>
176 <li><a name="toc-drawbox" href="#drawbox">18.5 drawbox</a></li>
177 <li><a name="toc-drawtext" href="#drawtext">18.6 drawtext</a></li>
178 <li><a name="toc-fade" href="#fade">18.7 fade</a></li>
179 <li><a name="toc-fieldorder" href="#fieldorder">18.8 fieldorder</a></li>
180 <li><a name="toc-fifo" href="#fifo">18.9 fifo</a></li>
181 <li><a name="toc-format" href="#format">18.10 format</a></li>
182 <li><a name="toc-frei0r-1" href="#frei0r-1">18.11 frei0r</a></li>
183 <li><a name="toc-gradfun" href="#gradfun">18.12 gradfun</a></li>
184 <li><a name="toc-hflip" href="#hflip">18.13 hflip</a></li>
185 <li><a name="toc-hqdn3d" href="#hqdn3d">18.14 hqdn3d</a></li>
186 <li><a name="toc-mp" href="#mp">18.15 mp</a></li>
187 <li><a name="toc-noformat" href="#noformat">18.16 noformat</a></li>
188 <li><a name="toc-null-1" href="#null-1">18.17 null</a></li>
189 <li><a name="toc-ocv" href="#ocv">18.18 ocv</a>
191 <li><a name="toc-dilate-1" href="#dilate-1">18.18.1 dilate</a></li>
192 <li><a name="toc-erode" href="#erode">18.18.2 erode</a></li>
193 <li><a name="toc-smooth" href="#smooth">18.18.3 smooth</a></li>
195 <li><a name="toc-overlay" href="#overlay">18.19 overlay</a></li>
196 <li><a name="toc-pad" href="#pad">18.20 pad</a></li>
197 <li><a name="toc-pixdesctest" href="#pixdesctest">18.21 pixdesctest</a></li>
198 <li><a name="toc-scale" href="#scale">18.22 scale</a></li>
199 <li><a name="toc-setdar-1" href="#setdar-1">18.23 setdar</a></li>
200 <li><a name="toc-setpts" href="#setpts">18.24 setpts</a></li>
201 <li><a name="toc-setsar-1" href="#setsar-1">18.25 setsar</a></li>
202 <li><a name="toc-settb" href="#settb">18.26 settb</a></li>
203 <li><a name="toc-showinfo" href="#showinfo">18.27 showinfo</a></li>
204 <li><a name="toc-slicify" href="#slicify">18.28 slicify</a></li>
205 <li><a name="toc-transpose" href="#transpose">18.29 transpose</a></li>
206 <li><a name="toc-unsharp" href="#unsharp">18.30 unsharp</a></li>
207 <li><a name="toc-vflip" href="#vflip">18.31 vflip</a></li>
208 <li><a name="toc-yadif" href="#yadif">18.32 yadif</a></li>
210 <li><a name="toc-Video-Sources" href="#Video-Sources">19. Video Sources</a>
212 <li><a name="toc-buffer" href="#buffer">19.1 buffer</a></li>
213 <li><a name="toc-color" href="#color">19.2 color</a></li>
214 <li><a name="toc-movie" href="#movie">19.3 movie</a></li>
215 <li><a name="toc-nullsrc" href="#nullsrc">19.4 nullsrc</a></li>
216 <li><a name="toc-frei0r_005fsrc" href="#frei0r_005fsrc">19.5 frei0r_src</a></li>
218 <li><a name="toc-Video-Sinks" href="#Video-Sinks">20. Video Sinks</a>
220 <li><a name="toc-nullsink" href="#nullsink">20.1 nullsink</a></li>
222 <li><a name="toc-Metadata" href="#Metadata">21. Metadata</a></li>
227 <a name="Synopsis"></a>
228 <h1 class="chapter"><a href="ffmpeg.html#toc-Synopsis">1. Synopsis</a></h1>
230 <p>The generic syntax is:
232 <table><tr><td> </td><td><pre class="example">ffmpeg [[infile options][‘<samp>-i</samp>’ <var>infile</var>]]... {[outfile options] <var>outfile</var>}...
233 </pre></td></tr></table>
235 <a name="Description"></a>
236 <h1 class="chapter"><a href="ffmpeg.html#toc-Description">2. Description</a></h1>
238 <p>ffmpeg is a very fast video and audio converter that can also grab from
239 a live audio/video source. It can also convert between arbitrary sample
240 rates and resize video on the fly with a high quality polyphase filter.
242 <p>The command line interface is designed to be intuitive, in the sense
243 that ffmpeg tries to figure out all parameters that can possibly be
244 derived automatically. You usually only have to specify the target
247 <p>As a general rule, options are applied to the next specified
248 file. Therefore, order is important, and you can have the same
249 option on the command line multiple times. Each occurrence is
250 then applied to the next input or output file.
254 To set the video bitrate of the output file to 64kbit/s:
255 <table><tr><td> </td><td><pre class="example">ffmpeg -i input.avi -b 64k output.avi
256 </pre></td></tr></table>
259 To force the frame rate of the output file to 24 fps:
260 <table><tr><td> </td><td><pre class="example">ffmpeg -i input.avi -r 24 output.avi
261 </pre></td></tr></table>
264 To force the frame rate of the input file (valid for raw formats only)
265 to 1 fps and the frame rate of the output file to 24 fps:
266 <table><tr><td> </td><td><pre class="example">ffmpeg -r 1 -i input.m2v -r 24 output.avi
267 </pre></td></tr></table>
270 <p>The format option may be needed for raw input files.
272 <p>By default ffmpeg tries to convert as losslessly as possible: It
273 uses the same audio and video parameters for the outputs as the one
274 specified for the inputs.
277 <a name="Options"></a>
278 <h1 class="chapter"><a href="ffmpeg.html#toc-Options">3. Options</a></h1>
280 <p>All the numerical options, if not specified otherwise, accept in input
281 a string representing a number, which may contain one of the
282 International System number postfixes, for example ’K’, ’M’, ’G’.
283 If ’i’ is appended after the postfix, powers of 2 are used instead of
284 powers of 10. The ’B’ postfix multiplies the value for 8, and can be
285 appended after another postfix or used alone. This allows using for
286 example ’KB’, ’MiB’, ’G’ and ’B’ as postfix.
288 <p>Options which do not take arguments are boolean options, and set the
289 corresponding value to true. They can be set to false by prefixing
290 with "no" the option name, for example using "-nofoo" in the
291 commandline will set to false the boolean option with name "foo".
293 <a name="Generic-options"></a>
294 <h2 class="section"><a href="ffmpeg.html#toc-Generic-options">3.1 Generic options</a></h2>
296 <p>These options are shared amongst the ff* tools.
298 <dl compact="compact">
299 <dt> ‘<samp>-L</samp>’</dt>
303 <dt> ‘<samp>-h, -?, -help, --help</samp>’</dt>
307 <dt> ‘<samp>-version</samp>’</dt>
311 <dt> ‘<samp>-formats</samp>’</dt>
312 <dd><p>Show available formats.
314 <p>The fields preceding the format names have the following meanings:
315 </p><dl compact="compact">
316 <dt> ‘<samp>D</samp>’</dt>
317 <dd><p>Decoding available
319 <dt> ‘<samp>E</samp>’</dt>
320 <dd><p>Encoding available
325 <dt> ‘<samp>-codecs</samp>’</dt>
326 <dd><p>Show available codecs.
328 <p>The fields preceding the codec names have the following meanings:
329 </p><dl compact="compact">
330 <dt> ‘<samp>D</samp>’</dt>
331 <dd><p>Decoding available
333 <dt> ‘<samp>E</samp>’</dt>
334 <dd><p>Encoding available
336 <dt> ‘<samp>V/A/S</samp>’</dt>
337 <dd><p>Video/audio/subtitle codec
339 <dt> ‘<samp>S</samp>’</dt>
340 <dd><p>Codec supports slices
342 <dt> ‘<samp>D</samp>’</dt>
343 <dd><p>Codec supports direct rendering
345 <dt> ‘<samp>T</samp>’</dt>
346 <dd><p>Codec can handle input truncated at random locations instead of only at frame boundaries
351 <dt> ‘<samp>-bsfs</samp>’</dt>
352 <dd><p>Show available bitstream filters.
355 <dt> ‘<samp>-protocols</samp>’</dt>
356 <dd><p>Show available protocols.
359 <dt> ‘<samp>-filters</samp>’</dt>
360 <dd><p>Show available libavfilter filters.
363 <dt> ‘<samp>-pix_fmts</samp>’</dt>
364 <dd><p>Show available pixel formats.
367 <dt> ‘<samp>-loglevel <var>loglevel</var></samp>’</dt>
368 <dd><p>Set the logging level used by the library.
369 <var>loglevel</var> is a number or a string containing one of the following values:
370 </p><dl compact="compact">
371 <dt> ‘<samp>quiet</samp>’</dt>
372 <dt> ‘<samp>panic</samp>’</dt>
373 <dt> ‘<samp>fatal</samp>’</dt>
374 <dt> ‘<samp>error</samp>’</dt>
375 <dt> ‘<samp>warning</samp>’</dt>
376 <dt> ‘<samp>info</samp>’</dt>
377 <dt> ‘<samp>verbose</samp>’</dt>
378 <dt> ‘<samp>debug</samp>’</dt>
381 <p>By default the program logs to stderr, if coloring is supported by the
382 terminal, colors are used to mark errors and warnings. Log coloring
383 can be disabled setting the environment variable
384 <code>FFMPEG_FORCE_NOCOLOR</code> or <code>NO_COLOR</code>, or can be forced setting
385 the environment variable <code>FFMPEG_FORCE_COLOR</code>.
386 The use of the environment variable <code>NO_COLOR</code> is deprecated and
387 will be dropped in a following FFmpeg version.
392 <a name="Main-options"></a>
393 <h2 class="section"><a href="ffmpeg.html#toc-Main-options">3.2 Main options</a></h2>
395 <dl compact="compact">
396 <dt> ‘<samp>-f <var>fmt</var></samp>’</dt>
400 <dt> ‘<samp>-i <var>filename</var></samp>’</dt>
401 <dd><p>input file name
404 <dt> ‘<samp>-y</samp>’</dt>
405 <dd><p>Overwrite output files.
408 <dt> ‘<samp>-t <var>duration</var></samp>’</dt>
409 <dd><p>Restrict the transcoded/captured video sequence
410 to the duration specified in seconds.
411 <code>hh:mm:ss[.xxx]</code> syntax is also supported.
414 <dt> ‘<samp>-fs <var>limit_size</var></samp>’</dt>
415 <dd><p>Set the file size limit.
418 <dt> ‘<samp>-ss <var>position</var></samp>’</dt>
419 <dd><p>Seek to given time position in seconds.
420 <code>hh:mm:ss[.xxx]</code> syntax is also supported.
423 <dt> ‘<samp>-itsoffset <var>offset</var></samp>’</dt>
424 <dd><p>Set the input time offset in seconds.
425 <code>[-]hh:mm:ss[.xxx]</code> syntax is also supported.
426 This option affects all the input files that follow it.
427 The offset is added to the timestamps of the input files.
428 Specifying a positive offset means that the corresponding
429 streams are delayed by ’offset’ seconds.
432 <dt> ‘<samp>-timestamp <var>time</var></samp>’</dt>
433 <dd><p>Set the recording timestamp in the container.
434 The syntax for <var>time</var> is:
435 </p><table><tr><td> </td><td><pre class="example">now|([(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH[:MM[:SS[.m...]]])|(HH[MM[SS[.m...]]]))[Z|z])
436 </pre></td></tr></table>
437 <p>If the value is "now" it takes the current time.
438 Time is local time unless ’Z’ or ’z’ is appended, in which case it is
440 If the year-month-day part is not specified it takes the current
444 <dt> ‘<samp>-metadata <var>key</var>=<var>value</var></samp>’</dt>
445 <dd><p>Set a metadata key/value pair.
447 <p>For example, for setting the title in the output file:
448 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i in.avi -metadata title="my title" out.flv
449 </pre></td></tr></table>
452 <dt> ‘<samp>-v <var>number</var></samp>’</dt>
453 <dd><p>Set the logging verbosity level.
456 <dt> ‘<samp>-target <var>type</var></samp>’</dt>
457 <dd><p>Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd",
458 "ntsc-svcd", ... ). All the format options (bitrate, codecs,
459 buffer sizes) are then set automatically. You can just type:
461 <table><tr><td> </td><td><pre class="example">ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
462 </pre></td></tr></table>
464 <p>Nevertheless you can specify additional options as long as you know
465 they do not conflict with the standard, as in:
467 <table><tr><td> </td><td><pre class="example">ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
468 </pre></td></tr></table>
471 <dt> ‘<samp>-dframes <var>number</var></samp>’</dt>
472 <dd><p>Set the number of data frames to record.
475 <dt> ‘<samp>-scodec <var>codec</var></samp>’</dt>
476 <dd><p>Force subtitle codec (’copy’ to copy stream).
479 <dt> ‘<samp>-newsubtitle</samp>’</dt>
480 <dd><p>Add a new subtitle stream to the current output stream.
483 <dt> ‘<samp>-slang <var>code</var></samp>’</dt>
484 <dd><p>Set the ISO 639 language code (3 letters) of the current subtitle stream.
489 <a name="Video-Options"></a>
490 <h2 class="section"><a href="ffmpeg.html#toc-Video-Options">3.3 Video Options</a></h2>
492 <dl compact="compact">
493 <dt> ‘<samp>-b <var>bitrate</var></samp>’</dt>
494 <dd><p>Set the video bitrate in bit/s (default = 200 kb/s).
496 <dt> ‘<samp>-vframes <var>number</var></samp>’</dt>
497 <dd><p>Set the number of video frames to record.
499 <dt> ‘<samp>-r <var>fps</var></samp>’</dt>
500 <dd><p>Set frame rate (Hz value, fraction or abbreviation), (default = 25).
502 <dt> ‘<samp>-s <var>size</var></samp>’</dt>
503 <dd><p>Set frame size. The format is ‘<samp>wxh</samp>’ (ffserver default = 160x128).
504 There is no default for input streams,
505 for output streams it is set by default to the size of the source stream.
506 If the input file has video streams with different resolutions, the behaviour is undefined.
507 The following abbreviations are recognized:
508 </p><dl compact="compact">
509 <dt> ‘<samp>sqcif</samp>’</dt>
512 <dt> ‘<samp>qcif</samp>’</dt>
515 <dt> ‘<samp>cif</samp>’</dt>
518 <dt> ‘<samp>4cif</samp>’</dt>
521 <dt> ‘<samp>16cif</samp>’</dt>
524 <dt> ‘<samp>qqvga</samp>’</dt>
527 <dt> ‘<samp>qvga</samp>’</dt>
530 <dt> ‘<samp>vga</samp>’</dt>
533 <dt> ‘<samp>svga</samp>’</dt>
536 <dt> ‘<samp>xga</samp>’</dt>
539 <dt> ‘<samp>uxga</samp>’</dt>
542 <dt> ‘<samp>qxga</samp>’</dt>
545 <dt> ‘<samp>sxga</samp>’</dt>
548 <dt> ‘<samp>qsxga</samp>’</dt>
551 <dt> ‘<samp>hsxga</samp>’</dt>
554 <dt> ‘<samp>wvga</samp>’</dt>
557 <dt> ‘<samp>wxga</samp>’</dt>
560 <dt> ‘<samp>wsxga</samp>’</dt>
563 <dt> ‘<samp>wuxga</samp>’</dt>
566 <dt> ‘<samp>woxga</samp>’</dt>
569 <dt> ‘<samp>wqsxga</samp>’</dt>
572 <dt> ‘<samp>wquxga</samp>’</dt>
575 <dt> ‘<samp>whsxga</samp>’</dt>
578 <dt> ‘<samp>whuxga</samp>’</dt>
581 <dt> ‘<samp>cga</samp>’</dt>
584 <dt> ‘<samp>ega</samp>’</dt>
587 <dt> ‘<samp>hd480</samp>’</dt>
590 <dt> ‘<samp>hd720</samp>’</dt>
593 <dt> ‘<samp>hd1080</samp>’</dt>
599 <dt> ‘<samp>-aspect <var>aspect</var></samp>’</dt>
600 <dd><p>Set the video display aspect ratio specified by <var>aspect</var>.
602 <p><var>aspect</var> can be a floating point number string, or a string of the
603 form <var>num</var>:<var>den</var>, where <var>num</var> and <var>den</var> are the
604 numerator and denominator of the aspect ratio. For example "4:3",
605 "16:9", "1.3333", and "1.7777" are valid argument values.
608 <dt> ‘<samp>-croptop <var>size</var></samp>’</dt>
609 <dt> ‘<samp>-cropbottom <var>size</var></samp>’</dt>
610 <dt> ‘<samp>-cropleft <var>size</var></samp>’</dt>
611 <dt> ‘<samp>-cropright <var>size</var></samp>’</dt>
612 <dd><p>All the crop options have been removed. Use -vf
613 crop=width:height:x:y instead.
616 <dt> ‘<samp>-padtop <var>size</var></samp>’</dt>
617 <dt> ‘<samp>-padbottom <var>size</var></samp>’</dt>
618 <dt> ‘<samp>-padleft <var>size</var></samp>’</dt>
619 <dt> ‘<samp>-padright <var>size</var></samp>’</dt>
620 <dt> ‘<samp>-padcolor <var>hex_color</var></samp>’</dt>
621 <dd><p>All the pad options have been removed. Use -vf
622 pad=width:height:x:y:color instead.
624 <dt> ‘<samp>-vn</samp>’</dt>
625 <dd><p>Disable video recording.
627 <dt> ‘<samp>-bt <var>tolerance</var></samp>’</dt>
628 <dd><p>Set video bitrate tolerance (in bits, default 4000k).
629 Has a minimum value of: (target_bitrate/target_framerate).
630 In 1-pass mode, bitrate tolerance specifies how far ratecontrol is
631 willing to deviate from the target average bitrate value. This is
632 not related to min/max bitrate. Lowering tolerance too much has
633 an adverse effect on quality.
635 <dt> ‘<samp>-maxrate <var>bitrate</var></samp>’</dt>
636 <dd><p>Set max video bitrate (in bit/s).
637 Requires -bufsize to be set.
639 <dt> ‘<samp>-minrate <var>bitrate</var></samp>’</dt>
640 <dd><p>Set min video bitrate (in bit/s).
641 Most useful in setting up a CBR encode:
642 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
643 </pre></td></tr></table>
644 <p>It is of little use elsewise.
646 <dt> ‘<samp>-bufsize <var>size</var></samp>’</dt>
647 <dd><p>Set video buffer verifier buffer size (in bits).
649 <dt> ‘<samp>-vcodec <var>codec</var></samp>’</dt>
650 <dd><p>Force video codec to <var>codec</var>. Use the <code>copy</code> special value to
651 tell that the raw codec data must be copied as is.
653 <dt> ‘<samp>-sameq</samp>’</dt>
654 <dd><p>Use same quantizer as source (implies VBR).
657 <dt> ‘<samp>-pass <var>n</var></samp>’</dt>
658 <dd><p>Select the pass number (1 or 2). It is used to do two-pass
659 video encoding. The statistics of the video are recorded in the first
660 pass into a log file (see also the option -passlogfile),
661 and in the second pass that log file is used to generate the video
662 at the exact requested bitrate.
663 On pass 1, you may just deactivate audio and set output to null,
664 examples for Windows and Unix:
665 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y NUL
666 ffmpeg -i foo.mov -vcodec libxvid -pass 1 -an -f rawvideo -y /dev/null
667 </pre></td></tr></table>
670 <dt> ‘<samp>-passlogfile <var>prefix</var></samp>’</dt>
671 <dd><p>Set two-pass log file name prefix to <var>prefix</var>, the default file name
672 prefix is “ffmpeg2pass”. The complete file name will be
673 ‘<tt>PREFIX-N.log</tt>’, where N is a number specific to the output
677 <dt> ‘<samp>-newvideo</samp>’</dt>
678 <dd><p>Add a new video stream to the current output stream.
681 <dt> ‘<samp>-vlang <var>code</var></samp>’</dt>
682 <dd><p>Set the ISO 639 language code (3 letters) of the current video stream.
685 <dt> ‘<samp>-vf <var>filter_graph</var></samp>’</dt>
686 <dd><p><var>filter_graph</var> is a description of the filter graph to apply to
688 Use the option "-filters" to show all the available filters (including
689 also sources and sinks).
694 <a name="Advanced-Video-Options"></a>
695 <h2 class="section"><a href="ffmpeg.html#toc-Advanced-Video-Options">3.4 Advanced Video Options</a></h2>
697 <dl compact="compact">
698 <dt> ‘<samp>-pix_fmt <var>format</var></samp>’</dt>
699 <dd><p>Set pixel format. Use ’list’ as parameter to show all the supported
702 <dt> ‘<samp>-sws_flags <var>flags</var></samp>’</dt>
703 <dd><p>Set SwScaler flags.
705 <dt> ‘<samp>-g <var>gop_size</var></samp>’</dt>
706 <dd><p>Set the group of pictures size.
708 <dt> ‘<samp>-intra</samp>’</dt>
709 <dd><p>Use only intra frames.
711 <dt> ‘<samp>-vdt <var>n</var></samp>’</dt>
712 <dd><p>Discard threshold.
714 <dt> ‘<samp>-qscale <var>q</var></samp>’</dt>
715 <dd><p>Use fixed video quantizer scale (VBR).
717 <dt> ‘<samp>-qmin <var>q</var></samp>’</dt>
718 <dd><p>minimum video quantizer scale (VBR)
720 <dt> ‘<samp>-qmax <var>q</var></samp>’</dt>
721 <dd><p>maximum video quantizer scale (VBR)
723 <dt> ‘<samp>-qdiff <var>q</var></samp>’</dt>
724 <dd><p>maximum difference between the quantizer scales (VBR)
726 <dt> ‘<samp>-qblur <var>blur</var></samp>’</dt>
727 <dd><p>video quantizer scale blur (VBR) (range 0.0 - 1.0)
729 <dt> ‘<samp>-qcomp <var>compression</var></samp>’</dt>
730 <dd><p>video quantizer scale compression (VBR) (default 0.5).
731 Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0
734 <dt> ‘<samp>-lmin <var>lambda</var></samp>’</dt>
735 <dd><p>minimum video lagrange factor (VBR)
737 <dt> ‘<samp>-lmax <var>lambda</var></samp>’</dt>
738 <dd><p>max video lagrange factor (VBR)
740 <dt> ‘<samp>-mblmin <var>lambda</var></samp>’</dt>
741 <dd><p>minimum macroblock quantizer scale (VBR)
743 <dt> ‘<samp>-mblmax <var>lambda</var></samp>’</dt>
744 <dd><p>maximum macroblock quantizer scale (VBR)
746 <p>These four options (lmin, lmax, mblmin, mblmax) use ’lambda’ units,
747 but you may use the QP2LAMBDA constant to easily convert from ’q’ units:
748 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
749 </pre></td></tr></table>
752 <dt> ‘<samp>-rc_init_cplx <var>complexity</var></samp>’</dt>
753 <dd><p>initial complexity for single pass encoding
755 <dt> ‘<samp>-b_qfactor <var>factor</var></samp>’</dt>
756 <dd><p>qp factor between P- and B-frames
758 <dt> ‘<samp>-i_qfactor <var>factor</var></samp>’</dt>
759 <dd><p>qp factor between P- and I-frames
761 <dt> ‘<samp>-b_qoffset <var>offset</var></samp>’</dt>
762 <dd><p>qp offset between P- and B-frames
764 <dt> ‘<samp>-i_qoffset <var>offset</var></samp>’</dt>
765 <dd><p>qp offset between P- and I-frames
767 <dt> ‘<samp>-rc_eq <var>equation</var></samp>’</dt>
768 <dd><p>Set rate control equation (see section "Expression Evaluation")
769 (default = <code>tex^qComp</code>).
771 <p>When computing the rate control equation expression, besides the
772 standard functions defined in the section "Expression Evaluation", the
773 following functions are available:
774 </p><dl compact="compact">
775 <dt> <var>bits2qp(bits)</var></dt>
776 <dt> <var>qp2bits(qp)</var></dt>
779 <p>and the following constants are available:
780 </p><dl compact="compact">
781 <dt> <var>iTex</var></dt>
782 <dt> <var>pTex</var></dt>
783 <dt> <var>tex</var></dt>
784 <dt> <var>mv</var></dt>
785 <dt> <var>fCode</var></dt>
786 <dt> <var>iCount</var></dt>
787 <dt> <var>mcVar</var></dt>
788 <dt> <var>var</var></dt>
789 <dt> <var>isI</var></dt>
790 <dt> <var>isP</var></dt>
791 <dt> <var>isB</var></dt>
792 <dt> <var>avgQP</var></dt>
793 <dt> <var>qComp</var></dt>
794 <dt> <var>avgIITex</var></dt>
795 <dt> <var>avgPITex</var></dt>
796 <dt> <var>avgPPTex</var></dt>
797 <dt> <var>avgBPTex</var></dt>
798 <dt> <var>avgTex</var></dt>
802 <dt> ‘<samp>-rc_override <var>override</var></samp>’</dt>
803 <dd><p>rate control override for specific intervals
805 <dt> ‘<samp>-me_method <var>method</var></samp>’</dt>
806 <dd><p>Set motion estimation method to <var>method</var>.
807 Available methods are (from lowest to best quality):
808 </p><dl compact="compact">
809 <dt> ‘<samp>zero</samp>’</dt>
810 <dd><p>Try just the (0, 0) vector.
812 <dt> ‘<samp>phods</samp>’</dt>
813 <dt> ‘<samp>log</samp>’</dt>
814 <dt> ‘<samp>x1</samp>’</dt>
815 <dt> ‘<samp>hex</samp>’</dt>
816 <dt> ‘<samp>umh</samp>’</dt>
817 <dt> ‘<samp>epzs</samp>’</dt>
818 <dd><p>(default method)
820 <dt> ‘<samp>full</samp>’</dt>
821 <dd><p>exhaustive search (slow and marginally better than epzs)
826 <dt> ‘<samp>-dct_algo <var>algo</var></samp>’</dt>
827 <dd><p>Set DCT algorithm to <var>algo</var>. Available values are:
828 </p><dl compact="compact">
829 <dt> ‘<samp>0</samp>’</dt>
830 <dd><p>FF_DCT_AUTO (default)
832 <dt> ‘<samp>1</samp>’</dt>
833 <dd><p>FF_DCT_FASTINT
835 <dt> ‘<samp>2</samp>’</dt>
838 <dt> ‘<samp>3</samp>’</dt>
841 <dt> ‘<samp>4</samp>’</dt>
844 <dt> ‘<samp>5</samp>’</dt>
845 <dd><p>FF_DCT_ALTIVEC
850 <dt> ‘<samp>-idct_algo <var>algo</var></samp>’</dt>
851 <dd><p>Set IDCT algorithm to <var>algo</var>. Available values are:
852 </p><dl compact="compact">
853 <dt> ‘<samp>0</samp>’</dt>
854 <dd><p>FF_IDCT_AUTO (default)
856 <dt> ‘<samp>1</samp>’</dt>
859 <dt> ‘<samp>2</samp>’</dt>
860 <dd><p>FF_IDCT_SIMPLE
862 <dt> ‘<samp>3</samp>’</dt>
863 <dd><p>FF_IDCT_SIMPLEMMX
865 <dt> ‘<samp>4</samp>’</dt>
866 <dd><p>FF_IDCT_LIBMPEG2MMX
868 <dt> ‘<samp>5</samp>’</dt>
871 <dt> ‘<samp>6</samp>’</dt>
874 <dt> ‘<samp>7</samp>’</dt>
877 <dt> ‘<samp>8</samp>’</dt>
878 <dd><p>FF_IDCT_ALTIVEC
880 <dt> ‘<samp>9</samp>’</dt>
883 <dt> ‘<samp>10</samp>’</dt>
884 <dd><p>FF_IDCT_SIMPLEARM
889 <dt> ‘<samp>-er <var>n</var></samp>’</dt>
890 <dd><p>Set error resilience to <var>n</var>.
891 </p><dl compact="compact">
892 <dt> ‘<samp>1</samp>’</dt>
893 <dd><p>FF_ER_CAREFUL (default)
895 <dt> ‘<samp>2</samp>’</dt>
896 <dd><p>FF_ER_COMPLIANT
898 <dt> ‘<samp>3</samp>’</dt>
899 <dd><p>FF_ER_AGGRESSIVE
901 <dt> ‘<samp>4</samp>’</dt>
902 <dd><p>FF_ER_VERY_AGGRESSIVE
907 <dt> ‘<samp>-ec <var>bit_mask</var></samp>’</dt>
908 <dd><p>Set error concealment to <var>bit_mask</var>. <var>bit_mask</var> is a bit mask of
909 the following values:
910 </p><dl compact="compact">
911 <dt> ‘<samp>1</samp>’</dt>
912 <dd><p>FF_EC_GUESS_MVS (default = enabled)
914 <dt> ‘<samp>2</samp>’</dt>
915 <dd><p>FF_EC_DEBLOCK (default = enabled)
920 <dt> ‘<samp>-bf <var>frames</var></samp>’</dt>
921 <dd><p>Use ’frames’ B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
923 <dt> ‘<samp>-mbd <var>mode</var></samp>’</dt>
924 <dd><p>macroblock decision
925 </p><dl compact="compact">
926 <dt> ‘<samp>0</samp>’</dt>
927 <dd><p>FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in ffmpeg).
929 <dt> ‘<samp>1</samp>’</dt>
930 <dd><p>FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
932 <dt> ‘<samp>2</samp>’</dt>
933 <dd><p>FF_MB_DECISION_RD: rate distortion
938 <dt> ‘<samp>-4mv</samp>’</dt>
939 <dd><p>Use four motion vector by macroblock (MPEG-4 only).
941 <dt> ‘<samp>-part</samp>’</dt>
942 <dd><p>Use data partitioning (MPEG-4 only).
944 <dt> ‘<samp>-bug <var>param</var></samp>’</dt>
945 <dd><p>Work around encoder bugs that are not auto-detected.
947 <dt> ‘<samp>-strict <var>strictness</var></samp>’</dt>
948 <dd><p>How strictly to follow the standards.
950 <dt> ‘<samp>-aic</samp>’</dt>
951 <dd><p>Enable Advanced intra coding (h263+).
953 <dt> ‘<samp>-umv</samp>’</dt>
954 <dd><p>Enable Unlimited Motion Vector (h263+)
957 <dt> ‘<samp>-deinterlace</samp>’</dt>
958 <dd><p>Deinterlace pictures.
960 <dt> ‘<samp>-ilme</samp>’</dt>
961 <dd><p>Force interlacing support in encoder (MPEG-2 and MPEG-4 only).
962 Use this option if your input file is interlaced and you want
963 to keep the interlaced format for minimum losses.
964 The alternative is to deinterlace the input stream with
965 ‘<samp>-deinterlace</samp>’, but deinterlacing introduces losses.
967 <dt> ‘<samp>-psnr</samp>’</dt>
968 <dd><p>Calculate PSNR of compressed frames.
970 <dt> ‘<samp>-vstats</samp>’</dt>
971 <dd><p>Dump video coding statistics to ‘<tt>vstats_HHMMSS.log</tt>’.
973 <dt> ‘<samp>-vstats_file <var>file</var></samp>’</dt>
974 <dd><p>Dump video coding statistics to <var>file</var>.
976 <dt> ‘<samp>-top <var>n</var></samp>’</dt>
977 <dd><p>top=1/bottom=0/auto=-1 field first
979 <dt> ‘<samp>-dc <var>precision</var></samp>’</dt>
980 <dd><p>Intra_dc_precision.
982 <dt> ‘<samp>-vtag <var>fourcc/tag</var></samp>’</dt>
983 <dd><p>Force video tag/fourcc.
985 <dt> ‘<samp>-qphist</samp>’</dt>
986 <dd><p>Show QP histogram.
988 <dt> ‘<samp>-vbsf <var>bitstream_filter</var></samp>’</dt>
989 <dd><p>Bitstream filters available are "dump_extra", "remove_extra", "noise", "h264_mp4toannexb", "imxdump", "mjpegadump", "mjpeg2jpeg".
990 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i h264.mp4 -vcodec copy -vbsf h264_mp4toannexb -an out.h264
991 </pre></td></tr></table>
993 <dt> ‘<samp>-force_key_frames <var>time</var>[,<var>time</var>...]</samp>’</dt>
994 <dd><p>Force key frames at the specified timestamps, more precisely at the first
995 frames after each specified time.
996 This option can be useful to ensure that a seek point is present at a
997 chapter mark or any other designated place in the output file.
998 The timestamps must be specified in ascending order.
1002 <a name="Audio-Options"></a>
1003 <h2 class="section"><a href="ffmpeg.html#toc-Audio-Options">3.5 Audio Options</a></h2>
1005 <dl compact="compact">
1006 <dt> ‘<samp>-aframes <var>number</var></samp>’</dt>
1007 <dd><p>Set the number of audio frames to record.
1009 <dt> ‘<samp>-ar <var>freq</var></samp>’</dt>
1010 <dd><p>Set the audio sampling frequency. For input streams it is set by
1011 default to 44100 Hz, for output streams it is set by default to the
1012 frequency of the input stream. If the input file has audio streams
1013 with different frequencies, the behaviour is undefined.
1015 <dt> ‘<samp>-ab <var>bitrate</var></samp>’</dt>
1016 <dd><p>Set the audio bitrate in bit/s (default = 64k).
1018 <dt> ‘<samp>-aq <var>q</var></samp>’</dt>
1019 <dd><p>Set the audio quality (codec-specific, VBR).
1021 <dt> ‘<samp>-ac <var>channels</var></samp>’</dt>
1022 <dd><p>Set the number of audio channels. For input streams it is set by
1023 default to 1, for output streams it is set by default to the same
1024 number of audio channels in input. If the input file has audio streams
1025 with different channel count, the behaviour is undefined.
1027 <dt> ‘<samp>-an</samp>’</dt>
1028 <dd><p>Disable audio recording.
1030 <dt> ‘<samp>-acodec <var>codec</var></samp>’</dt>
1031 <dd><p>Force audio codec to <var>codec</var>. Use the <code>copy</code> special value to
1032 specify that the raw codec data must be copied as is.
1034 <dt> ‘<samp>-newaudio</samp>’</dt>
1035 <dd><p>Add a new audio track to the output file. If you want to specify parameters,
1036 do so before <code>-newaudio</code> (<code>-acodec</code>, <code>-ab</code>, etc..).
1038 <p>Mapping will be done automatically, if the number of output streams is equal to
1039 the number of input streams, else it will pick the first one that matches. You
1040 can override the mapping using <code>-map</code> as usual.
1043 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i file.mpg -vcodec copy -acodec ac3 -ab 384k test.mpg -acodec mp2 -ab 192k -newaudio
1044 </pre></td></tr></table>
1046 <dt> ‘<samp>-alang <var>code</var></samp>’</dt>
1047 <dd><p>Set the ISO 639 language code (3 letters) of the current audio stream.
1051 <a name="Advanced-Audio-options_003a"></a>
1052 <h2 class="section"><a href="ffmpeg.html#toc-Advanced-Audio-options_003a">3.6 Advanced Audio options:</a></h2>
1054 <dl compact="compact">
1055 <dt> ‘<samp>-atag <var>fourcc/tag</var></samp>’</dt>
1056 <dd><p>Force audio tag/fourcc.
1058 <dt> ‘<samp>-audio_service_type <var>type</var></samp>’</dt>
1059 <dd><p>Set the type of service that the audio stream contains.
1060 </p><dl compact="compact">
1061 <dt> ‘<samp>ma</samp>’</dt>
1062 <dd><p>Main Audio Service (default)
1064 <dt> ‘<samp>ef</samp>’</dt>
1067 <dt> ‘<samp>vi</samp>’</dt>
1068 <dd><p>Visually Impaired
1070 <dt> ‘<samp>hi</samp>’</dt>
1071 <dd><p>Hearing Impaired
1073 <dt> ‘<samp>di</samp>’</dt>
1076 <dt> ‘<samp>co</samp>’</dt>
1079 <dt> ‘<samp>em</samp>’</dt>
1082 <dt> ‘<samp>vo</samp>’</dt>
1085 <dt> ‘<samp>ka</samp>’</dt>
1090 <dt> ‘<samp>-absf <var>bitstream_filter</var></samp>’</dt>
1091 <dd><p>Bitstream filters available are "dump_extra", "remove_extra", "noise", "mp3comp", "mp3decomp".
1095 <a name="Subtitle-options_003a"></a>
1096 <h2 class="section"><a href="ffmpeg.html#toc-Subtitle-options_003a">3.7 Subtitle options:</a></h2>
1098 <dl compact="compact">
1099 <dt> ‘<samp>-scodec <var>codec</var></samp>’</dt>
1100 <dd><p>Force subtitle codec (’copy’ to copy stream).
1102 <dt> ‘<samp>-newsubtitle</samp>’</dt>
1103 <dd><p>Add a new subtitle stream to the current output stream.
1105 <dt> ‘<samp>-slang <var>code</var></samp>’</dt>
1106 <dd><p>Set the ISO 639 language code (3 letters) of the current subtitle stream.
1108 <dt> ‘<samp>-sn</samp>’</dt>
1109 <dd><p>Disable subtitle recording.
1111 <dt> ‘<samp>-sbsf <var>bitstream_filter</var></samp>’</dt>
1112 <dd><p>Bitstream filters available are "mov2textsub", "text2movsub".
1113 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i file.mov -an -vn -sbsf mov2textsub -scodec copy -f rawvideo sub.txt
1114 </pre></td></tr></table>
1118 <a name="Audio_002fVideo-grab-options"></a>
1119 <h2 class="section"><a href="ffmpeg.html#toc-Audio_002fVideo-grab-options">3.8 Audio/Video grab options</a></h2>
1121 <dl compact="compact">
1122 <dt> ‘<samp>-vc <var>channel</var></samp>’</dt>
1123 <dd><p>Set video grab channel (DV1394 only).
1125 <dt> ‘<samp>-tvstd <var>standard</var></samp>’</dt>
1126 <dd><p>Set television standard (NTSC, PAL (SECAM)).
1128 <dt> ‘<samp>-isync</samp>’</dt>
1129 <dd><p>Synchronize read on input.
1133 <a name="Advanced-options"></a>
1134 <h2 class="section"><a href="ffmpeg.html#toc-Advanced-options">3.9 Advanced options</a></h2>
1136 <dl compact="compact">
1137 <dt> ‘<samp>-map <var>input_file_id</var>.<var>input_stream_id</var>[:<var>sync_file_id</var>.<var>sync_stream_id</var>]</samp>’</dt>
1139 <p>Designate an input stream as a source for the output file. Each input
1140 stream is identified by the input file index <var>input_file_id</var> and
1141 the input stream index <var>input_stream_id</var> within the input
1142 file. Both indexes start at 0. If specified,
1143 <var>sync_file_id</var>.<var>sync_stream_id</var> sets which input stream
1144 is used as a presentation sync reference.
1146 <p>The <code>-map</code> options must be specified just after the output file.
1147 If any <code>-map</code> options are used, the number of <code>-map</code> options
1148 on the command line must match the number of streams in the output
1149 file. The first <code>-map</code> option on the command line specifies the
1150 source for output stream 0, the second <code>-map</code> option specifies
1151 the source for output stream 1, etc.
1153 <p>For example, if you have two audio streams in the first input file,
1154 these streams are identified by "0.0" and "0.1". You can use
1155 <code>-map</code> to select which stream to place in an output file. For
1157 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT out.wav -map 0.1
1158 </pre></td></tr></table>
1159 <p>will map the input stream in ‘<tt>INPUT</tt>’ identified by "0.1" to
1160 the (single) output stream in ‘<tt>out.wav</tt>’.
1162 <p>For example, to select the stream with index 2 from input file
1163 ‘<tt>a.mov</tt>’ (specified by the identifier "0.2"), and stream with
1164 index 6 from input ‘<tt>b.mov</tt>’ (specified by the identifier "1.6"),
1165 and copy them to the output file ‘<tt>out.mov</tt>’:
1166 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i a.mov -i b.mov -vcodec copy -acodec copy out.mov -map 0.2 -map 1.6
1167 </pre></td></tr></table>
1169 <p>To add more streams to the output file, you can use the
1170 <code>-newaudio</code>, <code>-newvideo</code>, <code>-newsubtitle</code> options.
1173 <dt> ‘<samp>-map_meta_data <var>outfile</var>[,<var>metadata</var>]:<var>infile</var>[,<var>metadata</var>]</samp>’</dt>
1174 <dd><p>Deprecated, use <var>-map_metadata</var> instead.
1177 <dt> ‘<samp>-map_metadata <var>outfile</var>[,<var>metadata</var>]:<var>infile</var>[,<var>metadata</var>]</samp>’</dt>
1178 <dd><p>Set metadata information of <var>outfile</var> from <var>infile</var>. Note that those
1179 are file indices (zero-based), not filenames.
1180 Optional <var>metadata</var> parameters specify, which metadata to copy - (g)lobal
1181 (i.e. metadata that applies to the whole file), per-(s)tream, per-(c)hapter or
1182 per-(p)rogram. All metadata specifiers other than global must be followed by the
1183 stream/chapter/program number. If metadata specifier is omitted, it defaults to
1186 <p>By default, global metadata is copied from the first input file to all output files,
1187 per-stream and per-chapter metadata is copied along with streams/chapters. These
1188 default mappings are disabled by creating any mapping of the relevant type. A negative
1189 file index can be used to create a dummy mapping that just disables automatic copying.
1191 <p>For example to copy metadata from the first stream of the input file to global metadata
1193 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i in.ogg -map_metadata 0:0,s0 out.mp3
1194 </pre></td></tr></table>
1196 <dt> ‘<samp>-map_chapters <var>outfile</var>:<var>infile</var></samp>’</dt>
1197 <dd><p>Copy chapters from <var>infile</var> to <var>outfile</var>. If no chapter mapping is specified,
1198 then chapters are copied from the first input file with at least one chapter to all
1199 output files. Use a negative file index to disable any chapter copying.
1201 <dt> ‘<samp>-debug</samp>’</dt>
1202 <dd><p>Print specific debug info.
1204 <dt> ‘<samp>-benchmark</samp>’</dt>
1205 <dd><p>Show benchmarking information at the end of an encode.
1206 Shows CPU time used and maximum memory consumption.
1207 Maximum memory consumption is not supported on all systems,
1208 it will usually display as 0 if not supported.
1210 <dt> ‘<samp>-dump</samp>’</dt>
1211 <dd><p>Dump each input packet.
1213 <dt> ‘<samp>-hex</samp>’</dt>
1214 <dd><p>When dumping packets, also dump the payload.
1216 <dt> ‘<samp>-bitexact</samp>’</dt>
1217 <dd><p>Only use bit exact algorithms (for codec testing).
1219 <dt> ‘<samp>-ps <var>size</var></samp>’</dt>
1220 <dd><p>Set RTP payload size in bytes.
1222 <dt> ‘<samp>-re</samp>’</dt>
1223 <dd><p>Read input at native frame rate. Mainly used to simulate a grab device.
1225 <dt> ‘<samp>-loop_input</samp>’</dt>
1226 <dd><p>Loop over the input stream. Currently it works only for image
1227 streams. This option is used for automatic FFserver testing.
1229 <dt> ‘<samp>-loop_output <var>number_of_times</var></samp>’</dt>
1230 <dd><p>Repeatedly loop output for formats that support looping such as animated GIF
1231 (0 will loop the output infinitely).
1233 <dt> ‘<samp>-threads <var>count</var></samp>’</dt>
1234 <dd><p>Thread count.
1236 <dt> ‘<samp>-vsync <var>parameter</var></samp>’</dt>
1237 <dd><p>Video sync method.
1239 <dl compact="compact">
1240 <dt> ‘<samp>0</samp>’</dt>
1241 <dd><p>Each frame is passed with its timestamp from the demuxer to the muxer.
1243 <dt> ‘<samp>1</samp>’</dt>
1244 <dd><p>Frames will be duplicated and dropped to achieve exactly the requested
1247 <dt> ‘<samp>2</samp>’</dt>
1248 <dd><p>Frames are passed through with their timestamp or dropped so as to
1249 prevent 2 frames from having the same timestamp.
1251 <dt> ‘<samp>-1</samp>’</dt>
1252 <dd><p>Chooses between 1 and 2 depending on muxer capabilities. This is the
1257 <p>With -map you can select from which stream the timestamps should be
1258 taken. You can leave either video or audio unchanged and sync the
1259 remaining stream(s) to the unchanged one.
1262 <dt> ‘<samp>-async <var>samples_per_second</var></samp>’</dt>
1263 <dd><p>Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps,
1264 the parameter is the maximum samples per second by which the audio is changed.
1265 -async 1 is a special case where only the start of the audio stream is corrected
1266 without any later correction.
1268 <dt> ‘<samp>-copyts</samp>’</dt>
1269 <dd><p>Copy timestamps from input to output.
1271 <dt> ‘<samp>-copytb</samp>’</dt>
1272 <dd><p>Copy input stream time base from input to output when stream copying.
1274 <dt> ‘<samp>-shortest</samp>’</dt>
1275 <dd><p>Finish encoding when the shortest input stream ends.
1277 <dt> ‘<samp>-dts_delta_threshold</samp>’</dt>
1278 <dd><p>Timestamp discontinuity delta threshold.
1280 <dt> ‘<samp>-muxdelay <var>seconds</var></samp>’</dt>
1281 <dd><p>Set the maximum demux-decode delay.
1283 <dt> ‘<samp>-muxpreload <var>seconds</var></samp>’</dt>
1284 <dd><p>Set the initial demux-decode delay.
1286 <dt> ‘<samp>-streamid <var>output-stream-index</var>:<var>new-value</var></samp>’</dt>
1287 <dd><p>Assign a new stream-id value to an output stream. This option should be
1288 specified prior to the output filename to which it applies.
1289 For the situation where multiple output files exist, a streamid
1290 may be reassigned to a different value.
1292 <p>For example, to set the stream 0 PID to 33 and the stream 1 PID to 36 for
1293 an output mpegts file:
1294 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i infile -streamid 0:33 -streamid 1:36 out.ts
1295 </pre></td></tr></table>
1299 <a name="Preset-files"></a>
1300 <h2 class="section"><a href="ffmpeg.html#toc-Preset-files">3.10 Preset files</a></h2>
1302 <p>A preset file contains a sequence of <var>option</var>=<var>value</var> pairs,
1303 one for each line, specifying a sequence of options which would be
1304 awkward to specify on the command line. Lines starting with the hash
1305 (’#’) character are ignored and are used to provide comments. Check
1306 the ‘<tt>ffpresets</tt>’ directory in the FFmpeg source tree for examples.
1308 <p>Preset files are specified with the <code>vpre</code>, <code>apre</code>,
1309 <code>spre</code>, and <code>fpre</code> options. The <code>fpre</code> option takes the
1310 filename of the preset instead of a preset name as input and can be
1311 used for any kind of codec. For the <code>vpre</code>, <code>apre</code>, and
1312 <code>spre</code> options, the options specified in a preset file are
1313 applied to the currently selected codec of the same type as the preset
1316 <p>The argument passed to the <code>vpre</code>, <code>apre</code>, and <code>spre</code>
1317 preset options identifies the preset file to use according to the
1320 <p>First ffmpeg searches for a file named <var>arg</var>.ffpreset in the
1321 directories ‘<tt>$FFMPEG_DATADIR</tt>’ (if set), and ‘<tt>$HOME/.ffmpeg</tt>’, and in
1322 the datadir defined at configuration time (usually ‘<tt>PREFIX/share/ffmpeg</tt>’)
1323 in that order. For example, if the argument is <code>libx264-max</code>, it will
1324 search for the file ‘<tt>libx264-max.ffpreset</tt>’.
1326 <p>If no such file is found, then ffmpeg will search for a file named
1327 <var>codec_name</var>-<var>arg</var>.ffpreset in the above-mentioned
1328 directories, where <var>codec_name</var> is the name of the codec to which
1329 the preset file options will be applied. For example, if you select
1330 the video codec with <code>-vcodec libx264</code> and use <code>-vpre max</code>,
1331 then it will search for the file ‘<tt>libx264-max.ffpreset</tt>’.
1334 <h1 class="chapter"><a href="ffmpeg.html#toc-Tips">4. Tips</a></h1>
1338 For streaming at very low bitrate application, use a low frame rate
1339 and a small GOP size. This is especially true for RealVideo where
1340 the Linux player does not seem to be very fast, so it can miss
1341 frames. An example is:
1343 <table><tr><td> </td><td><pre class="example">ffmpeg -g 3 -r 3 -t 10 -b 50k -s qcif -f rv10 /tmp/b.rm
1344 </pre></td></tr></table>
1347 The parameter ’q’ which is displayed while encoding is the current
1348 quantizer. The value 1 indicates that a very good quality could
1349 be achieved. The value 31 indicates the worst quality. If q=31 appears
1350 too often, it means that the encoder cannot compress enough to meet
1351 your bitrate. You must either increase the bitrate, decrease the
1352 frame rate or decrease the frame size.
1355 If your computer is not fast enough, you can speed up the
1356 compression at the expense of the compression ratio. You can use
1357 ’-me zero’ to speed up motion estimation, and ’-intra’ to disable
1358 motion estimation completely (you have only I-frames, which means it
1359 is about as good as JPEG compression).
1362 To have very low audio bitrates, reduce the sampling frequency
1363 (down to 22050 Hz for MPEG audio, 22050 or 11025 for AC-3).
1366 To have a constant quality (but a variable bitrate), use the option
1367 ’-qscale n’ when ’n’ is between 1 (excellent quality) and 31 (worst
1371 When converting video files, you can use the ’-sameq’ option which
1372 uses the same quality factor in the encoder as in the decoder.
1373 It allows almost lossless encoding.
1377 <a name="Examples"></a>
1378 <h1 class="chapter"><a href="ffmpeg.html#toc-Examples">5. Examples</a></h1>
1380 <a name="Video-and-Audio-grabbing"></a>
1381 <h2 class="section"><a href="ffmpeg.html#toc-Video-and-Audio-grabbing">5.1 Video and Audio grabbing</a></h2>
1383 <p>If you specify the input format and device then ffmpeg can grab video
1386 <table><tr><td> </td><td><pre class="example">ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg
1387 </pre></td></tr></table>
1389 <p>Note that you must activate the right video source and channel before
1390 launching ffmpeg with any TV viewer such as xawtv
1391 (<a href="http://linux.bytesex.org/xawtv/">http://linux.bytesex.org/xawtv/</a>) by Gerd Knorr. You also
1392 have to set the audio recording levels correctly with a
1395 <a name="X11-grabbing"></a>
1396 <h2 class="section"><a href="ffmpeg.html#toc-X11-grabbing">5.2 X11 grabbing</a></h2>
1398 <p>Grab the X11 display with ffmpeg via
1400 <table><tr><td> </td><td><pre class="example">ffmpeg -f x11grab -s cif -r 25 -i :0.0 /tmp/out.mpg
1401 </pre></td></tr></table>
1403 <p>0.0 is display.screen number of your X11 server, same as
1404 the DISPLAY environment variable.
1406 <table><tr><td> </td><td><pre class="example">ffmpeg -f x11grab -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg
1407 </pre></td></tr></table>
1409 <p>0.0 is display.screen number of your X11 server, same as the DISPLAY environment
1410 variable. 10 is the x-offset and 20 the y-offset for the grabbing.
1412 <a name="Video-and-Audio-file-format-conversion"></a>
1413 <h2 class="section"><a href="ffmpeg.html#toc-Video-and-Audio-file-format-conversion">5.3 Video and Audio file format conversion</a></h2>
1415 <p>Any supported file format and protocol can serve as input to ffmpeg:
1420 You can use YUV files as input:
1422 <table><tr><td> </td><td><pre class="example">ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
1423 </pre></td></tr></table>
1425 <p>It will use the files:
1426 </p><table><tr><td> </td><td><pre class="example">/tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
1427 /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
1428 </pre></td></tr></table>
1430 <p>The Y files use twice the resolution of the U and V files. They are
1431 raw files, without header. They can be generated by all decent video
1432 decoders. You must specify the size of the image with the ‘<samp>-s</samp>’ option
1433 if ffmpeg cannot guess it.
1436 You can input from a raw YUV420P file:
1438 <table><tr><td> </td><td><pre class="example">ffmpeg -i /tmp/test.yuv /tmp/out.avi
1439 </pre></td></tr></table>
1441 <p>test.yuv is a file containing raw YUV planar data. Each frame is composed
1442 of the Y plane followed by the U and V planes at half vertical and
1443 horizontal resolution.
1446 You can output to a raw YUV420P file:
1448 <table><tr><td> </td><td><pre class="example">ffmpeg -i mydivx.avi hugefile.yuv
1449 </pre></td></tr></table>
1452 You can set several input files and output files:
1454 <table><tr><td> </td><td><pre class="example">ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
1455 </pre></td></tr></table>
1457 <p>Converts the audio file a.wav and the raw YUV video file a.yuv
1461 You can also do audio and video conversions at the same time:
1463 <table><tr><td> </td><td><pre class="example">ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
1464 </pre></td></tr></table>
1466 <p>Converts a.wav to MPEG audio at 22050 Hz sample rate.
1469 You can encode to several formats at the same time and define a
1470 mapping from input stream to output streams:
1472 <table><tr><td> </td><td><pre class="example">ffmpeg -i /tmp/a.wav -ab 64k /tmp/a.mp2 -ab 128k /tmp/b.mp2 -map 0:0 -map 0:0
1473 </pre></td></tr></table>
1475 <p>Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits. ’-map
1476 file:index’ specifies which input stream is used for each output
1477 stream, in the order of the definition of output streams.
1480 You can transcode decrypted VOBs:
1482 <table><tr><td> </td><td><pre class="example">ffmpeg -i snatch_1.vob -f avi -vcodec mpeg4 -b 800k -g 300 -bf 2 -acodec libmp3lame -ab 128k snatch.avi
1483 </pre></td></tr></table>
1485 <p>This is a typical DVD ripping example; the input is a VOB file, the
1486 output an AVI file with MPEG-4 video and MP3 audio. Note that in this
1487 command we use B-frames so the MPEG-4 stream is DivX5 compatible, and
1488 GOP size is 300 which means one intra frame every 10 seconds for 29.97fps
1489 input video. Furthermore, the audio stream is MP3-encoded so you need
1490 to enable LAME support by passing <code>--enable-libmp3lame</code> to configure.
1491 The mapping is particularly useful for DVD transcoding
1492 to get the desired audio language.
1494 <p>NOTE: To see the supported input formats, use <code>ffmpeg -formats</code>.
1497 You can extract images from a video, or create a video from many images:
1499 <p>For extracting images from a video:
1500 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
1501 </pre></td></tr></table>
1503 <p>This will extract one video frame per second from the video and will
1504 output them in files named ‘<tt>foo-001.jpeg</tt>’, ‘<tt>foo-002.jpeg</tt>’,
1505 etc. Images will be rescaled to fit the new WxH values.
1507 <p>If you want to extract just a limited number of frames, you can use the
1508 above command in combination with the -vframes or -t option, or in
1509 combination with -ss to start extracting from a certain point in time.
1511 <p>For creating a video from many images:
1512 </p><table><tr><td> </td><td><pre class="example">ffmpeg -f image2 -i foo-%03d.jpeg -r 12 -s WxH foo.avi
1513 </pre></td></tr></table>
1515 <p>The syntax <code>foo-%03d.jpeg</code> specifies to use a decimal number
1516 composed of three digits padded with zeroes to express the sequence
1517 number. It is the same syntax supported by the C printf function, but
1518 only formats accepting a normal integer are suitable.
1521 You can put many streams of the same type in the output:
1523 <table><tr><td> </td><td><pre class="example">ffmpeg -i test1.avi -i test2.avi -vcodec copy -acodec copy -vcodec copy -acodec copy test12.avi -newvideo -newaudio
1524 </pre></td></tr></table>
1526 <p>In addition to the first video and audio streams, the resulting
1527 output file ‘<tt>test12.avi</tt>’ will contain the second video
1528 and the second audio stream found in the input streams list.
1530 <p>The <code>-newvideo</code>, <code>-newaudio</code> and <code>-newsubtitle</code>
1531 options have to be specified immediately after the name of the output
1532 file to which you want to add them.
1536 <a name="Expression-Evaluation"></a>
1537 <h1 class="chapter"><a href="ffmpeg.html#toc-Expression-Evaluation">6. Expression Evaluation</a></h1>
1539 <p>When evaluating an arithemetic expression, FFmpeg uses an internal
1540 formula evaluator, implemented through the ‘<tt>libavutil/eval.h</tt>’
1543 <p>An expression may contain unary, binary operators, constants, and
1546 <p>Two expressions <var>expr1</var> and <var>expr2</var> can be combined to form
1547 another expression "<var>expr1</var>;<var>expr2</var>".
1548 <var>expr1</var> and <var>expr2</var> are evaluated in turn, and the new
1549 expression evaluates to the value of <var>expr2</var>.
1551 <p>The following binary operators are available: <code>+</code>, <code>-</code>,
1552 <code>*</code>, <code>/</code>, <code>^</code>.
1554 <p>The following unary operators are available: <code>+</code>, <code>-</code>.
1556 <p>The following functions are available:
1557 </p><dl compact="compact">
1558 <dt> ‘<samp>sinh(x)</samp>’</dt>
1559 <dt> ‘<samp>cosh(x)</samp>’</dt>
1560 <dt> ‘<samp>tanh(x)</samp>’</dt>
1561 <dt> ‘<samp>sin(x)</samp>’</dt>
1562 <dt> ‘<samp>cos(x)</samp>’</dt>
1563 <dt> ‘<samp>tan(x)</samp>’</dt>
1564 <dt> ‘<samp>atan(x)</samp>’</dt>
1565 <dt> ‘<samp>asin(x)</samp>’</dt>
1566 <dt> ‘<samp>acos(x)</samp>’</dt>
1567 <dt> ‘<samp>exp(x)</samp>’</dt>
1568 <dt> ‘<samp>log(x)</samp>’</dt>
1569 <dt> ‘<samp>abs(x)</samp>’</dt>
1570 <dt> ‘<samp>squish(x)</samp>’</dt>
1571 <dt> ‘<samp>gauss(x)</samp>’</dt>
1572 <dt> ‘<samp>isnan(x)</samp>’</dt>
1573 <dd><p>Return 1.0 if <var>x</var> is NAN, 0.0 otherwise.
1576 <dt> ‘<samp>mod(x, y)</samp>’</dt>
1577 <dt> ‘<samp>max(x, y)</samp>’</dt>
1578 <dt> ‘<samp>min(x, y)</samp>’</dt>
1579 <dt> ‘<samp>eq(x, y)</samp>’</dt>
1580 <dt> ‘<samp>gte(x, y)</samp>’</dt>
1581 <dt> ‘<samp>gt(x, y)</samp>’</dt>
1582 <dt> ‘<samp>lte(x, y)</samp>’</dt>
1583 <dt> ‘<samp>lt(x, y)</samp>’</dt>
1584 <dt> ‘<samp>st(var, expr)</samp>’</dt>
1585 <dd><p>Allow to store the value of the expression <var>expr</var> in an internal
1586 variable. <var>var</var> specifies the number of the variable where to
1587 store the value, and it is a value ranging from 0 to 9. The function
1588 returns the value stored in the internal variable.
1591 <dt> ‘<samp>ld(var)</samp>’</dt>
1592 <dd><p>Allow to load the value of the internal variable with number
1593 <var>var</var>, which was previosly stored with st(<var>var</var>, <var>expr</var>).
1594 The function returns the loaded value.
1597 <dt> ‘<samp>while(cond, expr)</samp>’</dt>
1598 <dd><p>Evaluate expression <var>expr</var> while the expression <var>cond</var> is
1599 non-zero, and returns the value of the last <var>expr</var> evaluation, or
1600 NAN if <var>cond</var> was always false.
1603 <dt> ‘<samp>ceil(expr)</samp>’</dt>
1604 <dd><p>Round the value of expression <var>expr</var> upwards to the nearest
1605 integer. For example, "ceil(1.5)" is "2.0".
1608 <dt> ‘<samp>floor(expr)</samp>’</dt>
1609 <dd><p>Round the value of expression <var>expr</var> downwards to the nearest
1610 integer. For example, "floor(-1.5)" is "-2.0".
1613 <dt> ‘<samp>trunc(expr)</samp>’</dt>
1614 <dd><p>Round the value of expression <var>expr</var> towards zero to the nearest
1615 integer. For example, "trunc(-1.5)" is "-1.0".
1618 <dt> ‘<samp>sqrt(expr)</samp>’</dt>
1619 <dd><p>Compute the square root of <var>expr</var>. This is equivalent to
1620 "(<var>expr</var>)^.5".
1626 <p><code>*</code> works like AND
1628 <p><code>+</code> works like OR
1631 </p><table><tr><td> </td><td><pre class="example">if A then B else C
1632 </pre></td></tr></table>
1634 </p><table><tr><td> </td><td><pre class="example">A*B + not(A)*C
1635 </pre></td></tr></table>
1637 <p>When A evaluates to either 1 or 0, that is the same as
1638 </p><table><tr><td> </td><td><pre class="example">A*B + eq(A,0)*C
1639 </pre></td></tr></table>
1641 <p>In your C code, you can extend the list of unary and binary functions,
1642 and define recognized constants, so that they are available for your
1645 <p>The evaluator also recognizes the International System number
1646 postfixes. If ’i’ is appended after the postfix, powers of 2 are used
1647 instead of powers of 10. The ’B’ postfix multiplies the value for 8,
1648 and can be appended after another postfix or used alone. This allows
1649 using for example ’KB’, ’MiB’, ’G’ and ’B’ as postfix.
1651 <p>Follows the list of available International System postfixes, with
1652 indication of the corresponding powers of 10 and of 2.
1653 </p><dl compact="compact">
1654 <dt> ‘<samp>y</samp>’</dt>
1657 <dt> ‘<samp>z</samp>’</dt>
1660 <dt> ‘<samp>a</samp>’</dt>
1663 <dt> ‘<samp>f</samp>’</dt>
1666 <dt> ‘<samp>p</samp>’</dt>
1669 <dt> ‘<samp>n</samp>’</dt>
1672 <dt> ‘<samp>u</samp>’</dt>
1675 <dt> ‘<samp>m</samp>’</dt>
1678 <dt> ‘<samp>c</samp>’</dt>
1681 <dt> ‘<samp>d</samp>’</dt>
1684 <dt> ‘<samp>h</samp>’</dt>
1687 <dt> ‘<samp>k</samp>’</dt>
1690 <dt> ‘<samp>K</samp>’</dt>
1693 <dt> ‘<samp>M</samp>’</dt>
1696 <dt> ‘<samp>G</samp>’</dt>
1699 <dt> ‘<samp>T</samp>’</dt>
1702 <dt> ‘<samp>P</samp>’</dt>
1705 <dt> ‘<samp>E</samp>’</dt>
1708 <dt> ‘<samp>Z</samp>’</dt>
1711 <dt> ‘<samp>Y</samp>’</dt>
1716 <a name="Encoders"></a>
1717 <h1 class="chapter"><a href="ffmpeg.html#toc-Encoders">7. Encoders</a></h1>
1719 <p>Encoders are configured elements in FFmpeg which allow the encoding of
1722 <p>When you configure your FFmpeg build, all the supported native encoders
1723 are enabled by default. Encoders requiring an external library must be enabled
1724 manually via the corresponding <code>--enable-lib</code> option. You can list all
1725 available encoders using the configure option <code>--list-encoders</code>.
1727 <p>You can disable all the encoders with the configure option
1728 <code>--disable-encoders</code> and selectively enable / disable single encoders
1729 with the options <code>--enable-encoder=<var>ENCODER</var></code> /
1730 <code>--disable-encoder=<var>ENCODER</var></code>.
1732 <p>The option <code>-codecs</code> of the ff* tools will display the list of
1735 <p>A description of some of the currently available encoders follows.
1737 <a name="Audio-Encoders"></a>
1738 <h2 class="section"><a href="ffmpeg.html#toc-Audio-Encoders">7.1 Audio Encoders</a></h2>
1740 <a name="ac3-and-ac3_005ffixed"></a>
1741 <h3 class="subsection"><a href="ffmpeg.html#toc-ac3-and-ac3_005ffixed">7.1.1 ac3 and ac3_fixed</a></h3>
1743 <p>AC-3 audio encoders.
1745 <p>These encoders implement part of ATSC A/52:2010 and ETSI TS 102 366, as well as
1746 the undocumented RealAudio 3 (a.k.a. dnet).
1748 <p>The <var>ac3</var> encoder uses floating-point math, while the <var>ac3_fixed</var>
1749 encoder only uses fixed-point integer math. This does not mean that one is
1750 always faster, just that one or the other may be better suited to a
1751 particular system. The floating-point encoder will generally produce better
1752 quality audio for a given bitrate. The <var>ac3_fixed</var> encoder is not the
1753 default codec for any of the output formats, so it must be specified explicitly
1754 using the option <code>-acodec ac3_fixed</code> in order to use it.
1756 <a name="AC_002d3-Metadata"></a>
1757 <h3 class="subheading">AC-3 Metadata</h3>
1759 <p>The AC-3 metadata options are used to set parameters that describe the audio,
1760 but in most cases do not affect the audio encoding itself. Some of the options
1761 do directly affect or influence the decoding and playback of the resulting
1762 bitstream, while others are just for informational purposes. A few of the
1763 options will add bits to the output stream that could otherwise be used for
1764 audio data, and will thus affect the quality of the output. Those will be
1765 indicated accordingly with a note in the option list below.
1767 <p>These parameters are described in detail in several publicly-available
1770 <li> <a href="http://www.atsc.org/cms/standards/a_52-2010.pdf">A/52:2010 - Digital Audio Compression (AC-3) (E-AC-3) Standard</a>
1771 </li><li> <a href="http://www.atsc.org/cms/standards/a_54a_with_corr_1.pdf">A/54 - Guide to the Use of the ATSC Digital Television Standard</a>
1772 </li><li> <a href="http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/18_Metadata.Guide.pdf">Dolby Metadata Guide</a>
1773 </li><li> <a href="http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/46_DDEncodingGuidelines.pdf">Dolby Digital Professional Encoding Guidelines</a>
1776 <a name="Metadata-Control-Options"></a>
1777 <h4 class="subsubheading">Metadata Control Options</h4>
1779 <dl compact="compact">
1780 <dt> ‘<samp>-per_frame_metadata <var>boolean</var></samp>’</dt>
1781 <dd><p>Allow Per-Frame Metadata. Specifies if the encoder should check for changing
1782 metadata for each frame.
1783 </p><dl compact="compact">
1784 <dt> ‘<samp>0</samp>’</dt>
1785 <dd><p>The metadata values set at initialization will be used for every frame in the
1788 <dt> ‘<samp>1</samp>’</dt>
1789 <dd><p>Metadata values can be changed before encoding each frame.
1796 <a name="Downmix-Levels"></a>
1797 <h4 class="subsubheading">Downmix Levels</h4>
1799 <dl compact="compact">
1800 <dt> ‘<samp>-center_mixlev <var>level</var></samp>’</dt>
1801 <dd><p>Center Mix Level. The amount of gain the decoder should apply to the center
1802 channel when downmixing to stereo. This field will only be written to the
1803 bitstream if a center channel is present. The value is specified as a scale
1804 factor. There are 3 valid values:
1805 </p><dl compact="compact">
1806 <dt> ‘<samp>0.707</samp>’</dt>
1807 <dd><p>Apply -3dB gain
1809 <dt> ‘<samp>0.595</samp>’</dt>
1810 <dd><p>Apply -4.5dB gain (default)
1812 <dt> ‘<samp>0.500</samp>’</dt>
1813 <dd><p>Apply -6dB gain
1818 <dt> ‘<samp>-surround_mixlev <var>level</var></samp>’</dt>
1819 <dd><p>Surround Mix Level. The amount of gain the decoder should apply to the surround
1820 channel(s) when downmixing to stereo. This field will only be written to the
1821 bitstream if one or more surround channels are present. The value is specified
1822 as a scale factor. There are 3 valid values:
1823 </p><dl compact="compact">
1824 <dt> ‘<samp>0.707</samp>’</dt>
1825 <dd><p>Apply -3dB gain
1827 <dt> ‘<samp>0.500</samp>’</dt>
1828 <dd><p>Apply -6dB gain (default)
1830 <dt> ‘<samp>0.000</samp>’</dt>
1831 <dd><p>Silence Surround Channel(s)
1838 <a name="Audio-Production-Information"></a>
1839 <h4 class="subsubheading">Audio Production Information</h4>
1840 <p>Audio Production Information is optional information describing the mixing
1841 environment. Either none or both of the fields are written to the bitstream.
1843 <dl compact="compact">
1844 <dt> ‘<samp>-mixing_level <var>number</var></samp>’</dt>
1845 <dd><p>Mixing Level. Specifies peak sound pressure level (SPL) in the production
1846 environment when the mix was mastered. Valid values are 80 to 111, or -1 for
1847 unknown or not indicated. The default value is -1, but that value cannot be
1848 used if the Audio Production Information is written to the bitstream. Therefore,
1849 if the <code>room_type</code> option is not the default value, the <code>mixing_level</code>
1850 option must not be -1.
1853 <dt> ‘<samp>-room_type <var>type</var></samp>’</dt>
1854 <dd><p>Room Type. Describes the equalization used during the final mixing session at
1855 the studio or on the dubbing stage. A large room is a dubbing stage with the
1856 industry standard X-curve equalization; a small room has flat equalization.
1857 This field will not be written to the bitstream if both the <code>mixing_level</code>
1858 option and the <code>room_type</code> option have the default values.
1859 </p><dl compact="compact">
1860 <dt> ‘<samp>0</samp>’</dt>
1861 <dt> ‘<samp>notindicated</samp>’</dt>
1862 <dd><p>Not Indicated (default)
1864 <dt> ‘<samp>1</samp>’</dt>
1865 <dt> ‘<samp>large</samp>’</dt>
1868 <dt> ‘<samp>2</samp>’</dt>
1869 <dt> ‘<samp>small</samp>’</dt>
1877 <a name="Other-Metadata-Options"></a>
1878 <h4 class="subsubheading">Other Metadata Options</h4>
1880 <dl compact="compact">
1881 <dt> ‘<samp>-copyright <var>boolean</var></samp>’</dt>
1882 <dd><p>Copyright Indicator. Specifies whether a copyright exists for this audio.
1883 </p><dl compact="compact">
1884 <dt> ‘<samp>0</samp>’</dt>
1885 <dt> ‘<samp>off</samp>’</dt>
1886 <dd><p>No Copyright Exists (default)
1888 <dt> ‘<samp>1</samp>’</dt>
1889 <dt> ‘<samp>on</samp>’</dt>
1890 <dd><p>Copyright Exists
1895 <dt> ‘<samp>-dialnorm <var>value</var></samp>’</dt>
1896 <dd><p>Dialogue Normalization. Indicates how far the average dialogue level of the
1897 program is below digital 100% full scale (0 dBFS). This parameter determines a
1898 level shift during audio reproduction that sets the average volume of the
1899 dialogue to a preset level. The goal is to match volume level between program
1900 sources. A value of -31dB will result in no volume level change, relative to
1901 the source volume, during audio reproduction. Valid values are whole numbers in
1902 the range -31 to -1, with -31 being the default.
1905 <dt> ‘<samp>-dsur_mode <var>mode</var></samp>’</dt>
1906 <dd><p>Dolby Surround Mode. Specifies whether the stereo signal uses Dolby Surround
1907 (Pro Logic). This field will only be written to the bitstream if the audio
1908 stream is stereo. Using this option does <b>NOT</b> mean the encoder will actually
1909 apply Dolby Surround processing.
1910 </p><dl compact="compact">
1911 <dt> ‘<samp>0</samp>’</dt>
1912 <dt> ‘<samp>notindicated</samp>’</dt>
1913 <dd><p>Not Indicated (default)
1915 <dt> ‘<samp>1</samp>’</dt>
1916 <dt> ‘<samp>off</samp>’</dt>
1917 <dd><p>Not Dolby Surround Encoded
1919 <dt> ‘<samp>2</samp>’</dt>
1920 <dt> ‘<samp>on</samp>’</dt>
1921 <dd><p>Dolby Surround Encoded
1926 <dt> ‘<samp>-original <var>boolean</var></samp>’</dt>
1927 <dd><p>Original Bit Stream Indicator. Specifies whether this audio is from the
1928 original source and not a copy.
1929 </p><dl compact="compact">
1930 <dt> ‘<samp>0</samp>’</dt>
1931 <dt> ‘<samp>off</samp>’</dt>
1932 <dd><p>Not Original Source
1934 <dt> ‘<samp>1</samp>’</dt>
1935 <dt> ‘<samp>on</samp>’</dt>
1936 <dd><p>Original Source (default)
1943 <a name="Extended-Bitstream-Information"></a>
1944 <h4 class="subsubheading">Extended Bitstream Information</h4>
1945 <p>The extended bitstream options are part of the Alternate Bit Stream Syntax as
1946 specified in Annex D of the A/52:2010 standard. It is grouped into 2 parts.
1947 If any one parameter in a group is specified, all values in that group will be
1948 written to the bitstream. Default values are used for those that are written
1949 but have not been specified. If the mixing levels are written, the decoder
1950 will use these values instead of the ones specified in the <code>center_mixlev</code>
1951 and <code>surround_mixlev</code> options if it supports the Alternate Bit Stream
1954 <a name="Extended-Bitstream-Information-_002d-Part-1"></a>
1955 <h4 class="subsubheading">Extended Bitstream Information - Part 1</h4>
1957 <dl compact="compact">
1958 <dt> ‘<samp>-dmix_mode <var>mode</var></samp>’</dt>
1959 <dd><p>Preferred Stereo Downmix Mode. Allows the user to select either Lt/Rt
1960 (Dolby Surround) or Lo/Ro (normal stereo) as the preferred stereo downmix mode.
1961 </p><dl compact="compact">
1962 <dt> ‘<samp>0</samp>’</dt>
1963 <dt> ‘<samp>notindicated</samp>’</dt>
1964 <dd><p>Not Indicated (default)
1966 <dt> ‘<samp>1</samp>’</dt>
1967 <dt> ‘<samp>ltrt</samp>’</dt>
1968 <dd><p>Lt/Rt Downmix Preferred
1970 <dt> ‘<samp>2</samp>’</dt>
1971 <dt> ‘<samp>loro</samp>’</dt>
1972 <dd><p>Lo/Ro Downmix Preferred
1977 <dt> ‘<samp>-ltrt_cmixlev <var>level</var></samp>’</dt>
1978 <dd><p>Lt/Rt Center Mix Level. The amount of gain the decoder should apply to the
1979 center channel when downmixing to stereo in Lt/Rt mode.
1980 </p><dl compact="compact">
1981 <dt> ‘<samp>1.414</samp>’</dt>
1982 <dd><p>Apply +3dB gain
1984 <dt> ‘<samp>1.189</samp>’</dt>
1985 <dd><p>Apply +1.5dB gain
1987 <dt> ‘<samp>1.000</samp>’</dt>
1988 <dd><p>Apply 0dB gain
1990 <dt> ‘<samp>0.841</samp>’</dt>
1991 <dd><p>Apply -1.5dB gain
1993 <dt> ‘<samp>0.707</samp>’</dt>
1994 <dd><p>Apply -3.0dB gain
1996 <dt> ‘<samp>0.595</samp>’</dt>
1997 <dd><p>Apply -4.5dB gain (default)
1999 <dt> ‘<samp>0.500</samp>’</dt>
2000 <dd><p>Apply -6.0dB gain
2002 <dt> ‘<samp>0.000</samp>’</dt>
2003 <dd><p>Silence Center Channel
2008 <dt> ‘<samp>-ltrt_surmixlev <var>level</var></samp>’</dt>
2009 <dd><p>Lt/Rt Surround Mix Level. The amount of gain the decoder should apply to the
2010 surround channel(s) when downmixing to stereo in Lt/Rt mode.
2011 </p><dl compact="compact">
2012 <dt> ‘<samp>0.841</samp>’</dt>
2013 <dd><p>Apply -1.5dB gain
2015 <dt> ‘<samp>0.707</samp>’</dt>
2016 <dd><p>Apply -3.0dB gain
2018 <dt> ‘<samp>0.595</samp>’</dt>
2019 <dd><p>Apply -4.5dB gain
2021 <dt> ‘<samp>0.500</samp>’</dt>
2022 <dd><p>Apply -6.0dB gain (default)
2024 <dt> ‘<samp>0.000</samp>’</dt>
2025 <dd><p>Silence Surround Channel(s)
2030 <dt> ‘<samp>-loro_cmixlev <var>level</var></samp>’</dt>
2031 <dd><p>Lo/Ro Center Mix Level. The amount of gain the decoder should apply to the
2032 center channel when downmixing to stereo in Lo/Ro mode.
2033 </p><dl compact="compact">
2034 <dt> ‘<samp>1.414</samp>’</dt>
2035 <dd><p>Apply +3dB gain
2037 <dt> ‘<samp>1.189</samp>’</dt>
2038 <dd><p>Apply +1.5dB gain
2040 <dt> ‘<samp>1.000</samp>’</dt>
2041 <dd><p>Apply 0dB gain
2043 <dt> ‘<samp>0.841</samp>’</dt>
2044 <dd><p>Apply -1.5dB gain
2046 <dt> ‘<samp>0.707</samp>’</dt>
2047 <dd><p>Apply -3.0dB gain
2049 <dt> ‘<samp>0.595</samp>’</dt>
2050 <dd><p>Apply -4.5dB gain (default)
2052 <dt> ‘<samp>0.500</samp>’</dt>
2053 <dd><p>Apply -6.0dB gain
2055 <dt> ‘<samp>0.000</samp>’</dt>
2056 <dd><p>Silence Center Channel
2061 <dt> ‘<samp>-loro_surmixlev <var>level</var></samp>’</dt>
2062 <dd><p>Lo/Ro Surround Mix Level. The amount of gain the decoder should apply to the
2063 surround channel(s) when downmixing to stereo in Lo/Ro mode.
2064 </p><dl compact="compact">
2065 <dt> ‘<samp>0.841</samp>’</dt>
2066 <dd><p>Apply -1.5dB gain
2068 <dt> ‘<samp>0.707</samp>’</dt>
2069 <dd><p>Apply -3.0dB gain
2071 <dt> ‘<samp>0.595</samp>’</dt>
2072 <dd><p>Apply -4.5dB gain
2074 <dt> ‘<samp>0.500</samp>’</dt>
2075 <dd><p>Apply -6.0dB gain (default)
2077 <dt> ‘<samp>0.000</samp>’</dt>
2078 <dd><p>Silence Surround Channel(s)
2085 <a name="Extended-Bitstream-Information-_002d-Part-2"></a>
2086 <h4 class="subsubheading">Extended Bitstream Information - Part 2</h4>
2088 <dl compact="compact">
2089 <dt> ‘<samp>-dsurex_mode <var>mode</var></samp>’</dt>
2090 <dd><p>Dolby Surround EX Mode. Indicates whether the stream uses Dolby Surround EX
2091 (7.1 matrixed to 5.1). Using this option does <b>NOT</b> mean the encoder will actually
2092 apply Dolby Surround EX processing.
2093 </p><dl compact="compact">
2094 <dt> ‘<samp>0</samp>’</dt>
2095 <dt> ‘<samp>notindicated</samp>’</dt>
2096 <dd><p>Not Indicated (default)
2098 <dt> ‘<samp>1</samp>’</dt>
2099 <dt> ‘<samp>on</samp>’</dt>
2100 <dd><p>Dolby Surround EX On
2102 <dt> ‘<samp>2</samp>’</dt>
2103 <dt> ‘<samp>off</samp>’</dt>
2104 <dd><p>Dolby Surround EX Off
2109 <dt> ‘<samp>-dheadphone_mode <var>mode</var></samp>’</dt>
2110 <dd><p>Dolby Headphone Mode. Indicates whether the stream uses Dolby Headphone
2111 encoding (multi-channel matrixed to 2.0 for use with headphones). Using this
2112 option does <b>NOT</b> mean the encoder will actually apply Dolby Headphone
2114 </p><dl compact="compact">
2115 <dt> ‘<samp>0</samp>’</dt>
2116 <dt> ‘<samp>notindicated</samp>’</dt>
2117 <dd><p>Not Indicated (default)
2119 <dt> ‘<samp>1</samp>’</dt>
2120 <dt> ‘<samp>on</samp>’</dt>
2121 <dd><p>Dolby Headphone On
2123 <dt> ‘<samp>2</samp>’</dt>
2124 <dt> ‘<samp>off</samp>’</dt>
2125 <dd><p>Dolby Headphone Off
2130 <dt> ‘<samp>-ad_conv_type <var>type</var></samp>’</dt>
2131 <dd><p>A/D Converter Type. Indicates whether the audio has passed through HDCD A/D
2133 </p><dl compact="compact">
2134 <dt> ‘<samp>0</samp>’</dt>
2135 <dt> ‘<samp>standard</samp>’</dt>
2136 <dd><p>Standard A/D Converter (default)
2138 <dt> ‘<samp>1</samp>’</dt>
2139 <dt> ‘<samp>hdcd</samp>’</dt>
2140 <dd><p>HDCD A/D Converter
2147 <a name="Other-AC_002d3-Encoding-Options"></a>
2148 <h3 class="subheading">Other AC-3 Encoding Options</h3>
2150 <dl compact="compact">
2151 <dt> ‘<samp>-stereo_rematrixing <var>boolean</var></samp>’</dt>
2152 <dd><p>Stereo Rematrixing. Enables/Disables use of rematrixing for stereo input. This
2153 is an optional AC-3 feature that increases quality by selectively encoding
2154 the left/right channels as mid/side. This option is enabled by default, and it
2155 is highly recommended that it be left as enabled except for testing purposes.
2160 <a name="Demuxers"></a>
2161 <h1 class="chapter"><a href="ffmpeg.html#toc-Demuxers">8. Demuxers</a></h1>
2163 <p>Demuxers are configured elements in FFmpeg which allow to read the
2164 multimedia streams from a particular type of file.
2166 <p>When you configure your FFmpeg build, all the supported demuxers
2167 are enabled by default. You can list all available ones using the
2168 configure option "–list-demuxers".
2170 <p>You can disable all the demuxers using the configure option
2171 "–disable-demuxers", and selectively enable a single demuxer with
2172 the option "–enable-demuxer=<var>DEMUXER</var>", or disable it
2173 with the option "–disable-demuxer=<var>DEMUXER</var>".
2175 <p>The option "-formats" of the ff* tools will display the list of
2178 <p>The description of some of the currently available demuxers follows.
2180 <a name="image2-1"></a>
2181 <h2 class="section"><a href="ffmpeg.html#toc-image2-1">8.1 image2</a></h2>
2183 <p>Image file demuxer.
2185 <p>This demuxer reads from a list of image files specified by a pattern.
2187 <p>The pattern may contain the string "%d" or "%0<var>N</var>d", which
2188 specifies the position of the characters representing a sequential
2189 number in each filename matched by the pattern. If the form
2190 "%d0<var>N</var>d" is used, the string representing the number in each
2191 filename is 0-padded and <var>N</var> is the total number of 0-padded
2192 digits representing the number. The literal character ’%’ can be
2193 specified in the pattern with the string "%%".
2195 <p>If the pattern contains "%d" or "%0<var>N</var>d", the first filename of
2196 the file list specified by the pattern must contain a number
2197 inclusively contained between 0 and 4, all the following numbers must
2198 be sequential. This limitation may be hopefully fixed.
2200 <p>The pattern may contain a suffix which is used to automatically
2201 determine the format of the images contained in the files.
2203 <p>For example the pattern "img-%03d.bmp" will match a sequence of
2204 filenames of the form ‘<tt>img-001.bmp</tt>’, ‘<tt>img-002.bmp</tt>’, ...,
2205 ‘<tt>img-010.bmp</tt>’, etc.; the pattern "i%%m%%g-%d.jpg" will match a
2206 sequence of filenames of the form ‘<tt>i%m%g-1.jpg</tt>’,
2207 ‘<tt>i%m%g-2.jpg</tt>’, ..., ‘<tt>i%m%g-10.jpg</tt>’, etc.
2209 <p>The size, the pixel format, and the format of each image must be the
2210 same for all the files in the sequence.
2212 <p>The following example shows how to use ‘<tt>ffmpeg</tt>’ for creating a
2213 video from the images in the file sequence ‘<tt>img-001.jpeg</tt>’,
2214 ‘<tt>img-002.jpeg</tt>’, ..., assuming an input framerate of 10 frames per
2216 </p><table><tr><td> </td><td><pre class="example">ffmpeg -r 10 -f image2 -i 'img-%03d.jpeg' out.avi
2217 </pre></td></tr></table>
2219 <p>Note that the pattern must not necessarily contain "%d" or
2220 "%0<var>N</var>d", for example to convert a single image file
2221 ‘<tt>img.jpeg</tt>’ you can employ the command:
2222 </p><table><tr><td> </td><td><pre class="example">ffmpeg -f image2 -i img.jpeg img.png
2223 </pre></td></tr></table>
2225 <a name="applehttp-1"></a>
2226 <h2 class="section"><a href="ffmpeg.html#toc-applehttp-1">8.2 applehttp</a></h2>
2228 <p>Apple HTTP Live Streaming demuxer.
2230 <p>This demuxer presents all AVStreams from all variant streams.
2231 The id field is set to the bitrate variant index number. By setting
2232 the discard flags on AVStreams (by pressing ’a’ or ’v’ in ffplay),
2233 the caller can decide which variant streams to actually receive.
2234 The total bitrate of the variant that the stream belongs to is
2235 available in a metadata key named "variant_bitrate".
2237 <a name="Muxers"></a>
2238 <h1 class="chapter"><a href="ffmpeg.html#toc-Muxers">9. Muxers</a></h1>
2240 <p>Muxers are configured elements in FFmpeg which allow writing
2241 multimedia streams to a particular type of file.
2243 <p>When you configure your FFmpeg build, all the supported muxers
2244 are enabled by default. You can list all available muxers using the
2245 configure option <code>--list-muxers</code>.
2247 <p>You can disable all the muxers with the configure option
2248 <code>--disable-muxers</code> and selectively enable / disable single muxers
2249 with the options <code>--enable-muxer=<var>MUXER</var></code> /
2250 <code>--disable-muxer=<var>MUXER</var></code>.
2252 <p>The option <code>-formats</code> of the ff* tools will display the list of
2255 <p>A description of some of the currently available muxers follows.
2257 <p><a name="crc"></a>
2258 </p><a name="crc-1"></a>
2259 <h2 class="section"><a href="ffmpeg.html#toc-crc-1">9.1 crc</a></h2>
2261 <p>CRC (Cyclic Redundancy Check) testing format.
2263 <p>This muxer computes and prints the Adler-32 CRC of all the input audio
2264 and video frames. By default audio frames are converted to signed
2265 16-bit raw audio and video frames to raw video before computing the
2268 <p>The output of the muxer consists of a single line of the form:
2269 CRC=0x<var>CRC</var>, where <var>CRC</var> is a hexadecimal number 0-padded to
2270 8 digits containing the CRC for all the decoded input frames.
2272 <p>For example to compute the CRC of the input, and store it in the file
2273 ‘<tt>out.crc</tt>’:
2274 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -f crc out.crc
2275 </pre></td></tr></table>
2277 <p>You can print the CRC to stdout with the command:
2278 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -f crc -
2279 </pre></td></tr></table>
2281 <p>You can select the output format of each frame with ‘<tt>ffmpeg</tt>’ by
2282 specifying the audio and video codec and format. For example to
2283 compute the CRC of the input audio converted to PCM unsigned 8-bit
2284 and the input video converted to MPEG-2 video, use the command:
2285 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -acodec pcm_u8 -vcodec mpeg2video -f crc -
2286 </pre></td></tr></table>
2288 <p>See also the <code>framecrc</code> muxer (see <a href="#framecrc">framecrc</a>).
2290 <p><a name="framecrc"></a>
2291 </p><a name="framecrc-1"></a>
2292 <h2 class="section"><a href="ffmpeg.html#toc-framecrc-1">9.2 framecrc</a></h2>
2294 <p>Per-frame CRC (Cyclic Redundancy Check) testing format.
2296 <p>This muxer computes and prints the Adler-32 CRC for each decoded audio
2297 and video frame. By default audio frames are converted to signed
2298 16-bit raw audio and video frames to raw video before computing the
2301 <p>The output of the muxer consists of a line for each audio and video
2302 frame of the form: <var>stream_index</var>, <var>frame_dts</var>,
2303 <var>frame_size</var>, 0x<var>CRC</var>, where <var>CRC</var> is a hexadecimal
2304 number 0-padded to 8 digits containing the CRC of the decoded frame.
2306 <p>For example to compute the CRC of each decoded frame in the input, and
2307 store it in the file ‘<tt>out.crc</tt>’:
2308 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -f framecrc out.crc
2309 </pre></td></tr></table>
2311 <p>You can print the CRC of each decoded frame to stdout with the command:
2312 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -f framecrc -
2313 </pre></td></tr></table>
2315 <p>You can select the output format of each frame with ‘<tt>ffmpeg</tt>’ by
2316 specifying the audio and video codec and format. For example, to
2317 compute the CRC of each decoded input audio frame converted to PCM
2318 unsigned 8-bit and of each decoded input video frame converted to
2319 MPEG-2 video, use the command:
2320 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i INPUT -acodec pcm_u8 -vcodec mpeg2video -f framecrc -
2321 </pre></td></tr></table>
2323 <p>See also the <code>crc</code> muxer (see <a href="#crc">crc</a>).
2325 <a name="image2"></a>
2326 <h2 class="section"><a href="ffmpeg.html#toc-image2">9.3 image2</a></h2>
2328 <p>Image file muxer.
2330 <p>The image file muxer writes video frames to image files.
2332 <p>The output filenames are specified by a pattern, which can be used to
2333 produce sequentially numbered series of files.
2334 The pattern may contain the string "%d" or "%0<var>N</var>d", this string
2335 specifies the position of the characters representing a numbering in
2336 the filenames. If the form "%0<var>N</var>d" is used, the string
2337 representing the number in each filename is 0-padded to <var>N</var>
2338 digits. The literal character ’%’ can be specified in the pattern with
2339 the string "%%".
2341 <p>If the pattern contains "%d" or "%0<var>N</var>d", the first filename of
2342 the file list specified will contain the number 1, all the following
2343 numbers will be sequential.
2345 <p>The pattern may contain a suffix which is used to automatically
2346 determine the format of the image files to write.
2348 <p>For example the pattern "img-%03d.bmp" will specify a sequence of
2349 filenames of the form ‘<tt>img-001.bmp</tt>’, ‘<tt>img-002.bmp</tt>’, ...,
2350 ‘<tt>img-010.bmp</tt>’, etc.
2351 The pattern "img%%-%d.jpg" will specify a sequence of filenames of the
2352 form ‘<tt>img%-1.jpg</tt>’, ‘<tt>img%-2.jpg</tt>’, ..., ‘<tt>img%-10.jpg</tt>’,
2355 <p>The following example shows how to use ‘<tt>ffmpeg</tt>’ for creating a
2356 sequence of files ‘<tt>img-001.jpeg</tt>’, ‘<tt>img-002.jpeg</tt>’, ...,
2357 taking one image every second from the input video:
2358 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i in.avi -r 1 -f image2 'img-%03d.jpeg'
2359 </pre></td></tr></table>
2361 <p>Note that with ‘<tt>ffmpeg</tt>’, if the format is not specified with the
2362 <code>-f</code> option and the output filename specifies an image file
2363 format, the image2 muxer is automatically selected, so the previous
2364 command can be written as:
2365 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i in.avi -r 1 'img-%03d.jpeg'
2366 </pre></td></tr></table>
2368 <p>Note also that the pattern must not necessarily contain "%d" or
2369 "%0<var>N</var>d", for example to create a single image file
2370 ‘<tt>img.jpeg</tt>’ from the input video you can employ the command:
2371 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i in.avi -f image2 -vframes 1 img.jpeg
2372 </pre></td></tr></table>
2374 <p>The image muxer supports the .Y.U.V image file format. This format is
2375 special in that that each image frame consists of three files, for
2376 each of the YUV420P components. To read or write this image file format,
2377 specify the name of the ’.Y’ file. The muxer will automatically open the
2378 ’.U’ and ’.V’ files as required.
2380 <a name="mpegts"></a>
2381 <h2 class="section"><a href="ffmpeg.html#toc-mpegts">9.4 mpegts</a></h2>
2383 <p>MPEG transport stream muxer.
2385 <p>This muxer implements ISO 13818-1 and part of ETSI EN 300 468.
2387 <p>The muxer options are:
2389 <dl compact="compact">
2390 <dt> ‘<samp>-mpegts_original_network_id <var>number</var></samp>’</dt>
2391 <dd><p>Set the original_network_id (default 0x0001). This is unique identifier
2392 of a network in DVB. Its main use is in the unique identification of a
2393 service through the path Original_Network_ID, Transport_Stream_ID.
2395 <dt> ‘<samp>-mpegts_transport_stream_id <var>number</var></samp>’</dt>
2396 <dd><p>Set the transport_stream_id (default 0x0001). This identifies a
2399 <dt> ‘<samp>-mpegts_service_id <var>number</var></samp>’</dt>
2400 <dd><p>Set the service_id (default 0x0001) also known as program in DVB.
2402 <dt> ‘<samp>-mpegts_pmt_start_pid <var>number</var></samp>’</dt>
2403 <dd><p>Set the first PID for PMT (default 0x1000, max 0x1f00).
2405 <dt> ‘<samp>-mpegts_start_pid <var>number</var></samp>’</dt>
2406 <dd><p>Set the first PID for data packets (default 0x0100, max 0x0f00).
2410 <p>The recognized metadata settings in mpegts muxer are <code>service_provider</code>
2411 and <code>service_name</code>. If they are not set the default for
2412 <code>service_provider</code> is "FFmpeg" and the default for
2413 <code>service_name</code> is "Service01".
2415 <table><tr><td> </td><td><pre class="example">ffmpeg -i file.mpg -acodec copy -vcodec copy \
2416 -mpegts_original_network_id 0x1122 \
2417 -mpegts_transport_stream_id 0x3344 \
2418 -mpegts_service_id 0x5566 \
2419 -mpegts_pmt_start_pid 0x1500 \
2420 -mpegts_start_pid 0x150 \
2421 -metadata service_provider="Some provider" \
2422 -metadata service_name="Some Channel" \
2424 </pre></td></tr></table>
2427 <h2 class="section"><a href="ffmpeg.html#toc-null">9.5 null</a></h2>
2431 <p>This muxer does not generate any output file, it is mainly useful for
2432 testing or benchmarking purposes.
2434 <p>For example to benchmark decoding with ‘<tt>ffmpeg</tt>’ you can use the
2436 </p><table><tr><td> </td><td><pre class="example">ffmpeg -benchmark -i INPUT -f null out.null
2437 </pre></td></tr></table>
2439 <p>Note that the above command does not read or write the ‘<tt>out.null</tt>’
2440 file, but specifying the output file is required by the ‘<tt>ffmpeg</tt>’
2443 <p>Alternatively you can write the command as:
2444 </p><table><tr><td> </td><td><pre class="example">ffmpeg -benchmark -i INPUT -f null -
2445 </pre></td></tr></table>
2447 <a name="Input-Devices"></a>
2448 <h1 class="chapter"><a href="ffmpeg.html#toc-Input-Devices">10. Input Devices</a></h1>
2450 <p>Input devices are configured elements in FFmpeg which allow to access
2451 the data coming from a multimedia device attached to your system.
2453 <p>When you configure your FFmpeg build, all the supported input devices
2454 are enabled by default. You can list all available ones using the
2455 configure option "–list-indevs".
2457 <p>You can disable all the input devices using the configure option
2458 "–disable-indevs", and selectively enable an input device using the
2459 option "–enable-indev=<var>INDEV</var>", or you can disable a particular
2460 input device using the option "–disable-indev=<var>INDEV</var>".
2462 <p>The option "-formats" of the ff* tools will display the list of
2463 supported input devices (amongst the demuxers).
2465 <p>A description of the currently available input devices follows.
2468 <h2 class="section"><a href="ffmpeg.html#toc-alsa">10.1 alsa</a></h2>
2470 <p>ALSA (Advanced Linux Sound Architecture) input device.
2472 <p>To enable this input device during configuration you need libasound
2473 installed on your system.
2475 <p>This device allows capturing from an ALSA device. The name of the
2476 device to capture has to be an ALSA card identifier.
2478 <p>An ALSA identifier has the syntax:
2479 </p><table><tr><td> </td><td><pre class="example">hw:<var>CARD</var>[,<var>DEV</var>[,<var>SUBDEV</var>]]
2480 </pre></td></tr></table>
2482 <p>where the <var>DEV</var> and <var>SUBDEV</var> components are optional.
2484 <p>The three arguments (in order: <var>CARD</var>,<var>DEV</var>,<var>SUBDEV</var>)
2485 specify card number or identifier, device number and subdevice number
2488 <p>To see the list of cards currently recognized by your system check the
2489 files ‘<tt>/proc/asound/cards</tt>’ and ‘<tt>/proc/asound/devices</tt>’.
2491 <p>For example to capture with ‘<tt>ffmpeg</tt>’ from an ALSA device with
2492 card id 0, you may run the command:
2493 </p><table><tr><td> </td><td><pre class="example">ffmpeg -f alsa -i hw:0 alsaout.wav
2494 </pre></td></tr></table>
2496 <p>For more information see:
2497 <a href="http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html">http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html</a>
2500 <h2 class="section"><a href="ffmpeg.html#toc-bktr">10.2 bktr</a></h2>
2502 <p>BSD video input device.
2504 <a name="dv1394"></a>
2505 <h2 class="section"><a href="ffmpeg.html#toc-dv1394">10.3 dv1394</a></h2>
2507 <p>Linux DV 1394 input device.
2509 <a name="fbdev"></a>
2510 <h2 class="section"><a href="ffmpeg.html#toc-fbdev">10.4 fbdev</a></h2>
2512 <p>Linux framebuffer input device.
2514 <p>The Linux framebuffer is a graphic hardware-independent abstraction
2515 layer to show graphics on a computer monitor, typically on the
2516 console. It is accessed through a file device node, usually
2517 ‘<tt>/dev/fb0</tt>’.
2519 <p>For more detailed information read the file
2520 Documentation/fb/framebuffer.txt included in the Linux source tree.
2522 <p>To record from the framebuffer device ‘<tt>/dev/fb0</tt>’ with
2523 ‘<tt>ffmpeg</tt>’:
2524 </p><table><tr><td> </td><td><pre class="example">ffmpeg -f fbdev -r 10 -i /dev/fb0 out.avi
2525 </pre></td></tr></table>
2527 <p>You can take a single screenshot image with the command:
2528 </p><table><tr><td> </td><td><pre class="example">ffmpeg -f fbdev -vframes 1 -r 1 -i /dev/fb0 screenshot.jpeg
2529 </pre></td></tr></table>
2531 <p>See also <a href="http://linux-fbdev.sourceforge.net/">http://linux-fbdev.sourceforge.net/</a>, and fbset(1).
2534 <h2 class="section"><a href="ffmpeg.html#toc-jack">10.5 jack</a></h2>
2536 <p>JACK input device.
2538 <p>To enable this input device during configuration you need libjack
2539 installed on your system.
2541 <p>A JACK input device creates one or more JACK writable clients, one for
2542 each audio channel, with name <var>client_name</var>:input_<var>N</var>, where
2543 <var>client_name</var> is the name provided by the application, and <var>N</var>
2544 is a number which identifies the channel.
2545 Each writable client will send the acquired data to the FFmpeg input
2548 <p>Once you have created one or more JACK readable clients, you need to
2549 connect them to one or more JACK writable clients.
2551 <p>To connect or disconnect JACK clients you can use the
2552 ‘<tt>jack_connect</tt>’ and ‘<tt>jack_disconnect</tt>’ programs, or do it
2553 through a graphical interface, for example with ‘<tt>qjackctl</tt>’.
2555 <p>To list the JACK clients and their properties you can invoke the command
2556 ‘<tt>jack_lsp</tt>’.
2558 <p>Follows an example which shows how to capture a JACK readable client
2559 with ‘<tt>ffmpeg</tt>’.
2560 </p><table><tr><td> </td><td><pre class="example"># Create a JACK writable client with name "ffmpeg".
2561 $ ffmpeg -f jack -i ffmpeg -y out.wav
2563 # Start the sample jack_metro readable client.
2564 $ jack_metro -b 120 -d 0.2 -f 4000
2566 # List the current JACK clients.
2575 # Connect metro to the ffmpeg writable client.
2576 $ jack_connect metro:120_bpm ffmpeg:input_1
2577 </pre></td></tr></table>
2579 <p>For more information read:
2580 <a href="http://jackaudio.org/">http://jackaudio.org/</a>
2582 <a name="libdc1394"></a>
2583 <h2 class="section"><a href="ffmpeg.html#toc-libdc1394">10.6 libdc1394</a></h2>
2585 <p>IIDC1394 input device, based on libdc1394 and libraw1394.
2588 <h2 class="section"><a href="ffmpeg.html#toc-oss">10.7 oss</a></h2>
2590 <p>Open Sound System input device.
2592 <p>The filename to provide to the input device is the device node
2593 representing the OSS input device, and is usually set to
2594 ‘<tt>/dev/dsp</tt>’.
2596 <p>For example to grab from ‘<tt>/dev/dsp</tt>’ using ‘<tt>ffmpeg</tt>’ use the
2598 </p><table><tr><td> </td><td><pre class="example">ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
2599 </pre></td></tr></table>
2601 <p>For more information about OSS see:
2602 <a href="http://manuals.opensound.com/usersguide/dsp.html">http://manuals.opensound.com/usersguide/dsp.html</a>
2604 <a name="sndio-1"></a>
2605 <h2 class="section"><a href="ffmpeg.html#toc-sndio-1">10.8 sndio</a></h2>
2607 <p>sndio input device.
2609 <p>To enable this input device during configuration you need libsndio
2610 installed on your system.
2612 <p>The filename to provide to the input device is the device node
2613 representing the sndio input device, and is usually set to
2614 ‘<tt>/dev/audio0</tt>’.
2616 <p>For example to grab from ‘<tt>/dev/audio0</tt>’ using ‘<tt>ffmpeg</tt>’ use the
2618 </p><table><tr><td> </td><td><pre class="example">ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav
2619 </pre></td></tr></table>
2621 <a name="video4linux-and-video4linux2"></a>
2622 <h2 class="section"><a href="ffmpeg.html#toc-video4linux-and-video4linux2">10.9 video4linux and video4linux2</a></h2>
2624 <p>Video4Linux and Video4Linux2 input video devices.
2626 <p>The name of the device to grab is a file device node, usually Linux
2627 systems tend to automatically create such nodes when the device
2628 (e.g. an USB webcam) is plugged into the system, and has a name of the
2629 kind ‘<tt>/dev/video<var>N</var></tt>’, where <var>N</var> is a number associated to
2632 <p>Video4Linux and Video4Linux2 devices only support a limited set of
2633 <var>width</var>x<var>height</var> sizes and framerates. You can check which are
2634 supported for example with the command ‘<tt>dov4l</tt>’ for Video4Linux
2635 devices and the command ‘<tt>v4l-info</tt>’ for Video4Linux2 devices.
2637 <p>If the size for the device is set to 0x0, the input device will
2638 try to autodetect the size to use.
2639 Only for the video4linux2 device, if the frame rate is set to 0/0 the
2640 input device will use the frame rate value already set in the driver.
2642 <p>Video4Linux support is deprecated since Linux 2.6.30, and will be
2643 dropped in later versions.
2645 <p>Follow some usage examples of the video4linux devices with the ff*
2647 </p><table><tr><td> </td><td><pre class="example"># Grab and show the input of a video4linux device, frame rate is set
2648 # to the default of 25/1.
2649 ffplay -s 320x240 -f video4linux /dev/video0
2651 # Grab and show the input of a video4linux2 device, autoadjust size.
2652 ffplay -f video4linux2 /dev/video0
2654 # Grab and record the input of a video4linux2 device, autoadjust size,
2655 # frame rate value defaults to 0/0 so it is read from the video4linux2
2657 ffmpeg -f video4linux2 -i /dev/video0 out.mpeg
2658 </pre></td></tr></table>
2660 <a name="vfwcap"></a>
2661 <h2 class="section"><a href="ffmpeg.html#toc-vfwcap">10.10 vfwcap</a></h2>
2663 <p>VfW (Video for Windows) capture input device.
2665 <p>The filename passed as input is the capture driver number, ranging from
2666 0 to 9. You may use "list" as filename to print a list of drivers. Any
2667 other filename will be interpreted as device number 0.
2669 <a name="x11grab"></a>
2670 <h2 class="section"><a href="ffmpeg.html#toc-x11grab">10.11 x11grab</a></h2>
2672 <p>X11 video input device.
2674 <p>This device allows to capture a region of an X11 display.
2676 <p>The filename passed as input has the syntax:
2677 </p><table><tr><td> </td><td><pre class="example">[<var>hostname</var>]:<var>display_number</var>.<var>screen_number</var>[+<var>x_offset</var>,<var>y_offset</var>]
2678 </pre></td></tr></table>
2680 <p><var>hostname</var>:<var>display_number</var>.<var>screen_number</var> specifies the
2681 X11 display name of the screen to grab from. <var>hostname</var> can be
2682 ommitted, and defaults to "localhost". The environment variable
2683 <code>DISPLAY</code> contains the default display name.
2685 <p><var>x_offset</var> and <var>y_offset</var> specify the offsets of the grabbed
2686 area with respect to the top-left border of the X11 screen. They
2689 <p>Check the X11 documentation (e.g. man X) for more detailed information.
2691 <p>Use the ‘<tt>dpyinfo</tt>’ program for getting basic information about the
2692 properties of your X11 display (e.g. grep for "name" or "dimensions").
2694 <p>For example to grab from ‘<tt>:0.0</tt>’ using ‘<tt>ffmpeg</tt>’:
2695 </p><table><tr><td> </td><td><pre class="example">ffmpeg -f x11grab -r 25 -s cif -i :0.0 out.mpg
2697 # Grab at position 10,20.
2698 ffmpeg -f x11grab -25 -s cif -i :0.0+10,20 out.mpg
2699 </pre></td></tr></table>
2701 <a name="Output-Devices"></a>
2702 <h1 class="chapter"><a href="ffmpeg.html#toc-Output-Devices">11. Output Devices</a></h1>
2704 <p>Output devices are configured elements in FFmpeg which allow to write
2705 multimedia data to an output device attached to your system.
2707 <p>When you configure your FFmpeg build, all the supported output devices
2708 are enabled by default. You can list all available ones using the
2709 configure option "–list-outdevs".
2711 <p>You can disable all the output devices using the configure option
2712 "–disable-outdevs", and selectively enable an output device using the
2713 option "–enable-outdev=<var>OUTDEV</var>", or you can disable a particular
2714 input device using the option "–disable-outdev=<var>OUTDEV</var>".
2716 <p>The option "-formats" of the ff* tools will display the list of
2717 enabled output devices (amongst the muxers).
2719 <p>A description of the currently available output devices follows.
2721 <a name="alsa-1"></a>
2722 <h2 class="section"><a href="ffmpeg.html#toc-alsa-1">11.1 alsa</a></h2>
2724 <p>ALSA (Advanced Linux Sound Architecture) output device.
2726 <a name="oss-1"></a>
2727 <h2 class="section"><a href="ffmpeg.html#toc-oss-1">11.2 oss</a></h2>
2729 <p>OSS (Open Sound System) output device.
2731 <a name="sndio"></a>
2732 <h2 class="section"><a href="ffmpeg.html#toc-sndio">11.3 sndio</a></h2>
2734 <p>sndio audio output device.
2736 <a name="Protocols"></a>
2737 <h1 class="chapter"><a href="ffmpeg.html#toc-Protocols">12. Protocols</a></h1>
2739 <p>Protocols are configured elements in FFmpeg which allow to access
2740 resources which require the use of a particular protocol.
2742 <p>When you configure your FFmpeg build, all the supported protocols are
2743 enabled by default. You can list all available ones using the
2744 configure option "–list-protocols".
2746 <p>You can disable all the protocols using the configure option
2747 "–disable-protocols", and selectively enable a protocol using the
2748 option "–enable-protocol=<var>PROTOCOL</var>", or you can disable a
2749 particular protocol using the option
2750 "–disable-protocol=<var>PROTOCOL</var>".
2752 <p>The option "-protocols" of the ff* tools will display the list of
2753 supported protocols.
2755 <p>A description of the currently available protocols follows.
2757 <a name="applehttp"></a>
2758 <h2 class="section"><a href="ffmpeg.html#toc-applehttp">12.1 applehttp</a></h2>
2760 <p>Read Apple HTTP Live Streaming compliant segmented stream as
2761 a uniform one. The M3U8 playlists describing the segments can be
2762 remote HTTP resources or local files, accessed using the standard
2764 HTTP is default, specific protocol can be declared by specifying
2765 "+<var>proto</var>" after the applehttp URI scheme name, where <var>proto</var>
2766 is either "file" or "http".
2768 <table><tr><td> </td><td><pre class="example">applehttp://host/path/to/remote/resource.m3u8
2769 applehttp+http://host/path/to/remote/resource.m3u8
2770 applehttp+file://path/to/local/resource.m3u8
2771 </pre></td></tr></table>
2773 <a name="concat"></a>
2774 <h2 class="section"><a href="ffmpeg.html#toc-concat">12.2 concat</a></h2>
2776 <p>Physical concatenation protocol.
2778 <p>Allow to read and seek from many resource in sequence as if they were
2781 <p>A URL accepted by this protocol has the syntax:
2782 </p><table><tr><td> </td><td><pre class="example">concat:<var>URL1</var>|<var>URL2</var>|...|<var>URLN</var>
2783 </pre></td></tr></table>
2785 <p>where <var>URL1</var>, <var>URL2</var>, ..., <var>URLN</var> are the urls of the
2786 resource to be concatenated, each one possibly specifying a distinct
2789 <p>For example to read a sequence of files ‘<tt>split1.mpeg</tt>’,
2790 ‘<tt>split2.mpeg</tt>’, ‘<tt>split3.mpeg</tt>’ with ‘<tt>ffplay</tt>’ use the
2792 </p><table><tr><td> </td><td><pre class="example">ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
2793 </pre></td></tr></table>
2795 <p>Note that you may need to escape the character "|" which is special for
2799 <h2 class="section"><a href="ffmpeg.html#toc-file">12.3 file</a></h2>
2801 <p>File access protocol.
2803 <p>Allow to read from or read to a file.
2805 <p>For example to read from a file ‘<tt>input.mpeg</tt>’ with ‘<tt>ffmpeg</tt>’
2807 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i file:input.mpeg output.mpeg
2808 </pre></td></tr></table>
2810 <p>The ff* tools default to the file protocol, that is a resource
2811 specified with the name "FILE.mpeg" is interpreted as the URL
2812 "file:FILE.mpeg".
2814 <a name="gopher"></a>
2815 <h2 class="section"><a href="ffmpeg.html#toc-gopher">12.4 gopher</a></h2>
2820 <h2 class="section"><a href="ffmpeg.html#toc-http">12.5 http</a></h2>
2822 <p>HTTP (Hyper Text Transfer Protocol).
2825 <h2 class="section"><a href="ffmpeg.html#toc-mmst">12.6 mmst</a></h2>
2827 <p>MMS (Microsoft Media Server) protocol over TCP.
2830 <h2 class="section"><a href="ffmpeg.html#toc-mmsh">12.7 mmsh</a></h2>
2832 <p>MMS (Microsoft Media Server) protocol over HTTP.
2834 <p>The required syntax is:
2835 </p><table><tr><td> </td><td><pre class="example">mmsh://<var>server</var>[:<var>port</var>][/<var>app</var>][/<var>playpath</var>]
2836 </pre></td></tr></table>
2839 <h2 class="section"><a href="ffmpeg.html#toc-md5">12.8 md5</a></h2>
2841 <p>MD5 output protocol.
2843 <p>Computes the MD5 hash of the data to be written, and on close writes
2844 this to the designated output or stdout if none is specified. It can
2845 be used to test muxers without writing an actual file.
2847 <p>Some examples follow.
2848 </p><table><tr><td> </td><td><pre class="example"># Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
2849 ffmpeg -i input.flv -f avi -y md5:output.avi.md5
2851 # Write the MD5 hash of the encoded AVI file to stdout.
2852 ffmpeg -i input.flv -f avi -y md5:
2853 </pre></td></tr></table>
2855 <p>Note that some formats (typically MOV) require the output protocol to
2856 be seekable, so they will fail with the MD5 output protocol.
2859 <h2 class="section"><a href="ffmpeg.html#toc-pipe">12.9 pipe</a></h2>
2861 <p>UNIX pipe access protocol.
2863 <p>Allow to read and write from UNIX pipes.
2865 <p>The accepted syntax is:
2866 </p><table><tr><td> </td><td><pre class="example">pipe:[<var>number</var>]
2867 </pre></td></tr></table>
2869 <p><var>number</var> is the number corresponding to the file descriptor of the
2870 pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If <var>number</var>
2871 is not specified, by default the stdout file descriptor will be used
2872 for writing, stdin for reading.
2874 <p>For example to read from stdin with ‘<tt>ffmpeg</tt>’:
2875 </p><table><tr><td> </td><td><pre class="example">cat test.wav | ffmpeg -i pipe:0
2876 # ...this is the same as...
2877 cat test.wav | ffmpeg -i pipe:
2878 </pre></td></tr></table>
2880 <p>For writing to stdout with ‘<tt>ffmpeg</tt>’:
2881 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi
2882 # ...this is the same as...
2883 ffmpeg -i test.wav -f avi pipe: | cat > test.avi
2884 </pre></td></tr></table>
2886 <p>Note that some formats (typically MOV), require the output protocol to
2887 be seekable, so they will fail with the pipe output protocol.
2890 <h2 class="section"><a href="ffmpeg.html#toc-rtmp">12.10 rtmp</a></h2>
2892 <p>Real-Time Messaging Protocol.
2894 <p>The Real-Time Messaging Protocol (RTMP) is used for streaming multime‐
2895 dia content across a TCP/IP network.
2897 <p>The required syntax is:
2898 </p><table><tr><td> </td><td><pre class="example">rtmp://<var>server</var>[:<var>port</var>][/<var>app</var>][/<var>playpath</var>]
2899 </pre></td></tr></table>
2901 <p>The accepted parameters are:
2902 </p><dl compact="compact">
2903 <dt> ‘<samp>server</samp>’</dt>
2904 <dd><p>The address of the RTMP server.
2907 <dt> ‘<samp>port</samp>’</dt>
2908 <dd><p>The number of the TCP port to use (by default is 1935).
2911 <dt> ‘<samp>app</samp>’</dt>
2912 <dd><p>It is the name of the application to access. It usually corresponds to
2913 the path where the application is installed on the RTMP server
2914 (e.g. ‘<tt>/ondemand/</tt>’, ‘<tt>/flash/live/</tt>’, etc.).
2917 <dt> ‘<samp>playpath</samp>’</dt>
2918 <dd><p>It is the path or name of the resource to play with reference to the
2919 application specified in <var>app</var>, may be prefixed by "mp4:".
2924 <p>For example to read with ‘<tt>ffplay</tt>’ a multimedia resource named
2925 "sample" from the application "vod" from an RTMP server "myserver":
2926 </p><table><tr><td> </td><td><pre class="example">ffplay rtmp://myserver/vod/sample
2927 </pre></td></tr></table>
2929 <a name="rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte"></a>
2930 <h2 class="section"><a href="ffmpeg.html#toc-rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte">12.11 rtmp, rtmpe, rtmps, rtmpt, rtmpte</a></h2>
2932 <p>Real-Time Messaging Protocol and its variants supported through
2935 <p>Requires the presence of the librtmp headers and library during
2936 configuration. You need to explicitely configure the build with
2937 "–enable-librtmp". If enabled this will replace the native RTMP
2940 <p>This protocol provides most client functions and a few server
2941 functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT),
2942 encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled
2943 variants of these encrypted types (RTMPTE, RTMPTS).
2945 <p>The required syntax is:
2946 </p><table><tr><td> </td><td><pre class="example"><var>rtmp_proto</var>://<var>server</var>[:<var>port</var>][/<var>app</var>][/<var>playpath</var>] <var>options</var>
2947 </pre></td></tr></table>
2949 <p>where <var>rtmp_proto</var> is one of the strings "rtmp", "rtmpt", "rtmpe",
2950 "rtmps", "rtmpte", "rtmpts" corresponding to each RTMP variant, and
2951 <var>server</var>, <var>port</var>, <var>app</var> and <var>playpath</var> have the same
2952 meaning as specified for the RTMP native protocol.
2953 <var>options</var> contains a list of space-separated options of the form
2954 <var>key</var>=<var>val</var>.
2956 <p>See the librtmp manual page (man 3 librtmp) for more information.
2958 <p>For example, to stream a file in real-time to an RTMP server using
2959 ‘<tt>ffmpeg</tt>’:
2960 </p><table><tr><td> </td><td><pre class="example">ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
2961 </pre></td></tr></table>
2963 <p>To play the same stream using ‘<tt>ffplay</tt>’:
2964 </p><table><tr><td> </td><td><pre class="example">ffplay "rtmp://myserver/live/mystream live=1"
2965 </pre></td></tr></table>
2968 <h2 class="section"><a href="ffmpeg.html#toc-rtp">12.12 rtp</a></h2>
2970 <p>Real-Time Protocol.
2973 <h2 class="section"><a href="ffmpeg.html#toc-rtsp">12.13 rtsp</a></h2>
2975 <p>RTSP is not technically a protocol handler in libavformat, it is a demuxer
2976 and muxer. The demuxer supports both normal RTSP (with data transferred
2977 over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with
2978 data transferred over RDT).
2980 <p>The muxer can be used to send a stream using RTSP ANNOUNCE to a server
2981 supporting it (currently Darwin Streaming Server and Mischa Spiegelmock’s
2982 RTSP server, <a href="http://github.com/revmischa/rtsp-server">http://github.com/revmischa/rtsp-server</a>).
2984 <p>The required syntax for a RTSP url is:
2985 </p><table><tr><td> </td><td><pre class="example">rtsp://<var>hostname</var>[:<var>port</var>]/<var>path</var>[?<var>options</var>]
2986 </pre></td></tr></table>
2988 <p><var>options</var> is a <code>&</code>-separated list. The following options
2991 <dl compact="compact">
2992 <dt> ‘<samp>udp</samp>’</dt>
2993 <dd><p>Use UDP as lower transport protocol.
2996 <dt> ‘<samp>tcp</samp>’</dt>
2997 <dd><p>Use TCP (interleaving within the RTSP control channel) as lower
3001 <dt> ‘<samp>multicast</samp>’</dt>
3002 <dd><p>Use UDP multicast as lower transport protocol.
3005 <dt> ‘<samp>http</samp>’</dt>
3006 <dd><p>Use HTTP tunneling as lower transport protocol, which is useful for
3010 <dt> ‘<samp>filter_src</samp>’</dt>
3011 <dd><p>Accept packets only from negotiated peer address and port.
3015 <p>Multiple lower transport protocols may be specified, in that case they are
3016 tried one at a time (if the setup of one fails, the next one is tried).
3017 For the muxer, only the <code>tcp</code> and <code>udp</code> options are supported.
3019 <p>When receiving data over UDP, the demuxer tries to reorder received packets
3020 (since they may arrive out of order, or packets may get lost totally). In
3021 order for this to be enabled, a maximum delay must be specified in the
3022 <code>max_delay</code> field of AVFormatContext.
3024 <p>When watching multi-bitrate Real-RTSP streams with ‘<tt>ffplay</tt>’, the
3025 streams to display can be chosen with <code>-vst</code> <var>n</var> and
3026 <code>-ast</code> <var>n</var> for video and audio respectively, and can be switched
3027 on the fly by pressing <code>v</code> and <code>a</code>.
3029 <p>Example command lines:
3031 <p>To watch a stream over UDP, with a max reordering delay of 0.5 seconds:
3033 <table><tr><td> </td><td><pre class="example">ffplay -max_delay 500000 rtsp://server/video.mp4?udp
3034 </pre></td></tr></table>
3036 <p>To watch a stream tunneled over HTTP:
3038 <table><tr><td> </td><td><pre class="example">ffplay rtsp://server/video.mp4?http
3039 </pre></td></tr></table>
3041 <p>To send a stream in realtime to a RTSP server, for others to watch:
3043 <table><tr><td> </td><td><pre class="example">ffmpeg -re -i <var>input</var> -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
3044 </pre></td></tr></table>
3047 <h2 class="section"><a href="ffmpeg.html#toc-sap">12.14 sap</a></h2>
3049 <p>Session Announcement Protocol (RFC 2974). This is not technically a
3050 protocol handler in libavformat, it is a muxer and demuxer.
3051 It is used for signalling of RTP streams, by announcing the SDP for the
3052 streams regularly on a separate port.
3054 <a name="Muxer"></a>
3055 <h3 class="subsection"><a href="ffmpeg.html#toc-Muxer">12.14.1 Muxer</a></h3>
3057 <p>The syntax for a SAP url given to the muxer is:
3058 </p><table><tr><td> </td><td><pre class="example">sap://<var>destination</var>[:<var>port</var>][?<var>options</var>]
3059 </pre></td></tr></table>
3061 <p>The RTP packets are sent to <var>destination</var> on port <var>port</var>,
3062 or to port 5004 if no port is specified.
3063 <var>options</var> is a <code>&</code>-separated list. The following options
3066 <dl compact="compact">
3067 <dt> ‘<samp>announce_addr=<var>address</var></samp>’</dt>
3068 <dd><p>Specify the destination IP address for sending the announcements to.
3069 If omitted, the announcements are sent to the commonly used SAP
3070 announcement multicast address 224.2.127.254 (sap.mcast.net), or
3071 ff0e::2:7ffe if <var>destination</var> is an IPv6 address.
3074 <dt> ‘<samp>announce_port=<var>port</var></samp>’</dt>
3075 <dd><p>Specify the port to send the announcements on, defaults to
3076 9875 if not specified.
3079 <dt> ‘<samp>ttl=<var>ttl</var></samp>’</dt>
3080 <dd><p>Specify the time to live value for the announcements and RTP packets,
3084 <dt> ‘<samp>same_port=<var>0|1</var></samp>’</dt>
3085 <dd><p>If set to 1, send all RTP streams on the same port pair. If zero (the
3086 default), all streams are sent on unique ports, with each stream on a
3087 port 2 numbers higher than the previous.
3088 VLC/Live555 requires this to be set to 1, to be able to receive the stream.
3089 The RTP stack in libavformat for receiving requires all streams to be sent
3094 <p>Example command lines follow.
3096 <p>To broadcast a stream on the local subnet, for watching in VLC:
3098 <table><tr><td> </td><td><pre class="example">ffmpeg -re -i <var>input</var> -f sap sap://224.0.0.255?same_port=1
3099 </pre></td></tr></table>
3101 <p>Similarly, for watching in ffplay:
3103 <table><tr><td> </td><td><pre class="example">ffmpeg -re -i <var>input</var> -f sap sap://224.0.0.255
3104 </pre></td></tr></table>
3106 <p>And for watching in ffplay, over IPv6:
3108 <table><tr><td> </td><td><pre class="example">ffmpeg -re -i <var>input</var> -f sap sap://[ff0e::1:2:3:4]
3109 </pre></td></tr></table>
3111 <a name="Demuxer"></a>
3112 <h3 class="subsection"><a href="ffmpeg.html#toc-Demuxer">12.14.2 Demuxer</a></h3>
3114 <p>The syntax for a SAP url given to the demuxer is:
3115 </p><table><tr><td> </td><td><pre class="example">sap://[<var>address</var>][:<var>port</var>]
3116 </pre></td></tr></table>
3118 <p><var>address</var> is the multicast address to listen for announcements on,
3119 if omitted, the default 224.2.127.254 (sap.mcast.net) is used. <var>port</var>
3120 is the port that is listened on, 9875 if omitted.
3122 <p>The demuxers listens for announcements on the given address and port.
3123 Once an announcement is received, it tries to receive that particular stream.
3125 <p>Example command lines follow.
3127 <p>To play back the first stream announced on the normal SAP multicast address:
3129 <table><tr><td> </td><td><pre class="example">ffplay sap://
3130 </pre></td></tr></table>
3132 <p>To play back the first stream announced on one the default IPv6 SAP multicast address:
3134 <table><tr><td> </td><td><pre class="example">ffplay sap://[ff0e::2:7ffe]
3135 </pre></td></tr></table>
3138 <h2 class="section"><a href="ffmpeg.html#toc-tcp">12.15 tcp</a></h2>
3140 <p>Trasmission Control Protocol.
3142 <p>The required syntax for a TCP url is:
3143 </p><table><tr><td> </td><td><pre class="example">tcp://<var>hostname</var>:<var>port</var>[?<var>options</var>]
3144 </pre></td></tr></table>
3146 <dl compact="compact">
3147 <dt> ‘<samp>listen</samp>’</dt>
3148 <dd><p>Listen for an incoming connection
3150 <table><tr><td> </td><td><pre class="example">ffmpeg -i <var>input</var> -f <var>format</var> tcp://<var>hostname</var>:<var>port</var>?listen
3151 ffplay tcp://<var>hostname</var>:<var>port</var>
3152 </pre></td></tr></table>
3158 <h2 class="section"><a href="ffmpeg.html#toc-udp">12.16 udp</a></h2>
3160 <p>User Datagram Protocol.
3162 <p>The required syntax for a UDP url is:
3163 </p><table><tr><td> </td><td><pre class="example">udp://<var>hostname</var>:<var>port</var>[?<var>options</var>]
3164 </pre></td></tr></table>
3166 <p><var>options</var> contains a list of &-seperated options of the form <var>key</var>=<var>val</var>.
3167 Follow the list of supported options.
3169 <dl compact="compact">
3170 <dt> ‘<samp>buffer_size=<var>size</var></samp>’</dt>
3171 <dd><p>set the UDP buffer size in bytes
3174 <dt> ‘<samp>localport=<var>port</var></samp>’</dt>
3175 <dd><p>override the local UDP port to bind with
3178 <dt> ‘<samp>pkt_size=<var>size</var></samp>’</dt>
3179 <dd><p>set the size in bytes of UDP packets
3182 <dt> ‘<samp>reuse=<var>1|0</var></samp>’</dt>
3183 <dd><p>explicitly allow or disallow reusing UDP sockets
3186 <dt> ‘<samp>ttl=<var>ttl</var></samp>’</dt>
3187 <dd><p>set the time to live value (for multicast only)
3190 <dt> ‘<samp>connect=<var>1|0</var></samp>’</dt>
3191 <dd><p>Initialize the UDP socket with <code>connect()</code>. In this case, the
3192 destination address can’t be changed with ff_udp_set_remote_url later.
3193 If the destination address isn’t known at the start, this option can
3194 be specified in ff_udp_set_remote_url, too.
3195 This allows finding out the source address for the packets with getsockname,
3196 and makes writes return with AVERROR(ECONNREFUSED) if "destination
3197 unreachable" is received.
3198 For receiving, this gives the benefit of only receiving packets from
3199 the specified peer address/port.
3203 <p>Some usage examples of the udp protocol with ‘<tt>ffmpeg</tt>’ follow.
3205 <p>To stream over UDP to a remote endpoint:
3206 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i <var>input</var> -f <var>format</var> udp://<var>hostname</var>:<var>port</var>
3207 </pre></td></tr></table>
3209 <p>To stream in mpegts format over UDP using 188 sized UDP packets, using a large input buffer:
3210 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i <var>input</var> -f mpegts udp://<var>hostname</var>:<var>port</var>?pkt_size=188&buffer_size=65535
3211 </pre></td></tr></table>
3213 <p>To receive over UDP from a remote endpoint:
3214 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i udp://[<var>multicast-address</var>]:<var>port</var>
3215 </pre></td></tr></table>
3217 <a name="Bitstream-Filters"></a>
3218 <h1 class="chapter"><a href="ffmpeg.html#toc-Bitstream-Filters">13. Bitstream Filters</a></h1>
3220 <p>When you configure your FFmpeg build, all the supported bitstream
3221 filters are enabled by default. You can list all available ones using
3222 the configure option <code>--list-bsfs</code>.
3224 <p>You can disable all the bitstream filters using the configure option
3225 <code>--disable-bsfs</code>, and selectively enable any bitstream filter using
3226 the option <code>--enable-bsf=BSF</code>, or you can disable a particular
3227 bitstream filter using the option <code>--disable-bsf=BSF</code>.
3229 <p>The option <code>-bsfs</code> of the ff* tools will display the list of
3230 all the supported bitstream filters included in your build.
3232 <p>Below is a description of the currently available bitstream filters.
3234 <a name="aac_005fadtstoasc"></a>
3235 <h2 class="section"><a href="ffmpeg.html#toc-aac_005fadtstoasc">13.1 aac_adtstoasc</a></h2>
3237 <a name="chomp"></a>
3238 <h2 class="section"><a href="ffmpeg.html#toc-chomp">13.2 chomp</a></h2>
3240 <a name="dump_005fextradata"></a>
3241 <h2 class="section"><a href="ffmpeg.html#toc-dump_005fextradata">13.3 dump_extradata</a></h2>
3243 <a name="h264_005fmp4toannexb"></a>
3244 <h2 class="section"><a href="ffmpeg.html#toc-h264_005fmp4toannexb">13.4 h264_mp4toannexb</a></h2>
3246 <a name="imx_005fdump_005fheader"></a>
3247 <h2 class="section"><a href="ffmpeg.html#toc-imx_005fdump_005fheader">13.5 imx_dump_header</a></h2>
3249 <a name="mjpeg2jpeg"></a>
3250 <h2 class="section"><a href="ffmpeg.html#toc-mjpeg2jpeg">13.6 mjpeg2jpeg</a></h2>
3252 <p>Convert MJPEG/AVI1 packets to full JPEG/JFIF packets.
3254 <p>MJPEG is a video codec wherein each video frame is essentially a
3255 JPEG image. The individual frames can be extracted without loss,
3258 <table><tr><td> </td><td><pre class="example">ffmpeg -i ../some_mjpeg.avi -vcodec copy frames_%d.jpg
3259 </pre></td></tr></table>
3261 <p>Unfortunately, these chunks are incomplete JPEG images, because
3262 they lack the DHT segment required for decoding. Quoting from
3263 <a href="http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml">http://www.digitalpreservation.gov/formats/fdd/fdd000063.shtml</a>:
3265 <p>Avery Lee, writing in the rec.video.desktop newsgroup in 2001,
3266 commented that "MJPEG, or at least the MJPEG in AVIs having the
3267 MJPG fourcc, is restricted JPEG with a fixed – and *omitted* –
3268 Huffman table. The JPEG must be YCbCr colorspace, it must be 4:2:2,
3269 and it must use basic Huffman encoding, not arithmetic or
3270 progressive. . . . You can indeed extract the MJPEG frames and
3271 decode them with a regular JPEG decoder, but you have to prepend
3272 the DHT segment to them, or else the decoder won’t have any idea
3273 how to decompress the data. The exact table necessary is given in
3274 the OpenDML spec."
3276 <p>This bitstream filter patches the header of frames extracted from an MJPEG
3277 stream (carrying the AVI1 header ID and lacking a DHT segment) to
3278 produce fully qualified JPEG images.
3280 <table><tr><td> </td><td><pre class="example">ffmpeg -i mjpeg-movie.avi -vcodec copy -vbsf mjpeg2jpeg frame_%d.jpg
3281 exiftran -i -9 frame*.jpg
3282 ffmpeg -i frame_%d.jpg -vcodec copy rotated.avi
3283 </pre></td></tr></table>
3285 <a name="mjpega_005fdump_005fheader"></a>
3286 <h2 class="section"><a href="ffmpeg.html#toc-mjpega_005fdump_005fheader">13.7 mjpega_dump_header</a></h2>
3288 <a name="movsub"></a>
3289 <h2 class="section"><a href="ffmpeg.html#toc-movsub">13.8 movsub</a></h2>
3291 <a name="mp3_005fheader_005fcompress"></a>
3292 <h2 class="section"><a href="ffmpeg.html#toc-mp3_005fheader_005fcompress">13.9 mp3_header_compress</a></h2>
3294 <a name="mp3_005fheader_005fdecompress"></a>
3295 <h2 class="section"><a href="ffmpeg.html#toc-mp3_005fheader_005fdecompress">13.10 mp3_header_decompress</a></h2>
3297 <a name="noise"></a>
3298 <h2 class="section"><a href="ffmpeg.html#toc-noise">13.11 noise</a></h2>
3300 <a name="remove_005fextradata"></a>
3301 <h2 class="section"><a href="ffmpeg.html#toc-remove_005fextradata">13.12 remove_extradata</a></h2>
3303 <a name="Filtergraph-description"></a>
3304 <h1 class="chapter"><a href="ffmpeg.html#toc-Filtergraph-description">14. Filtergraph description</a></h1>
3306 <p>A filtergraph is a directed graph of connected filters. It can contain
3307 cycles, and there can be multiple links between a pair of
3308 filters. Each link has one input pad on one side connecting it to one
3309 filter from which it takes its input, and one output pad on the other
3310 side connecting it to the one filter accepting its output.
3312 <p>Each filter in a filtergraph is an instance of a filter class
3313 registered in the application, which defines the features and the
3314 number of input and output pads of the filter.
3316 <p>A filter with no input pads is called a "source", a filter with no
3317 output pads is called a "sink".
3319 <a name="Filtergraph-syntax"></a>
3320 <h2 class="section"><a href="ffmpeg.html#toc-Filtergraph-syntax">14.1 Filtergraph syntax</a></h2>
3322 <p>A filtergraph can be represented using a textual representation, which
3323 is recognized by the <code>-vf</code> and <code>-af</code> options of the ff*
3324 tools, and by the <code>av_parse_graph()</code> function defined in
3325 ‘<tt>libavfilter/avfiltergraph</tt>’.
3327 <p>A filterchain consists of a sequence of connected filters, each one
3328 connected to the previous one in the sequence. A filterchain is
3329 represented by a list of ","-separated filter descriptions.
3331 <p>A filtergraph consists of a sequence of filterchains. A sequence of
3332 filterchains is represented by a list of ";"-separated filterchain
3335 <p>A filter is represented by a string of the form:
3336 [<var>in_link_1</var>]...[<var>in_link_N</var>]<var>filter_name</var>=<var>arguments</var>[<var>out_link_1</var>]...[<var>out_link_M</var>]
3338 <p><var>filter_name</var> is the name of the filter class of which the
3339 described filter is an instance of, and has to be the name of one of
3340 the filter classes registered in the program.
3341 The name of the filter class is optionally followed by a string
3342 "=<var>arguments</var>".
3344 <p><var>arguments</var> is a string which contains the parameters used to
3345 initialize the filter instance, and are described in the filter
3348 <p>The list of arguments can be quoted using the character "’" as initial
3349 and ending mark, and the character ’\’ for escaping the characters
3350 within the quoted text; otherwise the argument string is considered
3351 terminated when the next special character (belonging to the set
3352 "[]=;,") is encountered.
3354 <p>The name and arguments of the filter are optionally preceded and
3355 followed by a list of link labels.
3356 A link label allows to name a link and associate it to a filter output
3357 or input pad. The preceding labels <var>in_link_1</var>
3358 ... <var>in_link_N</var>, are associated to the filter input pads,
3359 the following labels <var>out_link_1</var> ... <var>out_link_M</var>, are
3360 associated to the output pads.
3362 <p>When two link labels with the same name are found in the
3363 filtergraph, a link between the corresponding input and output pad is
3366 <p>If an output pad is not labelled, it is linked by default to the first
3367 unlabelled input pad of the next filter in the filterchain.
3368 For example in the filterchain:
3369 </p><table><tr><td> </td><td><pre class="example">nullsrc, split[L1], [L2]overlay, nullsink
3370 </pre></td></tr></table>
3371 <p>the split filter instance has two output pads, and the overlay filter
3372 instance two input pads. The first output pad of split is labelled
3373 "L1", the first input pad of overlay is labelled "L2", and the second
3374 output pad of split is linked to the second input pad of overlay,
3375 which are both unlabelled.
3377 <p>In a complete filterchain all the unlabelled filter input and output
3378 pads must be connected. A filtergraph is considered valid if all the
3379 filter input and output pads of all the filterchains are connected.
3381 <p>Follows a BNF description for the filtergraph syntax:
3382 </p><table><tr><td> </td><td><pre class="example"><var>NAME</var> ::= sequence of alphanumeric characters and '_'
3383 <var>LINKLABEL</var> ::= "[" <var>NAME</var> "]"
3384 <var>LINKLABELS</var> ::= <var>LINKLABEL</var> [<var>LINKLABELS</var>]
3385 <var>FILTER_ARGUMENTS</var> ::= sequence of chars (eventually quoted)
3386 <var>FILTER</var> ::= [<var>LINKNAMES</var>] <var>NAME</var> ["=" <var>ARGUMENTS</var>] [<var>LINKNAMES</var>]
3387 <var>FILTERCHAIN</var> ::= <var>FILTER</var> [,<var>FILTERCHAIN</var>]
3388 <var>FILTERGRAPH</var> ::= <var>FILTERCHAIN</var> [;<var>FILTERGRAPH</var>]
3389 </pre></td></tr></table>
3392 <a name="Audio-Filters"></a>
3393 <h1 class="chapter"><a href="ffmpeg.html#toc-Audio-Filters">15. Audio Filters</a></h1>
3395 <p>When you configure your FFmpeg build, you can disable any of the
3396 existing filters using –disable-filters.
3397 The configure output will show the audio filters included in your
3400 <p>Below is a description of the currently available audio filters.
3402 <a name="anull"></a>
3403 <h2 class="section"><a href="ffmpeg.html#toc-anull">15.1 anull</a></h2>
3405 <p>Pass the audio source unchanged to the output.
3408 <a name="Audio-Sources"></a>
3409 <h1 class="chapter"><a href="ffmpeg.html#toc-Audio-Sources">16. Audio Sources</a></h1>
3411 <p>Below is a description of the currently available audio sources.
3413 <a name="anullsrc"></a>
3414 <h2 class="section"><a href="ffmpeg.html#toc-anullsrc">16.1 anullsrc</a></h2>
3416 <p>Null audio source, never return audio frames. It is mainly useful as a
3417 template and to be employed in analysis / debugging tools.
3419 <p>It accepts as optional parameter a string of the form
3420 <var>sample_rate</var>:<var>channel_layout</var>.
3422 <p><var>sample_rate</var> specify the sample rate, and defaults to 44100.
3424 <p><var>channel_layout</var> specify the channel layout, and can be either an
3425 integer or a string representing a channel layout. The default value
3426 of <var>channel_layout</var> is 3, which corresponds to CH_LAYOUT_STEREO.
3428 <p>Check the channel_layout_map definition in
3429 ‘<tt>libavcodec/audioconvert.c</tt>’ for the mapping between strings and
3430 channel layout values.
3432 <p>Follow some examples:
3433 </p><table><tr><td> </td><td><pre class="example"># set the sample rate to 48000 Hz and the channel layout to CH_LAYOUT_MONO.
3438 </pre></td></tr></table>
3441 <a name="Audio-Sinks"></a>
3442 <h1 class="chapter"><a href="ffmpeg.html#toc-Audio-Sinks">17. Audio Sinks</a></h1>
3444 <p>Below is a description of the currently available audio sinks.
3446 <a name="anullsink"></a>
3447 <h2 class="section"><a href="ffmpeg.html#toc-anullsink">17.1 anullsink</a></h2>
3449 <p>Null audio sink, do absolutely nothing with the input audio. It is
3450 mainly useful as a template and to be employed in analysis / debugging
3454 <a name="Video-Filters"></a>
3455 <h1 class="chapter"><a href="ffmpeg.html#toc-Video-Filters">18. Video Filters</a></h1>
3457 <p>When you configure your FFmpeg build, you can disable any of the
3458 existing filters using –disable-filters.
3459 The configure output will show the video filters included in your
3462 <p>Below is a description of the currently available video filters.
3464 <a name="blackframe"></a>
3465 <h2 class="section"><a href="ffmpeg.html#toc-blackframe">18.1 blackframe</a></h2>
3467 <p>Detect frames that are (almost) completely black. Can be useful to
3468 detect chapter transitions or commercials. Output lines consist of
3469 the frame number of the detected frame, the percentage of blackness,
3470 the position in the file if known or -1 and the timestamp in seconds.
3472 <p>In order to display the output lines, you need to set the loglevel at
3473 least to the AV_LOG_INFO value.
3475 <p>The filter accepts the syntax:
3476 </p><table><tr><td> </td><td><pre class="example">blackframe[=<var>amount</var>:[<var>threshold</var>]]
3477 </pre></td></tr></table>
3479 <p><var>amount</var> is the percentage of the pixels that have to be below the
3480 threshold, and defaults to 98.
3482 <p><var>threshold</var> is the threshold below which a pixel value is
3483 considered black, and defaults to 32.
3486 <h2 class="section"><a href="ffmpeg.html#toc-copy">18.2 copy</a></h2>
3488 <p>Copy the input source unchanged to the output. Mainly useful for
3492 <h2 class="section"><a href="ffmpeg.html#toc-crop">18.3 crop</a></h2>
3494 <p>Crop the input video to <var>out_w</var>:<var>out_h</var>:<var>x</var>:<var>y</var>.
3496 <p>The parameters are expressions containing the following constants:
3498 <dl compact="compact">
3499 <dt> ‘<samp>E, PI, PHI</samp>’</dt>
3500 <dd><p>the corresponding mathematical approximated values for e
3501 (euler number), pi (greek PI), PHI (golden ratio)
3504 <dt> ‘<samp>x, y</samp>’</dt>
3505 <dd><p>the computed values for <var>x</var> and <var>y</var>. They are evaluated for
3509 <dt> ‘<samp>in_w, in_h</samp>’</dt>
3510 <dd><p>the input width and heigth
3513 <dt> ‘<samp>iw, ih</samp>’</dt>
3514 <dd><p>same as <var>in_w</var> and <var>in_h</var>
3517 <dt> ‘<samp>out_w, out_h</samp>’</dt>
3518 <dd><p>the output (cropped) width and heigth
3521 <dt> ‘<samp>ow, oh</samp>’</dt>
3522 <dd><p>same as <var>out_w</var> and <var>out_h</var>
3525 <dt> ‘<samp>n</samp>’</dt>
3526 <dd><p>the number of input frame, starting from 0
3529 <dt> ‘<samp>pos</samp>’</dt>
3530 <dd><p>the position in the file of the input frame, NAN if unknown
3533 <dt> ‘<samp>t</samp>’</dt>
3534 <dd><p>timestamp expressed in seconds, NAN if the input timestamp is unknown
3539 <p>The <var>out_w</var> and <var>out_h</var> parameters specify the expressions for
3540 the width and height of the output (cropped) video. They are
3541 evaluated just at the configuration of the filter.
3543 <p>The default value of <var>out_w</var> is "in_w", and the default value of
3544 <var>out_h</var> is "in_h".
3546 <p>The expression for <var>out_w</var> may depend on the value of <var>out_h</var>,
3547 and the expression for <var>out_h</var> may depend on <var>out_w</var>, but they
3548 cannot depend on <var>x</var> and <var>y</var>, as <var>x</var> and <var>y</var> are
3549 evaluated after <var>out_w</var> and <var>out_h</var>.
3551 <p>The <var>x</var> and <var>y</var> parameters specify the expressions for the
3552 position of the top-left corner of the output (non-cropped) area. They
3553 are evaluated for each frame. If the evaluated value is not valid, it
3554 is approximated to the nearest valid value.
3556 <p>The default value of <var>x</var> is "(in_w-out_w)/2", and the default
3557 value for <var>y</var> is "(in_h-out_h)/2", which set the cropped area at
3558 the center of the input image.
3560 <p>The expression for <var>x</var> may depend on <var>y</var>, and the expression
3561 for <var>y</var> may depend on <var>x</var>.
3563 <p>Follow some examples:
3564 </p><table><tr><td> </td><td><pre class="example"># crop the central input area with size 100x100
3567 # crop the central input area with size 2/3 of the input video
3568 "crop=2/3*in_w:2/3*in_h"
3570 # crop the input video central square
3573 # delimit the rectangle with the top-left corner placed at position
3574 # 100:100 and the right-bottom corner corresponding to the right-bottom
3575 # corner of the input image.
3576 crop=in_w-100:in_h-100:100:100
3578 # crop 10 pixels from the left and right borders, and 20 pixels from
3579 # the top and bottom borders
3580 "crop=in_w-2*10:in_h-2*20"
3582 # keep only the bottom right quarter of the input image
3583 "crop=in_w/2:in_h/2:in_w/2:in_h/2"
3585 # crop height for getting Greek harmony
3586 "crop=in_w:1/PHI*in_w"
3589 "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)"
3591 # erratic camera effect depending on timestamp
3592 "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)"
3594 # set x depending on the value of y
3595 "crop=in_w/2:in_h/2:y:10+10*sin(n/10)"
3596 </pre></td></tr></table>
3598 <a name="cropdetect"></a>
3599 <h2 class="section"><a href="ffmpeg.html#toc-cropdetect">18.4 cropdetect</a></h2>
3601 <p>Auto-detect crop size.
3603 <p>Calculate necessary cropping parameters and prints the recommended
3604 parameters through the logging system. The detected dimensions
3605 correspond to the non-black area of the input video.
3607 <p>It accepts the syntax:
3608 </p><table><tr><td> </td><td><pre class="example">cropdetect[=<var>limit</var>[:<var>round</var>[:<var>reset</var>]]]
3609 </pre></td></tr></table>
3611 <dl compact="compact">
3612 <dt> ‘<samp>limit</samp>’</dt>
3613 <dd><p>Threshold, which can be optionally specified from nothing (0) to
3614 everything (255), defaults to 24.
3617 <dt> ‘<samp>round</samp>’</dt>
3618 <dd><p>Value which the width/height should be divisible by, defaults to
3619 16. The offset is automatically adjusted to center the video. Use 2 to
3620 get only even dimensions (needed for 4:2:2 video). 16 is best when
3621 encoding to most video codecs.
3624 <dt> ‘<samp>reset</samp>’</dt>
3625 <dd><p>Counter that determines after how many frames cropdetect will reset
3626 the previously detected largest video area and start over to detect
3627 the current optimal crop area. Defaults to 0.
3629 <p>This can be useful when channel logos distort the video area. 0
3630 indicates never reset and return the largest area encountered during
3635 <a name="drawbox"></a>
3636 <h2 class="section"><a href="ffmpeg.html#toc-drawbox">18.5 drawbox</a></h2>
3638 <p>Draw a colored box on the input image.
3640 <p>It accepts the syntax:
3641 </p><table><tr><td> </td><td><pre class="example">drawbox=<var>x</var>:<var>y</var>:<var>width</var>:<var>height</var>:<var>color</var>
3642 </pre></td></tr></table>
3644 <dl compact="compact">
3645 <dt> ‘<samp>x, y</samp>’</dt>
3646 <dd><p>Specify the top left corner coordinates of the box. Default to 0.
3649 <dt> ‘<samp>width, height</samp>’</dt>
3650 <dd><p>Specify the width and height of the box, if 0 they are interpreted as
3651 the input width and height. Default to 0.
3654 <dt> ‘<samp>color</samp>’</dt>
3655 <dd><p>Specify the color of the box to write, it can be the name of a color
3656 (case insensitive match) or a 0xRRGGBB[AA] sequence.
3660 <p>Follow some examples:
3661 </p><table><tr><td> </td><td><pre class="example"># draw a black box around the edge of the input image
3664 # draw a box with color red and an opacity of 50%
3665 drawbox=10:20:200:60:red@0.5"
3666 </pre></td></tr></table>
3668 <a name="drawtext"></a>
3669 <h2 class="section"><a href="ffmpeg.html#toc-drawtext">18.6 drawtext</a></h2>
3671 <p>Draw text string or text from specified file on top of video using the
3672 libfreetype library.
3674 <p>To enable compilation of this filter you need to configure FFmpeg with
3675 <code>--enable-libfreetype</code>.
3677 <p>The filter also recognizes strftime() sequences in the provided text
3678 and expands them accordingly. Check the documentation of strftime().
3680 <p>The filter accepts parameters as a list of <var>key</var>=<var>value</var> pairs,
3681 separated by ":".
3683 <p>The description of the accepted parameters follows.
3685 <dl compact="compact">
3686 <dt> ‘<samp>fontfile</samp>’</dt>
3687 <dd><p>The font file to be used for drawing text. Path must be included.
3688 This parameter is mandatory.
3691 <dt> ‘<samp>text</samp>’</dt>
3692 <dd><p>The text string to be drawn. The text must be a sequence of UTF-8
3694 This parameter is mandatory if no file is specified with the parameter
3695 <var>textfile</var>.
3698 <dt> ‘<samp>textfile</samp>’</dt>
3699 <dd><p>A text file containing text to be drawn. The text must be a sequence
3700 of UTF-8 encoded characters.
3702 <p>This parameter is mandatory if no text string is specified with the
3703 parameter <var>text</var>.
3705 <p>If both text and textfile are specified, an error is thrown.
3708 <dt> ‘<samp>x, y</samp>’</dt>
3709 <dd><p>The offsets where text will be drawn within the video frame.
3710 Relative to the top/left border of the output image.
3712 <p>The default value of <var>x</var> and <var>y</var> is 0.
3715 <dt> ‘<samp>fontsize</samp>’</dt>
3716 <dd><p>The font size to be used for drawing text.
3717 The default value of <var>fontsize</var> is 16.
3720 <dt> ‘<samp>fontcolor</samp>’</dt>
3721 <dd><p>The color to be used for drawing fonts.
3722 Either a string (e.g. "red") or in 0xRRGGBB[AA] format
3723 (e.g. "0xff000033"), possibly followed by an alpha specifier.
3724 The default value of <var>fontcolor</var> is "black".
3727 <dt> ‘<samp>boxcolor</samp>’</dt>
3728 <dd><p>The color to be used for drawing box around text.
3729 Either a string (e.g. "yellow") or in 0xRRGGBB[AA] format
3730 (e.g. "0xff00ff"), possibly followed by an alpha specifier.
3731 The default value of <var>boxcolor</var> is "white".
3734 <dt> ‘<samp>box</samp>’</dt>
3735 <dd><p>Used to draw a box around text using background color.
3736 Value should be either 1 (enable) or 0 (disable).
3737 The default value of <var>box</var> is 0.
3740 <dt> ‘<samp>shadowx, shadowy</samp>’</dt>
3741 <dd><p>The x and y offsets for the text shadow position with respect to the
3742 position of the text. They can be either positive or negative
3743 values. Default value for both is "0".
3746 <dt> ‘<samp>shadowcolor</samp>’</dt>
3747 <dd><p>The color to be used for drawing a shadow behind the drawn text. It
3748 can be a color name (e.g. "yellow") or a string in the 0xRRGGBB[AA]
3749 form (e.g. "0xff00ff"), possibly followed by an alpha specifier.
3750 The default value of <var>shadowcolor</var> is "black".
3753 <dt> ‘<samp>ft_load_flags</samp>’</dt>
3754 <dd><p>Flags to be used for loading the fonts.
3756 <p>The flags map the corresponding flags supported by libfreetype, and are
3757 a combination of the following values:
3758 </p><dl compact="compact">
3759 <dt> <var>default</var></dt>
3760 <dt> <var>no_scale</var></dt>
3761 <dt> <var>no_hinting</var></dt>
3762 <dt> <var>render</var></dt>
3763 <dt> <var>no_bitmap</var></dt>
3764 <dt> <var>vertical_layout</var></dt>
3765 <dt> <var>force_autohint</var></dt>
3766 <dt> <var>crop_bitmap</var></dt>
3767 <dt> <var>pedantic</var></dt>
3768 <dt> <var>ignore_global_advance_width</var></dt>
3769 <dt> <var>no_recurse</var></dt>
3770 <dt> <var>ignore_transform</var></dt>
3771 <dt> <var>monochrome</var></dt>
3772 <dt> <var>linear_design</var></dt>
3773 <dt> <var>no_autohint</var></dt>
3774 <dt> <var>end table</var></dt>
3777 <p>Default value is "render".
3779 <p>For more information consult the documentation for the FT_LOAD_*
3783 <dt> ‘<samp>tabsize</samp>’</dt>
3784 <dd><p>The size in number of spaces to use for rendering the tab.
3789 <p>For example the command:
3790 </p><table><tr><td> </td><td><pre class="example">drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text'"
3791 </pre></td></tr></table>
3793 <p>will draw "Test Text" with font FreeSerif, using the default values
3794 for the optional parameters.
3797 </p><table><tr><td> </td><td><pre class="example">drawtext="fontfile=/usr/share/fonts/truetype/freefont/FreeSerif.ttf: text='Test Text':\
3798 x=100: y=50: fontsize=24: fontcolor=yellow@0.2: box=1: boxcolor=red@0.2"
3799 </pre></td></tr></table>
3801 <p>will draw ’Test Text’ with font FreeSerif of size 24 at position x=100
3802 and y=50 (counting from the top-left corner of the screen), text is
3803 yellow with a red box around it. Both the text and the box have an
3806 <p>Note that the double quotes are not necessary if spaces are not used
3807 within the parameter list.
3809 <p>For more information about libfreetype, check:
3810 <a href="http://www.freetype.org/">http://www.freetype.org/</a>.
3813 <h2 class="section"><a href="ffmpeg.html#toc-fade">18.7 fade</a></h2>
3815 <p>Apply fade-in/out effect to input video.
3817 <p>It accepts the parameters:
3818 <var>type</var>:<var>start_frame</var>:<var>nb_frames</var>
3820 <p><var>type</var> specifies if the effect type, can be either "in" for
3821 fade-in, or "out" for a fade-out effect.
3823 <p><var>start_frame</var> specifies the number of the start frame for starting
3824 to apply the fade effect.
3826 <p><var>nb_frames</var> specifies the number of frames for which the fade
3827 effect has to last. At the end of the fade-in effect the output video
3828 will have the same intensity as the input video, at the end of the
3829 fade-out transition the output video will be completely black.
3831 <p>A few usage examples follow, usable too as test scenarios.
3832 </p><table><tr><td> </td><td><pre class="example"># fade in first 30 frames of video
3835 # fade out last 45 frames of a 200-frame video
3838 # fade in first 25 frames and fade out last 25 frames of a 1000-frame video
3839 fade=in:0:25, fade=out:975:25
3841 # make first 5 frames black, then fade in from frame 5-24
3843 </pre></td></tr></table>
3845 <a name="fieldorder"></a>
3846 <h2 class="section"><a href="ffmpeg.html#toc-fieldorder">18.8 fieldorder</a></h2>
3848 <p>Transform the field order of the input video.
3850 <p>It accepts one parameter which specifies the required field order that
3851 the input interlaced video will be transformed to. The parameter can
3852 assume one of the following values:
3854 <dl compact="compact">
3855 <dt> ‘<samp>0 or bff</samp>’</dt>
3856 <dd><p>output bottom field first
3858 <dt> ‘<samp>1 or tff</samp>’</dt>
3859 <dd><p>output top field first
3863 <p>Default value is "tff".
3865 <p>Transformation is achieved by shifting the picture content up or down
3866 by one line, and filling the remaining line with appropriate picture content.
3867 This method is consistent with most broadcast field order converters.
3869 <p>If the input video is not flagged as being interlaced, or it is already
3870 flagged as being of the required output field order then this filter does
3871 not alter the incoming video.
3873 <p>This filter is very useful when converting to or from PAL DV material,
3874 which is bottom field first.
3877 </p><table><tr><td> </td><td><pre class="example">./ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
3878 </pre></td></tr></table>
3881 <h2 class="section"><a href="ffmpeg.html#toc-fifo">18.9 fifo</a></h2>
3883 <p>Buffer input images and send them when they are requested.
3885 <p>This filter is mainly useful when auto-inserted by the libavfilter
3888 <p>The filter does not take parameters.
3890 <a name="format"></a>
3891 <h2 class="section"><a href="ffmpeg.html#toc-format">18.10 format</a></h2>
3893 <p>Convert the input video to one of the specified pixel formats.
3894 Libavfilter will try to pick one that is supported for the input to
3897 <p>The filter accepts a list of pixel format names, separated by ":",
3898 for example "yuv420p:monow:rgb24".
3900 <p>Some examples follow:
3901 </p><table><tr><td> </td><td><pre class="example"># convert the input video to the format "yuv420p"
3904 # convert the input video to any of the formats in the list
3905 format=yuv420p:yuv444p:yuv410p
3906 </pre></td></tr></table>
3908 <p><a name="frei0r"></a>
3909 </p><a name="frei0r-1"></a>
3910 <h2 class="section"><a href="ffmpeg.html#toc-frei0r-1">18.11 frei0r</a></h2>
3912 <p>Apply a frei0r effect to the input video.
3914 <p>To enable compilation of this filter you need to install the frei0r
3915 header and configure FFmpeg with –enable-frei0r.
3917 <p>The filter supports the syntax:
3918 </p><table><tr><td> </td><td><pre class="example"><var>filter_name</var>[{:|=}<var>param1</var>:<var>param2</var>:...:<var>paramN</var>]
3919 </pre></td></tr></table>
3921 <p><var>filter_name</var> is the name to the frei0r effect to load. If the
3922 environment variable <code>FREI0R_PATH</code> is defined, the frei0r effect
3923 is searched in each one of the directories specified by the colon
3924 separated list in <code>FREIOR_PATH</code>, otherwise in the standard frei0r
3925 paths, which are in this order: ‘<tt>HOME/.frei0r-1/lib/</tt>’,
3926 ‘<tt>/usr/local/lib/frei0r-1/</tt>’, ‘<tt>/usr/lib/frei0r-1/</tt>’.
3928 <p><var>param1</var>, <var>param2</var>, ... , <var>paramN</var> specify the parameters
3929 for the frei0r effect.
3931 <p>A frei0r effect parameter can be a boolean (whose values are specified
3932 with "y" and "n"), a double, a color (specified by the syntax
3933 <var>R</var>/<var>G</var>/<var>B</var>, <var>R</var>, <var>G</var>, and <var>B</var> being float
3934 numbers from 0.0 to 1.0) or by an <code>av_parse_color()</code> color
3935 description), a position (specified by the syntax <var>X</var>/<var>Y</var>,
3936 <var>X</var> and <var>Y</var> being float numbers) and a string.
3938 <p>The number and kind of parameters depend on the loaded effect. If an
3939 effect parameter is not specified the default value is set.
3941 <p>Some examples follow:
3942 </p><table><tr><td> </td><td><pre class="example"># apply the distort0r effect, set the first two double parameters
3943 frei0r=distort0r:0.5:0.01
3945 # apply the colordistance effect, takes a color as first parameter
3946 frei0r=colordistance:0.2/0.3/0.4
3947 frei0r=colordistance:violet
3948 frei0r=colordistance:0x112233
3950 # apply the perspective effect, specify the top left and top right
3952 frei0r=perspective:0.2/0.2:0.8/0.2
3953 </pre></td></tr></table>
3955 <p>For more information see:
3956 <a href="http://piksel.org/frei0r">http://piksel.org/frei0r</a>
3958 <a name="gradfun"></a>
3959 <h2 class="section"><a href="ffmpeg.html#toc-gradfun">18.12 gradfun</a></h2>
3961 <p>Fix the banding artifacts that are sometimes introduced into nearly flat
3962 regions by truncation to 8bit colordepth.
3963 Interpolate the gradients that should go where the bands are, and
3966 <p>This filter is designed for playback only. Do not use it prior to
3967 lossy compression, because compression tends to lose the dither and
3968 bring back the bands.
3970 <p>The filter takes two optional parameters, separated by ’:’:
3971 <var>strength</var>:<var>radius</var>
3973 <p><var>strength</var> is the maximum amount by which the filter will change
3974 any one pixel. Also the threshold for detecting nearly flat
3975 regions. Acceptable values range from .51 to 255, default value is
3976 1.2, out-of-range values will be clipped to the valid range.
3978 <p><var>radius</var> is the neighborhood to fit the gradient to. A larger
3979 radius makes for smoother gradients, but also prevents the filter from
3980 modifying the pixels near detailed regions. Acceptable values are
3981 8-32, default value is 16, out-of-range values will be clipped to the
3984 <table><tr><td> </td><td><pre class="example"># default parameters
3989 </pre></td></tr></table>
3991 <a name="hflip"></a>
3992 <h2 class="section"><a href="ffmpeg.html#toc-hflip">18.13 hflip</a></h2>
3994 <p>Flip the input video horizontally.
3996 <p>For example to horizontally flip the video in input with
3997 ‘<tt>ffmpeg</tt>’:
3998 </p><table><tr><td> </td><td><pre class="example">ffmpeg -i in.avi -vf "hflip" out.avi
3999 </pre></td></tr></table>
4001 <a name="hqdn3d"></a>
4002 <h2 class="section"><a href="ffmpeg.html#toc-hqdn3d">18.14 hqdn3d</a></h2>
4004 <p>High precision/quality 3d denoise filter. This filter aims to reduce
4005 image noise producing smooth images and making still images really
4006 still. It should enhance compressibility.
4008 <p>It accepts the following optional parameters:
4009 <var>luma_spatial</var>:<var>chroma_spatial</var>:<var>luma_tmp</var>:<var>chroma_tmp</var>
4011 <dl compact="compact">
4012 <dt> ‘<samp>luma_spatial</samp>’</dt>
4013 <dd><p>a non-negative float number which specifies spatial luma strength,
4017 <dt> ‘<samp>chroma_spatial</samp>’</dt>
4018 <dd><p>a non-negative float number which specifies spatial chroma strength,
4019 defaults to 3.0*<var>luma_spatial</var>/4.0
4022 <dt> ‘<samp>luma_tmp</samp>’</dt>
4023 <dd><p>a float number which specifies luma temporal strength, defaults to
4024 6.0*<var>luma_spatial</var>/4.0
4027 <dt> ‘<samp>chroma_tmp</samp>’</dt>
4028 <dd><p>a float number which specifies chroma temporal strength, defaults to
4029 <var>luma_tmp</var>*<var>chroma_spatial</var>/<var>luma_spatial</var>
4034 <h2 class="section"><a href="ffmpeg.html#toc-mp">18.15 mp</a></h2>
4036 <p>Apply an MPlayer filter to the input video.
4038 <p>This filter provides a wrapper around most of the filters of
4041 <p>This wrapper is considered experimental. Some of the wrapped filters
4042 may not work properly and we may drop support for them, as they will
4043 be implemented natively into FFmpeg. Thus you should avoid
4044 depending on them when writing portable scripts.
4046 <p>The filters accepts the parameters:
4047 <var>filter_name</var>[:=]<var>filter_params</var>
4049 <p><var>filter_name</var> is the name of a supported MPlayer filter,
4050 <var>filter_params</var> is a string containing the parameters accepted by
4053 <p>The list of the currently supported filters follows:
4054 </p><dl compact="compact">
4055 <dt> <var>2xsai</var></dt>
4056 <dt> <var>blackframe</var></dt>
4057 <dt> <var>boxblur</var></dt>
4058 <dt> <var>cropdetect</var></dt>
4059 <dt> <var>decimate</var></dt>
4060 <dt> <var>delogo</var></dt>
4061 <dt> <var>denoise3d</var></dt>
4062 <dt> <var>detc</var></dt>
4063 <dt> <var>dint</var></dt>
4064 <dt> <var>divtc</var></dt>
4065 <dt> <var>down3dright</var></dt>
4066 <dt> <var>dsize</var></dt>
4067 <dt> <var>eq2</var></dt>
4068 <dt> <var>eq</var></dt>
4069 <dt> <var>field</var></dt>
4070 <dt> <var>fil</var></dt>
4071 <dt> <var>fixpts</var></dt>
4072 <dt> <var>framestep</var></dt>
4073 <dt> <var>fspp</var></dt>
4074 <dt> <var>geq</var></dt>
4075 <dt> <var>gradfun</var></dt>
4076 <dt> <var>harddup</var></dt>
4077 <dt> <var>hqdn3d</var></dt>
4078 <dt> <var>hue</var></dt>
4079 <dt> <var>il</var></dt>
4080 <dt> <var>ilpack</var></dt>
4081 <dt> <var>ivtc</var></dt>
4082 <dt> <var>kerndeint</var></dt>
4083 <dt> <var>mcdeint</var></dt>
4084 <dt> <var>mirror</var></dt>
4085 <dt> <var>noise</var></dt>
4086 <dt> <var>ow</var></dt>
4087 <dt> <var>palette</var></dt>
4088 <dt> <var>perspective</var></dt>
4089 <dt> <var>phase</var></dt>
4090 <dt> <var>pp7</var></dt>
4091 <dt> <var>pullup</var></dt>
4092 <dt> <var>qp</var></dt>
4093 <dt> <var>rectangle</var></dt>
4094 <dt> <var>remove_logo</var></dt>
4095 <dt> <var>rgbtest</var></dt>
4096 <dt> <var>rotate</var></dt>
4097 <dt> <var>sab</var></dt>
4098 <dt> <var>screenshot</var></dt>
4099 <dt> <var>smartblur</var></dt>
4100 <dt> <var>softpulldown</var></dt>
4101 <dt> <var>softskip</var></dt>
4102 <dt> <var>spp</var></dt>
4103 <dt> <var>swapuv</var></dt>
4104 <dt> <var>telecine</var></dt>
4105 <dt> <var>test</var></dt>
4106 <dt> <var>tile</var></dt>
4107 <dt> <var>tinterlace</var></dt>
4108 <dt> <var>unsharp</var></dt>
4109 <dt> <var>uspp</var></dt>
4110 <dt> <var>yuvcsp</var></dt>
4111 <dt> <var>yvu9</var></dt>
4114 <p>The parameter syntax and behavior for the listed filters are the same
4115 of the corresponding MPlayer filters. For detailed instructions check
4116 the "VIDEO FILTERS" section in the MPlayer manual.
4118 <p>Some examples follow:
4119 </p><table><tr><td> </td><td><pre class="example"># remove a logo by interpolating the surrounding pixels
4120 mp=delogo=200:200:80:20:1
4122 # adjust gamma, brightness, contrast
4125 # tweak hue and saturation
4127 </pre></td></tr></table>
4129 <p>See also mplayer(1), <a href="http://www.mplayerhq.hu/">http://www.mplayerhq.hu/</a>.
4131 <a name="noformat"></a>
4132 <h2 class="section"><a href="ffmpeg.html#toc-noformat">18.16 noformat</a></h2>
4134 <p>Force libavfilter not to use any of the specified pixel formats for the
4135 input to the next filter.
4137 <p>The filter accepts a list of pixel format names, separated by ":",
4138 for example "yuv420p:monow:rgb24".
4140 <p>Some examples follow:
4141 </p><table><tr><td> </td><td><pre class="example"># force libavfilter to use a format different from "yuv420p" for the
4142 # input to the vflip filter
4143 noformat=yuv420p,vflip
4145 # convert the input video to any of the formats not contained in the list
4146 noformat=yuv420p:yuv444p:yuv410p
4147 </pre></td></tr></table>
4149 <a name="null-1"></a>
4150 <h2 class="section"><a href="ffmpeg.html#toc-null-1">18.17 null</a></h2>
4152 <p>Pass the video source unchanged to the output.
4155 <h2 class="section"><a href="ffmpeg.html#toc-ocv">18.18 ocv</a></h2>
4157 <p>Apply video transform using libopencv.
4159 <p>To enable this filter install libopencv library and headers and
4160 configure FFmpeg with –enable-libopencv.
4162 <p>The filter takes the parameters: <var>filter_name</var>{:=}<var>filter_params</var>.
4164 <p><var>filter_name</var> is the name of the libopencv filter to apply.
4166 <p><var>filter_params</var> specifies the parameters to pass to the libopencv
4167 filter. If not specified the default values are assumed.
4169 <p>Refer to the official libopencv documentation for more precise
4171 <a href="http://opencv.willowgarage.com/documentation/c/image_filtering.html">http://opencv.willowgarage.com/documentation/c/image_filtering.html</a>
4173 <p>Follows the list of supported libopencv filters.
4175 <p><a name="dilate"></a>
4176 </p><a name="dilate-1"></a>
4177 <h3 class="subsection"><a href="ffmpeg.html#toc-dilate-1">18.18.1 dilate</a></h3>
4179 <p>Dilate an image by using a specific structuring element.
4180 This filter corresponds to the libopencv function <code>cvDilate</code>.
4182 <p>It accepts the parameters: <var>struct_el</var>:<var>nb_iterations</var>.
4184 <p><var>struct_el</var> represents a structuring element, and has the syntax:
4185 <var>cols</var>x<var>rows</var>+<var>anchor_x</var>x<var>anchor_y</var>/<var>shape</var>
4187 <p><var>cols</var> and <var>rows</var> represent the number of colums and rows of
4188 the structuring element, <var>anchor_x</var> and <var>anchor_y</var> the anchor
4189 point, and <var>shape</var> the shape for the structuring element, and
4190 can be one of the values "rect", "cross", "ellipse", "custom".
4192 <p>If the value for <var>shape</var> is "custom", it must be followed by a
4193 string of the form "=<var>filename</var>". The file with name
4194 <var>filename</var> is assumed to represent a binary image, with each
4195 printable character corresponding to a bright pixel. When a custom
4196 <var>shape</var> is used, <var>cols</var> and <var>rows</var> are ignored, the number
4197 or columns and rows of the read file are assumed instead.
4199 <p>The default value for <var>struct_el</var> is "3x3+0x0/rect".
4201 <p><var>nb_iterations</var> specifies the number of times the transform is
4202 applied to the image, and defaults to 1.
4204 <p>Follow some example:
4205 </p><table><tr><td> </td><td><pre class="example"># use the default values
4208 # dilate using a structuring element with a 5x5 cross, iterate two times
4209 ocv=dilate=5x5+2x2/cross:2
4211 # read the shape from the file diamond.shape, iterate two times
4212 # the file diamond.shape may contain a pattern of characters like this:
4218 # the specified cols and rows are ignored (but not the anchor point coordinates)
4219 ocv=0x0+2x2/custom=diamond.shape:2
4220 </pre></td></tr></table>
4222 <a name="erode"></a>
4223 <h3 class="subsection"><a href="ffmpeg.html#toc-erode">18.18.2 erode</a></h3>
4225 <p>Erode an image by using a specific structuring element.
4226 This filter corresponds to the libopencv function <code>cvErode</code>.
4228 <p>The filter accepts the parameters: <var>struct_el</var>:<var>nb_iterations</var>,
4229 with the same meaning and use of those of the dilate filter
4230 (see <a href="#dilate">dilate</a>).
4232 <a name="smooth"></a>
4233 <h3 class="subsection"><a href="ffmpeg.html#toc-smooth">18.18.3 smooth</a></h3>
4235 <p>Smooth the input video.
4237 <p>The filter takes the following parameters:
4238 <var>type</var>:<var>param1</var>:<var>param2</var>:<var>param3</var>:<var>param4</var>.
4240 <p><var>type</var> is the type of smooth filter to apply, and can be one of
4241 the following values: "blur", "blur_no_scale", "median", "gaussian",
4242 "bilateral". The default value is "gaussian".
4244 <p><var>param1</var>, <var>param2</var>, <var>param3</var>, and <var>param4</var> are
4245 parameters whose meanings depend on smooth type. <var>param1</var> and
4246 <var>param2</var> accept integer positive values or 0, <var>param3</var> and
4247 <var>param4</var> accept float values.
4249 <p>The default value for <var>param1</var> is 3, the default value for the
4250 other parameters is 0.
4252 <p>These parameters correspond to the parameters assigned to the
4253 libopencv function <code>cvSmooth</code>.
4255 <a name="overlay"></a>
4256 <h2 class="section"><a href="ffmpeg.html#toc-overlay">18.19 overlay</a></h2>
4258 <p>Overlay one video on top of another.
4260 <p>It takes two inputs and one output, the first input is the "main"
4261 video on which the second input is overlayed.
4263 <p>It accepts the parameters: <var>x</var>:<var>y</var>.
4265 <p><var>x</var> is the x coordinate of the overlayed video on the main video,
4266 <var>y</var> is the y coordinate. The parameters are expressions containing
4267 the following parameters:
4269 <dl compact="compact">
4270 <dt> ‘<samp>main_w, main_h</samp>’</dt>
4271 <dd><p>main input width and height
4274 <dt> ‘<samp>W, H</samp>’</dt>
4275 <dd><p>same as <var>main_w</var> and <var>main_h</var>
4278 <dt> ‘<samp>overlay_w, overlay_h</samp>’</dt>
4279 <dd><p>overlay input width and height
4282 <dt> ‘<samp>w, h</samp>’</dt>
4283 <dd><p>same as <var>overlay_w</var> and <var>overlay_h</var>
4287 <p>Be aware that frames are taken from each input video in timestamp
4288 order, hence, if their initial timestamps differ, it is a a good idea
4289 to pass the two inputs through a <var>setpts=PTS-STARTPTS</var> filter to
4290 have them begin in the same zero timestamp, as it does the example for
4291 the <var>movie</var> filter.
4293 <p>Follow some examples:
4294 </p><table><tr><td> </td><td><pre class="example"># draw the overlay at 10 pixels from the bottom right
4295 # corner of the main video.
4296 overlay=main_w-overlay_w-10:main_h-overlay_h-10
4298 # insert a transparent PNG logo in the bottom left corner of the input
4299 movie=logo.png [logo];
4300 [in][logo] overlay=10:main_h-overlay_h-10 [out]
4302 # insert 2 different transparent PNG logos (second logo on bottom
4304 movie=logo1.png [logo1];
4305 movie=logo2.png [logo2];
4306 [in][logo1] overlay=10:H-h-10 [in+logo1];
4307 [in+logo1][logo2] overlay=W-w-10:H-h-10 [out]
4309 # add a transparent color layer on top of the main video,
4310 # WxH specifies the size of the main input to the overlay filter
4311 color=red.3:WxH [over]; [in][over] overlay [out]
4312 </pre></td></tr></table>
4314 <p>You can chain togheter more overlays but the efficiency of such
4315 approach is yet to be tested.
4318 <h2 class="section"><a href="ffmpeg.html#toc-pad">18.20 pad</a></h2>
4320 <p>Add paddings to the input image, and places the original input at the
4321 given coordinates <var>x</var>, <var>y</var>.
4323 <p>It accepts the following parameters:
4324 <var>width</var>:<var>height</var>:<var>x</var>:<var>y</var>:<var>color</var>.
4326 <p>The parameters <var>width</var>, <var>height</var>, <var>x</var>, and <var>y</var> are
4327 expressions containing the following constants:
4329 <dl compact="compact">
4330 <dt> ‘<samp>E, PI, PHI</samp>’</dt>
4331 <dd><p>the corresponding mathematical approximated values for e
4332 (euler number), pi (greek PI), phi (golden ratio)
4335 <dt> ‘<samp>in_w, in_h</samp>’</dt>
4336 <dd><p>the input video width and heigth
4339 <dt> ‘<samp>iw, ih</samp>’</dt>
4340 <dd><p>same as <var>in_w</var> and <var>in_h</var>
4343 <dt> ‘<samp>out_w, out_h</samp>’</dt>
4344 <dd><p>the output width and heigth, that is the size of the padded area as
4345 specified by the <var>width</var> and <var>height</var> expressions
4348 <dt> ‘<samp>ow, oh</samp>’</dt>
4349 <dd><p>same as <var>out_w</var> and <var>out_h</var>
4352 <dt> ‘<samp>x, y</samp>’</dt>
4353 <dd><p>x and y offsets as specified by the <var>x</var> and <var>y</var>
4354 expressions, or NAN if not yet specified
4357 <dt> ‘<samp>a</samp>’</dt>
4358 <dd><p>input display aspect ratio, same as <var>iw</var> / <var>ih</var>
4361 <dt> ‘<samp>hsub, vsub</samp>’</dt>
4362 <dd><p>horizontal and vertical chroma subsample values. For example for the
4363 pixel format "yuv422p" <var>hsub</var> is 2 and <var>vsub</var> is 1.
4367 <p>Follows the description of the accepted parameters.
4369 <dl compact="compact">
4370 <dt> ‘<samp>width, height</samp>’</dt>
4372 <p>Specify the size of the output image with the paddings added. If the
4373 value for <var>width</var> or <var>height</var> is 0, the corresponding input size
4374 is used for the output.
4376 <p>The <var>width</var> expression can reference the value set by the
4377 <var>height</var> expression, and viceversa.
4379 <p>The default value of <var>width</var> and <var>height</var> is 0.
4382 <dt> ‘<samp>x, y</samp>’</dt>
4384 <p>Specify the offsets where to place the input image in the padded area
4385 with respect to the top/left border of the output image.
4387 <p>The <var>x</var> expression can reference the value set by the <var>y</var>
4388 expression, and viceversa.
4390 <p>The default value of <var>x</var> and <var>y</var> is 0.
4393 <dt> ‘<samp>color</samp>’</dt>
4395 <p>Specify the color of the padded area, it can be the name of a color
4396 (case insensitive match) or a 0xRRGGBB[AA] sequence.
4398 <p>The default value of <var>color</var> is "black".
4403 <p>Some examples follow:
4405 <table><tr><td> </td><td><pre class="example"># Add paddings with color "violet" to the input video. Output video
4406 # size is 640x480, the top-left corner of the input video is placed at
4408 pad=640:480:0:40:violet
4410 # pad the input to get an output with dimensions increased bt 3/2,
4411 # and put the input video at the center of the padded area
4412 pad="3/2*iw:3/2*ih:(ow-iw)/2:(oh-ih)/2"
4414 # pad the input to get a squared output with size equal to the maximum
4415 # value between the input width and height, and put the input video at
4416 # the center of the padded area
4417 pad="max(iw\,ih):ow:(ow-iw)/2:(oh-ih)/2"
4419 # pad the input to get a final w/h ratio of 16:9
4420 pad="ih*16/9:ih:(ow-iw)/2:(oh-ih)/2"
4422 # double output size and put the input video in the bottom-right
4423 # corner of the output padded area
4424 pad="2*iw:2*ih:ow-iw:oh-ih"
4425 </pre></td></tr></table>
4427 <a name="pixdesctest"></a>
4428 <h2 class="section"><a href="ffmpeg.html#toc-pixdesctest">18.21 pixdesctest</a></h2>
4430 <p>Pixel format descriptor test filter, mainly useful for internal
4431 testing. The output video should be equal to the input video.
4434 </p><table><tr><td> </td><td><pre class="example">format=monow, pixdesctest
4435 </pre></td></tr></table>
4437 <p>can be used to test the monowhite pixel format descriptor definition.
4439 <a name="scale"></a>
4440 <h2 class="section"><a href="ffmpeg.html#toc-scale">18.22 scale</a></h2>
4442 <p>Scale the input video to <var>width</var>:<var>height</var> and/or convert the image format.
4444 <p>The parameters <var>width</var> and <var>height</var> are expressions containing
4445 the following constants:
4447 <dl compact="compact">
4448 <dt> ‘<samp>E, PI, PHI</samp>’</dt>
4449 <dd><p>the corresponding mathematical approximated values for e
4450 (euler number), pi (greek PI), phi (golden ratio)
4453 <dt> ‘<samp>in_w, in_h</samp>’</dt>
4454 <dd><p>the input width and heigth
4457 <dt> ‘<samp>iw, ih</samp>’</dt>
4458 <dd><p>same as <var>in_w</var> and <var>in_h</var>
4461 <dt> ‘<samp>out_w, out_h</samp>’</dt>
4462 <dd><p>the output (cropped) width and heigth
4465 <dt> ‘<samp>ow, oh</samp>’</dt>
4466 <dd><p>same as <var>out_w</var> and <var>out_h</var>
4469 <dt> ‘<samp>a</samp>’</dt>
4470 <dd><p>input display aspect ratio, same as <var>iw</var> / <var>ih</var>
4473 <dt> ‘<samp>hsub, vsub</samp>’</dt>
4474 <dd><p>horizontal and vertical chroma subsample values. For example for the
4475 pixel format "yuv422p" <var>hsub</var> is 2 and <var>vsub</var> is 1.
4479 <p>If the input image format is different from the format requested by
4480 the next filter, the scale filter will convert the input to the
4483 <p>If the value for <var>width</var> or <var>height</var> is 0, the respective input
4484 size is used for the output.
4486 <p>If the value for <var>width</var> or <var>height</var> is -1, the scale filter will
4487 use, for the respective output size, a value that maintains the aspect
4488 ratio of the input image.
4490 <p>The default value of <var>width</var> and <var>height</var> is 0.
4492 <p>Some examples follow:
4493 </p><table><tr><td> </td><td><pre class="example"># scale the input video to a size of 200x100.
4496 # scale the input to 2x
4498 # the above is the same as
4501 # scale the input to half size
4504 # increase the width, and set the height to the same size
4507 # seek for Greek harmony
4511 # increase the height, and set the width to 3/2 of the height
4514 # increase the size, but make the size a multiple of the chroma
4515 scale="trunc(3/2*iw/hsub)*hsub:trunc(3/2*ih/vsub)*vsub"
4517 # increase the width to a maximum of 500 pixels, keep the same input aspect ratio
4518 scale='min(500\, iw*3/2):-1'
4519 </pre></td></tr></table>
4521 <p><a name="setdar"></a>
4522 </p><a name="setdar-1"></a>
4523 <h2 class="section"><a href="ffmpeg.html#toc-setdar-1">18.23 setdar</a></h2>
4525 <p>Set the Display Aspect Ratio for the filter output video.
4527 <p>This is done by changing the specified Sample (aka Pixel) Aspect
4528 Ratio, according to the following equation:
4529 <em>DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR</em>
4531 <p>Keep in mind that this filter does not modify the pixel dimensions of
4532 the video frame. Also the display aspect ratio set by this filter may
4533 be changed by later filters in the filterchain, e.g. in case of
4534 scaling or if another "setdar" or a "setsar" filter is applied.
4536 <p>The filter accepts a parameter string which represents the wanted
4537 display aspect ratio.
4538 The parameter can be a floating point number string, or an expression
4539 of the form <var>num</var>:<var>den</var>, where <var>num</var> and <var>den</var> are the
4540 numerator and denominator of the aspect ratio.
4541 If the parameter is not specified, it is assumed the value "0:1".
4543 <p>For example to change the display aspect ratio to 16:9, specify:
4544 </p><table><tr><td> </td><td><pre class="example">setdar=16:9
4545 # the above is equivalent to
4547 </pre></td></tr></table>
4549 <p>See also the "setsar" filter documentation (see <a href="#setsar">setsar</a>).
4551 <a name="setpts"></a>
4552 <h2 class="section"><a href="ffmpeg.html#toc-setpts">18.24 setpts</a></h2>
4554 <p>Change the PTS (presentation timestamp) of the input video frames.
4556 <p>Accept in input an expression evaluated through the eval API, which
4557 can contain the following constants:
4559 <dl compact="compact">
4560 <dt> ‘<samp>PTS</samp>’</dt>
4561 <dd><p>the presentation timestamp in input
4564 <dt> ‘<samp>PI</samp>’</dt>
4568 <dt> ‘<samp>PHI</samp>’</dt>
4572 <dt> ‘<samp>E</samp>’</dt>
4576 <dt> ‘<samp>N</samp>’</dt>
4577 <dd><p>the count of the input frame, starting from 0.
4580 <dt> ‘<samp>STARTPTS</samp>’</dt>
4581 <dd><p>the PTS of the first video frame
4584 <dt> ‘<samp>INTERLACED</samp>’</dt>
4585 <dd><p>tell if the current frame is interlaced
4588 <dt> ‘<samp>POS</samp>’</dt>
4589 <dd><p>original position in the file of the frame, or undefined if undefined
4590 for the current frame
4593 <dt> ‘<samp>PREV_INPTS</samp>’</dt>
4594 <dd><p>previous input PTS
4597 <dt> ‘<samp>PREV_OUTPTS</samp>’</dt>
4598 <dd><p>previous output PTS
4603 <p>Some examples follow:
4605 <table><tr><td> </td><td><pre class="example"># start counting PTS from zero
4617 # fixed rate 25 fps with some jitter
4618 setpts='1/(25*TB) * (N + 0.05 * sin(N*2*PI/25))'
4619 </pre></td></tr></table>
4621 <p><a name="setsar"></a>
4622 </p><a name="setsar-1"></a>
4623 <h2 class="section"><a href="ffmpeg.html#toc-setsar-1">18.25 setsar</a></h2>
4625 <p>Set the Sample (aka Pixel) Aspect Ratio for the filter output video.
4627 <p>Note that as a consequence of the application of this filter, the
4628 output display aspect ratio will change according to the following
4630 <em>DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR</em>
4632 <p>Keep in mind that the sample aspect ratio set by this filter may be
4633 changed by later filters in the filterchain, e.g. if another "setsar"
4634 or a "setdar" filter is applied.
4636 <p>The filter accepts a parameter string which represents the wanted
4637 sample aspect ratio.
4638 The parameter can be a floating point number string, or an expression
4639 of the form <var>num</var>:<var>den</var>, where <var>num</var> and <var>den</var> are the
4640 numerator and denominator of the aspect ratio.
4641 If the parameter is not specified, it is assumed the value "0:1".
4643 <p>For example to change the sample aspect ratio to 10:11, specify:
4644 </p><table><tr><td> </td><td><pre class="example">setsar=10:11
4645 </pre></td></tr></table>
4647 <a name="settb"></a>
4648 <h2 class="section"><a href="ffmpeg.html#toc-settb">18.26 settb</a></h2>
4650 <p>Set the timebase to use for the output frames timestamps.
4651 It is mainly useful for testing timebase configuration.
4653 <p>It accepts in input an arithmetic expression representing a rational.
4654 The expression can contain the constants "PI", "E", "PHI", "AVTB" (the
4655 default timebase), and "intb" (the input timebase).
4657 <p>The default value for the input is "intb".
4659 <p>Follow some examples.
4661 <table><tr><td> </td><td><pre class="example"># set the timebase to 1/25
4664 # set the timebase to 1/10
4667 #set the timebase to 1001/1000
4670 #set the timebase to 2*intb
4673 #set the default timebase value
4675 </pre></td></tr></table>
4677 <a name="showinfo"></a>
4678 <h2 class="section"><a href="ffmpeg.html#toc-showinfo">18.27 showinfo</a></h2>
4680 <p>Show a line containing various information for each input video frame.
4681 The input video is not modified.
4683 <p>The shown line contains a sequence of key/value pairs of the form
4684 <var>key</var>:<var>value</var>.
4686 <p>A description of each shown parameter follows:
4688 <dl compact="compact">
4689 <dt> ‘<samp>n</samp>’</dt>
4690 <dd><p>sequential number of the input frame, starting from 0
4693 <dt> ‘<samp>pts</samp>’</dt>
4694 <dd><p>Presentation TimeStamp of the input frame, expressed as a number of
4695 time base units. The time base unit depends on the filter input pad.
4698 <dt> ‘<samp>pts_time</samp>’</dt>
4699 <dd><p>Presentation TimeStamp of the input frame, expressed as a number of
4703 <dt> ‘<samp>pos</samp>’</dt>
4704 <dd><p>position of the frame in the input stream, -1 if this information in
4705 unavailable and/or meanigless (for example in case of synthetic video)
4708 <dt> ‘<samp>fmt</samp>’</dt>
4709 <dd><p>pixel format name
4712 <dt> ‘<samp>sar</samp>’</dt>
4713 <dd><p>sample aspect ratio of the input frame, expressed in the form
4714 <var>num</var>/<var>den</var>
4717 <dt> ‘<samp>s</samp>’</dt>
4718 <dd><p>size of the input frame, expressed in the form
4719 <var>width</var>x<var>height</var>
4722 <dt> ‘<samp>i</samp>’</dt>
4723 <dd><p>interlaced mode ("P" for "progressive", "T" for top field first, "B"
4724 for bottom field first)
4727 <dt> ‘<samp>iskey</samp>’</dt>
4728 <dd><p>1 if the frame is a key frame, 0 otherwise
4731 <dt> ‘<samp>type</samp>’</dt>
4732 <dd><p>picture type of the input frame ("I" for an I-frame, "P" for a
4733 P-frame, "B" for a B-frame, "?" for unknown type).
4734 Check also the documentation of the <code>AVPictureType</code> enum and of
4735 the <code>av_get_picture_type_char</code> function defined in
4736 ‘<tt>libavutil/avutil.h</tt>’.
4739 <dt> ‘<samp>checksum</samp>’</dt>
4740 <dd><p>Adler-32 checksum of all the planes of the input frame
4743 <dt> ‘<samp>plane_checksum</samp>’</dt>
4744 <dd><p>Adler-32 checksum of each plane of the input frame, expressed in the form
4745 "[<var>c0</var> <var>c1</var> <var>c2</var> <var>c3</var>]"
4749 <a name="slicify"></a>
4750 <h2 class="section"><a href="ffmpeg.html#toc-slicify">18.28 slicify</a></h2>
4752 <p>Pass the images of input video on to next video filter as multiple
4755 <table><tr><td> </td><td><pre class="example">./ffmpeg -i in.avi -vf "slicify=32" out.avi
4756 </pre></td></tr></table>
4758 <p>The filter accepts the slice height as parameter. If the parameter is
4759 not specified it will use the default value of 16.
4761 <p>Adding this in the beginning of filter chains should make filtering
4762 faster due to better use of the memory cache.
4764 <a name="transpose"></a>
4765 <h2 class="section"><a href="ffmpeg.html#toc-transpose">18.29 transpose</a></h2>
4767 <p>Transpose rows with columns in the input video and optionally flip it.
4769 <p>It accepts a parameter representing an integer, which can assume the
4772 <dl compact="compact">
4773 <dt> ‘<samp>0</samp>’</dt>
4774 <dd><p>Rotate by 90 degrees counterclockwise and vertically flip (default), that is:
4775 </p><table><tr><td> </td><td><pre class="example">L.R L.l
4778 </pre></td></tr></table>
4781 <dt> ‘<samp>1</samp>’</dt>
4782 <dd><p>Rotate by 90 degrees clockwise, that is:
4783 </p><table><tr><td> </td><td><pre class="example">L.R l.L
4786 </pre></td></tr></table>
4789 <dt> ‘<samp>2</samp>’</dt>
4790 <dd><p>Rotate by 90 degrees counterclockwise, that is:
4791 </p><table><tr><td> </td><td><pre class="example">L.R R.r
4794 </pre></td></tr></table>
4797 <dt> ‘<samp>3</samp>’</dt>
4798 <dd><p>Rotate by 90 degrees clockwise and vertically flip, that is:
4799 </p><table><tr><td> </td><td><pre class="example">L.R r.R
4802 </pre></td></tr></table>
4806 <a name="unsharp"></a>
4807 <h2 class="section"><a href="ffmpeg.html#toc-unsharp">18.30 unsharp</a></h2>
4809 <p>Sharpen or blur the input video.
4811 <p>It accepts the following parameters:
4812 <var>luma_msize_x</var>:<var>luma_msize_y</var>:<var>luma_amount</var>:<var>chroma_msize_x</var>:<var>chroma_msize_y</var>:<var>chroma_amount</var>
4814 <p>Negative values for the amount will blur the input video, while positive
4815 values will sharpen. All parameters are optional and default to the
4816 equivalent of the string ’5:5:1.0:0:0:0.0’.
4818 <dl compact="compact">
4819 <dt> ‘<samp>luma_msize_x</samp>’</dt>
4820 <dd><p>Set the luma matrix horizontal size. It can be an integer between 3
4821 and 13, default value is 5.
4824 <dt> ‘<samp>luma_msize_y</samp>’</dt>
4825 <dd><p>Set the luma matrix vertical size. It can be an integer between 3
4826 and 13, default value is 5.
4829 <dt> ‘<samp>luma_amount</samp>’</dt>
4830 <dd><p>Set the luma effect strength. It can be a float number between -2.0
4831 and 5.0, default value is 1.0.
4834 <dt> ‘<samp>chroma_msize_x</samp>’</dt>
4835 <dd><p>Set the chroma matrix horizontal size. It can be an integer between 3
4836 and 13, default value is 0.
4839 <dt> ‘<samp>chroma_msize_y</samp>’</dt>
4840 <dd><p>Set the chroma matrix vertical size. It can be an integer between 3
4841 and 13, default value is 0.
4844 <dt> ‘<samp>luma_amount</samp>’</dt>
4845 <dd><p>Set the chroma effect strength. It can be a float number between -2.0
4846 and 5.0, default value is 0.0.
4851 <table><tr><td> </td><td><pre class="example"># Strong luma sharpen effect parameters
4854 # Strong blur of both luma and chroma parameters
4855 unsharp=7:7:-2:7:7:-2
4857 # Use the default values with <code>ffmpeg</code>
4858 ./ffmpeg -i in.avi -vf "unsharp" out.mp4
4859 </pre></td></tr></table>
4861 <a name="vflip"></a>
4862 <h2 class="section"><a href="ffmpeg.html#toc-vflip">18.31 vflip</a></h2>
4864 <p>Flip the input video vertically.
4866 <table><tr><td> </td><td><pre class="example">./ffmpeg -i in.avi -vf "vflip" out.avi
4867 </pre></td></tr></table>
4869 <a name="yadif"></a>
4870 <h2 class="section"><a href="ffmpeg.html#toc-yadif">18.32 yadif</a></h2>
4872 <p>Deinterlace the input video ("yadif" means "yet another deinterlacing
4875 <p>It accepts the optional parameters: <var>mode</var>:<var>parity</var>.
4877 <p><var>mode</var> specifies the interlacing mode to adopt, accepts one of the
4880 <dl compact="compact">
4881 <dt> ‘<samp>0</samp>’</dt>
4882 <dd><p>output 1 frame for each frame
4884 <dt> ‘<samp>1</samp>’</dt>
4885 <dd><p>output 1 frame for each field
4887 <dt> ‘<samp>2</samp>’</dt>
4888 <dd><p>like 0 but skips spatial interlacing check
4890 <dt> ‘<samp>3</samp>’</dt>
4891 <dd><p>like 1 but skips spatial interlacing check
4895 <p>Default value is 0.
4897 <p><var>parity</var> specifies the picture field parity assumed for the input
4898 interlaced video, accepts one of the following values:
4900 <dl compact="compact">
4901 <dt> ‘<samp>0</samp>’</dt>
4902 <dd><p>assume bottom field first
4904 <dt> ‘<samp>1</samp>’</dt>
4905 <dd><p>assume top field first
4907 <dt> ‘<samp>-1</samp>’</dt>
4908 <dd><p>enable automatic detection
4912 <p>Default value is -1.
4913 If interlacing is unknown or decoder does not export this information,
4914 top field first will be assumed.
4917 <a name="Video-Sources"></a>
4918 <h1 class="chapter"><a href="ffmpeg.html#toc-Video-Sources">19. Video Sources</a></h1>
4920 <p>Below is a description of the currently available video sources.
4922 <a name="buffer"></a>
4923 <h2 class="section"><a href="ffmpeg.html#toc-buffer">19.1 buffer</a></h2>
4925 <p>Buffer video frames, and make them available to the filter chain.
4927 <p>This source is mainly intended for a programmatic use, in particular
4928 through the interface defined in ‘<tt>libavfilter/vsrc_buffer.h</tt>’.
4930 <p>It accepts the following parameters:
4931 <var>width</var>:<var>height</var>:<var>pix_fmt_string</var>:<var>timebase_num</var>:<var>timebase_den</var>:<var>sample_aspect_ratio_num</var>:<var>sample_aspect_ratio.den</var>
4933 <p>All the parameters need to be explicitely defined.
4935 <p>Follows the list of the accepted parameters.
4937 <dl compact="compact">
4938 <dt> ‘<samp>width, height</samp>’</dt>
4939 <dd><p>Specify the width and height of the buffered video frames.
4942 <dt> ‘<samp>pix_fmt_string</samp>’</dt>
4943 <dd><p>A string representing the pixel format of the buffered video frames.
4944 It may be a number corresponding to a pixel format, or a pixel format
4948 <dt> ‘<samp>timebase_num, timebase_den</samp>’</dt>
4949 <dd><p>Specify numerator and denomitor of the timebase assumed by the
4950 timestamps of the buffered frames.
4953 <dt> ‘<samp>sample_aspect_ratio.num, sample_aspect_ratio.den</samp>’</dt>
4954 <dd><p>Specify numerator and denominator of the sample aspect ratio assumed
4955 by the video frames.
4960 </p><table><tr><td> </td><td><pre class="example">buffer=320:240:yuv410p:1:24:1:1
4961 </pre></td></tr></table>
4963 <p>will instruct the source to accept video frames with size 320x240 and
4964 with format "yuv410p", assuming 1/24 as the timestamps timebase and
4965 square pixels (1:1 sample aspect ratio).
4966 Since the pixel format with name "yuv410p" corresponds to the number 6
4967 (check the enum PixelFormat definition in ‘<tt>libavutil/pixfmt.h</tt>’),
4968 this example corresponds to:
4969 </p><table><tr><td> </td><td><pre class="example">buffer=320:240:6:1:24
4970 </pre></td></tr></table>
4972 <a name="color"></a>
4973 <h2 class="section"><a href="ffmpeg.html#toc-color">19.2 color</a></h2>
4975 <p>Provide an uniformly colored input.
4977 <p>It accepts the following parameters:
4978 <var>color</var>:<var>frame_size</var>:<var>frame_rate</var>
4980 <p>Follows the description of the accepted parameters.
4982 <dl compact="compact">
4983 <dt> ‘<samp>color</samp>’</dt>
4984 <dd><p>Specify the color of the source. It can be the name of a color (case
4985 insensitive match) or a 0xRRGGBB[AA] sequence, possibly followed by an
4986 alpha specifier. The default value is "black".
4989 <dt> ‘<samp>frame_size</samp>’</dt>
4990 <dd><p>Specify the size of the sourced video, it may be a string of the form
4991 <var>width</var>x<var>heigth</var>, or the name of a size abbreviation. The
4992 default value is "320x240".
4995 <dt> ‘<samp>frame_rate</samp>’</dt>
4996 <dd><p>Specify the frame rate of the sourced video, as the number of frames
4997 generated per second. It has to be a string in the format
4998 <var>frame_rate_num</var>/<var>frame_rate_den</var>, an integer number, a float
4999 number or a valid video frame rate abbreviation. The default value is
5005 <p>For example the following graph description will generate a red source
5006 with an opacity of 0.2, with size "qcif" and a frame rate of 10
5007 frames per second, which will be overlayed over the source connected
5008 to the pad with identifier "in".
5010 <table><tr><td> </td><td><pre class="example">"color=red@0.2:qcif:10 [color]; [in][color] overlay [out]"
5011 </pre></td></tr></table>
5013 <a name="movie"></a>
5014 <h2 class="section"><a href="ffmpeg.html#toc-movie">19.3 movie</a></h2>
5016 <p>Read a video stream from a movie container.
5018 <p>It accepts the syntax: <var>movie_name</var>[:<var>options</var>] where
5019 <var>movie_name</var> is the name of the resource to read (not necessarily
5020 a file but also a device or a stream accessed through some protocol),
5021 and <var>options</var> is an optional sequence of <var>key</var>=<var>value</var>
5022 pairs, separated by ":".
5024 <p>The description of the accepted options follows.
5026 <dl compact="compact">
5027 <dt> ‘<samp>format_name, f</samp>’</dt>
5028 <dd><p>Specifies the format assumed for the movie to read, and can be either
5029 the name of a container or an input device. If not specified the
5030 format is guessed from <var>movie_name</var> or by probing.
5033 <dt> ‘<samp>seek_point, sp</samp>’</dt>
5034 <dd><p>Specifies the seek point in seconds, the frames will be output
5035 starting from this seek point, the parameter is evaluated with
5036 <code>av_strtod</code> so the numerical value may be suffixed by an IS
5037 postfix. Default value is "0".
5040 <dt> ‘<samp>stream_index, si</samp>’</dt>
5041 <dd><p>Specifies the index of the video stream to read. If the value is -1,
5042 the best suited video stream will be automatically selected. Default
5043 value is "-1".
5048 <p>This filter allows to overlay a second video on top of main input of
5049 a filtergraph as shown in this graph:
5050 </p><table><tr><td> </td><td><pre class="example">input -----------> deltapts0 --> overlay --> output
5053 movie --> scale--> deltapts1 -------+
5054 </pre></td></tr></table>
5056 <p>Some examples follow:
5057 </p><table><tr><td> </td><td><pre class="example"># skip 3.2 seconds from the start of the avi file in.avi, and overlay it
5058 # on top of the input labelled as "in".
5059 movie=in.avi:seek_point=3.2, scale=180:-1, setpts=PTS-STARTPTS [movie];
5060 [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
5062 # read from a video4linux2 device, and overlay it on top of the input
5063 # labelled as "in"
5064 movie=/dev/video0:f=video4linux2, scale=180:-1, setpts=PTS-STARTPTS [movie];
5065 [in] setpts=PTS-STARTPTS, [movie] overlay=16:16 [out]
5067 </pre></td></tr></table>
5069 <a name="nullsrc"></a>
5070 <h2 class="section"><a href="ffmpeg.html#toc-nullsrc">19.4 nullsrc</a></h2>
5072 <p>Null video source, never return images. It is mainly useful as a
5073 template and to be employed in analysis / debugging tools.
5075 <p>It accepts as optional parameter a string of the form
5076 <var>width</var>:<var>height</var>:<var>timebase</var>.
5078 <p><var>width</var> and <var>height</var> specify the size of the configured
5079 source. The default values of <var>width</var> and <var>height</var> are
5080 respectively 352 and 288 (corresponding to the CIF size format).
5082 <p><var>timebase</var> specifies an arithmetic expression representing a
5083 timebase. The expression can contain the constants "PI", "E", "PHI",
5084 "AVTB" (the default timebase), and defaults to the value "AVTB".
5086 <a name="frei0r_005fsrc"></a>
5087 <h2 class="section"><a href="ffmpeg.html#toc-frei0r_005fsrc">19.5 frei0r_src</a></h2>
5089 <p>Provide a frei0r source.
5091 <p>To enable compilation of this filter you need to install the frei0r
5092 header and configure FFmpeg with –enable-frei0r.
5094 <p>The source supports the syntax:
5095 </p><table><tr><td> </td><td><pre class="example"><var>size</var>:<var>rate</var>:<var>src_name</var>[{=|:}<var>param1</var>:<var>param2</var>:...:<var>paramN</var>]
5096 </pre></td></tr></table>
5098 <p><var>size</var> is the size of the video to generate, may be a string of the
5099 form <var>width</var>x<var>height</var> or a frame size abbreviation.
5100 <var>rate</var> is the rate of the video to generate, may be a string of
5101 the form <var>num</var>/<var>den</var> or a frame rate abbreviation.
5102 <var>src_name</var> is the name to the frei0r source to load. For more
5103 information regarding frei0r and how to set the parameters read the
5104 section "frei0r" (see <a href="#frei0r">frei0r</a>) in the description of the video
5107 <p>Some examples follow:
5108 </p><table><tr><td> </td><td><pre class="example"># generate a frei0r partik0l source with size 200x200 and framerate 10
5109 # which is overlayed on the overlay filter main input
5110 frei0r_src=200x200:10:partik0l=1234 [overlay]; [in][overlay] overlay
5111 </pre></td></tr></table>
5114 <a name="Video-Sinks"></a>
5115 <h1 class="chapter"><a href="ffmpeg.html#toc-Video-Sinks">20. Video Sinks</a></h1>
5117 <p>Below is a description of the currently available video sinks.
5119 <a name="nullsink"></a>
5120 <h2 class="section"><a href="ffmpeg.html#toc-nullsink">20.1 nullsink</a></h2>
5122 <p>Null video sink, do absolutely nothing with the input video. It is
5123 mainly useful as a template and to be employed in analysis / debugging
5127 <a name="Metadata"></a>
5128 <h1 class="chapter"><a href="ffmpeg.html#toc-Metadata">21. Metadata</a></h1>
5130 <p>FFmpeg is able to dump metadata from media files into a simple UTF-8-encoded
5131 INI-like text file and then load it back using the metadata muxer/demuxer.
5133 <p>The file format is as follows:
5136 A file consists of a header and a number of metadata tags divided into sections,
5137 each on its own line.
5140 The header is a ’;FFMETADATA’ string, followed by a version number (now 1).
5143 Metadata tags are of the form ’key=value’
5146 Immediately after header follows global metadata
5149 After global metadata there may be sections with per-stream/per-chapter
5153 A section starts with the section name in uppercase (i.e. STREAM or CHAPTER) in
5154 brackets (’[’, ’]’) and ends with next section or end of file.
5157 At the beginning of a chapter section there may be an optional timebase to be
5158 used for start/end values. It must be in form ’TIMEBASE=num/den’, where num and
5159 den are integers. If the timebase is missing then start/end times are assumed to
5161 Next a chapter section must contain chapter start and end times in form
5162 ’START=num’, ’END=num’, where num is a positive integer.
5165 Empty lines and lines starting with ’;’ or ’#’ are ignored.
5168 Metadata keys or values containing special characters (’=’, ’;’, ’#’, ’\’ and a
5169 newline) must be escaped with a backslash ’\’.
5172 Note that whitespace in metadata (e.g. foo = bar) is considered to be a part of
5173 the tag (in the example above key is ’foo ’, value is ’ bar’).
5176 <p>A ffmetadata file might look like this:
5177 </p><table><tr><td> </td><td><pre class="example">;FFMETADATA1
5180 artist=FFmpeg troll team
5185 #chapter ends at 0:01:00
5191 </pre></td></tr></table>
5197 This document was generated by <em>Kyle Schwarz</em> on <em>May 18, 2011</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.