1FFMPEG(1)                                                            FFMPEG(1)
2
3
4

NAME

6       ffmpeg - ffmpeg video converter
7

SYNOPSIS

9       ffmpeg [global_options] {[input_file_options] -i input_url} ...
10       {[output_file_options] output_url} ...
11

DESCRIPTION

13       ffmpeg is a very fast video and audio converter that can also grab from
14       a live audio/video source. It can also convert between arbitrary sample
15       rates and resize video on the fly with a high quality polyphase filter.
16
17       ffmpeg reads from an arbitrary number of input "files" (which can be
18       regular files, pipes, network streams, grabbing devices, etc.),
19       specified by the "-i" option, and writes to an arbitrary number of
20       output "files", which are specified by a plain output url. Anything
21       found on the command line which cannot be interpreted as an option is
22       considered to be an output url.
23
24       Each input or output url can, in principle, contain any number of
25       streams of different types (video/audio/subtitle/attachment/data). The
26       allowed number and/or types of streams may be limited by the container
27       format. Selecting which streams from which inputs will go into which
28       output is either done automatically or with the "-map" option (see the
29       Stream selection chapter).
30
31       To refer to input files in options, you must use their indices
32       (0-based). E.g.  the first input file is 0, the second is 1, etc.
33       Similarly, streams within a file are referred to by their indices. E.g.
34       "2:3" refers to the fourth stream in the third input file. Also see the
35       Stream specifiers chapter.
36
37       As a general rule, options are applied to the next specified file.
38       Therefore, order is important, and you can have the same option on the
39       command line multiple times. Each occurrence is then applied to the
40       next input or output file.  Exceptions from this rule are the global
41       options (e.g. verbosity level), which should be specified first.
42
43       Do not mix input and output files -- first specify all input files,
44       then all output files. Also do not mix options which belong to
45       different files. All options apply ONLY to the next input or output
46       file and are reset between files.
47
48       •   To set the video bitrate of the output file to 64 kbit/s:
49
50                   ffmpeg -i input.avi -b:v 64k -bufsize 64k output.avi
51
52       •   To force the frame rate of the output file to 24 fps:
53
54                   ffmpeg -i input.avi -r 24 output.avi
55
56       •   To force the frame rate of the input file (valid for raw formats
57           only) to 1 fps and the frame rate of the output file to 24 fps:
58
59                   ffmpeg -r 1 -i input.m2v -r 24 output.avi
60
61       The format option may be needed for raw input files.
62

DETAILED DESCRIPTION

64       The transcoding process in ffmpeg for each output can be described by
65       the following diagram:
66
67                _______              ______________
68               |       |            |              |
69               | input |  demuxer   | encoded data |   decoder
70               | file  | ---------> | packets      | -----+
71               |_______|            |______________|      |
72                                                          v
73                                                      _________
74                                                     |         |
75                                                     | decoded |
76                                                     | frames  |
77                                                     |_________|
78                ________             ______________       |
79               |        |           |              |      |
80               | output | <-------- | encoded data | <----+
81               | file   |   muxer   | packets      |   encoder
82               |________|           |______________|
83
84       ffmpeg calls the libavformat library (containing demuxers) to read
85       input files and get packets containing encoded data from them. When
86       there are multiple input files, ffmpeg tries to keep them synchronized
87       by tracking lowest timestamp on any active input stream.
88
89       Encoded packets are then passed to the decoder (unless streamcopy is
90       selected for the stream, see further for a description). The decoder
91       produces uncompressed frames (raw video/PCM audio/...) which can be
92       processed further by filtering (see next section). After filtering, the
93       frames are passed to the encoder, which encodes them and outputs
94       encoded packets. Finally those are passed to the muxer, which writes
95       the encoded packets to the output file.
96
97   Filtering
98       Before encoding, ffmpeg can process raw audio and video frames using
99       filters from the libavfilter library. Several chained filters form a
100       filter graph. ffmpeg distinguishes between two types of filtergraphs:
101       simple and complex.
102
103       Simple filtergraphs
104
105       Simple filtergraphs are those that have exactly one input and output,
106       both of the same type. In the above diagram they can be represented by
107       simply inserting an additional step between decoding and encoding:
108
109                _________                        ______________
110               |         |                      |              |
111               | decoded |                      | encoded data |
112               | frames  |\                   _ | packets      |
113               |_________| \                  /||______________|
114                            \   __________   /
115                 simple     _\||          | /  encoder
116                 filtergraph   | filtered |/
117                               | frames   |
118                               |__________|
119
120       Simple filtergraphs are configured with the per-stream -filter option
121       (with -vf and -af aliases for video and audio respectively).  A simple
122       filtergraph for video can look for example like this:
123
124                _______        _____________        _______        ________
125               |       |      |             |      |       |      |        |
126               | input | ---> | deinterlace | ---> | scale | ---> | output |
127               |_______|      |_____________|      |_______|      |________|
128
129       Note that some filters change frame properties but not frame contents.
130       E.g. the "fps" filter in the example above changes number of frames,
131       but does not touch the frame contents. Another example is the "setpts"
132       filter, which only sets timestamps and otherwise passes the frames
133       unchanged.
134
135       Complex filtergraphs
136
137       Complex filtergraphs are those which cannot be described as simply a
138       linear processing chain applied to one stream. This is the case, for
139       example, when the graph has more than one input and/or output, or when
140       output stream type is different from input. They can be represented
141       with the following diagram:
142
143                _________
144               |         |
145               | input 0 |\                    __________
146               |_________| \                  |          |
147                            \   _________    /| output 0 |
148                             \ |         |  / |__________|
149                _________     \| complex | /
150               |         |     |         |/
151               | input 1 |---->| filter  |\
152               |_________|     |         | \   __________
153                              /| graph   |  \ |          |
154                             / |         |   \| output 1 |
155                _________   /  |_________|    |__________|
156               |         | /
157               | input 2 |/
158               |_________|
159
160       Complex filtergraphs are configured with the -filter_complex option.
161       Note that this option is global, since a complex filtergraph, by its
162       nature, cannot be unambiguously associated with a single stream or
163       file.
164
165       The -lavfi option is equivalent to -filter_complex.
166
167       A trivial example of a complex filtergraph is the "overlay" filter,
168       which has two video inputs and one video output, containing one video
169       overlaid on top of the other. Its audio counterpart is the "amix"
170       filter.
171
172   Stream copy
173       Stream copy is a mode selected by supplying the "copy" parameter to the
174       -codec option. It makes ffmpeg omit the decoding and encoding step for
175       the specified stream, so it does only demuxing and muxing. It is useful
176       for changing the container format or modifying container-level
177       metadata. The diagram above will, in this case, simplify to this:
178
179                _______              ______________            ________
180               |       |            |              |          |        |
181               | input |  demuxer   | encoded data |  muxer   | output |
182               | file  | ---------> | packets      | -------> | file   |
183               |_______|            |______________|          |________|
184
185       Since there is no decoding or encoding, it is very fast and there is no
186       quality loss. However, it might not work in some cases because of many
187       factors. Applying filters is obviously also impossible, since filters
188       work on uncompressed data.
189

STREAM SELECTION

191       ffmpeg provides the "-map" option for manual control of stream
192       selection in each output file. Users can skip "-map" and let ffmpeg
193       perform automatic stream selection as described below. The "-vn / -an /
194       -sn / -dn" options can be used to skip inclusion of video, audio,
195       subtitle and data streams respectively, whether manually mapped or
196       automatically selected, except for those streams which are outputs of
197       complex filtergraphs.
198
199   Description
200       The sub-sections that follow describe the various rules that are
201       involved in stream selection.  The examples that follow next show how
202       these rules are applied in practice.
203
204       While every effort is made to accurately reflect the behavior of the
205       program, FFmpeg is under continuous development and the code may have
206       changed since the time of this writing.
207
208       Automatic stream selection
209
210       In the absence of any map options for a particular output file, ffmpeg
211       inspects the output format to check which type of streams can be
212       included in it, viz. video, audio and/or subtitles. For each acceptable
213       stream type, ffmpeg will pick one stream, when available, from among
214       all the inputs.
215
216       It will select that stream based upon the following criteria:
217
218       •   for video, it is the stream with the highest resolution,
219
220       •   for audio, it is the stream with the most channels,
221
222       •   for subtitles, it is the first subtitle stream found but there's a
223           caveat.  The output format's default subtitle encoder can be either
224           text-based or image-based, and only a subtitle stream of the same
225           type will be chosen.
226
227       In the case where several streams of the same type rate equally, the
228       stream with the lowest index is chosen.
229
230       Data or attachment streams are not automatically selected and can only
231       be included using "-map".
232
233       Manual stream selection
234
235       When "-map" is used, only user-mapped streams are included in that
236       output file, with one possible exception for filtergraph outputs
237       described below.
238
239       Complex filtergraphs
240
241       If there are any complex filtergraph output streams with unlabeled
242       pads, they will be added to the first output file. This will lead to a
243       fatal error if the stream type is not supported by the output format.
244       In the absence of the map option, the inclusion of these streams leads
245       to the automatic stream selection of their types being skipped. If map
246       options are present, these filtergraph streams are included in addition
247       to the mapped streams.
248
249       Complex filtergraph output streams with labeled pads must be mapped
250       once and exactly once.
251
252       Stream handling
253
254       Stream handling is independent of stream selection, with an exception
255       for subtitles described below. Stream handling is set via the "-codec"
256       option addressed to streams within a specific output file. In
257       particular, codec options are applied by ffmpeg after the stream
258       selection process and thus do not influence the latter. If no "-codec"
259       option is specified for a stream type, ffmpeg will select the default
260       encoder registered by the output file muxer.
261
262       An exception exists for subtitles. If a subtitle encoder is specified
263       for an output file, the first subtitle stream found of any type, text
264       or image, will be included. ffmpeg does not validate if the specified
265       encoder can convert the selected stream or if the converted stream is
266       acceptable within the output format. This applies generally as well:
267       when the user sets an encoder manually, the stream selection process
268       cannot check if the encoded stream can be muxed into the output file.
269       If it cannot, ffmpeg will abort and all output files will fail to be
270       processed.
271
272   Examples
273       The following examples illustrate the behavior, quirks and limitations
274       of ffmpeg's stream selection methods.
275
276       They assume the following three input files.
277
278               input file 'A.avi'
279                     stream 0: video 640x360
280                     stream 1: audio 2 channels
281
282               input file 'B.mp4'
283                     stream 0: video 1920x1080
284                     stream 1: audio 2 channels
285                     stream 2: subtitles (text)
286                     stream 3: audio 5.1 channels
287                     stream 4: subtitles (text)
288
289               input file 'C.mkv'
290                     stream 0: video 1280x720
291                     stream 1: audio 2 channels
292                     stream 2: subtitles (image)
293
294       Example: automatic stream selection
295
296               ffmpeg -i A.avi -i B.mp4 out1.mkv out2.wav -map 1:a -c:a copy out3.mov
297
298       There are three output files specified, and for the first two, no
299       "-map" options are set, so ffmpeg will select streams for these two
300       files automatically.
301
302       out1.mkv is a Matroska container file and accepts video, audio and
303       subtitle streams, so ffmpeg will try to select one of each type.For
304       video, it will select "stream 0" from B.mp4, which has the highest
305       resolution among all the input video streams.For audio, it will select
306       "stream 3" from B.mp4, since it has the greatest number of channels.For
307       subtitles, it will select "stream 2" from B.mp4, which is the first
308       subtitle stream from among A.avi and B.mp4.
309
310       out2.wav accepts only audio streams, so only "stream 3" from B.mp4 is
311       selected.
312
313       For out3.mov, since a "-map" option is set, no automatic stream
314       selection will occur. The "-map 1:a" option will select all audio
315       streams from the second input B.mp4. No other streams will be included
316       in this output file.
317
318       For the first two outputs, all included streams will be transcoded. The
319       encoders chosen will be the default ones registered by each output
320       format, which may not match the codec of the selected input streams.
321
322       For the third output, codec option for audio streams has been set to
323       "copy", so no decoding-filtering-encoding operations will occur, or can
324       occur.  Packets of selected streams shall be conveyed from the input
325       file and muxed within the output file.
326
327       Example: automatic subtitles selection
328
329               ffmpeg -i C.mkv out1.mkv -c:s dvdsub -an out2.mkv
330
331       Although out1.mkv is a Matroska container file which accepts subtitle
332       streams, only a video and audio stream shall be selected. The subtitle
333       stream of C.mkv is image-based and the default subtitle encoder of the
334       Matroska muxer is text-based, so a transcode operation for the
335       subtitles is expected to fail and hence the stream isn't selected.
336       However, in out2.mkv, a subtitle encoder is specified in the command
337       and so, the subtitle stream is selected, in addition to the video
338       stream. The presence of "-an" disables audio stream selection for
339       out2.mkv.
340
341       Example: unlabeled filtergraph outputs
342
343               ffmpeg -i A.avi -i C.mkv -i B.mp4 -filter_complex "overlay" out1.mp4 out2.srt
344
345       A filtergraph is setup here using the "-filter_complex" option and
346       consists of a single video filter. The "overlay" filter requires
347       exactly two video inputs, but none are specified, so the first two
348       available video streams are used, those of A.avi and C.mkv. The output
349       pad of the filter has no label and so is sent to the first output file
350       out1.mp4. Due to this, automatic selection of the video stream is
351       skipped, which would have selected the stream in B.mp4. The audio
352       stream with most channels viz. "stream 3" in B.mp4, is chosen
353       automatically. No subtitle stream is chosen however, since the MP4
354       format has no default subtitle encoder registered, and the user hasn't
355       specified a subtitle encoder.
356
357       The 2nd output file, out2.srt, only accepts text-based subtitle
358       streams. So, even though the first subtitle stream available belongs to
359       C.mkv, it is image-based and hence skipped.  The selected stream,
360       "stream 2" in B.mp4, is the first text-based subtitle stream.
361
362       Example: labeled filtergraph outputs
363
364               ffmpeg -i A.avi -i B.mp4 -i C.mkv -filter_complex "[1:v]hue=s=0[outv];overlay;aresample" \
365                      -map '[outv]' -an        out1.mp4 \
366                                               out2.mkv \
367                      -map '[outv]' -map 1:a:0 out3.mkv
368
369       The above command will fail, as the output pad labelled "[outv]" has
370       been mapped twice.  None of the output files shall be processed.
371
372               ffmpeg -i A.avi -i B.mp4 -i C.mkv -filter_complex "[1:v]hue=s=0[outv];overlay;aresample" \
373                      -an        out1.mp4 \
374                                 out2.mkv \
375                      -map 1:a:0 out3.mkv
376
377       This command above will also fail as the hue filter output has a label,
378       "[outv]", and hasn't been mapped anywhere.
379
380       The command should be modified as follows,
381
382               ffmpeg -i A.avi -i B.mp4 -i C.mkv -filter_complex "[1:v]hue=s=0,split=2[outv1][outv2];overlay;aresample" \
383                       -map '[outv1]' -an        out1.mp4 \
384                                                 out2.mkv \
385                       -map '[outv2]' -map 1:a:0 out3.mkv
386
387       The video stream from B.mp4 is sent to the hue filter, whose output is
388       cloned once using the split filter, and both outputs labelled. Then a
389       copy each is mapped to the first and third output files.
390
391       The overlay filter, requiring two video inputs, uses the first two
392       unused video streams. Those are the streams from A.avi and C.mkv. The
393       overlay output isn't labelled, so it is sent to the first output file
394       out1.mp4, regardless of the presence of the "-map" option.
395
396       The aresample filter is sent the first unused audio stream, that of
397       A.avi. Since this filter output is also unlabelled, it too is mapped to
398       the first output file. The presence of "-an" only suppresses automatic
399       or manual stream selection of audio streams, not outputs sent from
400       filtergraphs. Both these mapped streams shall be ordered before the
401       mapped stream in out1.mp4.
402
403       The video, audio and subtitle streams mapped to "out2.mkv" are entirely
404       determined by automatic stream selection.
405
406       out3.mkv consists of the cloned video output from the hue filter and
407       the first audio stream from B.mp4.
408

