You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2110 lines
57KB

  1. @chapter Encoders
  2. @c man begin ENCODERS
  3. Encoders are configured elements in FFmpeg which allow the encoding of
  4. multimedia streams.
  5. When you configure your FFmpeg build, all the supported native encoders
  6. are enabled by default. Encoders requiring an external library must be enabled
  7. manually via the corresponding @code{--enable-lib} option. You can list all
  8. available encoders using the configure option @code{--list-encoders}.
  9. You can disable all the encoders with the configure option
  10. @code{--disable-encoders} and selectively enable / disable single encoders
  11. with the options @code{--enable-encoder=@var{ENCODER}} /
  12. @code{--disable-encoder=@var{ENCODER}}.
  13. The option @code{-encoders} of the ff* tools will display the list of
  14. enabled encoders.
  15. @c man end ENCODERS
  16. @chapter Audio Encoders
  17. @c man begin AUDIO ENCODERS
  18. A description of some of the currently available audio encoders
  19. follows.
  20. @anchor{aacenc}
  21. @section aac
  22. Advanced Audio Coding (AAC) encoder.
  23. This encoder is an experimental FFmpeg-native AAC encoder. Currently only the
  24. low complexity (AAC-LC) profile is supported. To use this encoder, you must set
  25. @option{strict} option to @samp{experimental} or lower.
  26. As this encoder is experimental, unexpected behavior may exist from time to
  27. time. For a more stable AAC encoder, see @ref{libvo-aacenc}. However, be warned
  28. that it has a worse quality reported by some users.
  29. @c todo @ref{libaacplus}
  30. See also @ref{libfdk-aac-enc,,libfdk_aac} and @ref{libfaac}.
  31. @subsection Options
  32. @table @option
  33. @item b
  34. Set bit rate in bits/s. Setting this automatically activates constant bit rate
  35. (CBR) mode.
  36. @item q
  37. Set quality for variable bit rate (VBR) mode. This option is valid only using
  38. the @command{ffmpeg} command-line tool. For library interface users, use
  39. @option{global_quality}.
  40. @item stereo_mode
  41. Set stereo encoding mode. Possible values:
  42. @table @samp
  43. @item auto
  44. Automatically selected by the encoder.
  45. @item ms_off
  46. Disable middle/side encoding. This is the default.
  47. @item ms_force
  48. Force middle/side encoding.
  49. @end table
  50. @item aac_coder
  51. Set AAC encoder coding method. Possible values:
  52. @table @samp
  53. @item faac
  54. FAAC-inspired method.
  55. This method is a simplified reimplementation of the method used in FAAC, which
  56. sets thresholds proportional to the band energies, and then decreases all the
  57. thresholds with quantizer steps to find the appropriate quantization with
  58. distortion below threshold band by band.
  59. The quality of this method is comparable to the two loop searching method
  60. descibed below, but somewhat a little better and slower.
  61. @item anmr
  62. Average noise to mask ratio (ANMR) trellis-based solution.
  63. This has a theoretic best quality out of all the coding methods, but at the
  64. cost of the slowest speed.
  65. @item twoloop
  66. Two loop searching (TLS) method.
  67. This method first sets quantizers depending on band thresholds and then tries
  68. to find an optimal combination by adding or subtracting a specific value from
  69. all quantizers and adjusting some individual quantizer a little.
  70. This method produces similar quality with the FAAC method and is the default.
  71. @item fast
  72. Constant quantizer method.
  73. This method sets a constant quantizer for all bands. This is the fastest of all
  74. the methods, yet produces the worst quality.
  75. @end table
  76. @end table
  77. @section ac3 and ac3_fixed
  78. AC-3 audio encoders.
  79. These encoders implement part of ATSC A/52:2010 and ETSI TS 102 366, as well as
  80. the undocumented RealAudio 3 (a.k.a. dnet).
  81. The @var{ac3} encoder uses floating-point math, while the @var{ac3_fixed}
  82. encoder only uses fixed-point integer math. This does not mean that one is
  83. always faster, just that one or the other may be better suited to a
  84. particular system. The floating-point encoder will generally produce better
  85. quality audio for a given bitrate. The @var{ac3_fixed} encoder is not the
  86. default codec for any of the output formats, so it must be specified explicitly
  87. using the option @code{-acodec ac3_fixed} in order to use it.
  88. @subsection AC-3 Metadata
  89. The AC-3 metadata options are used to set parameters that describe the audio,
  90. but in most cases do not affect the audio encoding itself. Some of the options
  91. do directly affect or influence the decoding and playback of the resulting
  92. bitstream, while others are just for informational purposes. A few of the
  93. options will add bits to the output stream that could otherwise be used for
  94. audio data, and will thus affect the quality of the output. Those will be
  95. indicated accordingly with a note in the option list below.
  96. These parameters are described in detail in several publicly-available
  97. documents.
  98. @itemize
  99. @item @uref{http://www.atsc.org/cms/standards/a_52-2010.pdf,A/52:2010 - Digital Audio Compression (AC-3) (E-AC-3) Standard}
  100. @item @uref{http://www.atsc.org/cms/standards/a_54a_with_corr_1.pdf,A/54 - Guide to the Use of the ATSC Digital Television Standard}
  101. @item @uref{http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/18_Metadata.Guide.pdf,Dolby Metadata Guide}
  102. @item @uref{http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/46_DDEncodingGuidelines.pdf,Dolby Digital Professional Encoding Guidelines}
  103. @end itemize
  104. @subsubsection Metadata Control Options
  105. @table @option
  106. @item -per_frame_metadata @var{boolean}
  107. Allow Per-Frame Metadata. Specifies if the encoder should check for changing
  108. metadata for each frame.
  109. @table @option
  110. @item 0
  111. The metadata values set at initialization will be used for every frame in the
  112. stream. (default)
  113. @item 1
  114. Metadata values can be changed before encoding each frame.
  115. @end table
  116. @end table
  117. @subsubsection Downmix Levels
  118. @table @option
  119. @item -center_mixlev @var{level}
  120. Center Mix Level. The amount of gain the decoder should apply to the center
  121. channel when downmixing to stereo. This field will only be written to the
  122. bitstream if a center channel is present. The value is specified as a scale
  123. factor. There are 3 valid values:
  124. @table @option
  125. @item 0.707
  126. Apply -3dB gain
  127. @item 0.595
  128. Apply -4.5dB gain (default)
  129. @item 0.500
  130. Apply -6dB gain
  131. @end table
  132. @item -surround_mixlev @var{level}
  133. Surround Mix Level. The amount of gain the decoder should apply to the surround
  134. channel(s) when downmixing to stereo. This field will only be written to the
  135. bitstream if one or more surround channels are present. The value is specified
  136. as a scale factor. There are 3 valid values:
  137. @table @option
  138. @item 0.707
  139. Apply -3dB gain
  140. @item 0.500
  141. Apply -6dB gain (default)
  142. @item 0.000
  143. Silence Surround Channel(s)
  144. @end table
  145. @end table
  146. @subsubsection Audio Production Information
  147. Audio Production Information is optional information describing the mixing
  148. environment. Either none or both of the fields are written to the bitstream.
  149. @table @option
  150. @item -mixing_level @var{number}
  151. Mixing Level. Specifies peak sound pressure level (SPL) in the production
  152. environment when the mix was mastered. Valid values are 80 to 111, or -1 for
  153. unknown or not indicated. The default value is -1, but that value cannot be
  154. used if the Audio Production Information is written to the bitstream. Therefore,
  155. if the @code{room_type} option is not the default value, the @code{mixing_level}
  156. option must not be -1.
  157. @item -room_type @var{type}
  158. Room Type. Describes the equalization used during the final mixing session at
  159. the studio or on the dubbing stage. A large room is a dubbing stage with the
  160. industry standard X-curve equalization; a small room has flat equalization.
  161. This field will not be written to the bitstream if both the @code{mixing_level}
  162. option and the @code{room_type} option have the default values.
  163. @table @option
  164. @item 0
  165. @itemx notindicated
  166. Not Indicated (default)
  167. @item 1
  168. @itemx large
  169. Large Room
  170. @item 2
  171. @itemx small
  172. Small Room
  173. @end table
  174. @end table
  175. @subsubsection Other Metadata Options
  176. @table @option
  177. @item -copyright @var{boolean}
  178. Copyright Indicator. Specifies whether a copyright exists for this audio.
  179. @table @option
  180. @item 0
  181. @itemx off
  182. No Copyright Exists (default)
  183. @item 1
  184. @itemx on
  185. Copyright Exists
  186. @end table
  187. @item -dialnorm @var{value}
  188. Dialogue Normalization. Indicates how far the average dialogue level of the
  189. program is below digital 100% full scale (0 dBFS). This parameter determines a
  190. level shift during audio reproduction that sets the average volume of the
  191. dialogue to a preset level. The goal is to match volume level between program
  192. sources. A value of -31dB will result in no volume level change, relative to
  193. the source volume, during audio reproduction. Valid values are whole numbers in
  194. the range -31 to -1, with -31 being the default.
  195. @item -dsur_mode @var{mode}
  196. Dolby Surround Mode. Specifies whether the stereo signal uses Dolby Surround
  197. (Pro Logic). This field will only be written to the bitstream if the audio
  198. stream is stereo. Using this option does @b{NOT} mean the encoder will actually
  199. apply Dolby Surround processing.
  200. @table @option
  201. @item 0
  202. @itemx notindicated
  203. Not Indicated (default)
  204. @item 1
  205. @itemx off
  206. Not Dolby Surround Encoded
  207. @item 2
  208. @itemx on
  209. Dolby Surround Encoded
  210. @end table
  211. @item -original @var{boolean}
  212. Original Bit Stream Indicator. Specifies whether this audio is from the
  213. original source and not a copy.
  214. @table @option
  215. @item 0
  216. @itemx off
  217. Not Original Source
  218. @item 1
  219. @itemx on
  220. Original Source (default)
  221. @end table
  222. @end table
  223. @subsection Extended Bitstream Information
  224. The extended bitstream options are part of the Alternate Bit Stream Syntax as
  225. specified in Annex D of the A/52:2010 standard. It is grouped into 2 parts.
  226. If any one parameter in a group is specified, all values in that group will be
  227. written to the bitstream. Default values are used for those that are written
  228. but have not been specified. If the mixing levels are written, the decoder
  229. will use these values instead of the ones specified in the @code{center_mixlev}
  230. and @code{surround_mixlev} options if it supports the Alternate Bit Stream
  231. Syntax.
  232. @subsubsection Extended Bitstream Information - Part 1
  233. @table @option
  234. @item -dmix_mode @var{mode}
  235. Preferred Stereo Downmix Mode. Allows the user to select either Lt/Rt
  236. (Dolby Surround) or Lo/Ro (normal stereo) as the preferred stereo downmix mode.
  237. @table @option
  238. @item 0
  239. @itemx notindicated
  240. Not Indicated (default)
  241. @item 1
  242. @itemx ltrt
  243. Lt/Rt Downmix Preferred
  244. @item 2
  245. @itemx loro
  246. Lo/Ro Downmix Preferred
  247. @end table
  248. @item -ltrt_cmixlev @var{level}
  249. Lt/Rt Center Mix Level. The amount of gain the decoder should apply to the
  250. center channel when downmixing to stereo in Lt/Rt mode.
  251. @table @option
  252. @item 1.414
  253. Apply +3dB gain
  254. @item 1.189
  255. Apply +1.5dB gain
  256. @item 1.000
  257. Apply 0dB gain
  258. @item 0.841
  259. Apply -1.5dB gain
  260. @item 0.707
  261. Apply -3.0dB gain
  262. @item 0.595
  263. Apply -4.5dB gain (default)
  264. @item 0.500
  265. Apply -6.0dB gain
  266. @item 0.000
  267. Silence Center Channel
  268. @end table
  269. @item -ltrt_surmixlev @var{level}
  270. Lt/Rt Surround Mix Level. The amount of gain the decoder should apply to the
  271. surround channel(s) when downmixing to stereo in Lt/Rt mode.
  272. @table @option
  273. @item 0.841
  274. Apply -1.5dB gain
  275. @item 0.707
  276. Apply -3.0dB gain
  277. @item 0.595
  278. Apply -4.5dB gain
  279. @item 0.500
  280. Apply -6.0dB gain (default)
  281. @item 0.000
  282. Silence Surround Channel(s)
  283. @end table
  284. @item -loro_cmixlev @var{level}
  285. Lo/Ro Center Mix Level. The amount of gain the decoder should apply to the
  286. center channel when downmixing to stereo in Lo/Ro mode.
  287. @table @option
  288. @item 1.414
  289. Apply +3dB gain
  290. @item 1.189
  291. Apply +1.5dB gain
  292. @item 1.000
  293. Apply 0dB gain
  294. @item 0.841
  295. Apply -1.5dB gain
  296. @item 0.707
  297. Apply -3.0dB gain
  298. @item 0.595
  299. Apply -4.5dB gain (default)
  300. @item 0.500
  301. Apply -6.0dB gain
  302. @item 0.000
  303. Silence Center Channel
  304. @end table
  305. @item -loro_surmixlev @var{level}
  306. Lo/Ro Surround Mix Level. The amount of gain the decoder should apply to the
  307. surround channel(s) when downmixing to stereo in Lo/Ro mode.
  308. @table @option
  309. @item 0.841
  310. Apply -1.5dB gain
  311. @item 0.707
  312. Apply -3.0dB gain
  313. @item 0.595
  314. Apply -4.5dB gain
  315. @item 0.500
  316. Apply -6.0dB gain (default)
  317. @item 0.000
  318. Silence Surround Channel(s)
  319. @end table
  320. @end table
  321. @subsubsection Extended Bitstream Information - Part 2
  322. @table @option
  323. @item -dsurex_mode @var{mode}
  324. Dolby Surround EX Mode. Indicates whether the stream uses Dolby Surround EX
  325. (7.1 matrixed to 5.1). Using this option does @b{NOT} mean the encoder will actually
  326. apply Dolby Surround EX processing.
  327. @table @option
  328. @item 0
  329. @itemx notindicated
  330. Not Indicated (default)
  331. @item 1
  332. @itemx on
  333. Dolby Surround EX Off
  334. @item 2
  335. @itemx off
  336. Dolby Surround EX On
  337. @end table
  338. @item -dheadphone_mode @var{mode}
  339. Dolby Headphone Mode. Indicates whether the stream uses Dolby Headphone
  340. encoding (multi-channel matrixed to 2.0 for use with headphones). Using this
  341. option does @b{NOT} mean the encoder will actually apply Dolby Headphone
  342. processing.
  343. @table @option
  344. @item 0
  345. @itemx notindicated
  346. Not Indicated (default)
  347. @item 1
  348. @itemx on
  349. Dolby Headphone Off
  350. @item 2
  351. @itemx off
  352. Dolby Headphone On
  353. @end table
  354. @item -ad_conv_type @var{type}
  355. A/D Converter Type. Indicates whether the audio has passed through HDCD A/D
  356. conversion.
  357. @table @option
  358. @item 0
  359. @itemx standard
  360. Standard A/D Converter (default)
  361. @item 1
  362. @itemx hdcd
  363. HDCD A/D Converter
  364. @end table
  365. @end table
  366. @subsection Other AC-3 Encoding Options
  367. @table @option
  368. @item -stereo_rematrixing @var{boolean}
  369. Stereo Rematrixing. Enables/Disables use of rematrixing for stereo input. This
  370. is an optional AC-3 feature that increases quality by selectively encoding
  371. the left/right channels as mid/side. This option is enabled by default, and it
  372. is highly recommended that it be left as enabled except for testing purposes.
  373. @end table
  374. @subsection Floating-Point-Only AC-3 Encoding Options
  375. These options are only valid for the floating-point encoder and do not exist
  376. for the fixed-point encoder due to the corresponding features not being
  377. implemented in fixed-point.
  378. @table @option
  379. @item -channel_coupling @var{boolean}
  380. Enables/Disables use of channel coupling, which is an optional AC-3 feature
  381. that increases quality by combining high frequency information from multiple
  382. channels into a single channel. The per-channel high frequency information is
  383. sent with less accuracy in both the frequency and time domains. This allows
  384. more bits to be used for lower frequencies while preserving enough information
  385. to reconstruct the high frequencies. This option is enabled by default for the
  386. floating-point encoder and should generally be left as enabled except for
  387. testing purposes or to increase encoding speed.
  388. @table @option
  389. @item -1
  390. @itemx auto
  391. Selected by Encoder (default)
  392. @item 0
  393. @itemx off
  394. Disable Channel Coupling
  395. @item 1
  396. @itemx on
  397. Enable Channel Coupling
  398. @end table
  399. @item -cpl_start_band @var{number}
  400. Coupling Start Band. Sets the channel coupling start band, from 1 to 15. If a
  401. value higher than the bandwidth is used, it will be reduced to 1 less than the
  402. coupling end band. If @var{auto} is used, the start band will be determined by
  403. the encoder based on the bit rate, sample rate, and channel layout. This option
  404. has no effect if channel coupling is disabled.
  405. @table @option
  406. @item -1
  407. @itemx auto
  408. Selected by Encoder (default)
  409. @end table
  410. @end table
  411. @anchor{libfaac}
  412. @section libfaac
  413. libfaac AAC (Advanced Audio Coding) encoder wrapper.
  414. Requires the presence of the libfaac headers and library during
  415. configuration. You need to explicitly configure the build with
  416. @code{--enable-libfaac --enable-nonfree}.
  417. This encoder is considered to be of higher quality with respect to the
  418. @ref{aacenc,,the native experimental FFmpeg AAC encoder}.
  419. For more information see the libfaac project at
  420. @url{http://www.audiocoding.com/faac.html/}.
  421. @subsection Options
  422. The following shared FFmpeg codec options are recognized.
  423. The following options are supported by the libfaac wrapper. The
  424. @command{faac}-equivalent of the options are listed in parentheses.
  425. @table @option
  426. @item b (@emph{-b})
  427. Set bit rate in bits/s for ABR (Average Bit Rate) mode. If the bit rate
  428. is not explicitly specified, it is automatically set to a suitable
  429. value depending on the selected profile. @command{faac} bitrate is
  430. expressed in kilobits/s.
  431. Note that libfaac does not support CBR (Constant Bit Rate) but only
  432. ABR (Average Bit Rate).
  433. If VBR mode is enabled this option is ignored.
  434. @item ar (@emph{-R})
  435. Set audio sampling rate (in Hz).
  436. @item ac (@emph{-c})
  437. Set the number of audio channels.
  438. @item cutoff (@emph{-C})
  439. Set cutoff frequency. If not specified (or explicitly set to 0) it
  440. will use a value automatically computed by the library. Default value
  441. is 0.
  442. @item profile
  443. Set audio profile.
  444. The following profiles are recognized:
  445. @table @samp
  446. @item aac_main
  447. Main AAC (Main)
  448. @item aac_low
  449. Low Complexity AAC (LC)
  450. @item aac_ssr
  451. Scalable Sample Rate (SSR)
  452. @item aac_ltp
  453. Long Term Prediction (LTP)
  454. @end table
  455. If not specified it is set to @samp{aac_low}.
  456. @item flags +qscale
  457. Set constant quality VBR (Variable Bit Rate) mode.
  458. @item global_quality
  459. Set quality in VBR mode as an integer number of lambda units.
  460. Only relevant when VBR mode is enabled with @code{flags +qscale}. The
  461. value is converted to QP units by dividing it by @code{FF_QP2LAMBDA},
  462. and used to set the quality value used by libfaac. A reasonable range
  463. for the option value in QP units is [10-500], the higher the value the
  464. higher the quality.
  465. @item q (@emph{-q})
  466. Enable VBR mode when set to a non-negative value, and set constant
  467. quality value as a double floating point value in QP units.
  468. The value sets the quality value used by libfaac. A reasonable range
  469. for the option value is [10-500], the higher the value the higher the
  470. quality.
  471. This option is valid only using the @command{ffmpeg} command-line
  472. tool. For library interface users, use @option{global_quality}.
  473. @end table
  474. @subsection Examples
  475. @itemize
  476. @item
  477. Use @command{ffmpeg} to convert an audio file to ABR 128 kbps AAC in an M4A (MP4)
  478. container:
  479. @example
  480. ffmpeg -i input.wav -codec:a libfaac -b:a 128k -output.m4a
  481. @end example
  482. @item
  483. Use @command{ffmpeg} to convert an audio file to VBR AAC, using the
  484. LTP AAC profile:
  485. @example
  486. ffmpeg -i input.wav -c:a libfaac -profile:a aac_ltp -q:a 100 output.m4a
  487. @end example
  488. @end itemize
  489. @anchor{libfdk-aac-enc}
  490. @section libfdk_aac
  491. libfdk-aac AAC (Advanced Audio Coding) encoder wrapper.
  492. The libfdk-aac library is based on the Fraunhofer FDK AAC code from
  493. the Android project.
  494. Requires the presence of the libfdk-aac headers and library during
  495. configuration. You need to explicitly configure the build with
  496. @code{--enable-libfdk-aac}. The library is also incompatible with GPL,
  497. so if you allow the use of GPL, you should configure with
  498. @code{--enable-gpl --enable-nonfree --enable-libfdk-aac}.
  499. This encoder is considered to be of higher quality with respect to
  500. both @ref{aacenc,,the native experimental FFmpeg AAC encoder} and
  501. @ref{libfaac}.
  502. VBR encoding, enabled through the @option{vbr} or @option{flags
  503. +qscale} options, is experimental and only works with some
  504. combinations of parameters.
  505. For more information see the fdk-aac project at
  506. @url{http://sourceforge.net/p/opencore-amr/fdk-aac/}.
  507. @subsection Options
  508. The following options are mapped on the shared FFmpeg codec options.
  509. @table @option
  510. @item b
  511. Set bit rate in bits/s. If the bitrate is not explicitly specified, it
  512. is automatically set to a suitable value depending on the selected
  513. profile.
  514. In case VBR mode is enabled the option is ignored.
  515. @item ar
  516. Set audio sampling rate (in Hz).
  517. @item channels
  518. Set the number of audio channels.
  519. @item flags +qscale
  520. Enable fixed quality, VBR (Variable Bit Rate) mode.
  521. Note that VBR is implicitly enabled when the @option{vbr} value is
  522. positive.
  523. @item cutoff
  524. Set cutoff frequency. If not specified (or explicitly set to 0) it
  525. will use a value automatically computed by the library. Default value
  526. is 0.
  527. @item profile
  528. Set audio profile.
  529. The following profiles are recognized:
  530. @table @samp
  531. @item aac_low
  532. Low Complexity AAC (LC)
  533. @item aac_he
  534. High Efficiency AAC (HE-AAC)
  535. @item aac_he_v2
  536. High Efficiency AAC version 2 (HE-AACv2)
  537. @item aac_ld
  538. Low Delay AAC (LD)
  539. @item aac_eld
  540. Enhanced Low Delay AAC (ELD)
  541. @end table
  542. If not specified it is set to @samp{aac_low}.
  543. @end table
  544. The following are private options of the libfdk_aac encoder.
  545. @table @option
  546. @item afterburner
  547. Enable afterburner feature if set to 1, disabled if set to 0. This
  548. improves the quality but also the required processing power.
  549. Default value is 1.
  550. @item eld_sbr
  551. Enable SBR (Spectral Band Replication) for ELD if set to 1, disabled
  552. if set to 0.
  553. Default value is 0.
  554. @item signaling
  555. Set SBR/PS signaling style.
  556. It can assume one of the following values:
  557. @table @samp
  558. @item default
  559. choose signaling implicitly (explicit hierarchical by default,
  560. implicit if global header is disabled)
  561. @item implicit
  562. implicit backwards compatible signaling
  563. @item explicit_sbr
  564. explicit SBR, implicit PS signaling
  565. @item explicit_hierarchical
  566. explicit hierarchical signaling
  567. @end table
  568. Default value is @samp{default}.
  569. @item latm
  570. Output LATM/LOAS encapsulated data if set to 1, disabled if set to 0.
  571. Default value is 0.
  572. @item header_period
  573. Set StreamMuxConfig and PCE repetition period (in frames) for sending
  574. in-band configuration buffers within LATM/LOAS transport layer.
  575. Must be a 16-bits non-negative integer.
  576. Default value is 0.
  577. @item vbr
  578. Set VBR mode, from 1 to 5. 1 is lowest quality (though still pretty
  579. good) and 5 is highest quality. A value of 0 will disable VBR, and CBR
  580. (Constant Bit Rate) is enabled.
  581. Currently only the @samp{aac_low} profile supports VBR encoding.
  582. VBR modes 1-5 correspond to roughly the following average bit rates:
  583. @table @samp
  584. @item 1
  585. 32 kbps/channel
  586. @item 2
  587. 40 kbps/channel
  588. @item 3
  589. 48-56 kbps/channel
  590. @item 4
  591. 64 kbps/channel
  592. @item 5
  593. about 80-96 kbps/channel
  594. @end table
  595. Default value is 0.
  596. @end table
  597. @subsection Examples
  598. @itemize
  599. @item
  600. Use @command{ffmpeg} to convert an audio file to VBR AAC in an M4A (MP4)
  601. container:
  602. @example
  603. ffmpeg -i input.wav -codec:a libfdk_aac -vbr 3 output.m4a
  604. @end example
  605. @item
  606. Use @command{ffmpeg} to convert an audio file to CBR 64k kbps AAC, using the
  607. High-Efficiency AAC profile:
  608. @example
  609. ffmpeg -i input.wav -c:a libfdk_aac -profile:a aac_he -b:a 64k output.m4a
  610. @end example
  611. @end itemize
  612. @anchor{libmp3lame}
  613. @section libmp3lame
  614. LAME (Lame Ain't an MP3 Encoder) MP3 encoder wrapper.
  615. Requires the presence of the libmp3lame headers and library during
  616. configuration. You need to explicitly configure the build with
  617. @code{--enable-libmp3lame}.
  618. See @ref{libshine} for a fixed-point MP3 encoder, although with a
  619. lower quality.
  620. @subsection Options
  621. The following options are supported by the libmp3lame wrapper. The
  622. @command{lame}-equivalent of the options are listed in parentheses.
  623. @table @option
  624. @item b (@emph{-b})
  625. Set bitrate expressed in bits/s for CBR or ABR. LAME @code{bitrate} is
  626. expressed in kilobits/s.
  627. @item q (@emph{-V})
  628. Set constant quality setting for VBR. This option is valid only
  629. using the @command{ffmpeg} command-line tool. For library interface
  630. users, use @option{global_quality}.
  631. @item compression_level (@emph{-q})
  632. Set algorithm quality. Valid arguments are integers in the 0-9 range,
  633. with 0 meaning highest quality but slowest, and 9 meaning fastest
  634. while producing the worst quality.
  635. @item reservoir
  636. Enable use of bit reservoir when set to 1. Default value is 1. LAME
  637. has this enabled by default, but can be overriden by use
  638. @option{--nores} option.
  639. @item joint_stereo (@emph{-m j})
  640. Enable the encoder to use (on a frame by frame basis) either L/R
  641. stereo or mid/side stereo. Default value is 1.
  642. @item abr (@emph{--abr})
  643. Enable the encoder to use ABR when set to 1. The @command{lame}
  644. @option{--abr} sets the target bitrate, while this options only
  645. tells FFmpeg to use ABR still relies on @option{b} to set bitrate.
  646. @end table
  647. @section libopencore-amrnb
  648. OpenCORE Adaptive Multi-Rate Narrowband encoder.
  649. Requires the presence of the libopencore-amrnb headers and library during
  650. configuration. You need to explicitly configure the build with
  651. @code{--enable-libopencore-amrnb --enable-version3}.
  652. This is a mono-only encoder. Officially it only supports 8000Hz sample rate,
  653. but you can override it by setting @option{strict} to @samp{unofficial} or
  654. lower.
  655. @subsection Options
  656. @table @option
  657. @item b
  658. Set bitrate in bits per second. Only the following bitrates are supported,
  659. otherwise libavcodec will round to the nearest valid bitrate.
  660. @table @option
  661. @item 4750
  662. @item 5150
  663. @item 5900
  664. @item 6700
  665. @item 7400
  666. @item 7950
  667. @item 10200
  668. @item 12200
  669. @end table
  670. @item dtx
  671. Allow discontinuous transmission (generate comfort noise) when set to 1. The
  672. default value is 0 (disabled).
  673. @end table
  674. @anchor{libshine}
  675. @section libshine
  676. Shine Fixed-Point MP3 encoder wrapper.
  677. Shine is a fixed-point MP3 encoder. It has a far better performance on
  678. platforms without an FPU, e.g. armel CPUs, and some phones and tablets.
  679. However, as it is more targeted on performance than quality, it is not on par
  680. with LAME and other production-grade encoders quality-wise. Also, according to
  681. the project's homepage, this encoder may not be free of bugs as the code was
  682. written a long time ago and the project was dead for at least 5 years.
  683. This encoder only supports stereo and mono input. This is also CBR-only.
  684. The original project (last updated in early 2007) is at
  685. @url{http://sourceforge.net/projects/libshine-fxp/}. We only support the
  686. updated fork by the Savonet/Liquidsoap project at @url{https://github.com/savonet/shine}.
  687. Requires the presence of the libshine headers and library during
  688. configuration. You need to explicitly configure the build with
  689. @code{--enable-libshine}.
  690. See also @ref{libmp3lame}.
  691. @subsection Options
  692. The following options are supported by the libshine wrapper. The
  693. @command{shineenc}-equivalent of the options are listed in parentheses.
  694. @table @option
  695. @item b (@emph{-b})
  696. Set bitrate expressed in bits/s for CBR. @command{shineenc} @option{-b} option
  697. is expressed in kilobits/s.
  698. @end table
  699. @section libtwolame
  700. TwoLAME MP2 encoder wrapper.
  701. Requires the presence of the libtwolame headers and library during
  702. configuration. You need to explicitly configure the build with
  703. @code{--enable-libtwolame}.
  704. @subsection Options
  705. The following options are supported by the libtwolame wrapper. The
  706. @command{twolame}-equivalent options follow the FFmpeg ones and are in
  707. parentheses.
  708. @table @option
  709. @item b (@emph{-b})
  710. Set bitrate expressed in bits/s for CBR. @command{twolame} @option{b}
  711. option is expressed in kilobits/s. Default value is 128k.
  712. @item q (@emph{-V})
  713. Set quality for experimental VBR support. Maximum value range is
  714. from -50 to 50, useful range is from -10 to 10. The higher the
  715. value, the better the quality. This option is valid only using the
  716. @command{ffmpeg} command-line tool. For library interface users,
  717. use @option{global_quality}.
  718. @item mode (@emph{--mode})
  719. Set the mode of the resulting audio. Possible values:
  720. @table @samp
  721. @item auto
  722. Choose mode automatically based on the input. This is the default.
  723. @item stereo
  724. Stereo
  725. @item joint_stereo
  726. Joint stereo
  727. @item dual_channel
  728. Dual channel
  729. @item mono
  730. Mono
  731. @end table
  732. @item psymodel (@emph{--psyc-mode})
  733. Set psychoacoustic model to use in encoding. The argument must be
  734. an integer between -1 and 4, inclusive. The higher the value, the
  735. better the quality. The default value is 3.
  736. @item energy_levels (@emph{--energy})
  737. Enable energy levels extensions when set to 1. The default value is
  738. 0 (disabled).
  739. @item error_protection (@emph{--protect})
  740. Enable CRC error protection when set to 1. The default value is 0
  741. (disabled).
  742. @item copyright (@emph{--copyright})
  743. Set MPEG audio copyright flag when set to 1. The default value is 0
  744. (disabled).
  745. @item original (@emph{--original})
  746. Set MPEG audio original flag when set to 1. The default value is 0
  747. (disabled).
  748. @end table
  749. @anchor{libvo-aacenc}
  750. @section libvo-aacenc
  751. VisualOn AAC encoder.
  752. Requires the presence of the libvo-aacenc headers and library during
  753. configuration. You need to explicitly configure the build with
  754. @code{--enable-libvo-aacenc --enable-version3}.
  755. This encoder is considered to be worse than the
  756. @ref{aacenc,,native experimental FFmpeg AAC encoder}, according to
  757. multiple sources.
  758. @subsection Options
  759. The VisualOn AAC encoder only support encoding AAC-LC and up to 2
  760. channels. It is also CBR-only.
  761. @table @option
  762. @item b
  763. Set bit rate in bits/s.
  764. @end table
  765. @section libvo-amrwbenc
  766. VisualOn Adaptive Multi-Rate Wideband encoder.
  767. Requires the presence of the libvo-amrwbenc headers and library during
  768. configuration. You need to explicitly configure the build with
  769. @code{--enable-libvo-amrwbenc --enable-version3}.
  770. This is a mono-only encoder. Officially it only supports 16000Hz sample
  771. rate, but you can override it by setting @option{strict} to
  772. @samp{unofficial} or lower.
  773. @subsection Options
  774. @table @option
  775. @item b
  776. Set bitrate in bits/s. Only the following bitrates are supported, otherwise
  777. libavcodec will round to the nearest valid bitrate.
  778. @table @samp
  779. @item 6600
  780. @item 8850
  781. @item 12650
  782. @item 14250
  783. @item 15850
  784. @item 18250
  785. @item 19850
  786. @item 23050
  787. @item 23850
  788. @end table
  789. @item dtx
  790. Allow discontinuous transmission (generate comfort noise) when set to 1. The
  791. default value is 0 (disabled).
  792. @end table
  793. @section libopus
  794. libopus Opus Interactive Audio Codec encoder wrapper.
  795. Requires the presence of the libopus headers and library during
  796. configuration. You need to explicitly configure the build with
  797. @code{--enable-libopus}.
  798. @subsection Option Mapping
  799. Most libopus options are modeled after the @command{opusenc} utility from
  800. opus-tools. The following is an option mapping chart describing options
  801. supported by the libopus wrapper, and their @command{opusenc}-equivalent
  802. in parentheses.
  803. @table @option
  804. @item b (@emph{bitrate})
  805. Set the bit rate in bits/s. FFmpeg's @option{b} option is
  806. expressed in bits/s, while @command{opusenc}'s @option{bitrate} in
  807. kilobits/s.
  808. @item vbr (@emph{vbr}, @emph{hard-cbr}, and @emph{cvbr})
  809. Set VBR mode. The FFmpeg @option{vbr} option has the following
  810. valid arguments, with the their @command{opusenc} equivalent options
  811. in parentheses:
  812. @table @samp
  813. @item off (@emph{hard-cbr})
  814. Use constant bit rate encoding.
  815. @item on (@emph{vbr})
  816. Use variable bit rate encoding (the default).
  817. @item constrained (@emph{cvbr})
  818. Use constrained variable bit rate encoding.
  819. @end table
  820. @item compression_level (@emph{comp})
  821. Set encoding algorithm complexity. Valid options are integers in
  822. the 0-10 range. 0 gives the fastest encodes but lower quality, while 10
  823. gives the highest quality but slowest encoding. The default is 10.
  824. @item frame_duration (@emph{framesize})
  825. Set maximum frame size, or duration of a frame in milliseconds. The
  826. argument must be exactly the following: 2.5, 5, 10, 20, 40, 60. Smaller
  827. frame sizes achieve lower latency but less quality at a given bitrate.
  828. Sizes greater than 20ms are only interesting at fairly low bitrates.
  829. The default is 20ms.
  830. @item packet_loss (@emph{expect-loss})
  831. Set expected packet loss percentage. The default is 0.
  832. @item application (N.A.)
  833. Set intended application type. Valid options are listed below:
  834. @table @samp
  835. @item voip
  836. Favor improved speech intelligibility.
  837. @item audio
  838. Favor faithfulness to the input (the default).
  839. @item lowdelay
  840. Restrict to only the lowest delay modes.
  841. @end table
  842. @item cutoff (N.A.)
  843. Set cutoff bandwidth in Hz. The argument must be exactly one of the
  844. following: 4000, 6000, 8000, 12000, or 20000, corresponding to
  845. narrowband, mediumband, wideband, super wideband, and fullband
  846. respectively. The default is 0 (cutoff disabled).
  847. @end table
  848. @section libvorbis
  849. libvorbis encoder wrapper.
  850. Requires the presence of the libvorbisenc headers and library during
  851. configuration. You need to explicitly configure the build with
  852. @code{--enable-libvorbis}.
  853. @subsection Options
  854. The following options are supported by the libvorbis wrapper. The
  855. @command{oggenc}-equivalent of the options are listed in parentheses.
  856. To get a more accurate and extensive documentation of the libvorbis
  857. options, consult the libvorbisenc's and @command{oggenc}'s documentations.
  858. See @url{http://xiph.org/vorbis/},
  859. @url{http://wiki.xiph.org/Vorbis-tools}, and oggenc(1).
  860. @table @option
  861. @item b (@emph{-b})
  862. Set bitrate expressed in bits/s for ABR. @command{oggenc} @option{-b} is
  863. expressed in kilobits/s.
  864. @item q (@emph{-q})
  865. Set constant quality setting for VBR. The value should be a float
  866. number in the range of -1.0 to 10.0. The higher the value, the better
  867. the quality. The default value is @samp{3.0}.
  868. This option is valid only using the @command{ffmpeg} command-line tool.
  869. For library interface users, use @option{global_quality}.
  870. @item cutoff (@emph{--advanced-encode-option lowpass_frequency=N})
  871. Set cutoff bandwidth in Hz, a value of 0 disables cutoff. @command{oggenc}'s
  872. related option is expressed in kHz. The default value is @samp{0} (cutoff
  873. disabled).
  874. @item minrate (@emph{-m})
  875. Set minimum bitrate expressed in bits/s. @command{oggenc} @option{-m} is
  876. expressed in kilobits/s.
  877. @item maxrate (@emph{-M})
  878. Set maximum bitrate expressed in bits/s. @command{oggenc} @option{-M} is
  879. expressed in kilobits/s. This only has effect on ABR mode.
  880. @item iblock (@emph{--advanced-encode-option impulse_noisetune=N})
  881. Set noise floor bias for impulse blocks. The value is a float number from
  882. -15.0 to 0.0. A negative bias instructs the encoder to pay special attention
  883. to the crispness of transients in the encoded audio. The tradeoff for better
  884. transient response is a higher bitrate.
  885. @end table
  886. @anchor{libwavpack}
  887. @section libwavpack
  888. A wrapper providing WavPack encoding through libwavpack.
  889. Only lossless mode using 32-bit integer samples is supported currently.
  890. Requires the presence of the libwavpack headers and library during
  891. configuration. You need to explicitly configure the build with
  892. @code{--enable-libwavpack}.
  893. Note that a libavcodec-native encoder for the WavPack codec exists so users can
  894. encode audios with this codec without using this encoder. See @ref{wavpackenc}.
  895. @subsection Options
  896. @command{wavpack} command line utility's corresponding options are listed in
  897. parentheses, if any.
  898. @table @option
  899. @item frame_size (@emph{--blocksize})
  900. Default is 32768.
  901. @item compression_level
  902. Set speed vs. compression tradeoff. Acceptable arguments are listed below:
  903. @table @samp
  904. @item 0 (@emph{-f})
  905. Fast mode.
  906. @item 1
  907. Normal (default) settings.
  908. @item 2 (@emph{-h})
  909. High quality.
  910. @item 3 (@emph{-hh})
  911. Very high quality.
  912. @item 4-8 (@emph{-hh -x}@var{EXTRAPROC})
  913. Same as @samp{3}, but with extra processing enabled.
  914. @samp{4} is the same as @option{-x2} and @samp{8} is the same as @option{-x6}.
  915. @end table
  916. @end table
  917. @anchor{wavpackenc}
  918. @section wavpack
  919. WavPack lossless audio encoder.
  920. This is a libavcodec-native WavPack encoder. There is also an encoder based on
  921. libwavpack, but there is virtually no reason to use that encoder.
  922. See also @ref{libwavpack}.
  923. @subsection Options
  924. The equivalent options for @command{wavpack} command line utility are listed in
  925. parentheses.
  926. @subsubsection Shared options
  927. The following shared options are effective for this encoder. Only special notes
  928. about this particular encoder will be documented here. For the general meaning
  929. of the options, see @ref{codec-options,,the Codec Options chapter}.
  930. @table @option
  931. @item frame_size (@emph{--blocksize})
  932. For this encoder, the range for this option is between 128 and 131072. Default
  933. is automatically decided based on sample rate and number of channel.
  934. For the complete formula of calculating default, see
  935. @file{libavcodec/wavpackenc.c}.
  936. @item compression_level (@emph{-f}, @emph{-h}, @emph{-hh}, and @emph{-x})
  937. This option's syntax is consistent with @ref{libwavpack}'s.
  938. @end table
  939. @subsubsection Private options
  940. @table @option
  941. @item joint_stereo (@emph{-j})
  942. Set whether to enable joint stereo. Valid values are:
  943. @table @samp
  944. @item on (@emph{1})
  945. Force mid/side audio encoding.
  946. @item off (@emph{0})
  947. Force left/right audio encoding.
  948. @item auto
  949. Let the encoder decide automatically.
  950. @end table
  951. @item optimize_mono
  952. Set whether to enable optimization for mono. This option is only effective for
  953. non-mono streams. Available values:
  954. @table @samp
  955. @item on
  956. enabled
  957. @item off
  958. disabled
  959. @end table
  960. @end table
  961. @c man end AUDIO ENCODERS
  962. @chapter Video Encoders
  963. @c man begin VIDEO ENCODERS
  964. A description of some of the currently available video encoders
  965. follows.
  966. @section libtheora
  967. libtheora Theora encoder wrapper.
  968. Requires the presence of the libtheora headers and library during
  969. configuration. You need to explicitly configure the build with
  970. @code{--enable-libtheora}.
  971. For more informations about the libtheora project see
  972. @url{http://www.theora.org/}.
  973. @subsection Options
  974. The following global options are mapped to internal libtheora options
  975. which affect the quality and the bitrate of the encoded stream.
  976. @table @option
  977. @item b
  978. Set the video bitrate in bit/s for CBR (Constant Bit Rate) mode. In
  979. case VBR (Variable Bit Rate) mode is enabled this option is ignored.
  980. @item flags
  981. Used to enable constant quality mode (VBR) encoding through the
  982. @option{qscale} flag, and to enable the @code{pass1} and @code{pass2}
  983. modes.
  984. @item g
  985. Set the GOP size.
  986. @item global_quality
  987. Set the global quality as an integer in lambda units.
  988. Only relevant when VBR mode is enabled with @code{flags +qscale}. The
  989. value is converted to QP units by dividing it by @code{FF_QP2LAMBDA},
  990. clipped in the [0 - 10] range, and then multiplied by 6.3 to get a
  991. value in the native libtheora range [0-63]. A higher value corresponds
  992. to a higher quality.
  993. @item q
  994. Enable VBR mode when set to a non-negative value, and set constant
  995. quality value as a double floating point value in QP units.
  996. The value is clipped in the [0-10] range, and then multiplied by 6.3
  997. to get a value in the native libtheora range [0-63].
  998. This option is valid only using the @command{ffmpeg} command-line
  999. tool. For library interface users, use @option{global_quality}.
  1000. @end table
  1001. @subsection Examples
  1002. @itemize
  1003. @item
  1004. Set maximum constant quality (VBR) encoding with @command{ffmpeg}:
  1005. @example
  1006. ffmpeg -i INPUT -codec:v libtheora -q:v 10 OUTPUT.ogg
  1007. @end example
  1008. @item
  1009. Use @command{ffmpeg} to convert a CBR 1000 kbps Theora video stream:
  1010. @example
  1011. ffmpeg -i INPUT -codec:v libtheora -b:v 1000k OUTPUT.ogg
  1012. @end example
  1013. @end itemize
  1014. @section libvpx
  1015. VP8 format supported through libvpx.
  1016. Requires the presence of the libvpx headers and library during configuration.
  1017. You need to explicitly configure the build with @code{--enable-libvpx}.
  1018. @subsection Options
  1019. Mapping from FFmpeg to libvpx options with conversion notes in parentheses.
  1020. @table @option
  1021. @item threads
  1022. g_threads
  1023. @item profile
  1024. g_profile
  1025. @item vb
  1026. rc_target_bitrate
  1027. @item g
  1028. kf_max_dist
  1029. @item keyint_min
  1030. kf_min_dist
  1031. @item qmin
  1032. rc_min_quantizer
  1033. @item qmax
  1034. rc_max_quantizer
  1035. @item bufsize, vb
  1036. rc_buf_sz
  1037. @code{(bufsize * 1000 / vb)}
  1038. rc_buf_optimal_sz
  1039. @code{(bufsize * 1000 / vb * 5 / 6)}
  1040. @item rc_init_occupancy, vb
  1041. rc_buf_initial_sz
  1042. @code{(rc_init_occupancy * 1000 / vb)}
  1043. @item rc_buffer_aggressivity
  1044. rc_undershoot_pct
  1045. @item skip_threshold
  1046. rc_dropframe_thresh
  1047. @item qcomp
  1048. rc_2pass_vbr_bias_pct
  1049. @item maxrate, vb
  1050. rc_2pass_vbr_maxsection_pct
  1051. @code{(maxrate * 100 / vb)}
  1052. @item minrate, vb
  1053. rc_2pass_vbr_minsection_pct
  1054. @code{(minrate * 100 / vb)}
  1055. @item minrate, maxrate, vb
  1056. @code{VPX_CBR}
  1057. @code{(minrate == maxrate == vb)}
  1058. @item crf
  1059. @code{VPX_CQ}, @code{VP8E_SET_CQ_LEVEL}
  1060. @item quality
  1061. @table @option
  1062. @item @var{best}
  1063. @code{VPX_DL_BEST_QUALITY}
  1064. @item @var{good}
  1065. @code{VPX_DL_GOOD_QUALITY}
  1066. @item @var{realtime}
  1067. @code{VPX_DL_REALTIME}
  1068. @end table
  1069. @item speed
  1070. @code{VP8E_SET_CPUUSED}
  1071. @item nr
  1072. @code{VP8E_SET_NOISE_SENSITIVITY}
  1073. @item mb_threshold
  1074. @code{VP8E_SET_STATIC_THRESHOLD}
  1075. @item slices
  1076. @code{VP8E_SET_TOKEN_PARTITIONS}
  1077. @item max-intra-rate
  1078. @code{VP8E_SET_MAX_INTRA_BITRATE_PCT}
  1079. @item force_key_frames
  1080. @code{VPX_EFLAG_FORCE_KF}
  1081. @item Alternate reference frame related
  1082. @table @option
  1083. @item vp8flags altref
  1084. @code{VP8E_SET_ENABLEAUTOALTREF}
  1085. @item @var{arnr_max_frames}
  1086. @code{VP8E_SET_ARNR_MAXFRAMES}
  1087. @item @var{arnr_type}
  1088. @code{VP8E_SET_ARNR_TYPE}
  1089. @item @var{arnr_strength}
  1090. @code{VP8E_SET_ARNR_STRENGTH}
  1091. @item @var{rc_lookahead}
  1092. g_lag_in_frames
  1093. @end table
  1094. @item vp8flags error_resilient
  1095. g_error_resilient
  1096. @end table
  1097. For more information about libvpx see:
  1098. @url{http://www.webmproject.org/}
  1099. @section libwebp
  1100. libwebp WebP Image encoder wrapper
  1101. libwebp is Google's official encoder for WebP images. It can encode in either
  1102. lossy or lossless mode. Lossy images are essentially a wrapper around a VP8
  1103. frame. Lossless images are a separate codec developed by Google.
  1104. @subsection Pixel Format
  1105. Currently, libwebp only supports YUV420 for lossy and RGB for lossless due
  1106. to limitations of the format and libwebp. Alpha is supported for either mode.
  1107. Because of API limitations, if RGB is passed in when encoding lossy or YUV is
  1108. passed in for encoding lossless, the pixel format will automatically be
  1109. converted using functions from libwebp. This is not ideal and is done only for
  1110. convenience.
  1111. @subsection Options
  1112. @table @option
  1113. @item -lossless @var{boolean}
  1114. Enables/Disables use of lossless mode. Default is 0.
  1115. @item -compression_level @var{integer}
  1116. For lossy, this is a quality/speed tradeoff. Higher values give better quality
  1117. for a given size at the cost of increased encoding time. For lossless, this is
  1118. a size/speed tradeoff. Higher values give smaller size at the cost of increased
  1119. encoding time. More specifically, it controls the number of extra algorithms
  1120. and compression tools used, and varies the combination of these tools. This
  1121. maps to the @var{method} option in libwebp. The valid range is 0 to 6.
  1122. Default is 4.
  1123. @item -qscale @var{float}
  1124. For lossy encoding, this controls image quality, 0 to 100. For lossless
  1125. encoding, this controls the effort and time spent at compressing more. The
  1126. default value is 75. Note that for usage via libavcodec, this option is called
  1127. @var{global_quality} and must be multiplied by @var{FF_QP2LAMBDA}.
  1128. @item -preset @var{type}
  1129. Configuration preset. This does some automatic settings based on the general
  1130. type of the image.
  1131. @table @option
  1132. @item none
  1133. Do not use a preset.
  1134. @item default
  1135. Use the encoder default.
  1136. @item picture
  1137. Digital picture, like portrait, inner shot
  1138. @item photo
  1139. Outdoor photograph, with natural lighting
  1140. @item drawing
  1141. Hand or line drawing, with high-contrast details
  1142. @item icon
  1143. Small-sized colorful images
  1144. @item text
  1145. Text-like
  1146. @end table
  1147. @end table
  1148. @section libx264, libx264rgb
  1149. x264 H.264/MPEG-4 AVC encoder wrapper.
  1150. This encoder requires the presence of the libx264 headers and library
  1151. during configuration. You need to explicitly configure the build with
  1152. @code{--enable-libx264}.
  1153. libx264 supports an impressive number of features, including 8x8 and
  1154. 4x4 adaptive spatial transform, adaptive B-frame placement, CAVLC/CABAC
  1155. entropy coding, interlacing (MBAFF), lossless mode, psy optimizations
  1156. for detail retention (adaptive quantization, psy-RD, psy-trellis).
  1157. Many libx264 encoder options are mapped to FFmpeg global codec
  1158. options, while unique encoder options are provided through private
  1159. options. Additionally the @option{x264opts} and @option{x264-params}
  1160. private options allows to pass a list of key=value tuples as accepted
  1161. by the libx264 @code{x264_param_parse} function.
  1162. The x264 project website is at
  1163. @url{http://www.videolan.org/developers/x264.html}.
  1164. The libx264rgb encoder is the same as libx264, except it accepts packed RGB
  1165. pixel formats as input instead of YUV.
  1166. @subsection Supported Pixel Formats
  1167. x264 supports 8- to 10-bit color spaces. The exact bit depth is controlled at
  1168. x264's configure time. FFmpeg only supports one bit depth in one particular
  1169. build. In other words, it is not possible to build one FFmpeg with multiple
  1170. versions of x264 with different bit depths.
  1171. @subsection Options
  1172. The following options are supported by the libx264 wrapper. The
  1173. @command{x264}-equivalent options or values are listed in parentheses
  1174. for easy migration.
  1175. To reduce the duplication of documentation, only the private options
  1176. and some others requiring special attention are documented here. For
  1177. the documentation of the undocumented generic options, see
  1178. @ref{codec-options,,the Codec Options chapter}.
  1179. To get a more accurate and extensive documentation of the libx264
  1180. options, invoke the command @command{x264 --full-help} or consult
  1181. the libx264 documentation.
  1182. @table @option
  1183. @item b (@emph{bitrate})
  1184. Set bitrate in bits/s. Note that FFmpeg's @option{b} option is
  1185. expressed in bits/s, while @command{x264}'s @option{bitrate} is in
  1186. kilobits/s.
  1187. @item bf (@emph{bframes})
  1188. @item g (@emph{keyint})
  1189. @item qmax (@emph{qpmax})
  1190. @item qmin (@emph{qpmin})
  1191. @item qdiff (@emph{qpstep})
  1192. @item qblur (@emph{qblur})
  1193. @item qcomp (@emph{qcomp})
  1194. @item refs (@emph{ref})
  1195. @item sc_threshold (@emph{scenecut})
  1196. @item trellis (@emph{trellis})
  1197. @item nr (@emph{nr})
  1198. @item me_range (@emph{merange})
  1199. @item me_method (@emph{me})
  1200. Set motion estimation method. Possible values in the decreasing order
  1201. of speed:
  1202. @table @samp
  1203. @item dia (@emph{dia})
  1204. @item epzs (@emph{dia})
  1205. Diamond search with radius 1 (fastest). @samp{epzs} is an alias for
  1206. @samp{dia}.
  1207. @item hex (@emph{hex})
  1208. Hexagonal search with radius 2.
  1209. @item umh (@emph{umh})
  1210. Uneven multi-hexagon search.
  1211. @item esa (@emph{esa})
  1212. Exhaustive search.
  1213. @item tesa (@emph{tesa})
  1214. Hadamard exhaustive search (slowest).
  1215. @end table
  1216. @item subq (@emph{subme})
  1217. @item b_strategy (@emph{b-adapt})
  1218. @item keyint_min (@emph{min-keyint})
  1219. @item coder
  1220. Set entropy encoder. Possible values:
  1221. @table @samp
  1222. @item ac
  1223. Enable CABAC.
  1224. @item vlc
  1225. Enable CAVLC and disable CABAC. It generates the same effect as
  1226. @command{x264}'s @option{--no-cabac} option.
  1227. @end table
  1228. @item cmp
  1229. Set full pixel motion estimation comparation algorithm. Possible values:
  1230. @table @samp
  1231. @item chroma
  1232. Enable chroma in motion estimation.
  1233. @item sad
  1234. Ignore chroma in motion estimation. It generates the same effect as
  1235. @command{x264}'s @option{--no-chroma-me} option.
  1236. @end table
  1237. @item threads (@emph{threads})
  1238. @item thread_type
  1239. Set multithreading technique. Possible values:
  1240. @table @samp
  1241. @item slice
  1242. Slice-based multithreading. It generates the same effect as
  1243. @command{x264}'s @option{--sliced-threads} option.
  1244. @item frame
  1245. Frame-based multithreading.
  1246. @end table
  1247. @item flags
  1248. Set encoding flags. It can be used to disable closed GOP and enable
  1249. open GOP by setting it to @code{-cgop}. The result is similar to
  1250. the behavior of @command{x264}'s @option{--open-gop} option.
  1251. @item rc_init_occupancy (@emph{vbv-init})
  1252. @item preset (@emph{preset})
  1253. Set the encoding preset.
  1254. @item tune (@emph{tune})
  1255. Set tuning of the encoding params.
  1256. @item profile (@emph{profile})
  1257. Set profile restrictions.
  1258. @item fastfirstpass
  1259. Enable fast settings when encoding first pass, when set to 1. When set
  1260. to 0, it has the same effect of @command{x264}'s
  1261. @option{--slow-firstpass} option.
  1262. @item crf (@emph{crf})
  1263. Set the quality for constant quality mode.
  1264. @item crf_max (@emph{crf-max})
  1265. In CRF mode, prevents VBV from lowering quality beyond this point.
  1266. @item qp (@emph{qp})
  1267. Set constant quantization rate control method parameter.
  1268. @item aq-mode (@emph{aq-mode})
  1269. Set AQ method. Possible values:
  1270. @table @samp
  1271. @item none (@emph{0})
  1272. Disabled.
  1273. @item variance (@emph{1})
  1274. Variance AQ (complexity mask).
  1275. @item autovariance (@emph{2})
  1276. Auto-variance AQ (experimental).
  1277. @end table
  1278. @item aq-strength (@emph{aq-strength})
  1279. Set AQ strength, reduce blocking and blurring in flat and textured areas.
  1280. @item psy
  1281. Use psychovisual optimizations when set to 1. When set to 0, it has the
  1282. same effect as @command{x264}'s @option{--no-psy} option.
  1283. @item psy-rd (@emph{psy-rd})
  1284. Set strength of psychovisual optimization, in
  1285. @var{psy-rd}:@var{psy-trellis} format.
  1286. @item rc-lookahead (@emph{rc-lookahead})
  1287. Set number of frames to look ahead for frametype and ratecontrol.
  1288. @item weightb
  1289. Enable weighted prediction for B-frames when set to 1. When set to 0,
  1290. it has the same effect as @command{x264}'s @option{--no-weightb} option.
  1291. @item weightp (@emph{weightp})
  1292. Set weighted prediction method for P-frames. Possible values:
  1293. @table @samp
  1294. @item none (@emph{0})
  1295. Disabled
  1296. @item simple (@emph{1})
  1297. Enable only weighted refs
  1298. @item smart (@emph{2})
  1299. Enable both weighted refs and duplicates
  1300. @end table
  1301. @item ssim (@emph{ssim})
  1302. Enable calculation and printing SSIM stats after the encoding.
  1303. @item intra-refresh (@emph{intra-refresh})
  1304. Enable the use of Periodic Intra Refresh instead of IDR frames when set
  1305. to 1.
  1306. @item bluray-compat (@emph{bluray-compat})
  1307. Configure the encoder to be compatible with the bluray standard.
  1308. It is a shorthand for setting "bluray-compat=1 force-cfr=1".
  1309. @item b-bias (@emph{b-bias})
  1310. Set the influence on how often B-frames are used.
  1311. @item b-pyramid (@emph{b-pyramid})
  1312. Set method for keeping of some B-frames as references. Possible values:
  1313. @table @samp
  1314. @item none (@emph{none})
  1315. Disabled.
  1316. @item strict (@emph{strict})
  1317. Strictly hierarchical pyramid.
  1318. @item normal (@emph{normal})
  1319. Non-strict (not Blu-ray compatible).
  1320. @end table
  1321. @item mixed-refs
  1322. Enable the use of one reference per partition, as opposed to one
  1323. reference per macroblock when set to 1. When set to 0, it has the
  1324. same effect as @command{x264}'s @option{--no-mixed-refs} option.
  1325. @item 8x8dct
  1326. Enable adaptive spatial transform (high profile 8x8 transform)
  1327. when set to 1. When set to 0, it has the same effect as
  1328. @command{x264}'s @option{--no-8x8dct} option.
  1329. @item fast-pskip
  1330. Enable early SKIP detection on P-frames when set to 1. When set
  1331. to 0, it has the same effect as @command{x264}'s
  1332. @option{--no-fast-pskip} option.
  1333. @item aud (@emph{aud})
  1334. Enable use of access unit delimiters when set to 1.
  1335. @item mbtree
  1336. Enable use macroblock tree ratecontrol when set to 1. When set
  1337. to 0, it has the same effect as @command{x264}'s
  1338. @option{--no-mbtree} option.
  1339. @item deblock (@emph{deblock})
  1340. Set loop filter parameters, in @var{alpha}:@var{beta} form.
  1341. @item cplxblur (@emph{cplxblur})
  1342. Set fluctuations reduction in QP (before curve compression).
  1343. @item partitions (@emph{partitions})
  1344. Set partitions to consider as a comma-separated list of. Possible
  1345. values in the list:
  1346. @table @samp
  1347. @item p8x8
  1348. 8x8 P-frame partition.
  1349. @item p4x4
  1350. 4x4 P-frame partition.
  1351. @item b8x8
  1352. 4x4 B-frame partition.
  1353. @item i8x8
  1354. 8x8 I-frame partition.
  1355. @item i4x4
  1356. 4x4 I-frame partition.
  1357. (Enabling @samp{p4x4} requires @samp{p8x8} to be enabled. Enabling
  1358. @samp{i8x8} requires adaptive spatial transform (@option{8x8dct}
  1359. option) to be enabled.)
  1360. @item none (@emph{none})
  1361. Do not consider any partitions.
  1362. @item all (@emph{all})
  1363. Consider every partition.
  1364. @end table
  1365. @item direct-pred (@emph{direct})
  1366. Set direct MV prediction mode. Possible values:
  1367. @table @samp
  1368. @item none (@emph{none})
  1369. Disable MV prediction.
  1370. @item spatial (@emph{spatial})
  1371. Enable spatial predicting.
  1372. @item temporal (@emph{temporal})
  1373. Enable temporal predicting.
  1374. @item auto (@emph{auto})
  1375. Automatically decided.
  1376. @end table
  1377. @item slice-max-size (@emph{slice-max-size})
  1378. Set the limit of the size of each slice in bytes. If not specified
  1379. but RTP payload size (@option{ps}) is specified, that is used.
  1380. @item stats (@emph{stats})
  1381. Set the file name for multi-pass stats.
  1382. @item nal-hrd (@emph{nal-hrd})
  1383. Set signal HRD information (requires @option{vbv-bufsize} to be set).
  1384. Possible values:
  1385. @table @samp
  1386. @item none (@emph{none})
  1387. Disable HRD information signaling.
  1388. @item vbr (@emph{vbr})
  1389. Variable bit rate.
  1390. @item cbr (@emph{cbr})
  1391. Constant bit rate (not allowed in MP4 container).
  1392. @end table
  1393. @item x264opts (N.A.)
  1394. Set any x264 option, see @command{x264 --fullhelp} for a list.
  1395. Argument is a list of @var{key}=@var{value} couples separated by
  1396. ":". In @var{filter} and @var{psy-rd} options that use ":" as a separator
  1397. themselves, use "," instead. They accept it as well since long ago but this
  1398. is kept undocumented for some reason.
  1399. For example to specify libx264 encoding options with @command{ffmpeg}:
  1400. @example
  1401. ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv
  1402. @end example
  1403. @item x264-params (N.A.)
  1404. Override the x264 configuration using a :-separated list of key=value
  1405. parameters.
  1406. This option is functionally the same as the @option{x264opts}, but is
  1407. duplicated for compability with the Libav fork.
  1408. For example to specify libx264 encoding options with @command{ffmpeg}:
  1409. @example
  1410. ffmpeg -i INPUT -c:v libx264 -x264-params level=30:bframes=0:weightp=0:\
  1411. cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:\
  1412. no-fast-pskip=1:subq=6:8x8dct=0:trellis=0 OUTPUT
  1413. @end example
  1414. @end table
  1415. Encoding ffpresets for common usages are provided so they can be used with the
  1416. general presets system (e.g. passing the @option{pre} option).
  1417. @section libxvid
  1418. Xvid MPEG-4 Part 2 encoder wrapper.
  1419. This encoder requires the presence of the libxvidcore headers and library
  1420. during configuration. You need to explicitly configure the build with
  1421. @code{--enable-libxvid --enable-gpl}.
  1422. The native @code{mpeg4} encoder supports the MPEG-4 Part 2 format, so
  1423. users can encode to this format without this library.
  1424. @subsection Options
  1425. The following options are supported by the libxvid wrapper. Some of
  1426. the following options are listed but are not documented, and
  1427. correspond to shared codec options. See @ref{codec-options,,the Codec
  1428. Options chapter} for their documentation. The other shared options
  1429. which are not listed have no effect for the libxvid encoder.
  1430. @table @option
  1431. @item b
  1432. @item g
  1433. @item qmin
  1434. @item qmax
  1435. @item mpeg_quant
  1436. @item threads
  1437. @item bf
  1438. @item b_qfactor
  1439. @item b_qoffset
  1440. @item flags
  1441. Set specific encoding flags. Possible values:
  1442. @table @samp
  1443. @item mv4
  1444. Use four motion vector by macroblock.
  1445. @item aic
  1446. Enable high quality AC prediction.
  1447. @item gray
  1448. Only encode grayscale.
  1449. @item gmc
  1450. Enable the use of global motion compensation (GMC).
  1451. @item qpel
  1452. Enable quarter-pixel motion compensation.
  1453. @item cgop
  1454. Enable closed GOP.
  1455. @item global_header
  1456. Place global headers in extradata instead of every keyframe.
  1457. @end table
  1458. @item trellis
  1459. @item me_method
  1460. Set motion estimation method. Possible values in decreasing order of
  1461. speed and increasing order of quality:
  1462. @table @samp
  1463. @item zero
  1464. Use no motion estimation (default).
  1465. @item phods
  1466. @item x1
  1467. @item log
  1468. Enable advanced diamond zonal search for 16x16 blocks and half-pixel
  1469. refinement for 16x16 blocks. @samp{x1} and @samp{log} are aliases for
  1470. @samp{phods}.
  1471. @item epzs
  1472. Enable all of the things described above, plus advanced diamond zonal
  1473. search for 8x8 blocks, half-pixel refinement for 8x8 blocks, and motion
  1474. estimation on chroma planes.
  1475. @item full
  1476. Enable all of the things described above, plus extended 16x16 and 8x8
  1477. blocks search.
  1478. @end table
  1479. @item mbd
  1480. Set macroblock decision algorithm. Possible values in the increasing
  1481. order of quality:
  1482. @table @samp
  1483. @item simple
  1484. Use macroblock comparing function algorithm (default).
  1485. @item bits
  1486. Enable rate distortion-based half pixel and quarter pixel refinement for
  1487. 16x16 blocks.
  1488. @item rd
  1489. Enable all of the things described above, plus rate distortion-based
  1490. half pixel and quarter pixel refinement for 8x8 blocks, and rate
  1491. distortion-based search using square pattern.
  1492. @end table
  1493. @item lumi_aq
  1494. Enable lumi masking adaptive quantization when set to 1. Default is 0
  1495. (disabled).
  1496. @item variance_aq
  1497. Enable variance adaptive quantization when set to 1. Default is 0
  1498. (disabled).
  1499. When combined with @option{lumi_aq}, the resulting quality will not
  1500. be better than any of the two specified individually. In other
  1501. words, the resulting quality will be the worse one of the two
  1502. effects.
  1503. @item ssim
  1504. Set structural similarity (SSIM) displaying method. Possible values:
  1505. @table @samp
  1506. @item off
  1507. Disable displaying of SSIM information.
  1508. @item avg
  1509. Output average SSIM at the end of encoding to stdout. The format of
  1510. showing the average SSIM is:
  1511. @example
  1512. Average SSIM: %f
  1513. @end example
  1514. For users who are not familiar with C, %f means a float number, or
  1515. a decimal (e.g. 0.939232).
  1516. @item frame
  1517. Output both per-frame SSIM data during encoding and average SSIM at
  1518. the end of encoding to stdout. The format of per-frame information
  1519. is:
  1520. @example
  1521. SSIM: avg: %1.3f min: %1.3f max: %1.3f
  1522. @end example
  1523. For users who are not familiar with C, %1.3f means a float number
  1524. rounded to 3 digits after the dot (e.g. 0.932).
  1525. @end table
  1526. @item ssim_acc
  1527. Set SSIM accuracy. Valid options are integers within the range of
  1528. 0-4, while 0 gives the most accurate result and 4 computes the
  1529. fastest.
  1530. @end table
  1531. @section png
  1532. PNG image encoder.
  1533. @subsection Private options
  1534. @table @option
  1535. @item dpi @var{integer}
  1536. Set physical density of pixels, in dots per inch, unset by default
  1537. @item dpm @var{integer}
  1538. Set physical density of pixels, in dots per meter, unset by default
  1539. @end table
  1540. @section ProRes
  1541. Apple ProRes encoder.
  1542. FFmpeg contains 2 ProRes encoders, the prores-aw and prores-ks encoder.
  1543. The used encoder can be choosen with the @code{-vcodec} option.
  1544. @subsection Private Options for prores-ks
  1545. @table @option
  1546. @item profile @var{integer}
  1547. Select the ProRes profile to encode
  1548. @table @samp
  1549. @item proxy
  1550. @item lt
  1551. @item standard
  1552. @item hq
  1553. @item 4444
  1554. @end table
  1555. @item quant_mat @var{integer}
  1556. Select quantization matrix.
  1557. @table @samp
  1558. @item auto
  1559. @item default
  1560. @item proxy
  1561. @item lt
  1562. @item standard
  1563. @item hq
  1564. @end table
  1565. If set to @var{auto}, the matrix matching the profile will be picked.
  1566. If not set, the matrix providing the highest quality, @var{default}, will be
  1567. picked.
  1568. @item bits_per_mb @var{integer}
  1569. How many bits to allot for coding one macroblock. Different profiles use
  1570. between 200 and 2400 bits per macroblock, the maximum is 8000.
  1571. @item mbs_per_slice @var{integer}
  1572. Number of macroblocks in each slice (1-8); the default value (8)
  1573. should be good in almost all situations.
  1574. @item vendor @var{string}
  1575. Override the 4-byte vendor ID.
  1576. A custom vendor ID like @var{apl0} would claim the stream was produced by
  1577. the Apple encoder.
  1578. @item alpha_bits @var{integer}
  1579. Specify number of bits for alpha component.
  1580. Possible values are @var{0}, @var{8} and @var{16}.
  1581. Use @var{0} to disable alpha plane coding.
  1582. @end table
  1583. @subsection Speed considerations
  1584. In the default mode of operation the encoder has to honor frame constraints
  1585. (i.e. not produc frames with size bigger than requested) while still making
  1586. output picture as good as possible.
  1587. A frame containing a lot of small details is harder to compress and the encoder
  1588. would spend more time searching for appropriate quantizers for each slice.
  1589. Setting a higher @option{bits_per_mb} limit will improve the speed.
  1590. For the fastest encoding speed set the @option{qscale} parameter (4 is the
  1591. recommended value) and do not set a size constraint.
  1592. @c man end VIDEO ENCODERS