fftools-common-opts.texi 15 KB

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