OPTIONS

410       All the numerical options, if not specified otherwise, accept a string
411       representing a number as input, which may be followed by one of the SI
412       unit prefixes, for example: 'K', 'M', or 'G'.
413
414       If 'i' is appended to the SI unit prefix, the complete prefix will be
415       interpreted as a unit prefix for binary multiples, which are based on
416       powers of 1024 instead of powers of 1000. Appending 'B' to the SI unit
417       prefix multiplies the value by 8. This allows using, for example: 'KB',
418       'MiB', 'G' and 'B' as number suffixes.
419
420       Options which do not take arguments are boolean options, and set the
421       corresponding value to true. They can be set to false by prefixing the
422       option name with "no". For example using "-nofoo" will set the boolean
423       option with name "foo" to false.
424
425   Stream specifiers
426       Some options are applied per-stream, e.g. bitrate or codec. Stream
427       specifiers are used to precisely specify which stream(s) a given option
428       belongs to.
429
430       A stream specifier is a string generally appended to the option name
431       and separated from it by a colon. E.g. "-codec:a:1 ac3" contains the
432       "a:1" stream specifier, which matches the second audio stream.
433       Therefore, it would select the ac3 codec for the second audio stream.
434
435       A stream specifier can match several streams, so that the option is
436       applied to all of them. E.g. the stream specifier in "-b:a 128k"
437       matches all audio streams.
438
439       An empty stream specifier matches all streams. For example, "-codec
440       copy" or "-codec: copy" would copy all the streams without reencoding.
441
442       Possible forms of stream specifiers are:
443
444       stream_index
445           Matches the stream with this index. E.g. "-threads:1 4" would set
446           the thread count for the second stream to 4. If stream_index is
447           used as an additional stream specifier (see below), then it selects
448           stream number stream_index from the matching streams. Stream
449           numbering is based on the order of the streams as detected by
450           libavformat except when a program ID is also specified. In this
451           case it is based on the ordering of the streams in the program.
452
453       stream_type[:additional_stream_specifier]
454           stream_type is one of following: 'v' or 'V' for video, 'a' for
455           audio, 's' for subtitle, 'd' for data, and 't' for attachments. 'v'
456           matches all video streams, 'V' only matches video streams which are
457           not attached pictures, video thumbnails or cover arts. If
458           additional_stream_specifier is used, then it matches streams which
459           both have this type and match the additional_stream_specifier.
460           Otherwise, it matches all streams of the specified type.
461
462       p:program_id[:additional_stream_specifier]
463           Matches streams which are in the program with the id program_id. If
464           additional_stream_specifier is used, then it matches streams which
465           both are part of the program and match the
466           additional_stream_specifier.
467
468       #stream_id or i:stream_id
469           Match the stream by stream id (e.g. PID in MPEG-TS container).
470
471       m:key[:value]
472           Matches streams with the metadata tag key having the specified
473           value. If value is not given, matches streams that contain the
474           given tag with any value.
475
476       u   Matches streams with usable configuration, the codec must be
477           defined and the essential information such as video dimension or
478           audio sample rate must be present.
479
480           Note that in ffmpeg, matching by metadata will only work properly
481           for input files.
482
483   Generic options
484       These options are shared amongst the ff* tools.
485
486       -L  Show license.
487
488       -h, -?, -help, --help [arg]
489           Show help. An optional parameter may be specified to print help
490           about a specific item. If no argument is specified, only basic (non
491           advanced) tool options are shown.
492
493           Possible values of arg are:
494
495           long
496               Print advanced tool options in addition to the basic tool
497               options.
498
499           full
500               Print complete list of options, including shared and private
501               options for encoders, decoders, demuxers, muxers, filters, etc.
502
503           decoder=decoder_name
504               Print detailed information about the decoder named
505               decoder_name. Use the -decoders option to get a list of all
506               decoders.
507
508           encoder=encoder_name
509               Print detailed information about the encoder named
510               encoder_name. Use the -encoders option to get a list of all
511               encoders.
512
513           demuxer=demuxer_name
514               Print detailed information about the demuxer named
515               demuxer_name. Use the -formats option to get a list of all
516               demuxers and muxers.
517
518           muxer=muxer_name
519               Print detailed information about the muxer named muxer_name.
520               Use the -formats option to get a list of all muxers and
521               demuxers.
522
523           filter=filter_name
524               Print detailed information about the filter named filter_name.
525               Use the -filters option to get a list of all filters.
526
527           bsf=bitstream_filter_name
528               Print detailed information about the bitstream filter named
529               bitstream_filter_name.  Use the -bsfs option to get a list of
530               all bitstream filters.
531
532           protocol=protocol_name
533               Print detailed information about the protocol named
534               protocol_name.  Use the -protocols option to get a list of all
535               protocols.
536
537       -version
538           Show version.
539
540       -buildconf
541           Show the build configuration, one option per line.
542
543       -formats
544           Show available formats (including devices).
545
546       -demuxers
547           Show available demuxers.
548
549       -muxers
550           Show available muxers.
551
552       -devices
553           Show available devices.
554
555       -codecs
556           Show all codecs known to libavcodec.
557
558           Note that the term 'codec' is used throughout this documentation as
559           a shortcut for what is more correctly called a media bitstream
560           format.
561
562       -decoders
563           Show available decoders.
564
565       -encoders
566           Show all available encoders.
567
568       -bsfs
569           Show available bitstream filters.
570
571       -protocols
572           Show available protocols.
573
574       -filters
575           Show available libavfilter filters.
576
577       -pix_fmts
578           Show available pixel formats.
579
580       -sample_fmts
581           Show available sample formats.
582
583       -layouts
584           Show channel names and standard channel layouts.
585
586       -dispositions
587           Show stream dispositions.
588
589       -colors
590           Show recognized color names.
591
592       -sources device[,opt1=val1[,opt2=val2]...]
593           Show autodetected sources of the input device.  Some devices may
594           provide system-dependent source names that cannot be autodetected.
595           The returned list cannot be assumed to be always complete.
596
597                   ffmpeg -sources pulse,server=192.168.0.4
598
599       -sinks device[,opt1=val1[,opt2=val2]...]
600           Show autodetected sinks of the output device.  Some devices may
601           provide system-dependent sink names that cannot be autodetected.
602           The returned list cannot be assumed to be always complete.
603
604                   ffmpeg -sinks pulse,server=192.168.0.4
605
606       -loglevel [flags+]loglevel | -v [flags+]loglevel
607           Set logging level and flags used by the library.
608
609           The optional flags prefix can consist of the following values:
610
611           repeat
612               Indicates that repeated log output should not be compressed to
613               the first line and the "Last message repeated n times" line
614               will be omitted.
615
616           level
617               Indicates that log output should add a "[level]" prefix to each
618               message line. This can be used as an alternative to log
619               coloring, e.g. when dumping the log to file.
620
621           Flags can also be used alone by adding a '+'/'-' prefix to
622           set/reset a single flag without affecting other flags or changing
623           loglevel. When setting both flags and loglevel, a '+' separator is
624           expected between the last flags value and before loglevel.
625
626           loglevel is a string or a number containing one of the following
627           values:
628
629           quiet, -8
630               Show nothing at all; be silent.
631
632           panic, 0
633               Only show fatal errors which could lead the process to crash,
634               such as an assertion failure. This is not currently used for
635               anything.
636
637           fatal, 8
638               Only show fatal errors. These are errors after which the
639               process absolutely cannot continue.
640
641           error, 16
642               Show all errors, including ones which can be recovered from.
643
644           warning, 24
645               Show all warnings and errors. Any message related to possibly
646               incorrect or unexpected events will be shown.
647
648           info, 32
649               Show informative messages during processing. This is in
650               addition to warnings and errors. This is the default value.
651
652           verbose, 40
653               Same as "info", except more verbose.
654
655           debug, 48
656               Show everything, including debugging information.
657
658           trace, 56
659
660           For example to enable repeated log output, add the "level" prefix,
661           and set loglevel to "verbose":
662
663                   ffmpeg -loglevel repeat+level+verbose -i input output
664
665           Another example that enables repeated log output without affecting
666           current state of "level" prefix flag or loglevel:
667
668                   ffmpeg [...] -loglevel +repeat
669
670           By default the program logs to stderr. If coloring is supported by
671           the terminal, colors are used to mark errors and warnings. Log
672           coloring can be disabled setting the environment variable
673           AV_LOG_FORCE_NOCOLOR, or can be forced setting the environment
674           variable AV_LOG_FORCE_COLOR.
675
676       -report
677           Dump full command line and log output to a file named
678           "program-YYYYMMDD-HHMMSS.log" in the current directory.  This file
679           can be useful for bug reports.  It also implies "-loglevel debug".
680
681           Setting the environment variable FFREPORT to any value has the same
682           effect. If the value is a ':'-separated key=value sequence, these
683           options will affect the report; option values must be escaped if
684           they contain special characters or the options delimiter ':' (see
685           the ``Quoting and escaping'' section in the ffmpeg-utils manual).
686
687           The following options are recognized:
688
689           file
690               set the file name to use for the report; %p is expanded to the
691               name of the program, %t is expanded to a timestamp, "%%" is
692               expanded to a plain "%"
693
694           level
695               set the log verbosity level using a numerical value (see
696               "-loglevel").
697
698           For example, to output a report to a file named ffreport.log using
699           a log level of 32 (alias for log level "info"):
700
701                   FFREPORT=file=ffreport.log:level=32 ffmpeg -i input output
702
703           Errors in parsing the environment variable are not fatal, and will
704           not appear in the report.
705
706       -hide_banner
707           Suppress printing banner.
708
709           All FFmpeg tools will normally show a copyright notice, build
710           options and library versions. This option can be used to suppress
711           printing this information.
712
713       -cpuflags flags (global)
714           Allows setting and clearing cpu flags. This option is intended for
715           testing. Do not use it unless you know what you're doing.
716
717                   ffmpeg -cpuflags -sse+mmx ...
718                   ffmpeg -cpuflags mmx ...
719                   ffmpeg -cpuflags 0 ...
720
721           Possible flags for this option are:
722
723           x86
724               mmx
725               mmxext
726               sse
727               sse2
728               sse2slow
729               sse3
730               sse3slow
731               ssse3
732               atom
733               sse4.1
734               sse4.2
735               avx
736               avx2
737               xop
738               fma3
739               fma4
740               3dnow
741               3dnowext
742               bmi1
743               bmi2
744               cmov
745           ARM
746               armv5te
747               armv6
748               armv6t2
749               vfp
750               vfpv3
751               neon
752               setend
753           AArch64
754               armv8
755               vfp
756               neon
757           PowerPC
758               altivec
759           Specific Processors
760               pentium2
761               pentium3
762               pentium4
763               k6
764               k62
765               athlon
766               athlonxp
767               k8
768       -cpucount count (global)
769           Override detection of CPU count. This option is intended for
770           testing. Do not use it unless you know what you're doing.
771
772                   ffmpeg -cpucount 2
773
774       -max_alloc bytes
775           Set the maximum size limit for allocating a block on the heap by
776           ffmpeg's family of malloc functions. Exercise extreme caution when
777           using this option. Don't use if you do not understand the full
778           consequence of doing so.  Default is INT_MAX.
779
780   AVOptions
781       These options are provided directly by the libavformat, libavdevice and
782       libavcodec libraries. To see the list of available AVOptions, use the
783       -help option. They are separated into two categories:
784
785       generic
786           These options can be set for any container, codec or device.
787           Generic options are listed under AVFormatContext options for
788           containers/devices and under AVCodecContext options for codecs.
789
790       private
791           These options are specific to the given container, device or codec.
792           Private options are listed under their corresponding
793           containers/devices/codecs.
794
795       For example to write an ID3v2.3 header instead of a default ID3v2.4 to
796       an MP3 file, use the id3v2_version private option of the MP3 muxer:
797
798               ffmpeg -i input.flac -id3v2_version 3 out.mp3
799
800       All codec AVOptions are per-stream, and thus a stream specifier should
801       be attached to them:
802
803               ffmpeg -i multichannel.mxf -map 0:v:0 -map 0:a:0 -map 0:a:0 -c:a:0 ac3 -b:a:0 640k -ac:a:1 2 -c:a:1 aac -b:2 128k out.mp4
804
805       In the above example, a multichannel audio stream is mapped twice for
806       output.  The first instance is encoded with codec ac3 and bitrate 640k.
807       The second instance is downmixed to 2 channels and encoded with codec
808       aac. A bitrate of 128k is specified for it using absolute index of the
809       output stream.
810
811       Note: the -nooption syntax cannot be used for boolean AVOptions, use
812       -option 0/-option 1.
813
814       Note: the old undocumented way of specifying per-stream AVOptions by
815       prepending v/a/s to the options name is now obsolete and will be
816       removed soon.
817
818   Main options
819       -f fmt (input/output)
820           Force input or output file format. The format is normally auto
821           detected for input files and guessed from the file extension for
822           output files, so this option is not needed in most cases.
823
824       -i url (input)
825           input file url
826
827       -y (global)
828           Overwrite output files without asking.
829
830       -n (global)
831           Do not overwrite output files, and exit immediately if a specified
832           output file already exists.
833
834       -stream_loop number (input)
835           Set number of times input stream shall be looped. Loop 0 means no
836           loop, loop -1 means infinite loop.
837
838       -recast_media (global)
839           Allow forcing a decoder of a different media type than the one
840           detected or designated by the demuxer. Useful for decoding media
841           data muxed as data streams.
842
843       -c[:stream_specifier] codec (input/output,per-stream)
844       -codec[:stream_specifier] codec (input/output,per-stream)
845           Select an encoder (when used before an output file) or a decoder
846           (when used before an input file) for one or more streams. codec is
847           the name of a decoder/encoder or a special value "copy" (output
848           only) to indicate that the stream is not to be re-encoded.
849
850           For example
851
852                   ffmpeg -i INPUT -map 0 -c:v libx264 -c:a copy OUTPUT
853
854           encodes all video streams with libx264 and copies all audio
855           streams.
856
857           For each stream, the last matching "c" option is applied, so
858
859                   ffmpeg -i INPUT -map 0 -c copy -c:v:1 libx264 -c:a:137 libvorbis OUTPUT
860
861           will copy all the streams except the second video, which will be
862           encoded with libx264, and the 138th audio, which will be encoded
863           with libvorbis.
864
865       -t duration (input/output)
866           When used as an input option (before "-i"), limit the duration of
867           data read from the input file.
868
869           When used as an output option (before an output url), stop writing
870           the output after its duration reaches duration.
871
872           duration must be a time duration specification, see the Time
873           duration section in the ffmpeg-utils(1) manual.
874
875           -to and -t are mutually exclusive and -t has priority.
876
877       -to position (input/output)
878           Stop writing the output or reading the input at position.  position
879           must be a time duration specification, see the Time duration
880           section in the ffmpeg-utils(1) manual.
881
882           -to and -t are mutually exclusive and -t has priority.
883
884       -fs limit_size (output)
885           Set the file size limit, expressed in bytes. No further chunk of
886           bytes is written after the limit is exceeded. The size of the
887           output file is slightly more than the requested file size.
888
889       -ss position (input/output)
890           When used as an input option (before "-i"), seeks in this input
891           file to position. Note that in most formats it is not possible to
892           seek exactly, so ffmpeg will seek to the closest seek point before
893           position.  When transcoding and -accurate_seek is enabled (the
894           default), this extra segment between the seek point and position
895           will be decoded and discarded. When doing stream copy or when
896           -noaccurate_seek is used, it will be preserved.
897
898           When used as an output option (before an output url), decodes but
899           discards input until the timestamps reach position.
900
901           position must be a time duration specification, see the Time
902           duration section in the ffmpeg-utils(1) manual.
903
904       -sseof position (input)
905           Like the "-ss" option but relative to the "end of file". That is
906           negative values are earlier in the file, 0 is at EOF.
907
908       -isync input_index (input)
909           Assign an input as a sync source.
910
911           This will take the difference between the start times of the target
912           and reference inputs and offset the timestamps of the target file
913           by that difference. The source timestamps of the two inputs should
914           derive from the same clock source for expected results. If "copyts"
915           is set then "start_at_zero" must also be set. If either of the
916           inputs has no starting timestamp then no sync adjustment is made.
917
918           Acceptable values are those that refer to a valid ffmpeg input
919           index. If the sync reference is the target index itself or -1, then
920           no adjustment is made to target timestamps. A sync reference may
921           not itself be synced to any other input.
922
923           Default value is -1.
924
925       -itsoffset offset (input)
926           Set the input time offset.
927
928           offset must be a time duration specification, see the Time duration
929           section in the ffmpeg-utils(1) manual.
930
931           The offset is added to the timestamps of the input files.
932           Specifying a positive offset means that the corresponding streams
933           are delayed by the time duration specified in offset.
934
935       -itsscale scale (input,per-stream)
936           Rescale input timestamps. scale should be a floating point number.
937
938       -timestamp date (output)
939           Set the recording timestamp in the container.
940
941           date must be a date specification, see the Date section in the
942           ffmpeg-utils(1) manual.
943
944       -metadata[:metadata_specifier] key=value (output,per-metadata)
945           Set a metadata key/value pair.
946
947           An optional metadata_specifier may be given to set metadata on
948           streams, chapters or programs. See "-map_metadata" documentation
949           for details.
950
951           This option overrides metadata set with "-map_metadata". It is also
952           possible to delete metadata by using an empty value.
953
954           For example, for setting the title in the output file:
955
956                   ffmpeg -i in.avi -metadata title="my title" out.flv
957
958           To set the language of the first audio stream:
959
960                   ffmpeg -i INPUT -metadata:s:a:0 language=eng OUTPUT
961
962       -disposition[:stream_specifier] value (output,per-stream)
963           Sets the disposition for a stream.
964
965           By default, the disposition is copied from the input stream, unless
966           the output stream this option applies to is fed by a complex
967           filtergraph - in that case the disposition is unset by default.
968
969           value is a sequence of items separated by '+' or '-'. The first
970           item may also be prefixed with '+' or '-', in which case this
971           option modifies the default value. Otherwise (the first item is not
972           prefixed) this options overrides the default value. A '+' prefix
973           adds the given disposition, '-' removes it. It is also possible to
974           clear the disposition by setting it to 0.
975
976           If no "-disposition" options were specified for an output file,
977           ffmpeg will automatically set the 'default' disposition on the
978           first stream of each type, when there are multiple streams of this
979           type in the output file and no stream of that type is already
980           marked as default.
981
982           The "-dispositions" option lists the known dispositions.
983
984           For example, to make the second audio stream the default stream:
985
986                   ffmpeg -i in.mkv -c copy -disposition:a:1 default out.mkv
987
988           To make the second subtitle stream the default stream and remove
989           the default disposition from the first subtitle stream:
990
991                   ffmpeg -i in.mkv -c copy -disposition:s:0 0 -disposition:s:1 default out.mkv
992
993           To add an embedded cover/thumbnail:
994
995                   ffmpeg -i in.mp4 -i IMAGE -map 0 -map 1 -c copy -c:v:1 png -disposition:v:1 attached_pic out.mp4
996
997           Not all muxers support embedded thumbnails, and those who do, only
998           support a few formats, like JPEG or PNG.
999
1000       -program
1001       [title=title:][program_num=program_num:]st=stream[:st=stream...]
1002       (output)
1003           Creates a program with the specified title, program_num and adds
1004           the specified stream(s) to it.
1005
1006       -target type (output)
1007           Specify target file type ("vcd", "svcd", "dvd", "dv", "dv50"). type
1008           may be prefixed with "pal-", "ntsc-" or "film-" to use the
1009           corresponding standard. All the format options (bitrate, codecs,
1010           buffer sizes) are then set automatically. You can just type:
1011
1012                   ffmpeg -i myfile.avi -target vcd /tmp/vcd.mpg
1013
1014           Nevertheless you can specify additional options as long as you know
1015           they do not conflict with the standard, as in:
1016
1017                   ffmpeg -i myfile.avi -target vcd -bf 2 /tmp/vcd.mpg
1018
1019           The parameters set for each target are as follows.
1020
1021           VCD
1022
1023                   <pal>:
1024                   -f vcd -muxrate 1411200 -muxpreload 0.44 -packetsize 2324
1025                   -s 352x288 -r 25
1026                   -codec:v mpeg1video -g 15 -b:v 1150k -maxrate:v 1150k -minrate:v 1150k -bufsize:v 327680
1027                   -ar 44100 -ac 2
1028                   -codec:a mp2 -b:a 224k
1029
1030                   <ntsc>:
1031                   -f vcd -muxrate 1411200 -muxpreload 0.44 -packetsize 2324
1032                   -s 352x240 -r 30000/1001
1033                   -codec:v mpeg1video -g 18 -b:v 1150k -maxrate:v 1150k -minrate:v 1150k -bufsize:v 327680
1034                   -ar 44100 -ac 2
1035                   -codec:a mp2 -b:a 224k
1036
1037                   <film>:
1038                   -f vcd -muxrate 1411200 -muxpreload 0.44 -packetsize 2324
1039                   -s 352x240 -r 24000/1001
1040                   -codec:v mpeg1video -g 18 -b:v 1150k -maxrate:v 1150k -minrate:v 1150k -bufsize:v 327680
1041                   -ar 44100 -ac 2
1042                   -codec:a mp2 -b:a 224k
1043
1044           SVCD
1045
1046                   <pal>:
1047                   -f svcd -packetsize 2324
1048                   -s 480x576 -pix_fmt yuv420p -r 25
1049                   -codec:v mpeg2video -g 15 -b:v 2040k -maxrate:v 2516k -minrate:v 0 -bufsize:v 1835008 -scan_offset 1
1050                   -ar 44100
1051                   -codec:a mp2 -b:a 224k
1052
1053                   <ntsc>:
1054                   -f svcd -packetsize 2324
1055                   -s 480x480 -pix_fmt yuv420p -r 30000/1001
1056                   -codec:v mpeg2video -g 18 -b:v 2040k -maxrate:v 2516k -minrate:v 0 -bufsize:v 1835008 -scan_offset 1
1057                   -ar 44100
1058                   -codec:a mp2 -b:a 224k
1059
1060                   <film>:
1061                   -f svcd -packetsize 2324
1062                   -s 480x480 -pix_fmt yuv420p -r 24000/1001
1063                   -codec:v mpeg2video -g 18 -b:v 2040k -maxrate:v 2516k -minrate:v 0 -bufsize:v 1835008 -scan_offset 1
1064                   -ar 44100
1065                   -codec:a mp2 -b:a 224k
1066
1067           DVD
1068
1069                   <pal>:
1070                   -f dvd -muxrate 10080k -packetsize 2048
1071                   -s 720x576 -pix_fmt yuv420p -r 25
1072                   -codec:v mpeg2video -g 15 -b:v 6000k -maxrate:v 9000k -minrate:v 0 -bufsize:v 1835008
1073                   -ar 48000
1074                   -codec:a ac3 -b:a 448k
1075
1076                   <ntsc>:
1077                   -f dvd -muxrate 10080k -packetsize 2048
1078                   -s 720x480 -pix_fmt yuv420p -r 30000/1001
1079                   -codec:v mpeg2video -g 18 -b:v 6000k -maxrate:v 9000k -minrate:v 0 -bufsize:v 1835008
1080                   -ar 48000
1081                   -codec:a ac3 -b:a 448k
1082
1083                   <film>:
1084                   -f dvd -muxrate 10080k -packetsize 2048
1085                   -s 720x480 -pix_fmt yuv420p -r 24000/1001
1086                   -codec:v mpeg2video -g 18 -b:v 6000k -maxrate:v 9000k -minrate:v 0 -bufsize:v 1835008
1087                   -ar 48000
1088                   -codec:a ac3 -b:a 448k
1089
1090           DV
1091
1092                   <pal>:
1093                   -f dv
1094                   -s 720x576 -pix_fmt yuv420p -r 25
1095                   -ar 48000 -ac 2
1096
1097                   <ntsc>:
1098                   -f dv
1099                   -s 720x480 -pix_fmt yuv411p -r 30000/1001
1100                   -ar 48000 -ac 2
1101
1102                   <film>:
1103                   -f dv
1104                   -s 720x480 -pix_fmt yuv411p -r 24000/1001
1105                   -ar 48000 -ac 2
1106
1107           The "dv50" target is identical to the "dv" target except that the
1108           pixel format set is "yuv422p" for all three standards.
1109
1110           Any user-set value for a parameter above will override the target
1111           preset value. In that case, the output may not comply with the
1112           target standard.
1113
1114       -dn (input/output)
1115           As an input option, blocks all data streams of a file from being
1116           filtered or being automatically selected or mapped for any output.
1117           See "-discard" option to disable streams individually.
1118
1119           As an output option, disables data recording i.e. automatic
1120           selection or mapping of any data stream. For full manual control
1121           see the "-map" option.
1122
1123       -dframes number (output)
1124           Set the number of data frames to output. This is an obsolete alias
1125           for "-frames:d", which you should use instead.
1126
1127       -frames[:stream_specifier] framecount (output,per-stream)
1128           Stop writing to the stream after framecount frames.
1129
1130       -q[:stream_specifier] q (output,per-stream)
1131       -qscale[:stream_specifier] q (output,per-stream)
1132           Use fixed quality scale (VBR). The meaning of q/qscale is codec-
1133           dependent.  If qscale is used without a stream_specifier then it
1134           applies only to the video stream, this is to maintain compatibility
1135           with previous behavior and as specifying the same codec specific
1136           value to 2 different codecs that is audio and video generally is
1137           not what is intended when no stream_specifier is used.
1138
1139       -filter[:stream_specifier] filtergraph (output,per-stream)
1140           Create the filtergraph specified by filtergraph and use it to
1141           filter the stream.
1142
1143           filtergraph is a description of the filtergraph to apply to the
1144           stream, and must have a single input and a single output of the
1145           same type of the stream. In the filtergraph, the input is
1146           associated to the label "in", and the output to the label "out".
1147           See the ffmpeg-filters manual for more information about the
1148           filtergraph syntax.
1149
1150           See the -filter_complex option if you want to create filtergraphs
1151           with multiple inputs and/or outputs.
1152
1153       -filter_script[:stream_specifier] filename (output,per-stream)
1154           This option is similar to -filter, the only difference is that its
1155           argument is the name of the file from which a filtergraph
1156           description is to be read.
1157
1158       -reinit_filter[:stream_specifier] integer (input,per-stream)
1159           This boolean option determines if the filtergraph(s) to which this
1160           stream is fed gets reinitialized when input frame parameters change
1161           mid-stream. This option is enabled by default as most video and all
1162           audio filters cannot handle deviation in input frame properties.
1163           Upon reinitialization, existing filter state is lost, like e.g. the
1164           frame count "n" reference available in some filters. Any frames
1165           buffered at time of reinitialization are lost.  The properties
1166           where a change triggers reinitialization are, for video, frame
1167           resolution or pixel format; for audio, sample format, sample rate,
1168           channel count or channel layout.
1169
1170       -filter_threads nb_threads (global)
1171           Defines how many threads are used to process a filter pipeline.
1172           Each pipeline will produce a thread pool with this many threads
1173           available for parallel processing.  The default is the number of
1174           available CPUs.
1175
1176       -pre[:stream_specifier] preset_name (output,per-stream)
1177           Specify the preset for matching stream(s).
1178
1179       -stats (global)
1180           Print encoding progress/statistics. It is on by default, to
1181           explicitly disable it you need to specify "-nostats".
1182
1183       -stats_period time (global)
1184           Set period at which encoding progress/statistics are updated.
1185           Default is 0.5 seconds.
1186
1187       -progress url (global)
1188           Send program-friendly progress information to url.
1189
1190           Progress information is written periodically and at the end of the
1191           encoding process. It is made of "key=value" lines. key consists of
1192           only alphanumeric characters. The last key of a sequence of
1193           progress information is always "progress".
1194
1195           The update period is set using "-stats_period".
1196
1197       -stdin
1198           Enable interaction on standard input. On by default unless standard
1199           input is used as an input. To explicitly disable interaction you
1200           need to specify "-nostdin".
1201
1202           Disabling interaction on standard input is useful, for example, if
1203           ffmpeg is in the background process group. Roughly the same result
1204           can be achieved with "ffmpeg ... < /dev/null" but it requires a
1205           shell.
1206
1207       -debug_ts (global)
1208           Print timestamp information. It is off by default. This option is
1209           mostly useful for testing and debugging purposes, and the output
1210           format may change from one version to another, so it should not be
1211           employed by portable scripts.
1212
1213           See also the option "-fdebug ts".
1214
1215       -attach filename (output)
1216           Add an attachment to the output file. This is supported by a few
1217           formats like Matroska for e.g. fonts used in rendering subtitles.
1218           Attachments are implemented as a specific type of stream, so this
1219           option will add a new stream to the file. It is then possible to
1220           use per-stream options on this stream in the usual way. Attachment
1221           streams created with this option will be created after all the
1222           other streams (i.e. those created with "-map" or automatic
1223           mappings).
1224
1225           Note that for Matroska you also have to set the mimetype metadata
1226           tag:
1227
1228                   ffmpeg -i INPUT -attach DejaVuSans.ttf -metadata:s:2 mimetype=application/x-truetype-font out.mkv
1229
1230           (assuming that the attachment stream will be third in the output
1231           file).
1232
1233       -dump_attachment[:stream_specifier] filename (input,per-stream)
1234           Extract the matching attachment stream into a file named filename.
1235           If filename is empty, then the value of the "filename" metadata tag
1236           will be used.
1237
1238           E.g. to extract the first attachment to a file named 'out.ttf':
1239
1240                   ffmpeg -dump_attachment:t:0 out.ttf -i INPUT
1241
1242           To extract all attachments to files determined by the "filename"
1243           tag:
1244
1245                   ffmpeg -dump_attachment:t "" -i INPUT
1246
1247           Technical note -- attachments are implemented as codec extradata,
1248           so this option can actually be used to extract extradata from any
1249           stream, not just attachments.
1250
1251   Video Options
1252       -vframes number (output)
1253           Set the number of video frames to output. This is an obsolete alias
1254           for "-frames:v", which you should use instead.
1255
1256       -r[:stream_specifier] fps (input/output,per-stream)
1257           Set frame rate (Hz value, fraction or abbreviation).
1258
1259           As an input option, ignore any timestamps stored in the file and
1260           instead generate timestamps assuming constant frame rate fps.  This
1261           is not the same as the -framerate option used for some input
1262           formats like image2 or v4l2 (it used to be the same in older
1263           versions of FFmpeg).  If in doubt use -framerate instead of the
1264           input option -r.
1265
1266           As an output option:
1267
1268           video encoding
1269               Duplicate or drop frames right before encoding them to achieve
1270               constant output frame rate fps.
1271
1272           video streamcopy
1273               Indicate to the muxer that fps is the stream frame rate. No
1274               data is dropped or duplicated in this case. This may produce
1275               invalid files if fps does not match the actual stream frame
1276               rate as determined by packet timestamps.  See also the "setts"
1277               bitstream filter.
1278
1279       -fpsmax[:stream_specifier] fps (output,per-stream)
1280           Set maximum frame rate (Hz value, fraction or abbreviation).
1281
1282           Clamps output frame rate when output framerate is auto-set and is
1283           higher than this value.  Useful in batch processing or when input
1284           framerate is wrongly detected as very high.  It cannot be set
1285           together with "-r". It is ignored during streamcopy.
1286
1287       -s[:stream_specifier] size (input/output,per-stream)
1288           Set frame size.
1289
1290           As an input option, this is a shortcut for the video_size private
1291           option, recognized by some demuxers for which the frame size is
1292           either not stored in the file or is configurable -- e.g. raw video
1293           or video grabbers.
1294
1295           As an output option, this inserts the "scale" video filter to the
1296           end of the corresponding filtergraph. Please use the "scale" filter
1297           directly to insert it at the beginning or some other place.
1298
1299           The format is wxh (default - same as source).
1300
1301       -aspect[:stream_specifier] aspect (output,per-stream)
1302           Set the video display aspect ratio specified by aspect.
1303
1304           aspect can be a floating point number string, or a string of the
1305           form num:den, where num and den are the numerator and denominator
1306           of the aspect ratio. For example "4:3", "16:9", "1.3333", and
1307           "1.7777" are valid argument values.
1308
1309           If used together with -vcodec copy, it will affect the aspect ratio
1310           stored at container level, but not the aspect ratio stored in
1311           encoded frames, if it exists.
1312
1313       -display_rotation[:stream_specifier] rotation (input,per-stream)
1314           Set video rotation metadata.
1315
1316           rotation is a decimal number specifying the amount in degree by
1317           which the video should be rotated counter-clockwise before being
1318           displayed.
1319
1320           This option overrides the rotation/display transform metadata
1321           stored in the file, if any. When the video is being transcoded
1322           (rather than copied) and "-autorotate" is enabled, the video will
1323           be rotated at the filtering stage. Otherwise, the metadata will be
1324           written into the output file if the muxer supports it.
1325
1326           If the "-display_hflip" and/or "-display_vflip" options are given,
1327           they are applied after the rotation specified by this option.
1328
1329       -display_hflip[:stream_specifier] (input,per-stream)
1330           Set whether on display the image should be horizontally flipped.
1331
1332           See the "-display_rotation" option for more details.
1333
1334       -display_vflip[:stream_specifier] (input,per-stream)
1335           Set whether on display the image should be vertically flipped.
1336
1337           See the "-display_rotation" option for more details.
1338
1339       -vn (input/output)
1340           As an input option, blocks all video streams of a file from being
1341           filtered or being automatically selected or mapped for any output.
1342           See "-discard" option to disable streams individually.
1343
1344           As an output option, disables video recording i.e. automatic
1345           selection or mapping of any video stream. For full manual control
1346           see the "-map" option.
1347
1348       -vcodec codec (output)
1349           Set the video codec. This is an alias for "-codec:v".
1350
1351       -pass[:stream_specifier] n (output,per-stream)
1352           Select the pass number (1 or 2). It is used to do two-pass video
1353           encoding. The statistics of the video are recorded in the first
1354           pass into a log file (see also the option -passlogfile), and in the
1355           second pass that log file is used to generate the video at the
1356           exact requested bitrate.  On pass 1, you may just deactivate audio
1357           and set output to null, examples for Windows and Unix:
1358
1359                   ffmpeg -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y NUL
1360                   ffmpeg -i foo.mov -c:v libxvid -pass 1 -an -f rawvideo -y /dev/null
1361
1362       -passlogfile[:stream_specifier] prefix (output,per-stream)
1363           Set two-pass log file name prefix to prefix, the default file name
1364           prefix is ``ffmpeg2pass''. The complete file name will be
1365           PREFIX-N.log, where N is a number specific to the output stream
1366
1367       -vf filtergraph (output)
1368           Create the filtergraph specified by filtergraph and use it to
1369           filter the stream.
1370
1371           This is an alias for "-filter:v", see the -filter option.
1372
1373       -autorotate
1374           Automatically rotate the video according to file metadata. Enabled
1375           by default, use -noautorotate to disable it.
1376
1377       -autoscale
1378           Automatically scale the video according to the resolution of first
1379           frame.  Enabled by default, use -noautoscale to disable it. When
1380           autoscale is disabled, all output frames of filter graph might not
1381           be in the same resolution and may be inadequate for some
1382           encoder/muxer. Therefore, it is not recommended to disable it
1383           unless you really know what you are doing.  Disable autoscale at
1384           your own risk.
1385
1386   Advanced Video options
1387       -pix_fmt[:stream_specifier] format (input/output,per-stream)
1388           Set pixel format. Use "-pix_fmts" to show all the supported pixel
1389           formats.  If the selected pixel format can not be selected, ffmpeg
1390           will print a warning and select the best pixel format supported by
1391           the encoder.  If pix_fmt is prefixed by a "+", ffmpeg will exit
1392           with an error if the requested pixel format can not be selected,
1393           and automatic conversions inside filtergraphs are disabled.  If
1394           pix_fmt is a single "+", ffmpeg selects the same pixel format as
1395           the input (or graph output) and automatic conversions are disabled.
1396
1397       -sws_flags flags (input/output)
1398           Set SwScaler flags.
1399
1400       -rc_override[:stream_specifier] override (output,per-stream)
1401           Rate control override for specific intervals, formatted as
1402           "int,int,int" list separated with slashes. Two first values are the
1403           beginning and end frame numbers, last one is quantizer to use if
1404           positive, or quality factor if negative.
1405
1406       -psnr
1407           Calculate PSNR of compressed frames. This option is deprecated,
1408           pass the PSNR flag to the encoder instead, using "-flags +psnr".
1409
1410       -vstats
1411           Dump video coding statistics to vstats_HHMMSS.log.
1412
1413       -vstats_file file
1414           Dump video coding statistics to file.
1415
1416       -vstats_version file
1417           Specifies which version of the vstats format to use. Default is 2.
1418
1419           version = 1 :
1420
1421           "frame= %5d q= %2.1f PSNR= %6.2f f_size= %6d s_size= %8.0fkB time=
1422           %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s"
1423
1424           version > 1:
1425
1426           "out= %2d st= %2d frame= %5d q= %2.1f PSNR= %6.2f f_size= %6d
1427           s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s"
1428
1429       -top[:stream_specifier] n (output,per-stream)
1430           top=1/bottom=0/auto=-1 field first
1431
1432       -vtag fourcc/tag (output)
1433           Force video tag/fourcc. This is an alias for "-tag:v".
1434
1435       -qphist (global)
1436           Show QP histogram
1437
1438       -vbsf bitstream_filter
1439           Deprecated see -bsf
1440
1441       -force_key_frames[:stream_specifier] time[,time...] (output,per-stream)
1442       -force_key_frames[:stream_specifier] expr:expr (output,per-stream)
1443       -force_key_frames[:stream_specifier] source (output,per-stream)
1444       -force_key_frames[:stream_specifier] source_no_drop (output,per-stream)
1445           force_key_frames can take arguments of the following form:
1446
1447           time[,time...]
1448               If the argument consists of timestamps, ffmpeg will round the
1449               specified times to the nearest output timestamp as per the
1450               encoder time base and force a keyframe at the first frame
1451               having timestamp equal or greater than the computed timestamp.
1452               Note that if the encoder time base is too coarse, then the
1453               keyframes may be forced on frames with timestamps lower than
1454               the specified time.  The default encoder time base is the
1455               inverse of the output framerate but may be set otherwise via
1456               "-enc_time_base".
1457
1458               If one of the times is ""chapters"[delta]", it is expanded into
1459               the time of the beginning of all chapters in the file, shifted
1460               by delta, expressed as a time in seconds.  This option can be
1461               useful to ensure that a seek point is present at a chapter mark
1462               or any other designated place in the output file.
1463
1464               For example, to insert a key frame at 5 minutes, plus key
1465               frames 0.1 second before the beginning of every chapter:
1466
1467                       -force_key_frames 0:05:00,chapters-0.1
1468
1469           expr:expr
1470               If the argument is prefixed with "expr:", the string expr is
1471               interpreted like an expression and is evaluated for each frame.
1472               A key frame is forced in case the evaluation is non-zero.
1473
1474               The expression in expr can contain the following constants:
1475
1476               n   the number of current processed frame, starting from 0
1477
1478               n_forced
1479                   the number of forced frames
1480
1481               prev_forced_n
1482                   the number of the previous forced frame, it is "NAN" when
1483                   no keyframe was forced yet
1484
1485               prev_forced_t
1486                   the time of the previous forced frame, it is "NAN" when no
1487                   keyframe was forced yet
1488
1489               t   the time of the current processed frame
1490
1491               For example to force a key frame every 5 seconds, you can
1492               specify:
1493
1494                       -force_key_frames expr:gte(t,n_forced*5)
1495
1496               To force a key frame 5 seconds after the time of the last
1497               forced one, starting from second 13:
1498
1499                       -force_key_frames expr:if(isnan(prev_forced_t),gte(t,13),gte(t,prev_forced_t+5))
1500
1501           source
1502               If the argument is "source", ffmpeg will force a key frame if
1503               the current frame being encoded is marked as a key frame in its
1504               source.
1505
1506           source_no_drop
1507               If the argument is "source_no_drop", ffmpeg will force a key
1508               frame if the current frame being encoded is marked as a key
1509               frame in its source.  In cases where this particular source
1510               frame has to be dropped, enforce the next available frame to
1511               become a key frame instead.
1512
1513           Note that forcing too many keyframes is very harmful for the
1514           lookahead algorithms of certain encoders: using fixed-GOP options
1515           or similar would be more efficient.
1516
1517       -copyinkf[:stream_specifier] (output,per-stream)
1518           When doing stream copy, copy also non-key frames found at the
1519           beginning.
1520
1521       -init_hw_device type[=name][:device[,key=value...]]
1522           Initialise a new hardware device of type type called name, using
1523           the given device parameters.  If no name is specified it will
1524           receive a default name of the form "type%d".
1525
1526           The meaning of device and the following arguments depends on the
1527           device type:
1528
1529           cuda
1530               device is the number of the CUDA device.
1531
1532               The following options are recognized:
1533
1534               primary_ctx
1535                   If set to 1, uses the primary device context instead of
1536                   creating a new one.
1537
1538               Examples:
1539
1540               -init_hw_device cuda:1
1541                   Choose the second device on the system.
1542
1543               -init_hw_device cuda:0,primary_ctx=1
1544                   Choose the first device and use the primary device context.
1545
1546           dxva2
1547               device is the number of the Direct3D 9 display adapter.
1548
1549           d3d11va
1550               device is the number of the Direct3D 11 display adapter.
1551
1552           vaapi
1553               device is either an X11 display name or a DRM render node.  If
1554               not specified, it will attempt to open the default X11 display
1555               ($DISPLAY) and then the first DRM render node
1556               (/dev/dri/renderD128).
1557
1558           vdpau
1559               device is an X11 display name.  If not specified, it will
1560               attempt to open the default X11 display ($DISPLAY).
1561
1562           qsv device selects a value in MFX_IMPL_*. Allowed values are:
1563
1564               auto
1565               sw
1566               hw
1567               auto_any
1568               hw_any
1569               hw2
1570               hw3
1571               hw4
1572
1573               If not specified, auto_any is used.  (Note that it may be
1574               easier to achieve the desired result for QSV by creating the
1575               platform-appropriate subdevice (dxva2 or d3d11va or vaapi) and
1576               then deriving a QSV device from that.)
1577
1578               Alternatively, child_device_type helps to choose platform-
1579               appropriate subdevice type.  On Windows d3d11va is used as
1580               default subdevice type.
1581
1582               Examples:
1583
1584               -init_hw_device qsv:hw,child_device_type=d3d11va
1585                   Choose the GPU subdevice with type d3d11va and create QSV
1586                   device with MFX_IMPL_HARDWARE.
1587
1588               -init_hw_device qsv:hw,child_device_type=dxva2
1589                   Choose the GPU subdevice with type dxva2 and create QSV
1590                   device with MFX_IMPL_HARDWARE.
1591
1592           opencl
1593               device selects the platform and device as
1594               platform_index.device_index.
1595
1596               The set of devices can also be filtered using the key-value
1597               pairs to find only devices matching particular platform or
1598               device strings.
1599
1600               The strings usable as filters are:
1601
1602               platform_profile
1603               platform_version
1604               platform_name
1605               platform_vendor
1606               platform_extensions
1607               device_name
1608               device_vendor
1609               driver_version
1610               device_version
1611               device_profile
1612               device_extensions
1613               device_type
1614
1615               The indices and filters must together uniquely select a device.
1616
1617               Examples:
1618
1619               -init_hw_device opencl:0.1
1620                   Choose the second device on the first platform.
1621
1622               -init_hw_device opencl:,device_name=Foo9000
1623                   Choose the device with a name containing the string
1624                   Foo9000.
1625
1626               -init_hw_device
1627               opencl:1,device_type=gpu,device_extensions=cl_khr_fp16
1628                   Choose the GPU device on the second platform supporting the
1629                   cl_khr_fp16 extension.
1630
1631           vulkan
1632               If device is an integer, it selects the device by its index in
1633               a system-dependent list of devices.  If device is any other
1634               string, it selects the first device with a name containing that
1635               string as a substring.
1636
1637               The following options are recognized:
1638
1639               debug
1640                   If set to 1, enables the validation layer, if installed.
1641
1642               linear_images
1643                   If set to 1, images allocated by the hwcontext will be
1644                   linear and locally mappable.
1645
1646               instance_extensions
1647                   A plus separated list of additional instance extensions to
1648                   enable.
1649
1650               device_extensions
1651                   A plus separated list of additional device extensions to
1652                   enable.
1653
1654               Examples:
1655
1656               -init_hw_device vulkan:1
1657                   Choose the second device on the system.
1658
1659               -init_hw_device vulkan:RADV
1660                   Choose the first device with a name containing the string
1661                   RADV.
1662
1663               -init_hw_device
1664               vulkan:0,instance_extensions=VK_KHR_wayland_surface+VK_KHR_xcb_surface
1665                   Choose the first device and enable the Wayland and XCB
1666                   instance extensions.
1667
1668       -init_hw_device type[=name]@source
1669           Initialise a new hardware device of type type called name, deriving
1670           it from the existing device with the name source.
1671
1672       -init_hw_device list
1673           List all hardware device types supported in this build of ffmpeg.
1674
1675       -filter_hw_device name
1676           Pass the hardware device called name to all filters in any filter
1677           graph.  This can be used to set the device to upload to with the
1678           "hwupload" filter, or the device to map to with the "hwmap" filter.
1679           Other filters may also make use of this parameter when they require
1680           a hardware device.  Note that this is typically only required when
1681           the input is not already in hardware frames - when it is, filters
1682           will derive the device they require from the context of the frames
1683           they receive as input.
1684
1685           This is a global setting, so all filters will receive the same
1686           device.
1687
1688       -hwaccel[:stream_specifier] hwaccel (input,per-stream)
1689           Use hardware acceleration to decode the matching stream(s). The
1690           allowed values of hwaccel are:
1691
1692           none
1693               Do not use any hardware acceleration (the default).
1694
1695           auto
1696               Automatically select the hardware acceleration method.
1697
1698           vdpau
1699               Use VDPAU (Video Decode and Presentation API for Unix) hardware
1700               acceleration.
1701
1702           dxva2
1703               Use DXVA2 (DirectX Video Acceleration) hardware acceleration.
1704
1705           d3d11va
1706               Use D3D11VA (DirectX Video Acceleration) hardware acceleration.
1707
1708           vaapi
1709               Use VAAPI (Video Acceleration API) hardware acceleration.
1710
1711           qsv Use the Intel QuickSync Video acceleration for video
1712               transcoding.
1713
1714               Unlike most other values, this option does not enable
1715               accelerated decoding (that is used automatically whenever a qsv
1716               decoder is selected), but accelerated transcoding, without
1717               copying the frames into the system memory.
1718
1719               For it to work, both the decoder and the encoder must support
1720               QSV acceleration and no filters must be used.
1721
1722           This option has no effect if the selected hwaccel is not available
1723           or not supported by the chosen decoder.
1724
1725           Note that most acceleration methods are intended for playback and
1726           will not be faster than software decoding on modern CPUs.
1727           Additionally, ffmpeg will usually need to copy the decoded frames
1728           from the GPU memory into the system memory, resulting in further
1729           performance loss. This option is thus mainly useful for testing.
1730
1731       -hwaccel_device[:stream_specifier] hwaccel_device (input,per-stream)
1732           Select a device to use for hardware acceleration.
1733
1734           This option only makes sense when the -hwaccel option is also
1735           specified.  It can either refer to an existing device created with
1736           -init_hw_device by name, or it can create a new device as if
1737           -init_hw_device type:hwaccel_device were called immediately before.
1738
1739       -hwaccels
1740           List all hardware acceleration components enabled in this build of
1741           ffmpeg.  Actual runtime availability depends on the hardware and
1742           its suitable driver being installed.
1743
1744       -fix_sub_duration_heartbeat[:stream_specifier]
1745           Set a specific output video stream as the heartbeat stream
1746           according to which to split and push through currently in-progress
1747           subtitle upon receipt of a random access packet.
1748
1749           This lowers the latency of subtitles for which the end packet or
1750           the following subtitle has not yet been received. As a drawback,
1751           this will most likely lead to duplication of subtitle events in
1752           order to cover the full duration, so when dealing with use cases
1753           where latency of when the subtitle event is passed on to output is
1754           not relevant this option should not be utilized.
1755
1756           Requires -fix_sub_duration to be set for the relevant input
1757           subtitle stream for this to have any effect, as well as for the
1758           input subtitle stream having to be directly mapped to the same
1759           output in which the heartbeat stream resides.
1760
1761   Audio Options
1762       -aframes number (output)
1763           Set the number of audio frames to output. This is an obsolete alias
1764           for "-frames:a", which you should use instead.
1765
1766       -ar[:stream_specifier] freq (input/output,per-stream)
1767           Set the audio sampling frequency. For output streams it is set by
1768           default to the frequency of the corresponding input stream. For
1769           input streams this option only makes sense for audio grabbing
1770           devices and raw demuxers and is mapped to the corresponding demuxer
1771           options.
1772
1773       -aq q (output)
1774           Set the audio quality (codec-specific, VBR). This is an alias for
1775           -q:a.
1776
1777       -ac[:stream_specifier] channels (input/output,per-stream)
1778           Set the number of audio channels. For output streams it is set by
1779           default to the number of input audio channels. For input streams
1780           this option only makes sense for audio grabbing devices and raw
1781           demuxers and is mapped to the corresponding demuxer options.
1782
1783       -an (input/output)
1784           As an input option, blocks all audio streams of a file from being
1785           filtered or being automatically selected or mapped for any output.
1786           See "-discard" option to disable streams individually.
1787
1788           As an output option, disables audio recording i.e. automatic
1789           selection or mapping of any audio stream. For full manual control
1790           see the "-map" option.
1791
1792       -acodec codec (input/output)
1793           Set the audio codec. This is an alias for "-codec:a".
1794
1795       -sample_fmt[:stream_specifier] sample_fmt (output,per-stream)
1796           Set the audio sample format. Use "-sample_fmts" to get a list of
1797           supported sample formats.
1798
1799       -af filtergraph (output)
1800           Create the filtergraph specified by filtergraph and use it to
1801           filter the stream.
1802
1803           This is an alias for "-filter:a", see the -filter option.
1804
1805   Advanced Audio options
1806       -atag fourcc/tag (output)
1807           Force audio tag/fourcc. This is an alias for "-tag:a".
1808
1809       -absf bitstream_filter
1810           Deprecated, see -bsf
1811
1812       -guess_layout_max channels (input,per-stream)
1813           If some input channel layout is not known, try to guess only if it
1814           corresponds to at most the specified number of channels. For
1815           example, 2 tells to ffmpeg to recognize 1 channel as mono and 2
1816           channels as stereo but not 6 channels as 5.1. The default is to
1817           always try to guess. Use 0 to disable all guessing.
1818
1819   Subtitle options
1820       -scodec codec (input/output)
1821           Set the subtitle codec. This is an alias for "-codec:s".
1822
1823       -sn (input/output)
1824           As an input option, blocks all subtitle streams of a file from
1825           being filtered or being automatically selected or mapped for any
1826           output. See "-discard" option to disable streams individually.
1827
1828           As an output option, disables subtitle recording i.e. automatic
1829           selection or mapping of any subtitle stream. For full manual
1830           control see the "-map" option.
1831
1832       -sbsf bitstream_filter
1833           Deprecated, see -bsf
1834
1835   Advanced Subtitle options
1836       -fix_sub_duration
1837           Fix subtitles durations. For each subtitle, wait for the next
1838           packet in the same stream and adjust the duration of the first to
1839           avoid overlap. This is necessary with some subtitles codecs,
1840           especially DVB subtitles, because the duration in the original
1841           packet is only a rough estimate and the end is actually marked by
1842           an empty subtitle frame. Failing to use this option when necessary
1843           can result in exaggerated durations or muxing failures due to non-
1844           monotonic timestamps.
1845
1846           Note that this option will delay the output of all data until the
1847           next subtitle packet is decoded: it may increase memory consumption
1848           and latency a lot.
1849
1850       -canvas_size size
1851           Set the size of the canvas used to render subtitles.
1852
1853   Advanced options
1854       -map [-]input_file_id[:stream_specifier][?] | [linklabel] (output)
1855           Create one or more streams in the output file. This option has two
1856           forms for specifying the data source(s): the first selects one or
1857           more streams from some input file (specified with "-i"), the second
1858           takes an output from some complex filtergraph (specified with
1859           "-filter_complex" or "-filter_complex_script").
1860
1861           In the first form, an output stream is created for every stream
1862           from the input file with the index input_file_id. If
1863           stream_specifier is given, only those streams that match the
1864           specifier are used (see the Stream specifiers section for the
1865           stream_specifier syntax).
1866
1867           A "-" character before the stream identifier creates a "negative"
1868           mapping.  It disables matching streams from already created
1869           mappings.
1870
1871           A trailing "?" after the stream index will allow the map to be
1872           optional: if the map matches no streams the map will be ignored
1873           instead of failing. Note the map will still fail if an invalid
1874           input file index is used; such as if the map refers to a non-
1875           existent input.
1876
1877           An alternative [linklabel] form will map outputs from complex
1878           filter graphs (see the -filter_complex option) to the output file.
1879           linklabel must correspond to a defined output link label in the
1880           graph.
1881
1882           This option may be specified multiple times, each adding more
1883           streams to the output file. Any given input stream may also be
1884           mapped any number of times as a source for different output
1885           streams, e.g. in order to use different encoding options and/or
1886           filters. The streams are created in the output in the same order in
1887           which the "-map" options are given on the commandline.
1888
1889           Using this option disables the default mappings for this output
1890           file.
1891
1892           Examples:
1893
1894           map everything
1895               To map ALL streams from the first input file to output
1896
1897                       ffmpeg -i INPUT -map 0 output
1898
1899           select specific stream
1900               If you have two audio streams in the first input file, these
1901               streams are identified by 0:0 and 0:1. You can use "-map" to
1902               select which streams to place in an output file. For example:
1903
1904                       ffmpeg -i INPUT -map 0:1 out.wav
1905
1906               will map the second input stream in INPUT to the (single)
1907               output stream in out.wav.
1908
1909           create multiple streams
1910               To select the stream with index 2 from input file a.mov
1911               (specified by the identifier 0:2), and stream with index 6 from
1912               input b.mov (specified by the identifier 1:6), and copy them to
1913               the output file out.mov:
1914
1915                       ffmpeg -i a.mov -i b.mov -c copy -map 0:2 -map 1:6 out.mov
1916
1917           create multiple streams 2
1918               To select all video and the third audio stream from an input
1919               file:
1920
1921                       ffmpeg -i INPUT -map 0:v -map 0:a:2 OUTPUT
1922
1923           negative map
1924               To map all the streams except the second audio, use negative
1925               mappings
1926
1927                       ffmpeg -i INPUT -map 0 -map -0:a:1 OUTPUT
1928
1929           optional map
1930               To map the video and audio streams from the first input, and
1931               using the trailing "?", ignore the audio mapping if no audio
1932               streams exist in the first input:
1933
1934                       ffmpeg -i INPUT -map 0:v -map 0:a? OUTPUT
1935
1936           map by language
1937               To pick the English audio stream:
1938
1939                       ffmpeg -i INPUT -map 0:m:language:eng OUTPUT
1940
1941       -ignore_unknown
1942           Ignore input streams with unknown type instead of failing if
1943           copying such streams is attempted.
1944
1945       -copy_unknown
1946           Allow input streams with unknown type to be copied instead of
1947           failing if copying such streams is attempted.
1948
1949       -map_channel
1950       [input_file_id.stream_specifier.channel_id|-1][?][:output_file_id.stream_specifier]
1951           This option is deprecated and will be removed. It can be replaced
1952           by the pan filter. In some cases it may be easier to use some
1953           combination of the channelsplit, channelmap, or amerge filters.
1954
1955           Map an audio channel from a given input to an output. If
1956           output_file_id.stream_specifier is not set, the audio channel will
1957           be mapped on all the audio streams.
1958
1959           Using "-1" instead of input_file_id.stream_specifier.channel_id
1960           will map a muted channel.
1961
1962           A trailing "?" will allow the map_channel to be optional: if the
1963           map_channel matches no channel the map_channel will be ignored
1964           instead of failing.
1965
1966           For example, assuming INPUT is a stereo audio file, you can switch
1967           the two audio channels with the following command:
1968
1969                   ffmpeg -i INPUT -map_channel 0.0.1 -map_channel 0.0.0 OUTPUT
1970
1971           If you want to mute the first channel and keep the second:
1972
1973                   ffmpeg -i INPUT -map_channel -1 -map_channel 0.0.1 OUTPUT
1974
1975           The order of the "-map_channel" option specifies the order of the
1976           channels in the output stream. The output channel layout is guessed
1977           from the number of channels mapped (mono if one "-map_channel",
1978           stereo if two, etc.). Using "-ac" in combination of "-map_channel"
1979           makes the channel gain levels to be updated if input and output
1980           channel layouts don't match (for instance two "-map_channel"
1981           options and "-ac 6").
1982
1983           You can also extract each channel of an input to specific outputs;
1984           the following command extracts two channels of the INPUT audio
1985           stream (file 0, stream 0) to the respective OUTPUT_CH0 and
1986           OUTPUT_CH1 outputs:
1987
1988                   ffmpeg -i INPUT -map_channel 0.0.0 OUTPUT_CH0 -map_channel 0.0.1 OUTPUT_CH1
1989
1990           The following example splits the channels of a stereo input into
1991           two separate streams, which are put into the same output file:
1992
1993                   ffmpeg -i stereo.wav -map 0:0 -map 0:0 -map_channel 0.0.0:0.0 -map_channel 0.0.1:0.1 -y out.ogg
1994
1995           Note that currently each output stream can only contain channels
1996           from a single input stream; you can't for example use
1997           "-map_channel" to pick multiple input audio channels contained in
1998           different streams (from the same or different files) and merge them
1999           into a single output stream. It is therefore not currently
2000           possible, for example, to turn two separate mono streams into a
2001           single stereo stream. However splitting a stereo stream into two
2002           single channel mono streams is possible.
2003
2004           If you need this feature, a possible workaround is to use the
2005           amerge filter. For example, if you need to merge a media (here
2006           input.mkv) with 2 mono audio streams into one single stereo channel
2007           audio stream (and keep the video stream), you can use the following
2008           command:
2009
2010                   ffmpeg -i input.mkv -filter_complex "[0:1] [0:2] amerge" -c:a pcm_s16le -c:v copy output.mkv
2011
2012           To map the first two audio channels from the first input, and using
2013           the trailing "?", ignore the audio channel mapping if the first
2014           input is mono instead of stereo:
2015
2016                   ffmpeg -i INPUT -map_channel 0.0.0 -map_channel 0.0.1? OUTPUT
2017
2018       -map_metadata[:metadata_spec_out] infile[:metadata_spec_in]
2019       (output,per-metadata)
2020           Set metadata information of the next output file from infile. Note
2021           that those are file indices (zero-based), not filenames.  Optional
2022           metadata_spec_in/out parameters specify, which metadata to copy.  A
2023           metadata specifier can have the following forms:
2024
2025           g   global metadata, i.e. metadata that applies to the whole file
2026
2027           s[:stream_spec]
2028               per-stream metadata. stream_spec is a stream specifier as
2029               described in the Stream specifiers chapter. In an input
2030               metadata specifier, the first matching stream is copied from.
2031               In an output metadata specifier, all matching streams are
2032               copied to.
2033
2034           c:chapter_index
2035               per-chapter metadata. chapter_index is the zero-based chapter
2036               index.
2037
2038           p:program_index
2039               per-program metadata. program_index is the zero-based program
2040               index.
2041
2042           If metadata specifier is omitted, it defaults to global.
2043
2044           By default, global metadata is copied from the first input file,
2045           per-stream and per-chapter metadata is copied along with
2046           streams/chapters. These default mappings are disabled by creating
2047           any mapping of the relevant type. A negative file index can be used
2048           to create a dummy mapping that just disables automatic copying.
2049
2050           For example to copy metadata from the first stream of the input
2051           file to global metadata of the output file:
2052
2053                   ffmpeg -i in.ogg -map_metadata 0:s:0 out.mp3
2054
2055           To do the reverse, i.e. copy global metadata to all audio streams:
2056
2057                   ffmpeg -i in.mkv -map_metadata:s:a 0:g out.mkv
2058
2059           Note that simple 0 would work as well in this example, since global
2060           metadata is assumed by default.
2061
2062       -map_chapters input_file_index (output)
2063           Copy chapters from input file with index input_file_index to the
2064           next output file. If no chapter mapping is specified, then chapters
2065           are copied from the first input file with at least one chapter. Use
2066           a negative file index to disable any chapter copying.
2067
2068       -benchmark (global)
2069           Show benchmarking information at the end of an encode.  Shows real,
2070           system and user time used and maximum memory consumption.  Maximum
2071           memory consumption is not supported on all systems, it will usually
2072           display as 0 if not supported.
2073
2074       -benchmark_all (global)
2075           Show benchmarking information during the encode.  Shows real,
2076           system and user time used in various steps (audio/video
2077           encode/decode).
2078
2079       -timelimit duration (global)
2080           Exit after ffmpeg has been running for duration seconds in CPU user
2081           time.
2082
2083       -dump (global)
2084           Dump each input packet to stderr.
2085
2086       -hex (global)
2087           When dumping packets, also dump the payload.
2088
2089       -readrate speed (input)
2090           Limit input read speed.
2091
2092           Its value is a floating-point positive number which represents the
2093           maximum duration of media, in seconds, that should be ingested in
2094           one second of wallclock time.  Default value is zero and represents
2095           no imposed limitation on speed of ingestion.  Value 1 represents
2096           real-time speed and is equivalent to "-re".
2097
2098           Mainly used to simulate a capture device or live input stream (e.g.
2099           when reading from a file).  Should not be used with a low value
2100           when input is an actual capture device or live stream as it may
2101           cause packet loss.
2102
2103           It is useful for when flow speed of output packets is important,
2104           such as live streaming.
2105
2106       -re (input)
2107           Read input at native frame rate. This is equivalent to setting
2108           "-readrate 1".
2109
2110       -vsync parameter (global)
2111       -fps_mode[:stream_specifier] parameter (output,per-stream)
2112           Set video sync method / framerate mode. vsync is applied to all
2113           output video streams but can be overridden for a stream by setting
2114           fps_mode. vsync is deprecated and will be removed in the future.
2115
2116           For compatibility reasons some of the values for vsync can be
2117           specified as numbers (shown in parentheses in the following table).
2118
2119           passthrough (0)
2120               Each frame is passed with its timestamp from the demuxer to the
2121               muxer.
2122
2123           cfr (1)
2124               Frames will be duplicated and dropped to achieve exactly the
2125               requested constant frame rate.
2126
2127           vfr (2)
2128               Frames are passed through with their timestamp or dropped so as
2129               to prevent 2 frames from having the same timestamp.
2130
2131           drop
2132               As passthrough but destroys all timestamps, making the muxer
2133               generate fresh timestamps based on frame-rate.
2134
2135           auto (-1)
2136               Chooses between cfr and vfr depending on muxer capabilities.
2137               This is the default method.
2138
2139           Note that the timestamps may be further modified by the muxer,
2140           after this.  For example, in the case that the format option
2141           avoid_negative_ts is enabled.
2142
2143           With -map you can select from which stream the timestamps should be
2144           taken. You can leave either video or audio unchanged and sync the
2145           remaining stream(s) to the unchanged one.
2146
2147       -frame_drop_threshold parameter
2148           Frame drop threshold, which specifies how much behind video frames
2149           can be before they are dropped. In frame rate units, so 1.0 is one
2150           frame.  The default is -1.1. One possible usecase is to avoid
2151           framedrops in case of noisy timestamps or to increase frame drop
2152           precision in case of exact timestamps.
2153
2154       -adrift_threshold time
2155           Set the minimum difference between timestamps and audio data (in
2156           seconds) to trigger adding/dropping samples to make it match the
2157           timestamps. This option effectively is a threshold to select
2158           between hard (add/drop) and soft (squeeze/stretch) compensation.
2159           "-async" must be set to a positive value.
2160
2161       -apad parameters (output,per-stream)
2162           Pad the output audio stream(s). This is the same as applying "-af
2163           apad".  Argument is a string of filter parameters composed the same
2164           as with the "apad" filter.  "-shortest" must be set for this output
2165           for the option to take effect.
2166
2167       -copyts
2168           Do not process input timestamps, but keep their values without
2169           trying to sanitize them. In particular, do not remove the initial
2170           start time offset value.
2171
2172           Note that, depending on the vsync option or on specific muxer
2173           processing (e.g. in case the format option avoid_negative_ts is
2174           enabled) the output timestamps may mismatch with the input
2175           timestamps even when this option is selected.
2176
2177       -start_at_zero
2178           When used with copyts, shift input timestamps so they start at
2179           zero.
2180
2181           This means that using e.g. "-ss 50" will make output timestamps
2182           start at 50 seconds, regardless of what timestamp the input file
2183           started at.
2184
2185       -copytb mode
2186           Specify how to set the encoder timebase when stream copying.  mode
2187           is an integer numeric value, and can assume one of the following
2188           values:
2189
2190           1   Use the demuxer timebase.
2191
2192               The time base is copied to the output encoder from the
2193               corresponding input demuxer. This is sometimes required to
2194               avoid non monotonically increasing timestamps when copying
2195               video streams with variable frame rate.
2196
2197           0   Use the decoder timebase.
2198
2199               The time base is copied to the output encoder from the
2200               corresponding input decoder.
2201
2202           -1  Try to make the choice automatically, in order to generate a
2203               sane output.
2204
2205           Default value is -1.
2206
2207       -enc_time_base[:stream_specifier] timebase (output,per-stream)
2208           Set the encoder timebase. timebase is a floating point number, and
2209           can assume one of the following values:
2210
2211           0   Assign a default value according to the media type.
2212
2213               For video - use 1/framerate, for audio - use 1/samplerate.
2214
2215           -1  Use the input stream timebase when possible.
2216
2217               If an input stream is not available, the default timebase will
2218               be used.
2219
2220           >0  Use the provided number as the timebase.
2221
2222               This field can be provided as a ratio of two integers (e.g.
2223               1:24, 1:48000) or as a floating point number (e.g. 0.04166,
2224               2.0833e-5)
2225
2226           Default value is 0.
2227
2228       -bitexact (input/output)
2229           Enable bitexact mode for (de)muxer and (de/en)coder
2230
2231       -shortest (output)
2232           Finish encoding when the shortest output stream ends.
2233
2234           Note that this option may require buffering frames, which
2235           introduces extra latency. The maximum amount of this latency may be
2236           controlled with the "-shortest_buf_duration" option.
2237
2238       -shortest_buf_duration duration (output)
2239           The "-shortest" option may require buffering potentially large
2240           amounts of data when at least one of the streams is "sparse" (i.e.
2241           has large gaps between frames – this is typically the case for
2242           subtitles).
2243
2244           This option controls the maximum duration of buffered frames in
2245           seconds.  Larger values may allow the "-shortest" option to produce
2246           more accurate results, but increase memory use and latency.
2247
2248           The default value is 10 seconds.
2249
2250       -dts_delta_threshold
2251           Timestamp discontinuity delta threshold.
2252
2253       -dts_error_threshold seconds
2254           Timestamp error delta threshold. This threshold use to discard
2255           crazy/damaged timestamps and the default is 30 hours which is
2256           arbitrarily picked and quite conservative.
2257
2258       -muxdelay seconds (output)
2259           Set the maximum demux-decode delay.
2260
2261       -muxpreload seconds (output)
2262           Set the initial demux-decode delay.
2263
2264       -streamid output-stream-index:new-value (output)
2265           Assign a new stream-id value to an output stream. This option
2266           should be specified prior to the output filename to which it
2267           applies.  For the situation where multiple output files exist, a
2268           streamid may be reassigned to a different value.
2269
2270           For example, to set the stream 0 PID to 33 and the stream 1 PID to
2271           36 for an output mpegts file:
2272
2273                   ffmpeg -i inurl -streamid 0:33 -streamid 1:36 out.ts
2274
2275       -bsf[:stream_specifier] bitstream_filters (output,per-stream)
2276           Set bitstream filters for matching streams. bitstream_filters is a
2277           comma-separated list of bitstream filters. Use the "-bsfs" option
2278           to get the list of bitstream filters.
2279
2280                   ffmpeg -i h264.mp4 -c:v copy -bsf:v h264_mp4toannexb -an out.h264
2281
2282
2283                   ffmpeg -i file.mov -an -vn -bsf:s mov2textsub -c:s copy -f rawvideo sub.txt
2284
2285       -tag[:stream_specifier] codec_tag (input/output,per-stream)
2286           Force a tag/fourcc for matching streams.
2287
2288       -timecode hh:mm:ssSEPff
2289           Specify Timecode for writing. SEP is ':' for non drop timecode and
2290           ';' (or '.') for drop.
2291
2292                   ffmpeg -i input.mpg -timecode 01:02:03.04 -r 30000/1001 -s ntsc output.mpg
2293
2294       -filter_complex filtergraph (global)
2295           Define a complex filtergraph, i.e. one with arbitrary number of
2296           inputs and/or outputs. For simple graphs -- those with one input
2297           and one output of the same type -- see the -filter options.
2298           filtergraph is a description of the filtergraph, as described in
2299           the ``Filtergraph syntax'' section of the ffmpeg-filters manual.
2300
2301           Input link labels must refer to input streams using the
2302           "[file_index:stream_specifier]" syntax (i.e. the same as -map
2303           uses). If stream_specifier matches multiple streams, the first one
2304           will be used. An unlabeled input will be connected to the first
2305           unused input stream of the matching type.
2306
2307           Output link labels are referred to with -map. Unlabeled outputs are
2308           added to the first output file.
2309
2310           Note that with this option it is possible to use only lavfi sources
2311           without normal input files.
2312
2313           For example, to overlay an image over video
2314
2315                   ffmpeg -i video.mkv -i image.png -filter_complex '[0:v][1:v]overlay[out]' -map
2316                   '[out]' out.mkv
2317
2318           Here "[0:v]" refers to the first video stream in the first input
2319           file, which is linked to the first (main) input of the overlay
2320           filter. Similarly the first video stream in the second input is
2321           linked to the second (overlay) input of overlay.
2322
2323           Assuming there is only one video stream in each input file, we can
2324           omit input labels, so the above is equivalent to
2325
2326                   ffmpeg -i video.mkv -i image.png -filter_complex 'overlay[out]' -map
2327                   '[out]' out.mkv
2328
2329           Furthermore we can omit the output label and the single output from
2330           the filter graph will be added to the output file automatically, so
2331           we can simply write
2332
2333                   ffmpeg -i video.mkv -i image.png -filter_complex 'overlay' out.mkv
2334
2335           As a special exception, you can use a bitmap subtitle stream as
2336           input: it will be converted into a video with the same size as the
2337           largest video in the file, or 720x576 if no video is present. Note
2338           that this is an experimental and temporary solution. It will be
2339           removed once libavfilter has proper support for subtitles.
2340
2341           For example, to hardcode subtitles on top of a DVB-T recording
2342           stored in MPEG-TS format, delaying the subtitles by 1 second:
2343
2344                   ffmpeg -i input.ts -filter_complex \
2345                     '[#0x2ef] setpts=PTS+1/TB [sub] ; [#0x2d0] [sub] overlay' \
2346                     -sn -map '#0x2dc' output.mkv
2347
2348           (0x2d0, 0x2dc and 0x2ef are the MPEG-TS PIDs of respectively the
2349           video, audio and subtitles streams; 0:0, 0:3 and 0:7 would have
2350           worked too)
2351
2352           To generate 5 seconds of pure red video using lavfi "color" source:
2353
2354                   ffmpeg -filter_complex 'color=c=red' -t 5 out.mkv
2355
2356       -filter_complex_threads nb_threads (global)
2357           Defines how many threads are used to process a filter_complex
2358           graph.  Similar to filter_threads but used for "-filter_complex"
2359           graphs only.  The default is the number of available CPUs.
2360
2361       -lavfi filtergraph (global)
2362           Define a complex filtergraph, i.e. one with arbitrary number of
2363           inputs and/or outputs. Equivalent to -filter_complex.
2364
2365       -filter_complex_script filename (global)
2366           This option is similar to -filter_complex, the only difference is
2367           that its argument is the name of the file from which a complex
2368           filtergraph description is to be read.
2369
2370       -accurate_seek (input)
2371           This option enables or disables accurate seeking in input files
2372           with the -ss option. It is enabled by default, so seeking is
2373           accurate when transcoding. Use -noaccurate_seek to disable it,
2374           which may be useful e.g. when copying some streams and transcoding
2375           the others.
2376
2377       -seek_timestamp (input)
2378           This option enables or disables seeking by timestamp in input files
2379           with the -ss option. It is disabled by default. If enabled, the
2380           argument to the -ss option is considered an actual timestamp, and
2381           is not offset by the start time of the file. This matters only for
2382           files which do not start from timestamp 0, such as transport
2383           streams.
2384
2385       -thread_queue_size size (input/output)
2386           For input, this option sets the maximum number of queued packets
2387           when reading from the file or device. With low latency / high rate
2388           live streams, packets may be discarded if they are not read in a
2389           timely manner; setting this value can force ffmpeg to use a
2390           separate input thread and read packets as soon as they arrive. By
2391           default ffmpeg only does this if multiple inputs are specified.
2392
2393           For output, this option specified the maximum number of packets
2394           that may be queued to each muxing thread.
2395
2396       -sdp_file file (global)
2397           Print sdp information for an output stream to file.  This allows
2398           dumping sdp information when at least one output isn't an rtp
2399           stream. (Requires at least one of the output formats to be rtp).
2400
2401       -discard (input)
2402           Allows discarding specific streams or frames from streams.  Any
2403           input stream can be fully discarded, using value "all" whereas
2404           selective discarding of frames from a stream occurs at the demuxer
2405           and is not supported by all demuxers.
2406
2407           none
2408               Discard no frame.
2409
2410           default
2411               Default, which discards no frames.
2412
2413           noref
2414               Discard all non-reference frames.
2415
2416           bidir
2417               Discard all bidirectional frames.
2418
2419           nokey
2420               Discard all frames excepts keyframes.
2421
2422           all Discard all frames.
2423
2424       -abort_on flags (global)
2425           Stop and abort on various conditions. The following flags are
2426           available:
2427
2428           empty_output
2429               No packets were passed to the muxer, the output is empty.
2430
2431           empty_output_stream
2432               No packets were passed to the muxer in some of the output
2433               streams.
2434
2435       -max_error_rate (global)
2436           Set fraction of decoding frame failures across all inputs which
2437           when crossed ffmpeg will return exit code 69. Crossing this
2438           threshold does not terminate processing. Range is a floating-point
2439           number between 0 to 1. Default is 2/3.
2440
2441       -xerror (global)
2442           Stop and exit on error
2443
2444       -max_muxing_queue_size packets (output,per-stream)
2445           When transcoding audio and/or video streams, ffmpeg will not begin
2446           writing into the output until it has one packet for each such
2447           stream. While waiting for that to happen, packets for other streams
2448           are buffered. This option sets the size of this buffer, in packets,
2449           for the matching output stream.
2450
2451           The default value of this option should be high enough for most
2452           uses, so only touch this option if you are sure that you need it.
2453
2454       -muxing_queue_data_threshold bytes (output,per-stream)
2455           This is a minimum threshold until which the muxing queue size is
2456           not taken into account. Defaults to 50 megabytes per stream, and is
2457           based on the overall size of packets passed to the muxer.
2458
2459       -auto_conversion_filters (global)
2460           Enable automatically inserting format conversion filters in all
2461           filter graphs, including those defined by -vf, -af, -filter_complex
2462           and -lavfi. If filter format negotiation requires a conversion, the
2463           initialization of the filters will fail.  Conversions can still be
2464           performed by inserting the relevant conversion filter (scale,
2465           aresample) in the graph.  On by default, to explicitly disable it
2466           you need to specify "-noauto_conversion_filters".
2467
2468       -bits_per_raw_sample[:stream_specifier] value (output,per-stream)
2469           Declare the number of bits per raw sample in the given output
2470           stream to be value. Note that this option sets the information
2471           provided to the encoder/muxer, it does not change the stream to
2472           conform to this value. Setting values that do not match the stream
2473           properties may result in encoding failures or invalid output files.
2474
2475       -stats_enc_pre[:stream_specifier] path (output,per-stream)
2476       -stats_enc_post[:stream_specifier] path (output,per-stream)
2477       -stats_mux_pre[:stream_specifier] path (output,per-stream)
2478           Write per-frame encoding information about the matching streams
2479           into the file given by path.
2480
2481           -stats_enc_pre writes information about raw video or audio frames
2482           right before they are sent for encoding, while -stats_enc_post
2483           writes information about encoded packets as they are received from
2484           the encoder.  -stats_mux_pre writes information about packets just
2485           as they are about to be sent to the muxer. Every frame or packet
2486           produces one line in the specified file. The format of this line is
2487           controlled by -stats_enc_pre_fmt / -stats_enc_post_fmt /
2488           -stats_mux_pre_fmt.
2489
2490           When stats for multiple streams are written into a single file, the
2491           lines corresponding to different streams will be interleaved. The
2492           precise order of this interleaving is not specified and not
2493           guaranteed to remain stable between different invocations of the
2494           program, even with the same options.
2495
2496       -stats_enc_pre_fmt[:stream_specifier] format_spec (output,per-stream)
2497       -stats_enc_post_fmt[:stream_specifier] format_spec (output,per-stream)
2498       -stats_mux_pre_fmt[:stream_specifier] format_spec (output,per-stream)
2499           Specify the format for the lines written with -stats_enc_pre /
2500           -stats_enc_post / -stats_mux_pre.
2501
2502           format_spec is a string that may contain directives of the form
2503           {fmt}. format_spec is backslash-escaped --- use \{, \}, and \\ to
2504           write a literal {, }, or \, respectively, into the output.
2505
2506           The directives given with fmt may be one of the following:
2507
2508           fidx
2509               Index of the output file.
2510
2511           sidx
2512               Index of the output stream in the file.
2513
2514           n   Frame number. Pre-encoding: number of frames sent to the
2515               encoder so far.  Post-encoding: number of packets received from
2516               the encoder so far.  Muxing: number of packets submitted to the
2517               muxer for this stream so far.
2518
2519           ni  Input frame number. Index of the input frame (i.e. output by a
2520               decoder) that corresponds to this output frame or packet. -1 if
2521               unavailable.
2522
2523           tb  Encoder timebase, as a rational number num/den. Note that this
2524               may be different from the timebase used by the muxer.
2525
2526           tbi Timebase for ptsi, as a rational number num/den. Available when
2527               ptsi is available, 0/1 otherwise.
2528
2529           pts Presentation timestamp of the frame or packet, as an integer.
2530               Should be multiplied by the timebase to compute presentation
2531               time.
2532
2533           ptsi
2534               Presentation timestamp of the input frame (see ni), as an
2535               integer. Should be multiplied by tbi to compute presentation
2536               time. Printed as (2^63 - 1 = 9223372036854775807) when not
2537               available.
2538
2539           t   Presentation time of the frame or packet, as a decimal number.
2540               Equal to pts multiplied by tb.
2541
2542           ti  Presentation time of the input frame (see ni), as a decimal
2543               number. Equal to ptsi multiplied by tbi. Printed as inf when
2544               not available.
2545
2546           dts Decoding timestamp of the packet, as an integer. Should be
2547               multiplied by the timebase to compute presentation time. Post-
2548               encoding only.
2549
2550           dt  Decoding time of the frame or packet, as a decimal number.
2551               Equal to dts multiplied by tb.
2552
2553           sn  Number of audio samples sent to the encoder so far. Audio and
2554               pre-encoding only.
2555
2556           samp
2557               Number of audio samples in the frame. Audio and pre-encoding
2558               only.
2559
2560           size
2561               Size of the encoded packet in bytes. Post-encoding only.
2562
2563           br  Current bitrate in bits per second. Post-encoding only.
2564
2565           abr Average bitrate for the whole stream so far, in bits per
2566               second, -1 if it cannot be determined at this point. Post-
2567               encoding only.
2568
2569           The default format strings are:
2570
2571           pre-encoding
2572               {fidx} {sidx} {n} {t}
2573
2574           post-encoding
2575               {fidx} {sidx} {n} {t}
2576
2577           In the future, new items may be added to the end of the default
2578           formatting strings. Users who depend on the format staying exactly
2579           the same, should prescribe it manually.
2580
2581           Note that stats for different streams written into the same file
2582           may have different formats.
2583
2584   Preset files
2585       A preset file contains a sequence of option=value pairs, one for each
2586       line, specifying a sequence of options which would be awkward to
2587       specify on the command line. Lines starting with the hash ('#')
2588       character are ignored and are used to provide comments. Check the
2589       presets directory in the FFmpeg source tree for examples.
2590
2591       There are two types of preset files: ffpreset and avpreset files.
2592
2593       ffpreset files
2594
2595       ffpreset files are specified with the "vpre", "apre", "spre", and
2596       "fpre" options. The "fpre" option takes the filename of the preset
2597       instead of a preset name as input and can be used for any kind of
2598       codec. For the "vpre", "apre", and "spre" options, the options
2599       specified in a preset file are applied to the currently selected codec
2600       of the same type as the preset option.
2601
2602       The argument passed to the "vpre", "apre", and "spre" preset options
2603       identifies the preset file to use according to the following rules:
2604
2605       First ffmpeg searches for a file named arg.ffpreset in the directories
2606       $FFMPEG_DATADIR (if set), and $HOME/.ffmpeg, and in the datadir defined
2607       at configuration time (usually PREFIX/share/ffmpeg) or in a ffpresets
2608       folder along the executable on win32, in that order. For example, if
2609       the argument is "libvpx-1080p", it will search for the file
2610       libvpx-1080p.ffpreset.
2611
2612       If no such file is found, then ffmpeg will search for a file named
2613       codec_name-arg.ffpreset in the above-mentioned directories, where
2614       codec_name is the name of the codec to which the preset file options
2615       will be applied. For example, if you select the video codec with
2616       "-vcodec libvpx" and use "-vpre 1080p", then it will search for the
2617       file libvpx-1080p.ffpreset.
2618
2619       avpreset files
2620
2621       avpreset files are specified with the "pre" option. They work similar
2622       to ffpreset files, but they only allow encoder- specific options.
2623       Therefore, an option=value pair specifying an encoder cannot be used.
2624
2625       When the "pre" option is specified, ffmpeg will look for files with the
2626       suffix .avpreset in the directories $AVCONV_DATADIR (if set), and
2627       $HOME/.avconv, and in the datadir defined at configuration time
2628       (usually PREFIX/share/ffmpeg), in that order.
2629
2630       First ffmpeg searches for a file named codec_name-arg.avpreset in the
2631       above-mentioned directories, where codec_name is the name of the codec
2632       to which the preset file options will be applied. For example, if you
2633       select the video codec with "-vcodec libvpx" and use "-pre 1080p", then
2634       it will search for the file libvpx-1080p.avpreset.
2635
2636       If no such file is found, then ffmpeg will search for a file named
2637       arg.avpreset in the same directories.
2638

