]> git.sesse.net Git - ffmpeg/blob - doc/fftools-common-opts.texi
avformat/aviobuf: fix checks in ffio_ensure_seekback
[ffmpeg] / doc / fftools-common-opts.texi
1 All the numerical options, if not specified otherwise, accept a string
2 representing a number as input, which may be followed by one of the SI
3 unit prefixes, for example: 'K', 'M', or 'G'.
4
5 If 'i' is appended to the SI unit prefix, the complete prefix will be
6 interpreted as a unit prefix for binary multiples, which are based on
7 powers of 1024 instead of powers of 1000. Appending 'B' to the SI unit
8 prefix multiplies the value by 8. This allows using, for example:
9 'KB', 'MiB', 'G' and 'B' as number suffixes.
10
11 Options which do not take arguments are boolean options, and set the
12 corresponding value to true. They can be set to false by prefixing
13 the option name with "no". For example using "-nofoo"
14 will set the boolean option with name "foo" to false.
15
16 @anchor{Stream specifiers}
17 @section Stream specifiers
18 Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers
19 are used to precisely specify which stream(s) a given option belongs to.
20
21 A stream specifier is a string generally appended to the option name and
22 separated from it by a colon. E.g. @code{-codec:a:1 ac3} contains the
23 @code{a:1} stream specifier, which matches the second audio stream. Therefore, it
24 would select the ac3 codec for the second audio stream.
25
26 A stream specifier can match several streams, so that the option is applied to all
27 of them. E.g. the stream specifier in @code{-b:a 128k} matches all audio
28 streams.
29
30 An empty stream specifier matches all streams. For example, @code{-codec copy}
31 or @code{-codec: copy} would copy all the streams without reencoding.
32
33 Possible forms of stream specifiers are:
34 @table @option
35 @item @var{stream_index}
36 Matches the stream with this index. E.g. @code{-threads:1 4} would set the
37 thread count for the second stream to 4. If @var{stream_index} is used as an
38 additional stream specifier (see below), then it selects stream number
39 @var{stream_index} from the matching streams. Stream numbering is based on the
40 order of the streams as detected by libavformat except when a program ID is
41 also specified. In this case it is based on the ordering of the streams in the
42 program.
43 @item @var{stream_type}[:@var{additional_stream_specifier}]
44 @var{stream_type} is one of following: 'v' or 'V' for video, 'a' for audio, 's'
45 for subtitle, 'd' for data, and 't' for attachments. 'v' matches all video
46 streams, 'V' only matches video streams which are not attached pictures, video
47 thumbnails or cover arts. If @var{additional_stream_specifier} is used, then
48 it matches streams which both have this type and match the
49 @var{additional_stream_specifier}. Otherwise, it matches all streams of the
50 specified type.
51 @item p:@var{program_id}[:@var{additional_stream_specifier}]
52 Matches streams which are in the program with the id @var{program_id}. If
53 @var{additional_stream_specifier} is used, then it matches streams which both
54 are part of the program and match the @var{additional_stream_specifier}.
55
56 @item #@var{stream_id} or i:@var{stream_id}
57 Match the stream by stream id (e.g. PID in MPEG-TS container).
58 @item m:@var{key}[:@var{value}]
59 Matches streams with the metadata tag @var{key} having the specified value. If
60 @var{value} is not given, matches streams that contain the given tag with any
61 value.
62 @item u
63 Matches streams with usable configuration, the codec must be defined and the
64 essential information such as video dimension or audio sample rate must be present.
65
66 Note that in @command{ffmpeg}, matching by metadata will only work properly for
67 input files.
68 @end table
69
70 @section Generic options
71
72 These options are shared amongst the ff* tools.
73
74 @table @option
75
76 @item -L
77 Show license.
78
79 @item -h, -?, -help, --help [@var{arg}]
80 Show help. An optional parameter may be specified to print help about a specific
81 item. If no argument is specified, only basic (non advanced) tool
82 options are shown.
83
84 Possible values of @var{arg} are:
85 @table @option
86 @item long
87 Print advanced tool options in addition to the basic tool options.
88
89 @item full
90 Print complete list of options, including shared and private options
91 for encoders, decoders, demuxers, muxers, filters, etc.
92
93 @item decoder=@var{decoder_name}
94 Print detailed information about the decoder named @var{decoder_name}. Use the
95 @option{-decoders} option to get a list of all decoders.
96
97 @item encoder=@var{encoder_name}
98 Print detailed information about the encoder named @var{encoder_name}. Use the
99 @option{-encoders} option to get a list of all encoders.
100
101 @item demuxer=@var{demuxer_name}
102 Print detailed information about the demuxer named @var{demuxer_name}. Use the
103 @option{-formats} option to get a list of all demuxers and muxers.
104
105 @item muxer=@var{muxer_name}
106 Print detailed information about the muxer named @var{muxer_name}. Use the
107 @option{-formats} option to get a list of all muxers and demuxers.
108
109 @item filter=@var{filter_name}
110 Print detailed information about the filter named @var{filter_name}. Use the
111 @option{-filters} option to get a list of all filters.
112
113 @item bsf=@var{bitstream_filter_name}
114 Print detailed information about the bitstream filter named @var{bitstream_filter_name}.
115 Use the @option{-bsfs} option to get a list of all bitstream filters.
116
117 @item protocol=@var{protocol_name}
118 Print detailed information about the protocol named @var{protocol_name}.
119 Use the @option{-protocols} option to get a list of all protocols.
120 @end table
121
122 @item -version
123 Show version.
124
125 @item -formats
126 Show available formats (including devices).
127
128 @item -demuxers
129 Show available demuxers.
130
131 @item -muxers
132 Show available muxers.
133
134 @item -devices
135 Show available devices.
136
137 @item -codecs
138 Show all codecs known to libavcodec.
139
140 Note that the term 'codec' is used throughout this documentation as a shortcut
141 for what is more correctly called a media bitstream format.
142
143 @item -decoders
144 Show available decoders.
145
146 @item -encoders
147 Show all available encoders.
148
149 @item -bsfs
150 Show available bitstream filters.
151
152 @item -protocols
153 Show available protocols.
154
155 @item -filters
156 Show available libavfilter filters.
157
158 @item -pix_fmts
159 Show available pixel formats.
160
161 @item -sample_fmts
162 Show available sample formats.
163
164 @item -layouts
165 Show channel names and standard channel layouts.
166
167 @item -colors
168 Show recognized color names.
169
170 @item -sources @var{device}[,@var{opt1}=@var{val1}[,@var{opt2}=@var{val2}]...]
171 Show autodetected sources of the input device.
172 Some devices may provide system-dependent source names that cannot be autodetected.
173 The returned list cannot be assumed to be always complete.
174 @example
175 ffmpeg -sources pulse,server=192.168.0.4
176 @end example
177
178 @item -sinks @var{device}[,@var{opt1}=@var{val1}[,@var{opt2}=@var{val2}]...]
179 Show autodetected sinks of the output device.
180 Some devices may provide system-dependent sink names that cannot be autodetected.
181 The returned list cannot be assumed to be always complete.
182 @example
183 ffmpeg -sinks pulse,server=192.168.0.4
184 @end example
185
186 @item -loglevel [@var{flags}+]@var{loglevel} | -v [@var{flags}+]@var{loglevel}
187 Set logging level and flags used by the library.
188
189 The optional @var{flags} prefix can consist of the following values:
190 @table @samp
191 @item repeat
192 Indicates that repeated log output should not be compressed to the first line
193 and the "Last message repeated n times" line will be omitted.
194 @item level
195 Indicates that log output should add a @code{[level]} prefix to each message
196 line. This can be used as an alternative to log coloring, e.g. when dumping the
197 log to file.
198 @end table
199 Flags can also be used alone by adding a '+'/'-' prefix to set/reset a single
200 flag without affecting other @var{flags} or changing @var{loglevel}. When
201 setting both @var{flags} and @var{loglevel}, a '+' separator is expected
202 between the last @var{flags} value and before @var{loglevel}.
203
204 @var{loglevel} is a string or a number containing one of the following values:
205 @table @samp
206 @item quiet, -8
207 Show nothing at all; be silent.
208 @item panic, 0
209 Only show fatal errors which could lead the process to crash, such as
210 an assertion failure. This is not currently used for anything.
211 @item fatal, 8
212 Only show fatal errors. These are errors after which the process absolutely
213 cannot continue.
214 @item error, 16
215 Show all errors, including ones which can be recovered from.
216 @item warning, 24
217 Show all warnings and errors. Any message related to possibly
218 incorrect or unexpected events will be shown.
219 @item info, 32
220 Show informative messages during processing. This is in addition to
221 warnings and errors. This is the default value.
222 @item verbose, 40
223 Same as @code{info}, except more verbose.
224 @item debug, 48
225 Show everything, including debugging information.
226 @item trace, 56
227 @end table
228
229 For example to enable repeated log output, add the @code{level} prefix, and set
230 @var{loglevel} to @code{verbose}:
231 @example
232 ffmpeg -loglevel repeat+level+verbose -i input output
233 @end example
234 Another example that enables repeated log output without affecting current
235 state of @code{level} prefix flag or @var{loglevel}:
236 @example
237 ffmpeg [...] -loglevel +repeat
238 @end example
239
240 By default the program logs to stderr. If coloring is supported by the
241 terminal, colors are used to mark errors and warnings. Log coloring
242 can be disabled setting the environment variable
243 @env{AV_LOG_FORCE_NOCOLOR}, or can be forced setting
244 the environment variable @env{AV_LOG_FORCE_COLOR}.
245
246 @item -report
247 Dump full command line and log output to a file named
248 @code{@var{program}-@var{YYYYMMDD}-@var{HHMMSS}.log} in the current
249 directory.
250 This file can be useful for bug reports.
251 It also implies @code{-loglevel debug}.
252
253 Setting the environment variable @env{FFREPORT} to any value has the
254 same effect. If the value is a ':'-separated key=value sequence, these
255 options will affect the report; option values must be escaped if they
256 contain special characters or the options delimiter ':' (see the
257 ``Quoting and escaping'' section in the ffmpeg-utils manual).
258
259 The following options are recognized:
260 @table @option
261 @item file
262 set the file name to use for the report; @code{%p} is expanded to the name
263 of the program, @code{%t} is expanded to a timestamp, @code{%%} is expanded
264 to a plain @code{%}
265 @item level
266 set the log verbosity level using a numerical value (see @code{-loglevel}).
267 @end table
268
269 For example, to output a report to a file named @file{ffreport.log}
270 using a log level of @code{32} (alias for log level @code{info}):
271
272 @example
273 FFREPORT=file=ffreport.log:level=32 ffmpeg -i input output
274 @end example
275
276 Errors in parsing the environment variable are not fatal, and will not
277 appear in the report.
278
279 @item -hide_banner
280 Suppress printing banner.
281
282 All FFmpeg tools will normally show a copyright notice, build options
283 and library versions. This option can be used to suppress printing
284 this information.
285
286 @item -cpuflags flags (@emph{global})
287 Allows setting and clearing cpu flags. This option is intended
288 for testing. Do not use it unless you know what you're doing.
289 @example
290 ffmpeg -cpuflags -sse+mmx ...
291 ffmpeg -cpuflags mmx ...
292 ffmpeg -cpuflags 0 ...
293 @end example
294 Possible flags for this option are:
295 @table @samp
296 @item x86
297 @table @samp
298 @item mmx
299 @item mmxext
300 @item sse
301 @item sse2
302 @item sse2slow
303 @item sse3
304 @item sse3slow
305 @item ssse3
306 @item atom
307 @item sse4.1
308 @item sse4.2
309 @item avx
310 @item avx2
311 @item xop
312 @item fma3
313 @item fma4
314 @item 3dnow
315 @item 3dnowext
316 @item bmi1
317 @item bmi2
318 @item cmov
319 @end table
320 @item ARM
321 @table @samp
322 @item armv5te
323 @item armv6
324 @item armv6t2
325 @item vfp
326 @item vfpv3
327 @item neon
328 @item setend
329 @end table
330 @item AArch64
331 @table @samp
332 @item armv8
333 @item vfp
334 @item neon
335 @end table
336 @item PowerPC
337 @table @samp
338 @item altivec
339 @end table
340 @item Specific Processors
341 @table @samp
342 @item pentium2
343 @item pentium3
344 @item pentium4
345 @item k6
346 @item k62
347 @item athlon
348 @item athlonxp
349 @item k8
350 @end table
351 @end table
352 @end table
353
354 @section AVOptions
355
356 These options are provided directly by the libavformat, libavdevice and
357 libavcodec libraries. To see the list of available AVOptions, use the
358 @option{-help} option. They are separated into two categories:
359 @table @option
360 @item generic
361 These options can be set for any container, codec or device. Generic options
362 are listed under AVFormatContext options for containers/devices and under
363 AVCodecContext options for codecs.
364 @item private
365 These options are specific to the given container, device or codec. Private
366 options are listed under their corresponding containers/devices/codecs.
367 @end table
368
369 For example to write an ID3v2.3 header instead of a default ID3v2.4 to
370 an MP3 file, use the @option{id3v2_version} private option of the MP3
371 muxer:
372 @example
373 ffmpeg -i input.flac -id3v2_version 3 out.mp3
374 @end example
375
376 All codec AVOptions are per-stream, and thus a stream specifier
377 should be attached to them:
378 @example
379 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
380 @end example
381
382 In the above example, a multichannel audio stream is mapped twice for output.
383 The first instance is encoded with codec ac3 and bitrate 640k.
384 The second instance is downmixed to 2 channels and encoded with codec aac. A bitrate of 128k is specified for it using
385 absolute index of the output stream.
386
387 Note: the @option{-nooption} syntax cannot be used for boolean
388 AVOptions, use @option{-option 0}/@option{-option 1}.
389
390 Note: the old undocumented way of specifying per-stream AVOptions by
391 prepending v/a/s to the options name is now obsolete and will be
392 removed soon.