fftools-common-opts.texi 15 KB

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