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.

2617 lines
73KB

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