EXAMPLES

2640   Video and Audio grabbing
2641       If you specify the input format and device then ffmpeg can grab video
2642       and audio directly.
2643
2644               ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg
2645
2646       Or with an ALSA audio source (mono input, card id 1) instead of OSS:
2647
2648               ffmpeg -f alsa -ac 1 -i hw:1 -f video4linux2 -i /dev/video0 /tmp/out.mpg
2649
2650       Note that you must activate the right video source and channel before
2651       launching ffmpeg with any TV viewer such as
2652       <http://linux.bytesex.org/xawtv/> by Gerd Knorr. You also have to set
2653       the audio recording levels correctly with a standard mixer.
2654
2655   X11 grabbing
2656       Grab the X11 display with ffmpeg via
2657
2658               ffmpeg -f x11grab -video_size cif -framerate 25 -i :0.0 /tmp/out.mpg
2659
2660       0.0 is display.screen number of your X11 server, same as the DISPLAY
2661       environment variable.
2662
2663               ffmpeg -f x11grab -video_size cif -framerate 25 -i :0.0+10,20 /tmp/out.mpg
2664
2665       0.0 is display.screen number of your X11 server, same as the DISPLAY
2666       environment variable. 10 is the x-offset and 20 the y-offset for the
2667       grabbing.
2668
2669   Video and Audio file format conversion
2670       Any supported file format and protocol can serve as input to ffmpeg:
2671
2672       Examples:
2673
2674       •   You can use YUV files as input:
2675
2676                   ffmpeg -i /tmp/test%d.Y /tmp/out.mpg
2677
2678           It will use the files:
2679
2680                   /tmp/test0.Y, /tmp/test0.U, /tmp/test0.V,
2681                   /tmp/test1.Y, /tmp/test1.U, /tmp/test1.V, etc...
2682
2683           The Y files use twice the resolution of the U and V files. They are
2684           raw files, without header. They can be generated by all decent
2685           video decoders. You must specify the size of the image with the -s
2686           option if ffmpeg cannot guess it.
2687
2688       •   You can input from a raw YUV420P file:
2689
2690                   ffmpeg -i /tmp/test.yuv /tmp/out.avi
2691
2692           test.yuv is a file containing raw YUV planar data. Each frame is
2693           composed of the Y plane followed by the U and V planes at half
2694           vertical and horizontal resolution.
2695
2696       •   You can output to a raw YUV420P file:
2697
2698                   ffmpeg -i mydivx.avi hugefile.yuv
2699
2700       •   You can set several input files and output files:
2701
2702                   ffmpeg -i /tmp/a.wav -s 640x480 -i /tmp/a.yuv /tmp/a.mpg
2703
2704           Converts the audio file a.wav and the raw YUV video file a.yuv to
2705           MPEG file a.mpg.
2706
2707       •   You can also do audio and video conversions at the same time:
2708
2709                   ffmpeg -i /tmp/a.wav -ar 22050 /tmp/a.mp2
2710
2711           Converts a.wav to MPEG audio at 22050 Hz sample rate.
2712
2713       •   You can encode to several formats at the same time and define a
2714           mapping from input stream to output streams:
2715
2716                   ffmpeg -i /tmp/a.wav -map 0:a -b:a 64k /tmp/a.mp2 -map 0:a -b:a 128k /tmp/b.mp2
2717
2718           Converts a.wav to a.mp2 at 64 kbits and to b.mp2 at 128 kbits.
2719           '-map file:index' specifies which input stream is used for each
2720           output stream, in the order of the definition of output streams.
2721
2722       •   You can transcode decrypted VOBs:
2723
2724                   ffmpeg -i snatch_1.vob -f avi -c:v mpeg4 -b:v 800k -g 300 -bf 2 -c:a libmp3lame -b:a 128k snatch.avi
2725
2726           This is a typical DVD ripping example; the input is a VOB file, the
2727           output an AVI file with MPEG-4 video and MP3 audio. Note that in
2728           this command we use B-frames so the MPEG-4 stream is DivX5
2729           compatible, and GOP size is 300 which means one intra frame every
2730           10 seconds for 29.97fps input video. Furthermore, the audio stream
2731           is MP3-encoded so you need to enable LAME support by passing
2732           "--enable-libmp3lame" to configure.  The mapping is particularly
2733           useful for DVD transcoding to get the desired audio language.
2734
2735           NOTE: To see the supported input formats, use "ffmpeg -demuxers".
2736
2737       •   You can extract images from a video, or create a video from many
2738           images:
2739
2740           For extracting images from a video:
2741
2742                   ffmpeg -i foo.avi -r 1 -s WxH -f image2 foo-%03d.jpeg
2743
2744           This will extract one video frame per second from the video and
2745           will output them in files named foo-001.jpeg, foo-002.jpeg, etc.
2746           Images will be rescaled to fit the new WxH values.
2747
2748           If you want to extract just a limited number of frames, you can use
2749           the above command in combination with the "-frames:v" or "-t"
2750           option, or in combination with -ss to start extracting from a
2751           certain point in time.
2752
2753           For creating a video from many images:
2754
2755                   ffmpeg -f image2 -framerate 12 -i foo-%03d.jpeg -s WxH foo.avi
2756
2757           The syntax "foo-%03d.jpeg" specifies to use a decimal number
2758           composed of three digits padded with zeroes to express the sequence
2759           number. It is the same syntax supported by the C printf function,
2760           but only formats accepting a normal integer are suitable.
2761
2762           When importing an image sequence, -i also supports expanding shell-
2763           like wildcard patterns (globbing) internally, by selecting the
2764           image2-specific "-pattern_type glob" option.
2765
2766           For example, for creating a video from filenames matching the glob
2767           pattern "foo-*.jpeg":
2768
2769                   ffmpeg -f image2 -pattern_type glob -framerate 12 -i 'foo-*.jpeg' -s WxH foo.avi
2770
2771       •   You can put many streams of the same type in the output:
2772
2773                   ffmpeg -i test1.avi -i test2.avi -map 1:1 -map 1:0 -map 0:1 -map 0:0 -c copy -y test12.nut
2774
2775           The resulting output file test12.nut will contain the first four
2776           streams from the input files in reverse order.
2777
2778       •   To force CBR video output:
2779
2780                   ffmpeg -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
2781
2782       •   The four options lmin, lmax, mblmin and mblmax use 'lambda' units,
2783           but you may use the QP2LAMBDA constant to easily convert from 'q'
2784           units:
2785
2786                   ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
2787

SEE ALSO

2789       ffmpeg-all(1), ffplay(1), ffprobe(1), ffmpeg-utils(1),
2790       ffmpeg-scaler(1), ffmpeg-resampler(1), ffmpeg-codecs(1),
2791       ffmpeg-bitstream-filters(1), ffmpeg-formats(1), ffmpeg-devices(1),
2792       ffmpeg-protocols(1), ffmpeg-filters(1)
2793

AUTHORS

2795       The FFmpeg developers.
2796
2797       For details about the authorship, see the Git history of the project
2798       (https://git.ffmpeg.org/ffmpeg), e.g. by typing the command git log in
2799       the FFmpeg source directory, or browsing the online repository at
2800       <https://git.ffmpeg.org/ffmpeg>.
2801
2802       Maintainers for the specific components are listed in the file
2803       MAINTAINERS in the source code tree.
2804
2805
2806
2807                                                                     FFMPEG(1)
Impressum