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.

2568 lines
72KB

  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 the default AAC encoder, natively implemented into FFmpeg. Its
  24. quality is on par or better than libfdk_aac at the default bitrate of 128kbps.
  25. This encoder also implements more options, profiles and samplerates than
  26. other encoders (with only the AAC-HE profile pending to be implemented) so this
  27. encoder has become the default and is the recommended choice.
  28. @subsection Options
  29. @table @option
  30. @item b
  31. Set bit rate in bits/s. Setting this automatically activates constant bit rate
  32. (CBR) mode. If this option is unspecified it is set to 128kbps.
  33. @item q
  34. Set quality for variable bit rate (VBR) mode. This option is valid only using
  35. the @command{ffmpeg} command-line tool. For library interface users, use
  36. @option{global_quality}.
  37. @item cutoff
  38. Set cutoff frequency. If unspecified will allow the encoder to dynamically
  39. adjust the cutoff to improve clarity on low bitrates.
  40. @item aac_coder
  41. Set AAC encoder coding method. Possible values:
  42. @table @samp
  43. @item twoloop
  44. Two loop searching (TLS) method.
  45. This method first sets quantizers depending on band thresholds and then tries
  46. to find an optimal combination by adding or subtracting a specific value from
  47. all quantizers and adjusting some individual quantizer a little.
  48. Will tune itself based on whether aac_is/aac_ms/aac_pns are enabled.
  49. This is the default choice for a coder.
  50. @item anmr
  51. Average noise to mask ratio (ANMR) trellis-based solution.
  52. This is an experimental coder which currently produces a lower quality, is more
  53. unstable and is slower than the default twoloop coder but has potential.
  54. Currently has no support for the @option{aac_is} or @option{aac_pns} options.
  55. Not currently recommended.
  56. @item fast
  57. Constant quantizer method.
  58. This method sets a constant quantizer for all bands. This is the fastest of all
  59. the methods and has no rate control or support for @option{aac_is} or
  60. @option{aac_pns}.
  61. Not recommended.
  62. @end table
  63. @item aac_ms
  64. Sets mid/side coding mode. The default value of auto will automatically use
  65. M/S with bands which will benefit from such coding. Can be forced for all bands
  66. using the value "enable", which is mainly useful for debugging or disabled using
  67. "disable".
  68. @item aac_is
  69. Sets intensity stereo coding tool usage. By default, it's enabled and will
  70. automatically toggle IS for similar pairs of stereo bands if it's benefitial.
  71. Can be disabled for debugging by setting the value to "disable".
  72. @item aac_pns
  73. Uses perceptual noise substitution to replace low entropy high frequency bands
  74. with imperceivable white noise during the decoding process. By default, it's
  75. enabled, but can be disabled for debugging purposes by using "disable".
  76. @item aac_tns
  77. Enables the use of a multitap FIR filter which spans through the high frequency
  78. bands to hide quantization noise during the encoding process and is reverted
  79. by the decoder. As well as decreasing unpleasant artifacts in the high range
  80. this also reduces the entropy in the high bands and allows for more bits to
  81. be used by the mid-low bands. By default it's enabled but can be disabled for
  82. debugging by setting the option to "disable".
  83. @item aac_ltp
  84. Enables the use of the long term prediction extension which increases coding
  85. efficiency in very low bandwidth situations such as encoding of voice or
  86. solo piano music by extending constant harmonic peaks in bands throughout
  87. frames. This option is implied by profile:a aac_low and is incompatible with
  88. aac_pred. Use in conjunction with @option{-ar} to decrease the samplerate.
  89. @item aac_pred
  90. Enables the use of a more traditional style of prediction where the spectral
  91. coefficients transmitted are replaced by the difference of the current
  92. coefficients minus the previous "predicted" coefficients. In theory and sometimes
  93. in practice this can improve quality for low to mid bitrate audio.
  94. This option implies the aac_main profile and is incompatible with aac_ltp.
  95. @item profile
  96. Sets the encoding profile, possible values:
  97. @table @samp
  98. @item aac_low
  99. The default, AAC "Low-complexity" profile. Is the most compatible and produces
  100. decent quality.
  101. @item mpeg2_aac_low
  102. Equivalent to -profile:a aac_low -aac_pns 0. PNS was introduced with the MPEG4
  103. specifications.
  104. @item aac_ltp
  105. Long term prediction profile, is enabled by and will enable the aac_ltp option.
  106. Introduced in MPEG4.
  107. @item aac_main
  108. Main-type prediction profile, is enabled by and will enable the aac_pred option.
  109. Introduced in MPEG2.
  110. If this option is unspecified it is set to @samp{aac_low}.
  111. @end table
  112. @end table
  113. @section ac3 and ac3_fixed
  114. AC-3 audio encoders.
  115. These encoders implement part of ATSC A/52:2010 and ETSI TS 102 366, as well as
  116. the undocumented RealAudio 3 (a.k.a. dnet).
  117. The @var{ac3} encoder uses floating-point math, while the @var{ac3_fixed}
  118. encoder only uses fixed-point integer math. This does not mean that one is
  119. always faster, just that one or the other may be better suited to a
  120. particular system. The floating-point encoder will generally produce better
  121. quality audio for a given bitrate. The @var{ac3_fixed} encoder is not the
  122. default codec for any of the output formats, so it must be specified explicitly
  123. using the option @code{-acodec ac3_fixed} in order to use it.
  124. @subsection AC-3 Metadata
  125. The AC-3 metadata options are used to set parameters that describe the audio,
  126. but in most cases do not affect the audio encoding itself. Some of the options
  127. do directly affect or influence the decoding and playback of the resulting
  128. bitstream, while others are just for informational purposes. A few of the
  129. options will add bits to the output stream that could otherwise be used for
  130. audio data, and will thus affect the quality of the output. Those will be
  131. indicated accordingly with a note in the option list below.
  132. These parameters are described in detail in several publicly-available
  133. documents.
  134. @itemize
  135. @item @uref{http://www.atsc.org/cms/standards/a_52-2010.pdf,A/52:2010 - Digital Audio Compression (AC-3) (E-AC-3) Standard}
  136. @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}
  137. @item @uref{http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/18_Metadata.Guide.pdf,Dolby Metadata Guide}
  138. @item @uref{http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/46_DDEncodingGuidelines.pdf,Dolby Digital Professional Encoding Guidelines}
  139. @end itemize
  140. @subsubsection Metadata Control Options
  141. @table @option
  142. @item -per_frame_metadata @var{boolean}
  143. Allow Per-Frame Metadata. Specifies if the encoder should check for changing
  144. metadata for each frame.
  145. @table @option
  146. @item 0
  147. The metadata values set at initialization will be used for every frame in the
  148. stream. (default)
  149. @item 1
  150. Metadata values can be changed before encoding each frame.
  151. @end table
  152. @end table
  153. @subsubsection Downmix Levels
  154. @table @option
  155. @item -center_mixlev @var{level}
  156. Center Mix Level. The amount of gain the decoder should apply to the center
  157. channel when downmixing to stereo. This field will only be written to the
  158. bitstream if a center channel is present. The value is specified as a scale
  159. factor. There are 3 valid values:
  160. @table @option
  161. @item 0.707
  162. Apply -3dB gain
  163. @item 0.595
  164. Apply -4.5dB gain (default)
  165. @item 0.500
  166. Apply -6dB gain
  167. @end table
  168. @item -surround_mixlev @var{level}
  169. Surround Mix Level. The amount of gain the decoder should apply to the surround
  170. channel(s) when downmixing to stereo. This field will only be written to the
  171. bitstream if one or more surround channels are present. The value is specified
  172. as a scale factor. There are 3 valid values:
  173. @table @option
  174. @item 0.707
  175. Apply -3dB gain
  176. @item 0.500
  177. Apply -6dB gain (default)
  178. @item 0.000
  179. Silence Surround Channel(s)
  180. @end table
  181. @end table
  182. @subsubsection Audio Production Information
  183. Audio Production Information is optional information describing the mixing
  184. environment. Either none or both of the fields are written to the bitstream.
  185. @table @option
  186. @item -mixing_level @var{number}
  187. Mixing Level. Specifies peak sound pressure level (SPL) in the production
  188. environment when the mix was mastered. Valid values are 80 to 111, or -1 for
  189. unknown or not indicated. The default value is -1, but that value cannot be
  190. used if the Audio Production Information is written to the bitstream. Therefore,
  191. if the @code{room_type} option is not the default value, the @code{mixing_level}
  192. option must not be -1.
  193. @item -room_type @var{type}
  194. Room Type. Describes the equalization used during the final mixing session at
  195. the studio or on the dubbing stage. A large room is a dubbing stage with the
  196. industry standard X-curve equalization; a small room has flat equalization.
  197. This field will not be written to the bitstream if both the @code{mixing_level}
  198. option and the @code{room_type} option have the default values.
  199. @table @option
  200. @item 0
  201. @itemx notindicated
  202. Not Indicated (default)
  203. @item 1
  204. @itemx large
  205. Large Room
  206. @item 2
  207. @itemx small
  208. Small Room
  209. @end table
  210. @end table
  211. @subsubsection Other Metadata Options
  212. @table @option
  213. @item -copyright @var{boolean}
  214. Copyright Indicator. Specifies whether a copyright exists for this audio.
  215. @table @option
  216. @item 0
  217. @itemx off
  218. No Copyright Exists (default)
  219. @item 1
  220. @itemx on
  221. Copyright Exists
  222. @end table
  223. @item -dialnorm @var{value}
  224. Dialogue Normalization. Indicates how far the average dialogue level of the
  225. program is below digital 100% full scale (0 dBFS). This parameter determines a
  226. level shift during audio reproduction that sets the average volume of the
  227. dialogue to a preset level. The goal is to match volume level between program
  228. sources. A value of -31dB will result in no volume level change, relative to
  229. the source volume, during audio reproduction. Valid values are whole numbers in
  230. the range -31 to -1, with -31 being the default.
  231. @item -dsur_mode @var{mode}
  232. Dolby Surround Mode. Specifies whether the stereo signal uses Dolby Surround
  233. (Pro Logic). This field will only be written to the bitstream if the audio
  234. stream is stereo. Using this option does @b{NOT} mean the encoder will actually
  235. apply Dolby Surround processing.
  236. @table @option
  237. @item 0
  238. @itemx notindicated
  239. Not Indicated (default)
  240. @item 1
  241. @itemx off
  242. Not Dolby Surround Encoded
  243. @item 2
  244. @itemx on
  245. Dolby Surround Encoded
  246. @end table
  247. @item -original @var{boolean}
  248. Original Bit Stream Indicator. Specifies whether this audio is from the
  249. original source and not a copy.
  250. @table @option
  251. @item 0
  252. @itemx off
  253. Not Original Source
  254. @item 1
  255. @itemx on
  256. Original Source (default)
  257. @end table
  258. @end table
  259. @subsection Extended Bitstream Information
  260. The extended bitstream options are part of the Alternate Bit Stream Syntax as
  261. specified in Annex D of the A/52:2010 standard. It is grouped into 2 parts.
  262. If any one parameter in a group is specified, all values in that group will be
  263. written to the bitstream. Default values are used for those that are written
  264. but have not been specified. If the mixing levels are written, the decoder
  265. will use these values instead of the ones specified in the @code{center_mixlev}
  266. and @code{surround_mixlev} options if it supports the Alternate Bit Stream
  267. Syntax.
  268. @subsubsection Extended Bitstream Information - Part 1
  269. @table @option
  270. @item -dmix_mode @var{mode}
  271. Preferred Stereo Downmix Mode. Allows the user to select either Lt/Rt
  272. (Dolby Surround) or Lo/Ro (normal stereo) as the preferred stereo downmix mode.
  273. @table @option
  274. @item 0
  275. @itemx notindicated
  276. Not Indicated (default)
  277. @item 1
  278. @itemx ltrt
  279. Lt/Rt Downmix Preferred
  280. @item 2
  281. @itemx loro
  282. Lo/Ro Downmix Preferred
  283. @end table
  284. @item -ltrt_cmixlev @var{level}
  285. Lt/Rt Center Mix Level. The amount of gain the decoder should apply to the
  286. center channel when downmixing to stereo in Lt/Rt 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 -ltrt_surmixlev @var{level}
  306. Lt/Rt Surround Mix Level. The amount of gain the decoder should apply to the
  307. surround channel(s) when downmixing to stereo in Lt/Rt 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. @item -loro_cmixlev @var{level}
  321. Lo/Ro Center Mix Level. The amount of gain the decoder should apply to the
  322. center channel when downmixing to stereo in Lo/Ro mode.
  323. @table @option
  324. @item 1.414
  325. Apply +3dB gain
  326. @item 1.189
  327. Apply +1.5dB gain
  328. @item 1.000
  329. Apply 0dB gain
  330. @item 0.841
  331. Apply -1.5dB gain
  332. @item 0.707
  333. Apply -3.0dB gain
  334. @item 0.595
  335. Apply -4.5dB gain (default)
  336. @item 0.500
  337. Apply -6.0dB gain
  338. @item 0.000
  339. Silence Center Channel
  340. @end table
  341. @item -loro_surmixlev @var{level}
  342. Lo/Ro Surround Mix Level. The amount of gain the decoder should apply to the
  343. surround channel(s) when downmixing to stereo in Lo/Ro mode.
  344. @table @option
  345. @item 0.841
  346. Apply -1.5dB gain
  347. @item 0.707
  348. Apply -3.0dB gain
  349. @item 0.595
  350. Apply -4.5dB gain
  351. @item 0.500
  352. Apply -6.0dB gain (default)
  353. @item 0.000
  354. Silence Surround Channel(s)
  355. @end table
  356. @end table
  357. @subsubsection Extended Bitstream Information - Part 2
  358. @table @option
  359. @item -dsurex_mode @var{mode}
  360. Dolby Surround EX Mode. Indicates whether the stream uses Dolby Surround EX
  361. (7.1 matrixed to 5.1). Using this option does @b{NOT} mean the encoder will actually
  362. apply Dolby Surround EX processing.
  363. @table @option
  364. @item 0
  365. @itemx notindicated
  366. Not Indicated (default)
  367. @item 1
  368. @itemx on
  369. Dolby Surround EX Off
  370. @item 2
  371. @itemx off
  372. Dolby Surround EX On
  373. @end table
  374. @item -dheadphone_mode @var{mode}
  375. Dolby Headphone Mode. Indicates whether the stream uses Dolby Headphone
  376. encoding (multi-channel matrixed to 2.0 for use with headphones). Using this
  377. option does @b{NOT} mean the encoder will actually apply Dolby Headphone
  378. processing.
  379. @table @option
  380. @item 0
  381. @itemx notindicated
  382. Not Indicated (default)
  383. @item 1
  384. @itemx on
  385. Dolby Headphone Off
  386. @item 2
  387. @itemx off
  388. Dolby Headphone On
  389. @end table
  390. @item -ad_conv_type @var{type}
  391. A/D Converter Type. Indicates whether the audio has passed through HDCD A/D
  392. conversion.
  393. @table @option
  394. @item 0
  395. @itemx standard
  396. Standard A/D Converter (default)
  397. @item 1
  398. @itemx hdcd
  399. HDCD A/D Converter
  400. @end table
  401. @end table
  402. @subsection Other AC-3 Encoding Options
  403. @table @option
  404. @item -stereo_rematrixing @var{boolean}
  405. Stereo Rematrixing. Enables/Disables use of rematrixing for stereo input. This
  406. is an optional AC-3 feature that increases quality by selectively encoding
  407. the left/right channels as mid/side. This option is enabled by default, and it
  408. is highly recommended that it be left as enabled except for testing purposes.
  409. @end table
  410. @subsection Floating-Point-Only AC-3 Encoding Options
  411. These options are only valid for the floating-point encoder and do not exist
  412. for the fixed-point encoder due to the corresponding features not being
  413. implemented in fixed-point.
  414. @table @option
  415. @item -channel_coupling @var{boolean}
  416. Enables/Disables use of channel coupling, which is an optional AC-3 feature
  417. that increases quality by combining high frequency information from multiple
  418. channels into a single channel. The per-channel high frequency information is
  419. sent with less accuracy in both the frequency and time domains. This allows
  420. more bits to be used for lower frequencies while preserving enough information
  421. to reconstruct the high frequencies. This option is enabled by default for the
  422. floating-point encoder and should generally be left as enabled except for
  423. testing purposes or to increase encoding speed.
  424. @table @option
  425. @item -1
  426. @itemx auto
  427. Selected by Encoder (default)
  428. @item 0
  429. @itemx off
  430. Disable Channel Coupling
  431. @item 1
  432. @itemx on
  433. Enable Channel Coupling
  434. @end table
  435. @item -cpl_start_band @var{number}
  436. Coupling Start Band. Sets the channel coupling start band, from 1 to 15. If a
  437. value higher than the bandwidth is used, it will be reduced to 1 less than the
  438. coupling end band. If @var{auto} is used, the start band will be determined by
  439. the encoder based on the bit rate, sample rate, and channel layout. This option
  440. has no effect if channel coupling is disabled.
  441. @table @option
  442. @item -1
  443. @itemx auto
  444. Selected by Encoder (default)
  445. @end table
  446. @end table
  447. @anchor{flac}
  448. @section flac
  449. FLAC (Free Lossless Audio Codec) Encoder
  450. @subsection Options
  451. The following options are supported by FFmpeg's flac encoder.
  452. @table @option
  453. @item compression_level
  454. Sets the compression level, which chooses defaults for many other options
  455. if they are not set explicitly.
  456. @item frame_size
  457. Sets the size of the frames in samples per channel.
  458. @item lpc_coeff_precision
  459. Sets the LPC coefficient precision, valid values are from 1 to 15, 15 is the
  460. default.
  461. @item lpc_type
  462. Sets the first stage LPC algorithm
  463. @table @samp
  464. @item none
  465. LPC is not used
  466. @item fixed
  467. fixed LPC coefficients
  468. @item levinson
  469. @item cholesky
  470. @end table
  471. @item lpc_passes
  472. Number of passes to use for Cholesky factorization during LPC analysis
  473. @item min_partition_order
  474. The minimum partition order
  475. @item max_partition_order
  476. The maximum partition order
  477. @item prediction_order_method
  478. @table @samp
  479. @item estimation
  480. @item 2level
  481. @item 4level
  482. @item 8level
  483. @item search
  484. Bruteforce search
  485. @item log
  486. @end table
  487. @item ch_mode
  488. Channel mode
  489. @table @samp
  490. @item auto
  491. The mode is chosen automatically for each frame
  492. @item indep
  493. Chanels are independently coded
  494. @item left_side
  495. @item right_side
  496. @item mid_side
  497. @end table
  498. @item exact_rice_parameters
  499. Chooses if rice parameters are calculated exactly or approximately.
  500. if set to 1 then they are chosen exactly, which slows the code down slightly and
  501. improves compression slightly.
  502. @item multi_dim_quant
  503. Multi Dimensional Quantization. If set to 1 then a 2nd stage LPC algorithm is
  504. applied after the first stage to finetune the coefficients. This is quite slow
  505. and slightly improves compression.
  506. @end table
  507. @anchor{libfaac}
  508. @section libfaac
  509. libfaac AAC (Advanced Audio Coding) encoder wrapper.
  510. This encoder is of much lower quality and is more unstable than any other AAC
  511. encoders, so it's highly recommended to instead use other encoders, like
  512. @ref{aacenc,,the native FFmpeg AAC encoder}.
  513. This encoder also requires the presence of the libfaac headers and library
  514. during configuration. You need to explicitly configure the build with
  515. @code{--enable-libfaac --enable-nonfree}.
  516. @subsection Options
  517. The following shared FFmpeg codec options are recognized.
  518. The following options are supported by the libfaac wrapper. The
  519. @command{faac}-equivalent of the options are listed in parentheses.
  520. @table @option
  521. @item b (@emph{-b})
  522. Set bit rate in bits/s for ABR (Average Bit Rate) mode. If the bit rate
  523. is not explicitly specified, it is automatically set to a suitable
  524. value depending on the selected profile. @command{faac} bitrate is
  525. expressed in kilobits/s.
  526. Note that libfaac does not support CBR (Constant Bit Rate) but only
  527. ABR (Average Bit Rate).
  528. If VBR mode is enabled this option is ignored.
  529. @item ar (@emph{-R})
  530. Set audio sampling rate (in Hz).
  531. @item ac (@emph{-c})
  532. Set the number of audio channels.
  533. @item cutoff (@emph{-C})
  534. Set cutoff frequency. If not specified (or explicitly set to 0) it
  535. will use a value automatically computed by the library. Default value
  536. is 0.
  537. @item profile
  538. Set audio profile.
  539. The following profiles are recognized:
  540. @table @samp
  541. @item aac_main
  542. Main AAC (Main)
  543. @item aac_low
  544. Low Complexity AAC (LC)
  545. @item aac_ssr
  546. Scalable Sample Rate (SSR)
  547. @item aac_ltp
  548. Long Term Prediction (LTP)
  549. @end table
  550. If not specified it is set to @samp{aac_low}.
  551. @item flags +qscale
  552. Set constant quality VBR (Variable Bit Rate) mode.
  553. @item global_quality
  554. Set quality in VBR mode as an integer number of lambda units.
  555. Only relevant when VBR mode is enabled with @code{flags +qscale}. The
  556. value is converted to QP units by dividing it by @code{FF_QP2LAMBDA},
  557. and used to set the quality value used by libfaac. A reasonable range
  558. for the option value in QP units is [10-500], the higher the value the
  559. higher the quality.
  560. @item q (@emph{-q})
  561. Enable VBR mode when set to a non-negative value, and set constant
  562. quality value as a double floating point value in QP units.
  563. The value sets the quality value used by libfaac. A reasonable range
  564. for the option value is [10-500], the higher the value the higher the
  565. quality.
  566. This option is valid only using the @command{ffmpeg} command-line
  567. tool. For library interface users, use @option{global_quality}.
  568. @end table
  569. @subsection Examples
  570. @itemize
  571. @item
  572. Use @command{ffmpeg} to convert an audio file to ABR 128 kbps AAC in an M4A (MP4)
  573. container:
  574. @example
  575. ffmpeg -i input.wav -codec:a libfaac -b:a 128k -output.m4a
  576. @end example
  577. @item
  578. Use @command{ffmpeg} to convert an audio file to VBR AAC, using the
  579. LTP AAC profile:
  580. @example
  581. ffmpeg -i input.wav -c:a libfaac -profile:a aac_ltp -q:a 100 output.m4a
  582. @end example
  583. @end itemize
  584. @anchor{libfdk-aac-enc}
  585. @section libfdk_aac
  586. libfdk-aac AAC (Advanced Audio Coding) encoder wrapper.
  587. The libfdk-aac library is based on the Fraunhofer FDK AAC code from
  588. the Android project.
  589. Requires the presence of the libfdk-aac headers and library during
  590. configuration. You need to explicitly configure the build with
  591. @code{--enable-libfdk-aac}. The library is also incompatible with GPL,
  592. so if you allow the use of GPL, you should configure with
  593. @code{--enable-gpl --enable-nonfree --enable-libfdk-aac}.
  594. This encoder is considered to produce output on par or worse at 128kbps to the
  595. @ref{aacenc,,the native FFmpeg AAC encoder} but can often produce better
  596. sounding audio at identical or lower bitrates and has support for the
  597. AAC-HE profiles.
  598. VBR encoding, enabled through the @option{vbr} or @option{flags
  599. +qscale} options, is experimental and only works with some
  600. combinations of parameters.
  601. Support for encoding 7.1 audio is only available with libfdk-aac 0.1.3 or
  602. higher.
  603. For more information see the fdk-aac project at
  604. @url{http://sourceforge.net/p/opencore-amr/fdk-aac/}.
  605. @subsection Options
  606. The following options are mapped on the shared FFmpeg codec options.
  607. @table @option
  608. @item b
  609. Set bit rate in bits/s. If the bitrate is not explicitly specified, it
  610. is automatically set to a suitable value depending on the selected
  611. profile.
  612. In case VBR mode is enabled the option is ignored.
  613. @item ar
  614. Set audio sampling rate (in Hz).
  615. @item channels
  616. Set the number of audio channels.
  617. @item flags +qscale
  618. Enable fixed quality, VBR (Variable Bit Rate) mode.
  619. Note that VBR is implicitly enabled when the @option{vbr} value is
  620. positive.
  621. @item cutoff
  622. Set cutoff frequency. If not specified (or explicitly set to 0) it
  623. will use a value automatically computed by the library. Default value
  624. is 0.
  625. @item profile
  626. Set audio profile.
  627. The following profiles are recognized:
  628. @table @samp
  629. @item aac_low
  630. Low Complexity AAC (LC)
  631. @item aac_he
  632. High Efficiency AAC (HE-AAC)
  633. @item aac_he_v2
  634. High Efficiency AAC version 2 (HE-AACv2)
  635. @item aac_ld
  636. Low Delay AAC (LD)
  637. @item aac_eld
  638. Enhanced Low Delay AAC (ELD)
  639. @end table
  640. If not specified it is set to @samp{aac_low}.
  641. @end table
  642. The following are private options of the libfdk_aac encoder.
  643. @table @option
  644. @item afterburner
  645. Enable afterburner feature if set to 1, disabled if set to 0. This
  646. improves the quality but also the required processing power.
  647. Default value is 1.
  648. @item eld_sbr
  649. Enable SBR (Spectral Band Replication) for ELD if set to 1, disabled
  650. if set to 0.
  651. Default value is 0.
  652. @item signaling
  653. Set SBR/PS signaling style.
  654. It can assume one of the following values:
  655. @table @samp
  656. @item default
  657. choose signaling implicitly (explicit hierarchical by default,
  658. implicit if global header is disabled)
  659. @item implicit
  660. implicit backwards compatible signaling
  661. @item explicit_sbr
  662. explicit SBR, implicit PS signaling
  663. @item explicit_hierarchical
  664. explicit hierarchical signaling
  665. @end table
  666. Default value is @samp{default}.
  667. @item latm
  668. Output LATM/LOAS encapsulated data if set to 1, disabled if set to 0.
  669. Default value is 0.
  670. @item header_period
  671. Set StreamMuxConfig and PCE repetition period (in frames) for sending
  672. in-band configuration buffers within LATM/LOAS transport layer.
  673. Must be a 16-bits non-negative integer.
  674. Default value is 0.
  675. @item vbr
  676. Set VBR mode, from 1 to 5. 1 is lowest quality (though still pretty
  677. good) and 5 is highest quality. A value of 0 will disable VBR, and CBR
  678. (Constant Bit Rate) is enabled.
  679. Currently only the @samp{aac_low} profile supports VBR encoding.
  680. VBR modes 1-5 correspond to roughly the following average bit rates:
  681. @table @samp
  682. @item 1
  683. 32 kbps/channel
  684. @item 2
  685. 40 kbps/channel
  686. @item 3
  687. 48-56 kbps/channel
  688. @item 4
  689. 64 kbps/channel
  690. @item 5
  691. about 80-96 kbps/channel
  692. @end table
  693. Default value is 0.
  694. @end table
  695. @subsection Examples
  696. @itemize
  697. @item
  698. Use @command{ffmpeg} to convert an audio file to VBR AAC in an M4A (MP4)
  699. container:
  700. @example
  701. ffmpeg -i input.wav -codec:a libfdk_aac -vbr 3 output.m4a
  702. @end example
  703. @item
  704. Use @command{ffmpeg} to convert an audio file to CBR 64k kbps AAC, using the
  705. High-Efficiency AAC profile:
  706. @example
  707. ffmpeg -i input.wav -c:a libfdk_aac -profile:a aac_he -b:a 64k output.m4a
  708. @end example
  709. @end itemize
  710. @anchor{libmp3lame}
  711. @section libmp3lame
  712. LAME (Lame Ain't an MP3 Encoder) MP3 encoder wrapper.
  713. Requires the presence of the libmp3lame headers and library during
  714. configuration. You need to explicitly configure the build with
  715. @code{--enable-libmp3lame}.
  716. See @ref{libshine} for a fixed-point MP3 encoder, although with a
  717. lower quality.
  718. @subsection Options
  719. The following options are supported by the libmp3lame wrapper. The
  720. @command{lame}-equivalent of the options are listed in parentheses.
  721. @table @option
  722. @item b (@emph{-b})
  723. Set bitrate expressed in bits/s for CBR or ABR. LAME @code{bitrate} is
  724. expressed in kilobits/s.
  725. @item q (@emph{-V})
  726. Set constant quality setting for VBR. This option is valid only
  727. using the @command{ffmpeg} command-line tool. For library interface
  728. users, use @option{global_quality}.
  729. @item compression_level (@emph{-q})
  730. Set algorithm quality. Valid arguments are integers in the 0-9 range,
  731. with 0 meaning highest quality but slowest, and 9 meaning fastest
  732. while producing the worst quality.
  733. @item reservoir
  734. Enable use of bit reservoir when set to 1. Default value is 1. LAME
  735. has this enabled by default, but can be overridden by use
  736. @option{--nores} option.
  737. @item joint_stereo (@emph{-m j})
  738. Enable the encoder to use (on a frame by frame basis) either L/R
  739. stereo or mid/side stereo. Default value is 1.
  740. @item abr (@emph{--abr})
  741. Enable the encoder to use ABR when set to 1. The @command{lame}
  742. @option{--abr} sets the target bitrate, while this options only
  743. tells FFmpeg to use ABR still relies on @option{b} to set bitrate.
  744. @end table
  745. @section libopencore-amrnb
  746. OpenCORE Adaptive Multi-Rate Narrowband encoder.
  747. Requires the presence of the libopencore-amrnb headers and library during
  748. configuration. You need to explicitly configure the build with
  749. @code{--enable-libopencore-amrnb --enable-version3}.
  750. This is a mono-only encoder. Officially it only supports 8000Hz sample rate,
  751. but you can override it by setting @option{strict} to @samp{unofficial} or
  752. lower.
  753. @subsection Options
  754. @table @option
  755. @item b
  756. Set bitrate in bits per second. Only the following bitrates are supported,
  757. otherwise libavcodec will round to the nearest valid bitrate.
  758. @table @option
  759. @item 4750
  760. @item 5150
  761. @item 5900
  762. @item 6700
  763. @item 7400
  764. @item 7950
  765. @item 10200
  766. @item 12200
  767. @end table
  768. @item dtx
  769. Allow discontinuous transmission (generate comfort noise) when set to 1. The
  770. default value is 0 (disabled).
  771. @end table
  772. @anchor{libshine}
  773. @section libshine
  774. Shine Fixed-Point MP3 encoder wrapper.
  775. Shine is a fixed-point MP3 encoder. It has a far better performance on
  776. platforms without an FPU, e.g. armel CPUs, and some phones and tablets.
  777. However, as it is more targeted on performance than quality, it is not on par
  778. with LAME and other production-grade encoders quality-wise. Also, according to
  779. the project's homepage, this encoder may not be free of bugs as the code was
  780. written a long time ago and the project was dead for at least 5 years.
  781. This encoder only supports stereo and mono input. This is also CBR-only.
  782. The original project (last updated in early 2007) is at
  783. @url{http://sourceforge.net/projects/libshine-fxp/}. We only support the
  784. updated fork by the Savonet/Liquidsoap project at @url{https://github.com/savonet/shine}.
  785. Requires the presence of the libshine headers and library during
  786. configuration. You need to explicitly configure the build with
  787. @code{--enable-libshine}.
  788. See also @ref{libmp3lame}.
  789. @subsection Options
  790. The following options are supported by the libshine wrapper. The
  791. @command{shineenc}-equivalent of the options are listed in parentheses.
  792. @table @option
  793. @item b (@emph{-b})
  794. Set bitrate expressed in bits/s for CBR. @command{shineenc} @option{-b} option
  795. is expressed in kilobits/s.
  796. @end table
  797. @section libtwolame
  798. TwoLAME MP2 encoder wrapper.
  799. Requires the presence of the libtwolame headers and library during
  800. configuration. You need to explicitly configure the build with
  801. @code{--enable-libtwolame}.
  802. @subsection Options
  803. The following options are supported by the libtwolame wrapper. The
  804. @command{twolame}-equivalent options follow the FFmpeg ones and are in
  805. parentheses.
  806. @table @option
  807. @item b (@emph{-b})
  808. Set bitrate expressed in bits/s for CBR. @command{twolame} @option{b}
  809. option is expressed in kilobits/s. Default value is 128k.
  810. @item q (@emph{-V})
  811. Set quality for experimental VBR support. Maximum value range is
  812. from -50 to 50, useful range is from -10 to 10. The higher the
  813. value, the better the quality. This option is valid only using the
  814. @command{ffmpeg} command-line tool. For library interface users,
  815. use @option{global_quality}.
  816. @item mode (@emph{--mode})
  817. Set the mode of the resulting audio. Possible values:
  818. @table @samp
  819. @item auto
  820. Choose mode automatically based on the input. This is the default.
  821. @item stereo
  822. Stereo
  823. @item joint_stereo
  824. Joint stereo
  825. @item dual_channel
  826. Dual channel
  827. @item mono
  828. Mono
  829. @end table
  830. @item psymodel (@emph{--psyc-mode})
  831. Set psychoacoustic model to use in encoding. The argument must be
  832. an integer between -1 and 4, inclusive. The higher the value, the
  833. better the quality. The default value is 3.
  834. @item energy_levels (@emph{--energy})
  835. Enable energy levels extensions when set to 1. The default value is
  836. 0 (disabled).
  837. @item error_protection (@emph{--protect})
  838. Enable CRC error protection when set to 1. The default value is 0
  839. (disabled).
  840. @item copyright (@emph{--copyright})
  841. Set MPEG audio copyright flag when set to 1. The default value is 0
  842. (disabled).
  843. @item original (@emph{--original})
  844. Set MPEG audio original flag when set to 1. The default value is 0
  845. (disabled).
  846. @end table
  847. @anchor{libvo-aacenc}
  848. @section libvo-aacenc
  849. VisualOn AAC encoder.
  850. Requires the presence of the libvo-aacenc headers and library during
  851. configuration. You need to explicitly configure the build with
  852. @code{--enable-libvo-aacenc --enable-version3}.
  853. This encoder is considered to be worse than the
  854. @ref{aacenc,,native FFmpeg AAC encoder}, according to
  855. multiple sources.
  856. @subsection Options
  857. The VisualOn AAC encoder only support encoding AAC-LC and up to 2
  858. channels. It is also CBR-only.
  859. @table @option
  860. @item b
  861. Set bit rate in bits/s.
  862. @end table
  863. @section libvo-amrwbenc
  864. VisualOn Adaptive Multi-Rate Wideband encoder.
  865. Requires the presence of the libvo-amrwbenc headers and library during
  866. configuration. You need to explicitly configure the build with
  867. @code{--enable-libvo-amrwbenc --enable-version3}.
  868. This is a mono-only encoder. Officially it only supports 16000Hz sample
  869. rate, but you can override it by setting @option{strict} to
  870. @samp{unofficial} or lower.
  871. @subsection Options
  872. @table @option
  873. @item b
  874. Set bitrate in bits/s. Only the following bitrates are supported, otherwise
  875. libavcodec will round to the nearest valid bitrate.
  876. @table @samp
  877. @item 6600
  878. @item 8850
  879. @item 12650
  880. @item 14250
  881. @item 15850
  882. @item 18250
  883. @item 19850
  884. @item 23050
  885. @item 23850
  886. @end table
  887. @item dtx
  888. Allow discontinuous transmission (generate comfort noise) when set to 1. The
  889. default value is 0 (disabled).
  890. @end table
  891. @section libopus
  892. libopus Opus Interactive Audio Codec encoder wrapper.
  893. Requires the presence of the libopus headers and library during
  894. configuration. You need to explicitly configure the build with
  895. @code{--enable-libopus}.
  896. @subsection Option Mapping
  897. Most libopus options are modelled after the @command{opusenc} utility from
  898. opus-tools. The following is an option mapping chart describing options
  899. supported by the libopus wrapper, and their @command{opusenc}-equivalent
  900. in parentheses.
  901. @table @option
  902. @item b (@emph{bitrate})
  903. Set the bit rate in bits/s. FFmpeg's @option{b} option is
  904. expressed in bits/s, while @command{opusenc}'s @option{bitrate} in
  905. kilobits/s.
  906. @item vbr (@emph{vbr}, @emph{hard-cbr}, and @emph{cvbr})
  907. Set VBR mode. The FFmpeg @option{vbr} option has the following
  908. valid arguments, with the @command{opusenc} equivalent options
  909. in parentheses:
  910. @table @samp
  911. @item off (@emph{hard-cbr})
  912. Use constant bit rate encoding.
  913. @item on (@emph{vbr})
  914. Use variable bit rate encoding (the default).
  915. @item constrained (@emph{cvbr})
  916. Use constrained variable bit rate encoding.
  917. @end table
  918. @item compression_level (@emph{comp})
  919. Set encoding algorithm complexity. Valid options are integers in
  920. the 0-10 range. 0 gives the fastest encodes but lower quality, while 10
  921. gives the highest quality but slowest encoding. The default is 10.
  922. @item frame_duration (@emph{framesize})
  923. Set maximum frame size, or duration of a frame in milliseconds. The
  924. argument must be exactly the following: 2.5, 5, 10, 20, 40, 60. Smaller
  925. frame sizes achieve lower latency but less quality at a given bitrate.
  926. Sizes greater than 20ms are only interesting at fairly low bitrates.
  927. The default is 20ms.
  928. @item packet_loss (@emph{expect-loss})
  929. Set expected packet loss percentage. The default is 0.
  930. @item application (N.A.)
  931. Set intended application type. Valid options are listed below:
  932. @table @samp
  933. @item voip
  934. Favor improved speech intelligibility.
  935. @item audio
  936. Favor faithfulness to the input (the default).
  937. @item lowdelay
  938. Restrict to only the lowest delay modes.
  939. @end table
  940. @item cutoff (N.A.)
  941. Set cutoff bandwidth in Hz. The argument must be exactly one of the
  942. following: 4000, 6000, 8000, 12000, or 20000, corresponding to
  943. narrowband, mediumband, wideband, super wideband, and fullband
  944. respectively. The default is 0 (cutoff disabled).
  945. @end table
  946. @section libvorbis
  947. libvorbis encoder wrapper.
  948. Requires the presence of the libvorbisenc headers and library during
  949. configuration. You need to explicitly configure the build with
  950. @code{--enable-libvorbis}.
  951. @subsection Options
  952. The following options are supported by the libvorbis wrapper. The
  953. @command{oggenc}-equivalent of the options are listed in parentheses.
  954. To get a more accurate and extensive documentation of the libvorbis
  955. options, consult the libvorbisenc's and @command{oggenc}'s documentations.
  956. See @url{http://xiph.org/vorbis/},
  957. @url{http://wiki.xiph.org/Vorbis-tools}, and oggenc(1).
  958. @table @option
  959. @item b (@emph{-b})
  960. Set bitrate expressed in bits/s for ABR. @command{oggenc} @option{-b} is
  961. expressed in kilobits/s.
  962. @item q (@emph{-q})
  963. Set constant quality setting for VBR. The value should be a float
  964. number in the range of -1.0 to 10.0. The higher the value, the better
  965. the quality. The default value is @samp{3.0}.
  966. This option is valid only using the @command{ffmpeg} command-line tool.
  967. For library interface users, use @option{global_quality}.
  968. @item cutoff (@emph{--advanced-encode-option lowpass_frequency=N})
  969. Set cutoff bandwidth in Hz, a value of 0 disables cutoff. @command{oggenc}'s
  970. related option is expressed in kHz. The default value is @samp{0} (cutoff
  971. disabled).
  972. @item minrate (@emph{-m})
  973. Set minimum bitrate expressed in bits/s. @command{oggenc} @option{-m} is
  974. expressed in kilobits/s.
  975. @item maxrate (@emph{-M})
  976. Set maximum bitrate expressed in bits/s. @command{oggenc} @option{-M} is
  977. expressed in kilobits/s. This only has effect on ABR mode.
  978. @item iblock (@emph{--advanced-encode-option impulse_noisetune=N})
  979. Set noise floor bias for impulse blocks. The value is a float number from
  980. -15.0 to 0.0. A negative bias instructs the encoder to pay special attention
  981. to the crispness of transients in the encoded audio. The tradeoff for better
  982. transient response is a higher bitrate.
  983. @end table
  984. @anchor{libwavpack}
  985. @section libwavpack
  986. A wrapper providing WavPack encoding through libwavpack.
  987. Only lossless mode using 32-bit integer samples is supported currently.
  988. Requires the presence of the libwavpack headers and library during
  989. configuration. You need to explicitly configure the build with
  990. @code{--enable-libwavpack}.
  991. Note that a libavcodec-native encoder for the WavPack codec exists so users can
  992. encode audios with this codec without using this encoder. See @ref{wavpackenc}.
  993. @subsection Options
  994. @command{wavpack} command line utility's corresponding options are listed in
  995. parentheses, if any.
  996. @table @option
  997. @item frame_size (@emph{--blocksize})
  998. Default is 32768.
  999. @item compression_level
  1000. Set speed vs. compression tradeoff. Acceptable arguments are listed below:
  1001. @table @samp
  1002. @item 0 (@emph{-f})
  1003. Fast mode.
  1004. @item 1
  1005. Normal (default) settings.
  1006. @item 2 (@emph{-h})
  1007. High quality.
  1008. @item 3 (@emph{-hh})
  1009. Very high quality.
  1010. @item 4-8 (@emph{-hh -x}@var{EXTRAPROC})
  1011. Same as @samp{3}, but with extra processing enabled.
  1012. @samp{4} is the same as @option{-x2} and @samp{8} is the same as @option{-x6}.
  1013. @end table
  1014. @end table
  1015. @anchor{wavpackenc}
  1016. @section wavpack
  1017. WavPack lossless audio encoder.
  1018. This is a libavcodec-native WavPack encoder. There is also an encoder based on
  1019. libwavpack, but there is virtually no reason to use that encoder.
  1020. See also @ref{libwavpack}.
  1021. @subsection Options
  1022. The equivalent options for @command{wavpack} command line utility are listed in
  1023. parentheses.
  1024. @subsubsection Shared options
  1025. The following shared options are effective for this encoder. Only special notes
  1026. about this particular encoder will be documented here. For the general meaning
  1027. of the options, see @ref{codec-options,,the Codec Options chapter}.
  1028. @table @option
  1029. @item frame_size (@emph{--blocksize})
  1030. For this encoder, the range for this option is between 128 and 131072. Default
  1031. is automatically decided based on sample rate and number of channel.
  1032. For the complete formula of calculating default, see
  1033. @file{libavcodec/wavpackenc.c}.
  1034. @item compression_level (@emph{-f}, @emph{-h}, @emph{-hh}, and @emph{-x})
  1035. This option's syntax is consistent with @ref{libwavpack}'s.
  1036. @end table
  1037. @subsubsection Private options
  1038. @table @option
  1039. @item joint_stereo (@emph{-j})
  1040. Set whether to enable joint stereo. Valid values are:
  1041. @table @samp
  1042. @item on (@emph{1})
  1043. Force mid/side audio encoding.
  1044. @item off (@emph{0})
  1045. Force left/right audio encoding.
  1046. @item auto
  1047. Let the encoder decide automatically.
  1048. @end table
  1049. @item optimize_mono
  1050. Set whether to enable optimization for mono. This option is only effective for
  1051. non-mono streams. Available values:
  1052. @table @samp
  1053. @item on
  1054. enabled
  1055. @item off
  1056. disabled
  1057. @end table
  1058. @end table
  1059. @c man end AUDIO ENCODERS
  1060. @chapter Video Encoders
  1061. @c man begin VIDEO ENCODERS
  1062. A description of some of the currently available video encoders
  1063. follows.
  1064. @section libopenh264
  1065. Cisco libopenh264 H.264/MPEG-4 AVC encoder wrapper.
  1066. This encoder requires the presence of the libopenh264 headers and
  1067. library during configuration. You need to explicitly configure the
  1068. build with @code{--enable-libopenh264}. The library is detected using
  1069. @command{pkg-config}.
  1070. For more information about the library see
  1071. @url{http://www.openh264.org}.
  1072. @subsection Options
  1073. The following FFmpeg global options affect the configurations of the
  1074. libopenh264 encoder.
  1075. @table @option
  1076. @item b
  1077. Set the bitrate (as a number of bits per second).
  1078. @item g
  1079. Set the GOP size.
  1080. @item maxrate
  1081. Set the max bitrate (as a number of bits per second).
  1082. @item flags +global_header
  1083. Set global header in the bitstream.
  1084. @item slices
  1085. Set the number of slices, used in parallelized encoding. Default value
  1086. is 0. This is only used when @option{slice_mode} is set to
  1087. @samp{fixed}.
  1088. @item slice_mode
  1089. Set slice mode. Can assume one of the follwing possible values:
  1090. @table @samp
  1091. @item fixed
  1092. a fixed number of slices
  1093. @item rowmb
  1094. one slice per row of macroblocks
  1095. @item auto
  1096. automatic number of slices according to number of threads
  1097. @item dyn
  1098. dynamic slicing
  1099. @end table
  1100. Default value is @samp{auto}.
  1101. @item loopfilter
  1102. Enable loop filter, if set to 1 (automatically enabled). To disable
  1103. set a value of 0.
  1104. @item profile
  1105. Set profile restrictions. If set to the value of @samp{main} enable
  1106. CABAC (set the @code{SEncParamExt.iEntropyCodingModeFlag} flag to 1).
  1107. @item max_nal_size
  1108. Set maximum NAL size in bytes.
  1109. @item allow_skip_frames
  1110. Allow skipping frames to hit the target bitrate if set to 1.
  1111. @end table
  1112. @section jpeg2000
  1113. The native jpeg 2000 encoder is lossy by default, the @code{-q:v}
  1114. option can be used to set the encoding quality. Lossless encoding
  1115. can be selected with @code{-pred 1}.
  1116. @subsection Options
  1117. @table @option
  1118. @item format
  1119. Can be set to either @code{j2k} or @code{jp2} (the default) that
  1120. makes it possible to store non-rgb pix_fmts.
  1121. @end table
  1122. @section snow
  1123. @subsection Options
  1124. @table @option
  1125. @item iterative_dia_size
  1126. dia size for the iterative motion estimation
  1127. @end table
  1128. @section libtheora
  1129. libtheora Theora encoder wrapper.
  1130. Requires the presence of the libtheora headers and library during
  1131. configuration. You need to explicitly configure the build with
  1132. @code{--enable-libtheora}.
  1133. For more information about the libtheora project see
  1134. @url{http://www.theora.org/}.
  1135. @subsection Options
  1136. The following global options are mapped to internal libtheora options
  1137. which affect the quality and the bitrate of the encoded stream.
  1138. @table @option
  1139. @item b
  1140. Set the video bitrate in bit/s for CBR (Constant Bit Rate) mode. In
  1141. case VBR (Variable Bit Rate) mode is enabled this option is ignored.
  1142. @item flags
  1143. Used to enable constant quality mode (VBR) encoding through the
  1144. @option{qscale} flag, and to enable the @code{pass1} and @code{pass2}
  1145. modes.
  1146. @item g
  1147. Set the GOP size.
  1148. @item global_quality
  1149. Set the global quality as an integer in lambda units.
  1150. Only relevant when VBR mode is enabled with @code{flags +qscale}. The
  1151. value is converted to QP units by dividing it by @code{FF_QP2LAMBDA},
  1152. clipped in the [0 - 10] range, and then multiplied by 6.3 to get a
  1153. value in the native libtheora range [0-63]. A higher value corresponds
  1154. to a higher quality.
  1155. @item q
  1156. Enable VBR mode when set to a non-negative value, and set constant
  1157. quality value as a double floating point value in QP units.
  1158. The value is clipped in the [0-10] range, and then multiplied by 6.3
  1159. to get a value in the native libtheora range [0-63].
  1160. This option is valid only using the @command{ffmpeg} command-line
  1161. tool. For library interface users, use @option{global_quality}.
  1162. @end table
  1163. @subsection Examples
  1164. @itemize
  1165. @item
  1166. Set maximum constant quality (VBR) encoding with @command{ffmpeg}:
  1167. @example
  1168. ffmpeg -i INPUT -codec:v libtheora -q:v 10 OUTPUT.ogg
  1169. @end example
  1170. @item
  1171. Use @command{ffmpeg} to convert a CBR 1000 kbps Theora video stream:
  1172. @example
  1173. ffmpeg -i INPUT -codec:v libtheora -b:v 1000k OUTPUT.ogg
  1174. @end example
  1175. @end itemize
  1176. @section libvpx
  1177. VP8/VP9 format supported through libvpx.
  1178. Requires the presence of the libvpx headers and library during configuration.
  1179. You need to explicitly configure the build with @code{--enable-libvpx}.
  1180. @subsection Options
  1181. The following options are supported by the libvpx wrapper. The
  1182. @command{vpxenc}-equivalent options or values are listed in parentheses
  1183. for easy migration.
  1184. To reduce the duplication of documentation, only the private options
  1185. and some others requiring special attention are documented here. For
  1186. the documentation of the undocumented generic options, see
  1187. @ref{codec-options,,the Codec Options chapter}.
  1188. To get more documentation of the libvpx options, invoke the command
  1189. @command{ffmpeg -h encoder=libvpx}, @command{ffmpeg -h encoder=libvpx-vp9} or
  1190. @command{vpxenc --help}. Further information is available in the libvpx API
  1191. documentation.
  1192. @table @option
  1193. @item b (@emph{target-bitrate})
  1194. Set bitrate in bits/s. Note that FFmpeg's @option{b} option is
  1195. expressed in bits/s, while @command{vpxenc}'s @option{target-bitrate} is in
  1196. kilobits/s.
  1197. @item g (@emph{kf-max-dist})
  1198. @item keyint_min (@emph{kf-min-dist})
  1199. @item qmin (@emph{min-q})
  1200. @item qmax (@emph{max-q})
  1201. @item bufsize (@emph{buf-sz}, @emph{buf-optimal-sz})
  1202. Set ratecontrol buffer size (in bits). Note @command{vpxenc}'s options are
  1203. specified in milliseconds, the libvpx wrapper converts this value as follows:
  1204. @code{buf-sz = bufsize * 1000 / bitrate},
  1205. @code{buf-optimal-sz = bufsize * 1000 / bitrate * 5 / 6}.
  1206. @item rc_init_occupancy (@emph{buf-initial-sz})
  1207. Set number of bits which should be loaded into the rc buffer before decoding
  1208. starts. Note @command{vpxenc}'s option is specified in milliseconds, the libvpx
  1209. wrapper converts this value as follows:
  1210. @code{rc_init_occupancy * 1000 / bitrate}.
  1211. @item undershoot-pct
  1212. Set datarate undershoot (min) percentage of the target bitrate.
  1213. @item overshoot-pct
  1214. Set datarate overshoot (max) percentage of the target bitrate.
  1215. @item skip_threshold (@emph{drop-frame})
  1216. @item qcomp (@emph{bias-pct})
  1217. @item maxrate (@emph{maxsection-pct})
  1218. Set GOP max bitrate in bits/s. Note @command{vpxenc}'s option is specified as a
  1219. percentage of the target bitrate, the libvpx wrapper converts this value as
  1220. follows: @code{(maxrate * 100 / bitrate)}.
  1221. @item minrate (@emph{minsection-pct})
  1222. Set GOP min bitrate in bits/s. Note @command{vpxenc}'s option is specified as a
  1223. percentage of the target bitrate, the libvpx wrapper converts this value as
  1224. follows: @code{(minrate * 100 / bitrate)}.
  1225. @item minrate, maxrate, b @emph{end-usage=cbr}
  1226. @code{(minrate == maxrate == bitrate)}.
  1227. @item crf (@emph{end-usage=cq}, @emph{cq-level})
  1228. @item quality, deadline (@emph{deadline})
  1229. @table @samp
  1230. @item best
  1231. Use best quality deadline. Poorly named and quite slow, this option should be
  1232. avoided as it may give worse quality output than good.
  1233. @item good
  1234. Use good quality deadline. This is a good trade-off between speed and quality
  1235. when used with the @option{cpu-used} option.
  1236. @item realtime
  1237. Use realtime quality deadline.
  1238. @end table
  1239. @item speed, cpu-used (@emph{cpu-used})
  1240. Set quality/speed ratio modifier. Higher values speed up the encode at the cost
  1241. of quality.
  1242. @item nr (@emph{noise-sensitivity})
  1243. @item static-thresh
  1244. Set a change threshold on blocks below which they will be skipped by the
  1245. encoder.
  1246. @item slices (@emph{token-parts})
  1247. Note that FFmpeg's @option{slices} option gives the total number of partitions,
  1248. while @command{vpxenc}'s @option{token-parts} is given as
  1249. @code{log2(partitions)}.
  1250. @item max-intra-rate
  1251. Set maximum I-frame bitrate as a percentage of the target bitrate. A value of 0
  1252. means unlimited.
  1253. @item force_key_frames
  1254. @code{VPX_EFLAG_FORCE_KF}
  1255. @item Alternate reference frame related
  1256. @table @option
  1257. @item auto-alt-ref
  1258. Enable use of alternate reference frames (2-pass only).
  1259. @item arnr-max-frames
  1260. Set altref noise reduction max frame count.
  1261. @item arnr-type
  1262. Set altref noise reduction filter type: backward, forward, centered.
  1263. @item arnr-strength
  1264. Set altref noise reduction filter strength.
  1265. @item rc-lookahead, lag-in-frames (@emph{lag-in-frames})
  1266. Set number of frames to look ahead for frametype and ratecontrol.
  1267. @end table
  1268. @item error-resilient
  1269. Enable error resiliency features.
  1270. @item VP9-specific options
  1271. @table @option
  1272. @item lossless
  1273. Enable lossless mode.
  1274. @item tile-columns
  1275. Set number of tile columns to use. Note this is given as
  1276. @code{log2(tile_columns)}. For example, 8 tile columns would be requested by
  1277. setting the @option{tile-columns} option to 3.
  1278. @item tile-rows
  1279. Set number of tile rows to use. Note this is given as @code{log2(tile_rows)}.
  1280. For example, 4 tile rows would be requested by setting the @option{tile-rows}
  1281. option to 2.
  1282. @item frame-parallel
  1283. Enable frame parallel decodability features.
  1284. @item aq-mode
  1285. Set adaptive quantization mode (0: off (default), 1: variance 2: complexity, 3:
  1286. cyclic refresh).
  1287. @item colorspace @emph{color-space}
  1288. Set input color space. The VP9 bitstream supports signaling the following
  1289. colorspaces:
  1290. @table @option
  1291. @item @samp{rgb} @emph{sRGB}
  1292. @item @samp{bt709} @emph{bt709}
  1293. @item @samp{unspecified} @emph{unknown}
  1294. @item @samp{bt470bg} @emph{bt601}
  1295. @item @samp{smpte170m} @emph{smpte170}
  1296. @item @samp{smpte240m} @emph{smpte240}
  1297. @item @samp{bt2020_ncl} @emph{bt2020}
  1298. @end table
  1299. @end table
  1300. @end table
  1301. For more information about libvpx see:
  1302. @url{http://www.webmproject.org/}
  1303. @section libwebp
  1304. libwebp WebP Image encoder wrapper
  1305. libwebp is Google's official encoder for WebP images. It can encode in either
  1306. lossy or lossless mode. Lossy images are essentially a wrapper around a VP8
  1307. frame. Lossless images are a separate codec developed by Google.
  1308. @subsection Pixel Format
  1309. Currently, libwebp only supports YUV420 for lossy and RGB for lossless due
  1310. to limitations of the format and libwebp. Alpha is supported for either mode.
  1311. Because of API limitations, if RGB is passed in when encoding lossy or YUV is
  1312. passed in for encoding lossless, the pixel format will automatically be
  1313. converted using functions from libwebp. This is not ideal and is done only for
  1314. convenience.
  1315. @subsection Options
  1316. @table @option
  1317. @item -lossless @var{boolean}
  1318. Enables/Disables use of lossless mode. Default is 0.
  1319. @item -compression_level @var{integer}
  1320. For lossy, this is a quality/speed tradeoff. Higher values give better quality
  1321. for a given size at the cost of increased encoding time. For lossless, this is
  1322. a size/speed tradeoff. Higher values give smaller size at the cost of increased
  1323. encoding time. More specifically, it controls the number of extra algorithms
  1324. and compression tools used, and varies the combination of these tools. This
  1325. maps to the @var{method} option in libwebp. The valid range is 0 to 6.
  1326. Default is 4.
  1327. @item -qscale @var{float}
  1328. For lossy encoding, this controls image quality, 0 to 100. For lossless
  1329. encoding, this controls the effort and time spent at compressing more. The
  1330. default value is 75. Note that for usage via libavcodec, this option is called
  1331. @var{global_quality} and must be multiplied by @var{FF_QP2LAMBDA}.
  1332. @item -preset @var{type}
  1333. Configuration preset. This does some automatic settings based on the general
  1334. type of the image.
  1335. @table @option
  1336. @item none
  1337. Do not use a preset.
  1338. @item default
  1339. Use the encoder default.
  1340. @item picture
  1341. Digital picture, like portrait, inner shot
  1342. @item photo
  1343. Outdoor photograph, with natural lighting
  1344. @item drawing
  1345. Hand or line drawing, with high-contrast details
  1346. @item icon
  1347. Small-sized colorful images
  1348. @item text
  1349. Text-like
  1350. @end table
  1351. @end table
  1352. @section libx264, libx264rgb
  1353. x264 H.264/MPEG-4 AVC encoder wrapper.
  1354. This encoder requires the presence of the libx264 headers and library
  1355. during configuration. You need to explicitly configure the build with
  1356. @code{--enable-libx264}.
  1357. libx264 supports an impressive number of features, including 8x8 and
  1358. 4x4 adaptive spatial transform, adaptive B-frame placement, CAVLC/CABAC
  1359. entropy coding, interlacing (MBAFF), lossless mode, psy optimizations
  1360. for detail retention (adaptive quantization, psy-RD, psy-trellis).
  1361. Many libx264 encoder options are mapped to FFmpeg global codec
  1362. options, while unique encoder options are provided through private
  1363. options. Additionally the @option{x264opts} and @option{x264-params}
  1364. private options allows one to pass a list of key=value tuples as accepted
  1365. by the libx264 @code{x264_param_parse} function.
  1366. The x264 project website is at
  1367. @url{http://www.videolan.org/developers/x264.html}.
  1368. The libx264rgb encoder is the same as libx264, except it accepts packed RGB
  1369. pixel formats as input instead of YUV.
  1370. @subsection Supported Pixel Formats
  1371. x264 supports 8- to 10-bit color spaces. The exact bit depth is controlled at
  1372. x264's configure time. FFmpeg only supports one bit depth in one particular
  1373. build. In other words, it is not possible to build one FFmpeg with multiple
  1374. versions of x264 with different bit depths.
  1375. @subsection Options
  1376. The following options are supported by the libx264 wrapper. The
  1377. @command{x264}-equivalent options or values are listed in parentheses
  1378. for easy migration.
  1379. To reduce the duplication of documentation, only the private options
  1380. and some others requiring special attention are documented here. For
  1381. the documentation of the undocumented generic options, see
  1382. @ref{codec-options,,the Codec Options chapter}.
  1383. To get a more accurate and extensive documentation of the libx264
  1384. options, invoke the command @command{x264 --full-help} or consult
  1385. the libx264 documentation.
  1386. @table @option
  1387. @item b (@emph{bitrate})
  1388. Set bitrate in bits/s. Note that FFmpeg's @option{b} option is
  1389. expressed in bits/s, while @command{x264}'s @option{bitrate} is in
  1390. kilobits/s.
  1391. @item bf (@emph{bframes})
  1392. @item g (@emph{keyint})
  1393. @item qmin (@emph{qpmin})
  1394. Minimum quantizer scale.
  1395. @item qmax (@emph{qpmax})
  1396. Maximum quantizer scale.
  1397. @item qdiff (@emph{qpstep})
  1398. Maximum difference between quantizer scales.
  1399. @item qblur (@emph{qblur})
  1400. Quantizer curve blur
  1401. @item qcomp (@emph{qcomp})
  1402. Quantizer curve compression factor
  1403. @item refs (@emph{ref})
  1404. Number of reference frames each P-frame can use. The range is from @var{0-16}.
  1405. @item sc_threshold (@emph{scenecut})
  1406. Sets the threshold for the scene change detection.
  1407. @item trellis (@emph{trellis})
  1408. Performs Trellis quantization to increase efficiency. Enabled by default.
  1409. @item nr (@emph{nr})
  1410. @item me_range (@emph{merange})
  1411. Maximum range of the motion search in pixels.
  1412. @item me_method (@emph{me})
  1413. Set motion estimation method. Possible values in the decreasing order
  1414. of speed:
  1415. @table @samp
  1416. @item dia (@emph{dia})
  1417. @item epzs (@emph{dia})
  1418. Diamond search with radius 1 (fastest). @samp{epzs} is an alias for
  1419. @samp{dia}.
  1420. @item hex (@emph{hex})
  1421. Hexagonal search with radius 2.
  1422. @item umh (@emph{umh})
  1423. Uneven multi-hexagon search.
  1424. @item esa (@emph{esa})
  1425. Exhaustive search.
  1426. @item tesa (@emph{tesa})
  1427. Hadamard exhaustive search (slowest).
  1428. @end table
  1429. @item subq (@emph{subme})
  1430. Sub-pixel motion estimation method.
  1431. @item b_strategy (@emph{b-adapt})
  1432. Adaptive B-frame placement decision algorithm. Use only on first-pass.
  1433. @item keyint_min (@emph{min-keyint})
  1434. Minimum GOP size.
  1435. @item coder
  1436. Set entropy encoder. Possible values:
  1437. @table @samp
  1438. @item ac
  1439. Enable CABAC.
  1440. @item vlc
  1441. Enable CAVLC and disable CABAC. It generates the same effect as
  1442. @command{x264}'s @option{--no-cabac} option.
  1443. @end table
  1444. @item cmp
  1445. Set full pixel motion estimation comparation algorithm. Possible values:
  1446. @table @samp
  1447. @item chroma
  1448. Enable chroma in motion estimation.
  1449. @item sad
  1450. Ignore chroma in motion estimation. It generates the same effect as
  1451. @command{x264}'s @option{--no-chroma-me} option.
  1452. @end table
  1453. @item threads (@emph{threads})
  1454. Number of encoding threads.
  1455. @item thread_type
  1456. Set multithreading technique. Possible values:
  1457. @table @samp
  1458. @item slice
  1459. Slice-based multithreading. It generates the same effect as
  1460. @command{x264}'s @option{--sliced-threads} option.
  1461. @item frame
  1462. Frame-based multithreading.
  1463. @end table
  1464. @item flags
  1465. Set encoding flags. It can be used to disable closed GOP and enable
  1466. open GOP by setting it to @code{-cgop}. The result is similar to
  1467. the behavior of @command{x264}'s @option{--open-gop} option.
  1468. @item rc_init_occupancy (@emph{vbv-init})
  1469. @item preset (@emph{preset})
  1470. Set the encoding preset.
  1471. @item tune (@emph{tune})
  1472. Set tuning of the encoding params.
  1473. @item profile (@emph{profile})
  1474. Set profile restrictions.
  1475. @item fastfirstpass
  1476. Enable fast settings when encoding first pass, when set to 1. When set
  1477. to 0, it has the same effect of @command{x264}'s
  1478. @option{--slow-firstpass} option.
  1479. @item crf (@emph{crf})
  1480. Set the quality for constant quality mode.
  1481. @item crf_max (@emph{crf-max})
  1482. In CRF mode, prevents VBV from lowering quality beyond this point.
  1483. @item qp (@emph{qp})
  1484. Set constant quantization rate control method parameter.
  1485. @item aq-mode (@emph{aq-mode})
  1486. Set AQ method. Possible values:
  1487. @table @samp
  1488. @item none (@emph{0})
  1489. Disabled.
  1490. @item variance (@emph{1})
  1491. Variance AQ (complexity mask).
  1492. @item autovariance (@emph{2})
  1493. Auto-variance AQ (experimental).
  1494. @end table
  1495. @item aq-strength (@emph{aq-strength})
  1496. Set AQ strength, reduce blocking and blurring in flat and textured areas.
  1497. @item psy
  1498. Use psychovisual optimizations when set to 1. When set to 0, it has the
  1499. same effect as @command{x264}'s @option{--no-psy} option.
  1500. @item psy-rd (@emph{psy-rd})
  1501. Set strength of psychovisual optimization, in
  1502. @var{psy-rd}:@var{psy-trellis} format.
  1503. @item rc-lookahead (@emph{rc-lookahead})
  1504. Set number of frames to look ahead for frametype and ratecontrol.
  1505. @item weightb
  1506. Enable weighted prediction for B-frames when set to 1. When set to 0,
  1507. it has the same effect as @command{x264}'s @option{--no-weightb} option.
  1508. @item weightp (@emph{weightp})
  1509. Set weighted prediction method for P-frames. Possible values:
  1510. @table @samp
  1511. @item none (@emph{0})
  1512. Disabled
  1513. @item simple (@emph{1})
  1514. Enable only weighted refs
  1515. @item smart (@emph{2})
  1516. Enable both weighted refs and duplicates
  1517. @end table
  1518. @item ssim (@emph{ssim})
  1519. Enable calculation and printing SSIM stats after the encoding.
  1520. @item intra-refresh (@emph{intra-refresh})
  1521. Enable the use of Periodic Intra Refresh instead of IDR frames when set
  1522. to 1.
  1523. @item avcintra-class (@emph{class})
  1524. Configure the encoder to generate AVC-Intra.
  1525. Valid values are 50,100 and 200
  1526. @item bluray-compat (@emph{bluray-compat})
  1527. Configure the encoder to be compatible with the bluray standard.
  1528. It is a shorthand for setting "bluray-compat=1 force-cfr=1".
  1529. @item b-bias (@emph{b-bias})
  1530. Set the influence on how often B-frames are used.
  1531. @item b-pyramid (@emph{b-pyramid})
  1532. Set method for keeping of some B-frames as references. Possible values:
  1533. @table @samp
  1534. @item none (@emph{none})
  1535. Disabled.
  1536. @item strict (@emph{strict})
  1537. Strictly hierarchical pyramid.
  1538. @item normal (@emph{normal})
  1539. Non-strict (not Blu-ray compatible).
  1540. @end table
  1541. @item mixed-refs
  1542. Enable the use of one reference per partition, as opposed to one
  1543. reference per macroblock when set to 1. When set to 0, it has the
  1544. same effect as @command{x264}'s @option{--no-mixed-refs} option.
  1545. @item 8x8dct
  1546. Enable adaptive spatial transform (high profile 8x8 transform)
  1547. when set to 1. When set to 0, it has the same effect as
  1548. @command{x264}'s @option{--no-8x8dct} option.
  1549. @item fast-pskip
  1550. Enable early SKIP detection on P-frames when set to 1. When set
  1551. to 0, it has the same effect as @command{x264}'s
  1552. @option{--no-fast-pskip} option.
  1553. @item aud (@emph{aud})
  1554. Enable use of access unit delimiters when set to 1.
  1555. @item mbtree
  1556. Enable use macroblock tree ratecontrol when set to 1. When set
  1557. to 0, it has the same effect as @command{x264}'s
  1558. @option{--no-mbtree} option.
  1559. @item deblock (@emph{deblock})
  1560. Set loop filter parameters, in @var{alpha}:@var{beta} form.
  1561. @item cplxblur (@emph{cplxblur})
  1562. Set fluctuations reduction in QP (before curve compression).
  1563. @item partitions (@emph{partitions})
  1564. Set partitions to consider as a comma-separated list of. Possible
  1565. values in the list:
  1566. @table @samp
  1567. @item p8x8
  1568. 8x8 P-frame partition.
  1569. @item p4x4
  1570. 4x4 P-frame partition.
  1571. @item b8x8
  1572. 4x4 B-frame partition.
  1573. @item i8x8
  1574. 8x8 I-frame partition.
  1575. @item i4x4
  1576. 4x4 I-frame partition.
  1577. (Enabling @samp{p4x4} requires @samp{p8x8} to be enabled. Enabling
  1578. @samp{i8x8} requires adaptive spatial transform (@option{8x8dct}
  1579. option) to be enabled.)
  1580. @item none (@emph{none})
  1581. Do not consider any partitions.
  1582. @item all (@emph{all})
  1583. Consider every partition.
  1584. @end table
  1585. @item direct-pred (@emph{direct})
  1586. Set direct MV prediction mode. Possible values:
  1587. @table @samp
  1588. @item none (@emph{none})
  1589. Disable MV prediction.
  1590. @item spatial (@emph{spatial})
  1591. Enable spatial predicting.
  1592. @item temporal (@emph{temporal})
  1593. Enable temporal predicting.
  1594. @item auto (@emph{auto})
  1595. Automatically decided.
  1596. @end table
  1597. @item slice-max-size (@emph{slice-max-size})
  1598. Set the limit of the size of each slice in bytes. If not specified
  1599. but RTP payload size (@option{ps}) is specified, that is used.
  1600. @item stats (@emph{stats})
  1601. Set the file name for multi-pass stats.
  1602. @item nal-hrd (@emph{nal-hrd})
  1603. Set signal HRD information (requires @option{vbv-bufsize} to be set).
  1604. Possible values:
  1605. @table @samp
  1606. @item none (@emph{none})
  1607. Disable HRD information signaling.
  1608. @item vbr (@emph{vbr})
  1609. Variable bit rate.
  1610. @item cbr (@emph{cbr})
  1611. Constant bit rate (not allowed in MP4 container).
  1612. @end table
  1613. @item x264opts (N.A.)
  1614. Set any x264 option, see @command{x264 --fullhelp} for a list.
  1615. Argument is a list of @var{key}=@var{value} couples separated by
  1616. ":". In @var{filter} and @var{psy-rd} options that use ":" as a separator
  1617. themselves, use "," instead. They accept it as well since long ago but this
  1618. is kept undocumented for some reason.
  1619. For example to specify libx264 encoding options with @command{ffmpeg}:
  1620. @example
  1621. ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv
  1622. @end example
  1623. @item a53cc @var{boolean}
  1624. Import closed captions (which must be ATSC compatible format) into output.
  1625. Only the mpeg2 and h264 decoders provide these. Default is 0 (off).
  1626. @item x264-params (N.A.)
  1627. Override the x264 configuration using a :-separated list of key=value
  1628. parameters.
  1629. This option is functionally the same as the @option{x264opts}, but is
  1630. duplicated for compatibility with the Libav fork.
  1631. For example to specify libx264 encoding options with @command{ffmpeg}:
  1632. @example
  1633. ffmpeg -i INPUT -c:v libx264 -x264-params level=30:bframes=0:weightp=0:\
  1634. cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:\
  1635. no-fast-pskip=1:subq=6:8x8dct=0:trellis=0 OUTPUT
  1636. @end example
  1637. @end table
  1638. Encoding ffpresets for common usages are provided so they can be used with the
  1639. general presets system (e.g. passing the @option{pre} option).
  1640. @section libx265
  1641. x265 H.265/HEVC encoder wrapper.
  1642. This encoder requires the presence of the libx265 headers and library
  1643. during configuration. You need to explicitly configure the build with
  1644. @option{--enable-libx265}.
  1645. @subsection Options
  1646. @table @option
  1647. @item preset
  1648. Set the x265 preset.
  1649. @item tune
  1650. Set the x265 tune parameter.
  1651. @item x265-params
  1652. Set x265 options using a list of @var{key}=@var{value} couples separated
  1653. by ":". See @command{x265 --help} for a list of options.
  1654. For example to specify libx265 encoding options with @option{-x265-params}:
  1655. @example
  1656. ffmpeg -i input -c:v libx265 -x265-params crf=26:psy-rd=1 output.mp4
  1657. @end example
  1658. @end table
  1659. @section libxvid
  1660. Xvid MPEG-4 Part 2 encoder wrapper.
  1661. This encoder requires the presence of the libxvidcore headers and library
  1662. during configuration. You need to explicitly configure the build with
  1663. @code{--enable-libxvid --enable-gpl}.
  1664. The native @code{mpeg4} encoder supports the MPEG-4 Part 2 format, so
  1665. users can encode to this format without this library.
  1666. @subsection Options
  1667. The following options are supported by the libxvid wrapper. Some of
  1668. the following options are listed but are not documented, and
  1669. correspond to shared codec options. See @ref{codec-options,,the Codec
  1670. Options chapter} for their documentation. The other shared options
  1671. which are not listed have no effect for the libxvid encoder.
  1672. @table @option
  1673. @item b
  1674. @item g
  1675. @item qmin
  1676. @item qmax
  1677. @item mpeg_quant
  1678. @item threads
  1679. @item bf
  1680. @item b_qfactor
  1681. @item b_qoffset
  1682. @item flags
  1683. Set specific encoding flags. Possible values:
  1684. @table @samp
  1685. @item mv4
  1686. Use four motion vector by macroblock.
  1687. @item aic
  1688. Enable high quality AC prediction.
  1689. @item gray
  1690. Only encode grayscale.
  1691. @item gmc
  1692. Enable the use of global motion compensation (GMC).
  1693. @item qpel
  1694. Enable quarter-pixel motion compensation.
  1695. @item cgop
  1696. Enable closed GOP.
  1697. @item global_header
  1698. Place global headers in extradata instead of every keyframe.
  1699. @end table
  1700. @item trellis
  1701. @item me_method
  1702. Set motion estimation method. Possible values in decreasing order of
  1703. speed and increasing order of quality:
  1704. @table @samp
  1705. @item zero
  1706. Use no motion estimation (default).
  1707. @item phods
  1708. @item x1
  1709. @item log
  1710. Enable advanced diamond zonal search for 16x16 blocks and half-pixel
  1711. refinement for 16x16 blocks. @samp{x1} and @samp{log} are aliases for
  1712. @samp{phods}.
  1713. @item epzs
  1714. Enable all of the things described above, plus advanced diamond zonal
  1715. search for 8x8 blocks, half-pixel refinement for 8x8 blocks, and motion
  1716. estimation on chroma planes.
  1717. @item full
  1718. Enable all of the things described above, plus extended 16x16 and 8x8
  1719. blocks search.
  1720. @end table
  1721. @item mbd
  1722. Set macroblock decision algorithm. Possible values in the increasing
  1723. order of quality:
  1724. @table @samp
  1725. @item simple
  1726. Use macroblock comparing function algorithm (default).
  1727. @item bits
  1728. Enable rate distortion-based half pixel and quarter pixel refinement for
  1729. 16x16 blocks.
  1730. @item rd
  1731. Enable all of the things described above, plus rate distortion-based
  1732. half pixel and quarter pixel refinement for 8x8 blocks, and rate
  1733. distortion-based search using square pattern.
  1734. @end table
  1735. @item lumi_aq
  1736. Enable lumi masking adaptive quantization when set to 1. Default is 0
  1737. (disabled).
  1738. @item variance_aq
  1739. Enable variance adaptive quantization when set to 1. Default is 0
  1740. (disabled).
  1741. When combined with @option{lumi_aq}, the resulting quality will not
  1742. be better than any of the two specified individually. In other
  1743. words, the resulting quality will be the worse one of the two
  1744. effects.
  1745. @item ssim
  1746. Set structural similarity (SSIM) displaying method. Possible values:
  1747. @table @samp
  1748. @item off
  1749. Disable displaying of SSIM information.
  1750. @item avg
  1751. Output average SSIM at the end of encoding to stdout. The format of
  1752. showing the average SSIM is:
  1753. @example
  1754. Average SSIM: %f
  1755. @end example
  1756. For users who are not familiar with C, %f means a float number, or
  1757. a decimal (e.g. 0.939232).
  1758. @item frame
  1759. Output both per-frame SSIM data during encoding and average SSIM at
  1760. the end of encoding to stdout. The format of per-frame information
  1761. is:
  1762. @example
  1763. SSIM: avg: %1.3f min: %1.3f max: %1.3f
  1764. @end example
  1765. For users who are not familiar with C, %1.3f means a float number
  1766. rounded to 3 digits after the dot (e.g. 0.932).
  1767. @end table
  1768. @item ssim_acc
  1769. Set SSIM accuracy. Valid options are integers within the range of
  1770. 0-4, while 0 gives the most accurate result and 4 computes the
  1771. fastest.
  1772. @end table
  1773. @section mpeg2
  1774. MPEG-2 video encoder.
  1775. @subsection Options
  1776. @table @option
  1777. @item seq_disp_ext @var{integer}
  1778. Specifies if the encoder should write a sequence_display_extension to the
  1779. output.
  1780. @table @option
  1781. @item -1
  1782. @itemx auto
  1783. Decide automatically to write it or not (this is the default) by checking if
  1784. the data to be written is different from the default or unspecified values.
  1785. @item 0
  1786. @itemx never
  1787. Never write it.
  1788. @item 1
  1789. @itemx always
  1790. Always write it.
  1791. @end table
  1792. @end table
  1793. @section png
  1794. PNG image encoder.
  1795. @subsection Private options
  1796. @table @option
  1797. @item dpi @var{integer}
  1798. Set physical density of pixels, in dots per inch, unset by default
  1799. @item dpm @var{integer}
  1800. Set physical density of pixels, in dots per meter, unset by default
  1801. @end table
  1802. @section ProRes
  1803. Apple ProRes encoder.
  1804. FFmpeg contains 2 ProRes encoders, the prores-aw and prores-ks encoder.
  1805. The used encoder can be chosen with the @code{-vcodec} option.
  1806. @subsection Private Options for prores-ks
  1807. @table @option
  1808. @item profile @var{integer}
  1809. Select the ProRes profile to encode
  1810. @table @samp
  1811. @item proxy
  1812. @item lt
  1813. @item standard
  1814. @item hq
  1815. @item 4444
  1816. @end table
  1817. @item quant_mat @var{integer}
  1818. Select quantization matrix.
  1819. @table @samp
  1820. @item auto
  1821. @item default
  1822. @item proxy
  1823. @item lt
  1824. @item standard
  1825. @item hq
  1826. @end table
  1827. If set to @var{auto}, the matrix matching the profile will be picked.
  1828. If not set, the matrix providing the highest quality, @var{default}, will be
  1829. picked.
  1830. @item bits_per_mb @var{integer}
  1831. How many bits to allot for coding one macroblock. Different profiles use
  1832. between 200 and 2400 bits per macroblock, the maximum is 8000.
  1833. @item mbs_per_slice @var{integer}
  1834. Number of macroblocks in each slice (1-8); the default value (8)
  1835. should be good in almost all situations.
  1836. @item vendor @var{string}
  1837. Override the 4-byte vendor ID.
  1838. A custom vendor ID like @var{apl0} would claim the stream was produced by
  1839. the Apple encoder.
  1840. @item alpha_bits @var{integer}
  1841. Specify number of bits for alpha component.
  1842. Possible values are @var{0}, @var{8} and @var{16}.
  1843. Use @var{0} to disable alpha plane coding.
  1844. @end table
  1845. @subsection Speed considerations
  1846. In the default mode of operation the encoder has to honor frame constraints
  1847. (i.e. not produce frames with size bigger than requested) while still making
  1848. output picture as good as possible.
  1849. A frame containing a lot of small details is harder to compress and the encoder
  1850. would spend more time searching for appropriate quantizers for each slice.
  1851. Setting a higher @option{bits_per_mb} limit will improve the speed.
  1852. For the fastest encoding speed set the @option{qscale} parameter (4 is the
  1853. recommended value) and do not set a size constraint.
  1854. @section libkvazaar
  1855. Kvazaar H.265/HEVC encoder.
  1856. Requires the presence of the libkvazaar headers and library during
  1857. configuration. You need to explicitly configure the build with
  1858. @option{--enable-libkvazaar}.
  1859. @subsection Options
  1860. @table @option
  1861. @item b
  1862. Set target video bitrate in bit/s and enable rate control.
  1863. @item kvazaar-params
  1864. Set kvazaar parameters as a list of @var{name}=@var{value} pairs separated
  1865. by commas (,). See kvazaar documentation for a list of options.
  1866. @end table
  1867. @section QSV encoders
  1868. The family of Intel QuickSync Video encoders (MPEG-2, H.264 and HEVC)
  1869. The ratecontrol method is selected as follows:
  1870. @itemize @bullet
  1871. @item
  1872. When @option{global_quality} is specified, a quality-based mode is used.
  1873. Specifically this means either
  1874. @itemize @minus
  1875. @item
  1876. @var{CQP} - constant quantizer scale, when the @option{qscale} codec flag is
  1877. also set (the @option{-qscale} ffmpeg option).
  1878. @item
  1879. @var{LA_ICQ} - intelligent constant quality with lookahead, when the
  1880. @option{look_ahead} option is also set.
  1881. @item
  1882. @var{ICQ} -- intelligent constant quality otherwise.
  1883. @end itemize
  1884. @item
  1885. Otherwise, a bitrate-based mode is used. For all of those, you should specify at
  1886. least the desired average bitrate with the @option{b} option.
  1887. @itemize @minus
  1888. @item
  1889. @var{LA} - VBR with lookahead, when the @option{look_ahead} option is specified.
  1890. @item
  1891. @var{VCM} - video conferencing mode, when the @option{vcm} option is set.
  1892. @item
  1893. @var{CBR} - constant bitrate, when @option{maxrate} is specified and equal to
  1894. the average bitrate.
  1895. @item
  1896. @var{VBR} - variable bitrate, when @option{maxrate} is specified, but is higher
  1897. than the average bitrate.
  1898. @item
  1899. @var{AVBR} - average VBR mode, when @option{maxrate} is not specified. This mode
  1900. is further configured by the @option{avbr_accuracy} and
  1901. @option{avbr_convergence} options.
  1902. @end itemize
  1903. @end itemize
  1904. Note that depending on your system, a different mode than the one you specified
  1905. may be selected by the encoder. Set the verbosity level to @var{verbose} or
  1906. higher to see the actual settings used by the QSV runtime.
  1907. Additional libavcodec global options are mapped to MSDK options as follows:
  1908. @itemize
  1909. @item
  1910. @option{g/gop_size} -> @option{GopPicSize}
  1911. @item
  1912. @option{bf/max_b_frames}+1 -> @option{GopRefDist}
  1913. @item
  1914. @option{rc_init_occupancy/rc_initial_buffer_occupancy} ->
  1915. @option{InitialDelayInKB}
  1916. @item
  1917. @option{slices} -> @option{NumSlice}
  1918. @item
  1919. @option{refs} -> @option{NumRefFrame}
  1920. @item
  1921. @option{b_strategy/b_frame_strategy} -> @option{BRefType}
  1922. @item
  1923. @option{cgop/CLOSED_GOP} codec flag -> @option{GopOptFlag}
  1924. @item
  1925. For the @var{CQP} mode, the @option{i_qfactor/i_qoffset} and
  1926. @option{b_qfactor/b_qoffset} set the difference between @var{QPP} and @var{QPI},
  1927. and @var{QPP} and @var{QPB} respectively.
  1928. @item
  1929. Setting the @option{coder} option to the value @var{vlc} will make the H.264
  1930. encoder use CAVLC instead of CABAC.
  1931. @end itemize
  1932. @c man end VIDEO ENCODERS
  1933. @chapter Subtitles Encoders
  1934. @c man begin SUBTITLES ENCODERS
  1935. @section dvdsub
  1936. This codec encodes the bitmap subtitle format that is used in DVDs.
  1937. Typically they are stored in VOBSUB file pairs (*.idx + *.sub),
  1938. and they can also be used in Matroska files.
  1939. @subsection Options
  1940. @table @option
  1941. @item even_rows_fix
  1942. When set to 1, enable a work-around that makes the number of pixel rows
  1943. even in all subtitles. This fixes a problem with some players that
  1944. cut off the bottom row if the number is odd. The work-around just adds
  1945. a fully transparent row if needed. The overhead is low, typically
  1946. one byte per subtitle on average.
  1947. By default, this work-around is disabled.
  1948. @end table
  1949. @c man end SUBTITLES ENCODERS