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.

1475 lines
39KB

  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{-codecs} 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. @section ac3 and ac3_fixed
  21. AC-3 audio encoders.
  22. These encoders implement part of ATSC A/52:2010 and ETSI TS 102 366, as well as
  23. the undocumented RealAudio 3 (a.k.a. dnet).
  24. The @var{ac3} encoder uses floating-point math, while the @var{ac3_fixed}
  25. encoder only uses fixed-point integer math. This does not mean that one is
  26. always faster, just that one or the other may be better suited to a
  27. particular system. The floating-point encoder will generally produce better
  28. quality audio for a given bitrate. The @var{ac3_fixed} encoder is not the
  29. default codec for any of the output formats, so it must be specified explicitly
  30. using the option @code{-acodec ac3_fixed} in order to use it.
  31. @subsection AC-3 Metadata
  32. The AC-3 metadata options are used to set parameters that describe the audio,
  33. but in most cases do not affect the audio encoding itself. Some of the options
  34. do directly affect or influence the decoding and playback of the resulting
  35. bitstream, while others are just for informational purposes. A few of the
  36. options will add bits to the output stream that could otherwise be used for
  37. audio data, and will thus affect the quality of the output. Those will be
  38. indicated accordingly with a note in the option list below.
  39. These parameters are described in detail in several publicly-available
  40. documents.
  41. @itemize
  42. @item @uref{http://www.atsc.org/cms/standards/a_52-2010.pdf,A/52:2010 - Digital Audio Compression (AC-3) (E-AC-3) Standard}
  43. @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}
  44. @item @uref{http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/18_Metadata.Guide.pdf,Dolby Metadata Guide}
  45. @item @uref{http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/46_DDEncodingGuidelines.pdf,Dolby Digital Professional Encoding Guidelines}
  46. @end itemize
  47. @subsubsection Metadata Control Options
  48. @table @option
  49. @item -per_frame_metadata @var{boolean}
  50. Allow Per-Frame Metadata. Specifies if the encoder should check for changing
  51. metadata for each frame.
  52. @table @option
  53. @item 0
  54. The metadata values set at initialization will be used for every frame in the
  55. stream. (default)
  56. @item 1
  57. Metadata values can be changed before encoding each frame.
  58. @end table
  59. @end table
  60. @subsubsection Downmix Levels
  61. @table @option
  62. @item -center_mixlev @var{level}
  63. Center Mix Level. The amount of gain the decoder should apply to the center
  64. channel when downmixing to stereo. This field will only be written to the
  65. bitstream if a center channel is present. The value is specified as a scale
  66. factor. There are 3 valid values:
  67. @table @option
  68. @item 0.707
  69. Apply -3dB gain
  70. @item 0.595
  71. Apply -4.5dB gain (default)
  72. @item 0.500
  73. Apply -6dB gain
  74. @end table
  75. @item -surround_mixlev @var{level}
  76. Surround Mix Level. The amount of gain the decoder should apply to the surround
  77. channel(s) when downmixing to stereo. This field will only be written to the
  78. bitstream if one or more surround channels are present. The value is specified
  79. as a scale factor. There are 3 valid values:
  80. @table @option
  81. @item 0.707
  82. Apply -3dB gain
  83. @item 0.500
  84. Apply -6dB gain (default)
  85. @item 0.000
  86. Silence Surround Channel(s)
  87. @end table
  88. @end table
  89. @subsubsection Audio Production Information
  90. Audio Production Information is optional information describing the mixing
  91. environment. Either none or both of the fields are written to the bitstream.
  92. @table @option
  93. @item -mixing_level @var{number}
  94. Mixing Level. Specifies peak sound pressure level (SPL) in the production
  95. environment when the mix was mastered. Valid values are 80 to 111, or -1 for
  96. unknown or not indicated. The default value is -1, but that value cannot be
  97. used if the Audio Production Information is written to the bitstream. Therefore,
  98. if the @code{room_type} option is not the default value, the @code{mixing_level}
  99. option must not be -1.
  100. @item -room_type @var{type}
  101. Room Type. Describes the equalization used during the final mixing session at
  102. the studio or on the dubbing stage. A large room is a dubbing stage with the
  103. industry standard X-curve equalization; a small room has flat equalization.
  104. This field will not be written to the bitstream if both the @code{mixing_level}
  105. option and the @code{room_type} option have the default values.
  106. @table @option
  107. @item 0
  108. @itemx notindicated
  109. Not Indicated (default)
  110. @item 1
  111. @itemx large
  112. Large Room
  113. @item 2
  114. @itemx small
  115. Small Room
  116. @end table
  117. @end table
  118. @subsubsection Other Metadata Options
  119. @table @option
  120. @item -copyright @var{boolean}
  121. Copyright Indicator. Specifies whether a copyright exists for this audio.
  122. @table @option
  123. @item 0
  124. @itemx off
  125. No Copyright Exists (default)
  126. @item 1
  127. @itemx on
  128. Copyright Exists
  129. @end table
  130. @item -dialnorm @var{value}
  131. Dialogue Normalization. Indicates how far the average dialogue level of the
  132. program is below digital 100% full scale (0 dBFS). This parameter determines a
  133. level shift during audio reproduction that sets the average volume of the
  134. dialogue to a preset level. The goal is to match volume level between program
  135. sources. A value of -31dB will result in no volume level change, relative to
  136. the source volume, during audio reproduction. Valid values are whole numbers in
  137. the range -31 to -1, with -31 being the default.
  138. @item -dsur_mode @var{mode}
  139. Dolby Surround Mode. Specifies whether the stereo signal uses Dolby Surround
  140. (Pro Logic). This field will only be written to the bitstream if the audio
  141. stream is stereo. Using this option does @b{NOT} mean the encoder will actually
  142. apply Dolby Surround processing.
  143. @table @option
  144. @item 0
  145. @itemx notindicated
  146. Not Indicated (default)
  147. @item 1
  148. @itemx off
  149. Not Dolby Surround Encoded
  150. @item 2
  151. @itemx on
  152. Dolby Surround Encoded
  153. @end table
  154. @item -original @var{boolean}
  155. Original Bit Stream Indicator. Specifies whether this audio is from the
  156. original source and not a copy.
  157. @table @option
  158. @item 0
  159. @itemx off
  160. Not Original Source
  161. @item 1
  162. @itemx on
  163. Original Source (default)
  164. @end table
  165. @end table
  166. @subsection Extended Bitstream Information
  167. The extended bitstream options are part of the Alternate Bit Stream Syntax as
  168. specified in Annex D of the A/52:2010 standard. It is grouped into 2 parts.
  169. If any one parameter in a group is specified, all values in that group will be
  170. written to the bitstream. Default values are used for those that are written
  171. but have not been specified. If the mixing levels are written, the decoder
  172. will use these values instead of the ones specified in the @code{center_mixlev}
  173. and @code{surround_mixlev} options if it supports the Alternate Bit Stream
  174. Syntax.
  175. @subsubsection Extended Bitstream Information - Part 1
  176. @table @option
  177. @item -dmix_mode @var{mode}
  178. Preferred Stereo Downmix Mode. Allows the user to select either Lt/Rt
  179. (Dolby Surround) or Lo/Ro (normal stereo) as the preferred stereo downmix mode.
  180. @table @option
  181. @item 0
  182. @itemx notindicated
  183. Not Indicated (default)
  184. @item 1
  185. @itemx ltrt
  186. Lt/Rt Downmix Preferred
  187. @item 2
  188. @itemx loro
  189. Lo/Ro Downmix Preferred
  190. @end table
  191. @item -ltrt_cmixlev @var{level}
  192. Lt/Rt Center Mix Level. The amount of gain the decoder should apply to the
  193. center channel when downmixing to stereo in Lt/Rt mode.
  194. @table @option
  195. @item 1.414
  196. Apply +3dB gain
  197. @item 1.189
  198. Apply +1.5dB gain
  199. @item 1.000
  200. Apply 0dB gain
  201. @item 0.841
  202. Apply -1.5dB gain
  203. @item 0.707
  204. Apply -3.0dB gain
  205. @item 0.595
  206. Apply -4.5dB gain (default)
  207. @item 0.500
  208. Apply -6.0dB gain
  209. @item 0.000
  210. Silence Center Channel
  211. @end table
  212. @item -ltrt_surmixlev @var{level}
  213. Lt/Rt Surround Mix Level. The amount of gain the decoder should apply to the
  214. surround channel(s) when downmixing to stereo in Lt/Rt mode.
  215. @table @option
  216. @item 0.841
  217. Apply -1.5dB gain
  218. @item 0.707
  219. Apply -3.0dB gain
  220. @item 0.595
  221. Apply -4.5dB gain
  222. @item 0.500
  223. Apply -6.0dB gain (default)
  224. @item 0.000
  225. Silence Surround Channel(s)
  226. @end table
  227. @item -loro_cmixlev @var{level}
  228. Lo/Ro Center Mix Level. The amount of gain the decoder should apply to the
  229. center channel when downmixing to stereo in Lo/Ro mode.
  230. @table @option
  231. @item 1.414
  232. Apply +3dB gain
  233. @item 1.189
  234. Apply +1.5dB gain
  235. @item 1.000
  236. Apply 0dB gain
  237. @item 0.841
  238. Apply -1.5dB gain
  239. @item 0.707
  240. Apply -3.0dB gain
  241. @item 0.595
  242. Apply -4.5dB gain (default)
  243. @item 0.500
  244. Apply -6.0dB gain
  245. @item 0.000
  246. Silence Center Channel
  247. @end table
  248. @item -loro_surmixlev @var{level}
  249. Lo/Ro Surround Mix Level. The amount of gain the decoder should apply to the
  250. surround channel(s) when downmixing to stereo in Lo/Ro mode.
  251. @table @option
  252. @item 0.841
  253. Apply -1.5dB gain
  254. @item 0.707
  255. Apply -3.0dB gain
  256. @item 0.595
  257. Apply -4.5dB gain
  258. @item 0.500
  259. Apply -6.0dB gain (default)
  260. @item 0.000
  261. Silence Surround Channel(s)
  262. @end table
  263. @end table
  264. @subsubsection Extended Bitstream Information - Part 2
  265. @table @option
  266. @item -dsurex_mode @var{mode}
  267. Dolby Surround EX Mode. Indicates whether the stream uses Dolby Surround EX
  268. (7.1 matrixed to 5.1). Using this option does @b{NOT} mean the encoder will actually
  269. apply Dolby Surround EX processing.
  270. @table @option
  271. @item 0
  272. @itemx notindicated
  273. Not Indicated (default)
  274. @item 1
  275. @itemx on
  276. Dolby Surround EX Off
  277. @item 2
  278. @itemx off
  279. Dolby Surround EX On
  280. @end table
  281. @item -dheadphone_mode @var{mode}
  282. Dolby Headphone Mode. Indicates whether the stream uses Dolby Headphone
  283. encoding (multi-channel matrixed to 2.0 for use with headphones). Using this
  284. option does @b{NOT} mean the encoder will actually apply Dolby Headphone
  285. processing.
  286. @table @option
  287. @item 0
  288. @itemx notindicated
  289. Not Indicated (default)
  290. @item 1
  291. @itemx on
  292. Dolby Headphone Off
  293. @item 2
  294. @itemx off
  295. Dolby Headphone On
  296. @end table
  297. @item -ad_conv_type @var{type}
  298. A/D Converter Type. Indicates whether the audio has passed through HDCD A/D
  299. conversion.
  300. @table @option
  301. @item 0
  302. @itemx standard
  303. Standard A/D Converter (default)
  304. @item 1
  305. @itemx hdcd
  306. HDCD A/D Converter
  307. @end table
  308. @end table
  309. @subsection Other AC-3 Encoding Options
  310. @table @option
  311. @item -stereo_rematrixing @var{boolean}
  312. Stereo Rematrixing. Enables/Disables use of rematrixing for stereo input. This
  313. is an optional AC-3 feature that increases quality by selectively encoding
  314. the left/right channels as mid/side. This option is enabled by default, and it
  315. is highly recommended that it be left as enabled except for testing purposes.
  316. @end table
  317. @subsection Floating-Point-Only AC-3 Encoding Options
  318. These options are only valid for the floating-point encoder and do not exist
  319. for the fixed-point encoder due to the corresponding features not being
  320. implemented in fixed-point.
  321. @table @option
  322. @item -channel_coupling @var{boolean}
  323. Enables/Disables use of channel coupling, which is an optional AC-3 feature
  324. that increases quality by combining high frequency information from multiple
  325. channels into a single channel. The per-channel high frequency information is
  326. sent with less accuracy in both the frequency and time domains. This allows
  327. more bits to be used for lower frequencies while preserving enough information
  328. to reconstruct the high frequencies. This option is enabled by default for the
  329. floating-point encoder and should generally be left as enabled except for
  330. testing purposes or to increase encoding speed.
  331. @table @option
  332. @item -1
  333. @itemx auto
  334. Selected by Encoder (default)
  335. @item 0
  336. @itemx off
  337. Disable Channel Coupling
  338. @item 1
  339. @itemx on
  340. Enable Channel Coupling
  341. @end table
  342. @item -cpl_start_band @var{number}
  343. Coupling Start Band. Sets the channel coupling start band, from 1 to 15. If a
  344. value higher than the bandwidth is used, it will be reduced to 1 less than the
  345. coupling end band. If @var{auto} is used, the start band will be determined by
  346. the encoder based on the bit rate, sample rate, and channel layout. This option
  347. has no effect if channel coupling is disabled.
  348. @table @option
  349. @item -1
  350. @itemx auto
  351. Selected by Encoder (default)
  352. @end table
  353. @end table
  354. @section libmp3lame
  355. LAME (Lame Ain't an MP3 Encoder) MP3 encoder wrapper.
  356. Requires the presence of the libmp3lame headers and library during
  357. configuration. You need to explicitly configure the build with
  358. @code{--enable-libmp3lame}.
  359. @subsection Options
  360. The following options are supported by the libmp3lame wrapper. The
  361. @command{lame}-equivalent of the options are listed in parentheses.
  362. @table @option
  363. @item b (@emph{-b})
  364. Set bitrate expressed in bits/s for CBR. LAME @code{bitrate} is
  365. expressed in kilobits/s.
  366. @item q (@emph{-V})
  367. Set constant quality setting for VBR. This option is valid only
  368. using the @command{ffmpeg} command-line tool. For library interface
  369. users, use @option{global_quality}.
  370. @item compression_level (@emph{-q})
  371. Set algorithm quality. Valid arguments are integers in the 0-9 range,
  372. with 0 meaning highest quality but slowest, and 9 meaning fastest
  373. while producing the worst quality.
  374. @item reservoir
  375. Enable use of bit reservoir when set to 1. Default value is 1. LAME
  376. has this enabled by default, but can be overriden by use
  377. @option{--nores} option.
  378. @item joint_stereo (@emph{-m j})
  379. Enable the encoder to use (on a frame by frame basis) either L/R
  380. stereo or mid/side stereo. Default value is 1.
  381. @end table
  382. @section libopencore-amrnb
  383. OpenCORE Adaptive Multi-Rate Narrowband encoder.
  384. Requires the presence of the libopencore-amrnb headers and library during
  385. configuration. You need to explicitly configure the build with
  386. @code{--enable-libopencore-amrnb --enable-version3}.
  387. This is a mono-only encoder. Officially it only supports 8000Hz sample rate,
  388. but you can override it by setting @option{strict} to @samp{unofficial} or
  389. lower.
  390. @subsection Options
  391. @table @option
  392. @item b
  393. Set bitrate in bits per second. Only the following bitrates are supported,
  394. otherwise libavcodec will round to the nearest valid bitrate.
  395. @table @option
  396. @item 4750
  397. @item 5150
  398. @item 5900
  399. @item 6700
  400. @item 7400
  401. @item 7950
  402. @item 10200
  403. @item 12200
  404. @end table
  405. @item dtx
  406. Allow discontinuous transmission (generate comfort noise) when set to 1. The
  407. default value is 0 (disabled).
  408. @end table
  409. @section libtwolame
  410. TwoLAME MP2 encoder wrapper.
  411. Requires the presence of the libtwolame headers and library during
  412. configuration. You need to explicitly configure the build with
  413. @code{--enable-libtwolame}.
  414. @subsection Options
  415. The following options are supported by the libtwolame wrapper. The
  416. @command{twolame}-equivalent options follow the FFmpeg ones and are in
  417. parentheses.
  418. @table @option
  419. @item b (@emph{-b})
  420. Set bitrate expressed in bits/s for CBR. @command{twolame} @option{b}
  421. option is expressed in kilobits/s. Default value is 128k.
  422. @item q (@emph{-V})
  423. Set quality for experimental VBR support. Maximum value range is
  424. from -50 to 50, useful range is from -10 to 10. The higher the
  425. value, the better the quality. This option is valid only using the
  426. @command{ffmpeg} command-line tool. For library interface users,
  427. use @option{global_quality}.
  428. @item mode (@emph{--mode})
  429. Set the mode of the resulting audio. Possible values:
  430. @table @samp
  431. @item auto
  432. Choose mode automatically based on the input. This is the default.
  433. @item stereo
  434. Stereo
  435. @item joint_stereo
  436. Joint stereo
  437. @item dual_channel
  438. Dual channel
  439. @item mono
  440. Mono
  441. @end table
  442. @item psymodel (@emph{--psyc-mode})
  443. Set psychoacoustic model to use in encoding. The argument must be
  444. an integer between -1 and 4, inclusive. The higher the value, the
  445. better the quality. The default value is 3.
  446. @item energy_levels (@emph{--energy})
  447. Enable energy levels extensions when set to 1. The default value is
  448. 0 (disabled).
  449. @item error_protection (@emph{--protect})
  450. Enable CRC error protection when set to 1. The default value is 0
  451. (disabled).
  452. @item copyright (@emph{--copyright})
  453. Set MPEG audio copyright flag when set to 1. The default value is 0
  454. (disabled).
  455. @item original (@emph{--original})
  456. Set MPEG audio original flag when set to 1. The default value is 0
  457. (disabled).
  458. @end table
  459. @section libvo-aacenc
  460. VisualOn AAC encoder.
  461. Requires the presence of the libvo-aacenc headers and library during
  462. configuration. You need to explicitly configure the build with
  463. @code{--enable-libvo-aacenc --enable-version3}.
  464. @subsection Options
  465. The VisualOn AAC encoder only support encoding AAC-LC and up to 2
  466. channels. It is also CBR-only. It is considered to be worse than the
  467. native experimental FFmpeg AAC encoder.
  468. @table @option
  469. @item b
  470. Bitrate.
  471. @end table
  472. @section libvo-amrwbenc
  473. VisualOn Adaptive Multi-Rate Wideband encoder.
  474. Requires the presence of the libvo-amrwbenc headers and library during
  475. configuration. You need to explicitly configure the build with
  476. @code{--enable-libvo-amrwbenc --enable-version3}.
  477. This is a mono-only encoder. Officially it only supports 16000Hz sample
  478. rate, but you can override it by setting @option{strict} to
  479. @samp{unofficial} or lower.
  480. @subsection Options
  481. @table @option
  482. @item b
  483. Set bitrate in bits/s. Only the following bitrates are supported, otherwise
  484. libavcodec will round to the nearest valid bitrate.
  485. @table @samp
  486. @item 6600
  487. @item 8850
  488. @item 12650
  489. @item 14250
  490. @item 15850
  491. @item 18250
  492. @item 19850
  493. @item 23050
  494. @item 23850
  495. @end table
  496. @item dtx
  497. Allow discontinuous transmission (generate comfort noise) when set to 1. The
  498. default value is 0 (disabled).
  499. @end table
  500. @section libopus
  501. libopus Opus Interactive Audio Codec encoder wrapper.
  502. Requires the presence of the libopus headers and library during
  503. configuration. You need to explicitly configure the build with
  504. @code{--enable-libopus}.
  505. @subsection Option Mapping
  506. Most libopus options are modeled after the @command{opusenc} utility from
  507. opus-tools. The following is an option mapping chart describing options
  508. supported by the libopus wrapper, and their @command{opusenc}-equivalent
  509. in parentheses.
  510. @table @option
  511. @item b (@emph{bitrate})
  512. Set the bit rate in bits/s. FFmpeg's @option{b} option is
  513. expressed in bits/s, while @command{opusenc}'s @option{bitrate} in
  514. kilobits/s.
  515. @item vbr (@emph{vbr}, @emph{hard-cbr}, and @emph{cvbr})
  516. Set VBR mode. The FFmpeg @option{vbr} option has the following
  517. valid arguments, with the their @command{opusenc} equivalent options
  518. in parentheses:
  519. @table @samp
  520. @item off (@emph{hard-cbr})
  521. Use constant bit rate encoding.
  522. @item on (@emph{vbr})
  523. Use variable bit rate encoding (the default).
  524. @item constrained (@emph{cvbr})
  525. Use constrained variable bit rate encoding.
  526. @end table
  527. @item compression_level (@emph{comp})
  528. Set encoding algorithm complexity. Valid options are integers in
  529. the 0-10 range. 0 gives the fastest encodes but lower quality, while 10
  530. gives the highest quality but slowest encoding. The default is 10.
  531. @item frame_duration (@emph{framesize})
  532. Set maximum frame size, or duration of a frame in milliseconds. The
  533. argument must be exactly the following: 2.5, 5, 10, 20, 40, 60. Smaller
  534. frame sizes achieve lower latency but less quality at a given bitrate.
  535. Sizes greater than 20ms are only interesting at fairly low bitrates.
  536. The default of FFmpeg is 10ms, but is 20ms in @command{opusenc}.
  537. @item packet_loss (@emph{expect-loss})
  538. Set expected packet loss percentage. The default is 0.
  539. @item application (N.A.)
  540. Set intended application type. Valid options are listed below:
  541. @table @samp
  542. @item voip
  543. Favor improved speech intelligibility.
  544. @item audio
  545. Favor faithfulness to the input (the default).
  546. @item lowdelay
  547. Restrict to only the lowest delay modes.
  548. @end table
  549. @item cutoff (N.A.)
  550. Set cutoff bandwidth in Hz. The argument must be exactly one of the
  551. following: 4000, 6000, 8000, 12000, or 20000, corresponding to
  552. narrowband, mediumband, wideband, super wideband, and fullband
  553. respectively. The default is 0 (cutoff disabled).
  554. @end table
  555. @section libwavpack
  556. A wrapper providing WavPack encoding through libwavpack.
  557. Only lossless mode using 32-bit integer samples is supported currently.
  558. The @option{compression_level} option can be used to control speed vs.
  559. compression tradeoff, with the values mapped to libwavpack as follows:
  560. @table @option
  561. @item 0
  562. Fast mode - corresponding to the wavpack @option{-f} option.
  563. @item 1
  564. Normal (default) settings.
  565. @item 2
  566. High quality - corresponding to the wavpack @option{-h} option.
  567. @item 3
  568. Very high quality - corresponding to the wavpack @option{-hh} option.
  569. @item 4-8
  570. Same as 3, but with extra processing enabled - corresponding to the wavpack
  571. @option{-x} option. I.e. 4 is the same as @option{-x2} and 8 is the same as
  572. @option{-x6}.
  573. @end table
  574. @c man end AUDIO ENCODERS
  575. @chapter Video Encoders
  576. @c man begin VIDEO ENCODERS
  577. A description of some of the currently available video encoders
  578. follows.
  579. @section libtheora
  580. Theora format supported through libtheora.
  581. Requires the presence of the libtheora headers and library during
  582. configuration. You need to explicitly configure the build with
  583. @code{--enable-libtheora}.
  584. @subsection Options
  585. The following global options are mapped to internal libtheora options
  586. which affect the quality and the bitrate of the encoded stream.
  587. @table @option
  588. @item b
  589. Set the video bitrate, only works if the @code{qscale} flag in
  590. @option{flags} is not enabled.
  591. @item flags
  592. Used to enable constant quality mode encoding through the
  593. @option{qscale} flag, and to enable the @code{pass1} and @code{pass2}
  594. modes.
  595. @item g
  596. Set the GOP size.
  597. @item global_quality
  598. Set the global quality in lambda units, only works if the
  599. @code{qscale} flag in @option{flags} is enabled. The value is clipped
  600. in the [0 - 10*@code{FF_QP2LAMBDA}] range, and then multiplied for 6.3
  601. to get a value in the native libtheora range [0-63]. A higher value
  602. corresponds to a higher quality.
  603. For example, to set maximum constant quality encoding with
  604. @command{ffmpeg}:
  605. @example
  606. ffmpeg -i INPUT -flags:v qscale -global_quality:v "10*QP2LAMBDA" -codec:v libtheora OUTPUT.ogg
  607. @end example
  608. @end table
  609. @section libvpx
  610. VP8 format supported through libvpx.
  611. Requires the presence of the libvpx headers and library during configuration.
  612. You need to explicitly configure the build with @code{--enable-libvpx}.
  613. @subsection Options
  614. Mapping from FFmpeg to libvpx options with conversion notes in parentheses.
  615. @table @option
  616. @item threads
  617. g_threads
  618. @item profile
  619. g_profile
  620. @item vb
  621. rc_target_bitrate
  622. @item g
  623. kf_max_dist
  624. @item keyint_min
  625. kf_min_dist
  626. @item qmin
  627. rc_min_quantizer
  628. @item qmax
  629. rc_max_quantizer
  630. @item bufsize, vb
  631. rc_buf_sz
  632. @code{(bufsize * 1000 / vb)}
  633. rc_buf_optimal_sz
  634. @code{(bufsize * 1000 / vb * 5 / 6)}
  635. @item rc_init_occupancy, vb
  636. rc_buf_initial_sz
  637. @code{(rc_init_occupancy * 1000 / vb)}
  638. @item rc_buffer_aggressivity
  639. rc_undershoot_pct
  640. @item skip_threshold
  641. rc_dropframe_thresh
  642. @item qcomp
  643. rc_2pass_vbr_bias_pct
  644. @item maxrate, vb
  645. rc_2pass_vbr_maxsection_pct
  646. @code{(maxrate * 100 / vb)}
  647. @item minrate, vb
  648. rc_2pass_vbr_minsection_pct
  649. @code{(minrate * 100 / vb)}
  650. @item minrate, maxrate, vb
  651. @code{VPX_CBR}
  652. @code{(minrate == maxrate == vb)}
  653. @item crf
  654. @code{VPX_CQ}, @code{VP8E_SET_CQ_LEVEL}
  655. @item quality
  656. @table @option
  657. @item @var{best}
  658. @code{VPX_DL_BEST_QUALITY}
  659. @item @var{good}
  660. @code{VPX_DL_GOOD_QUALITY}
  661. @item @var{realtime}
  662. @code{VPX_DL_REALTIME}
  663. @end table
  664. @item speed
  665. @code{VP8E_SET_CPUUSED}
  666. @item nr
  667. @code{VP8E_SET_NOISE_SENSITIVITY}
  668. @item mb_threshold
  669. @code{VP8E_SET_STATIC_THRESHOLD}
  670. @item slices
  671. @code{VP8E_SET_TOKEN_PARTITIONS}
  672. @item max-intra-rate
  673. @code{VP8E_SET_MAX_INTRA_BITRATE_PCT}
  674. @item force_key_frames
  675. @code{VPX_EFLAG_FORCE_KF}
  676. @item Alternate reference frame related
  677. @table @option
  678. @item vp8flags altref
  679. @code{VP8E_SET_ENABLEAUTOALTREF}
  680. @item @var{arnr_max_frames}
  681. @code{VP8E_SET_ARNR_MAXFRAMES}
  682. @item @var{arnr_type}
  683. @code{VP8E_SET_ARNR_TYPE}
  684. @item @var{arnr_strength}
  685. @code{VP8E_SET_ARNR_STRENGTH}
  686. @item @var{rc_lookahead}
  687. g_lag_in_frames
  688. @end table
  689. @item vp8flags error_resilient
  690. g_error_resilient
  691. @end table
  692. For more information about libvpx see:
  693. @url{http://www.webmproject.org/}
  694. @section libx264
  695. x264 H.264/MPEG-4 AVC encoder wrapper.
  696. This encoder requires the presence of the libx264 headers and library
  697. during configuration. You need to explicitly configure the build with
  698. @code{--enable-libx264}.
  699. libx264 supports an impressive number of features, including 8x8 and
  700. 4x4 adaptive spatial transform, adaptive B-frame placement, CAVLC/CABAC
  701. entropy coding, interlacing (MBAFF), lossless mode, psy optimizations
  702. for detail retention (adaptive quantization, psy-RD, psy-trellis).
  703. Many libx264 encoder options are mapped to FFmpeg global codec
  704. options, while unique encoder options are provided through private
  705. options. Additionally the @option{x264opts} and @option{x264-params}
  706. private options allows to pass a list of key=value tuples as accepted
  707. by the libx264 @code{x264_param_parse} function.
  708. The x264 project website is at
  709. @url{http://www.videolan.org/developers/x264.html}.
  710. @subsection Options
  711. The following options are supported by the libx264 wrapper. The
  712. @command{x264}-equivalent options or values are listed in parentheses
  713. for easy migration.
  714. To reduce the duplication of documentation, only the private options
  715. and some others requiring special attention are documented here. For
  716. the documentation of the undocumented generic options, see
  717. @ref{codec-options,,the Codec Options chapter}.
  718. To get a more accurate and extensive documentation of the libx264
  719. options, invoke the command @command{x264 --full-help} or consult
  720. the libx264 documentation.
  721. @table @option
  722. @item b (@emph{bitrate})
  723. Set bitrate in bits/s. Note that FFmpeg's @option{b} option is
  724. expressed in bits/s, while @command{x264}'s @option{bitrate} is in
  725. kilobits/s.
  726. @item bf (@emph{bframes})
  727. @item g (@emph{keyint})
  728. @item qmax (@emph{qpmax})
  729. @item qmin (@emph{qpmin})
  730. @item qdiff (@emph{qpstep})
  731. @item qblur (@emph{qblur})
  732. @item qcomp (@emph{qcomp})
  733. @item refs (@emph{ref})
  734. @item sc_threshold (@emph{scenecut})
  735. @item trellis (@emph{trellis})
  736. @item nr (@emph{nr})
  737. @item me_range (@emph{merange})
  738. @item me_method (@emph{me})
  739. Set motion estimation method. Possible values in the decreasing order
  740. of speed:
  741. @table @samp
  742. @item dia (@emph{dia})
  743. @item epzs (@emph{dia})
  744. Diamond search with radius 1 (fastest). @samp{epzs} is an alias for
  745. @samp{dia}.
  746. @item hex (@emph{hex})
  747. Hexagonal search with radius 2.
  748. @item umh (@emph{umh})
  749. Uneven multi-hexagon search.
  750. @item esa (@emph{esa})
  751. Exhaustive search.
  752. @item tesa (@emph{tesa})
  753. Hadamard exhaustive search (slowest).
  754. @end table
  755. @item subq (@emph{subme})
  756. @item b_strategy (@emph{b-adapt})
  757. @item keyint_min (@emph{min-keyint})
  758. @item coder
  759. Set entropy encoder. Possible values:
  760. @table @samp
  761. @item ac
  762. Enable CABAC.
  763. @item vlc
  764. Enable CAVLC and disable CABAC. It generates the same effect as
  765. @command{x264}'s @option{--no-cabac} option.
  766. @end table
  767. @item cmp
  768. Set full pixel motion estimation comparation algorithm. Possible values:
  769. @table @samp
  770. @item chroma
  771. Enable chroma in motion estimation.
  772. @item sad
  773. Ignore chroma in motion estimation. It generates the same effect as
  774. @command{x264}'s @option{--no-chroma-me} option.
  775. @end table
  776. @item threads (@emph{threads})
  777. @item thread_type
  778. Set multithreading technique. Possible values:
  779. @table @samp
  780. @item slice
  781. Slice-based multithreading. It generates the same effect as
  782. @command{x264}'s @option{--sliced-threads} option.
  783. @item frame
  784. Frame-based multithreading.
  785. @end table
  786. @item flags
  787. Set encoding flags. It can be used to disable closed GOP and enable
  788. open GOP by setting it to @code{-cgop}. The result is similar to
  789. the behavior of @command{x264}'s @option{--open-gop} option.
  790. @item rc_init_occupancy (@emph{vbv-init})
  791. @item preset (@emph{preset})
  792. Set the encoding preset.
  793. @item tune (@emph{tune})
  794. Set tuning of the encoding params.
  795. @item profile (@emph{profile})
  796. Set profile restrictions.
  797. @item fastfirstpass
  798. Enable fast settings when encoding first pass, when set to 1. When set
  799. to 0, it has the same effect of @command{x264}'s
  800. @option{--slow-firstpass} option.
  801. @item crf (@emph{crf})
  802. Set the quality for constant quality mode.
  803. @item crf_max (@emph{crf-max})
  804. In CRF mode, prevents VBV from lowering quality beyond this point.
  805. @item qp (@emph{qp})
  806. Set constant quantization rate control method parameter.
  807. @item aq-mode (@emph{aq-mode})
  808. Set AQ method. Possible values:
  809. @table @samp
  810. @item none (@emph{0})
  811. Disabled.
  812. @item variance (@emph{1})
  813. Variance AQ (complexity mask).
  814. @item autovariance (@emph{2})
  815. Auto-variance AQ (experimental).
  816. @end table
  817. @item aq-strength (@emph{aq-strength})
  818. Set AQ strength, reduce blocking and blurring in flat and textured areas.
  819. @item psy
  820. Use psychovisual optimizations when set to 1. When set to 0, it has the
  821. same effect as @command{x264}'s @option{--no-psy} option.
  822. @item psy-rd (@emph{psy-rd})
  823. Set strength of psychovisual optimization, in
  824. @var{psy-rd}:@var{psy-trellis} format.
  825. @item rc-lookahead (@emph{rc-lookahead})
  826. Set number of frames to look ahead for frametype and ratecontrol.
  827. @item weightb
  828. Enable weighted prediction for B-frames when set to 1. When set to 0,
  829. it has the same effect as @command{x264}'s @option{--no-weightb} option.
  830. @item weightp (@emph{weightp})
  831. Set weighted prediction method for P-frames. Possible values:
  832. @table @samp
  833. @item none (@emph{0})
  834. Disabled
  835. @item simple (@emph{1})
  836. Enable only weighted refs
  837. @item smart (@emph{2})
  838. Enable both weighted refs and duplicates
  839. @end table
  840. @item ssim (@emph{ssim})
  841. Enable calculation and printing SSIM stats after the encoding.
  842. @item intra-refresh (@emph{intra-refresh})
  843. Enable the use of Periodic Intra Refresh instead of IDR frames when set
  844. to 1.
  845. @item bluray-compat (@emph{bluray-compat})
  846. Configure the encoder to be compatible with the bluray standard.
  847. It is a shorthand for setting "bluray-compat=1 force-cfr=1".
  848. @item b-bias (@emph{b-bias})
  849. Set the influence on how often B-frames are used.
  850. @item b-pyramid (@emph{b-pyramid})
  851. Set method for keeping of some B-frames as references. Possible values:
  852. @table @samp
  853. @item none (@emph{none})
  854. Disabled.
  855. @item strict (@emph{strict})
  856. Strictly hierarchical pyramid.
  857. @item normal (@emph{normal})
  858. Non-strict (not Blu-ray compatible).
  859. @end table
  860. @item mixed-refs
  861. Enable the use of one reference per partition, as opposed to one
  862. reference per macroblock when set to 1. When set to 0, it has the
  863. same effect as @command{x264}'s @option{--no-mixed-refs} option.
  864. @item 8x8dct
  865. Enable adaptive spatial transform (high profile 8x8 transform)
  866. when set to 1. When set to 0, it has the same effect as
  867. @command{x264}'s @option{--no-8x8dct} option.
  868. @item fast-pskip
  869. Enable early SKIP detection on P-frames when set to 1. When set
  870. to 0, it has the same effect as @command{x264}'s
  871. @option{--no-fast-pskip} option.
  872. @item aud (@emph{aud})
  873. Enable use of access unit delimiters when set to 1.
  874. @item mbtree
  875. Enable use macroblock tree ratecontrol when set to 1. When set
  876. to 0, it has the same effect as @command{x264}'s
  877. @option{--no-mbtree} option.
  878. @item deblock (@emph{deblock})
  879. Set loop filter parameters, in @var{alpha}:@var{beta} form.
  880. @item cplxblur (@emph{cplxblur})
  881. Set fluctuations reduction in QP (before curve compression).
  882. @item partitions (@emph{partitions})
  883. Set partitions to consider as a comma-separated list of. Possible
  884. values in the list:
  885. @table @samp
  886. @item p8x8
  887. 8x8 P-frame partition.
  888. @item p4x4
  889. 4x4 P-frame partition.
  890. @item b8x8
  891. 4x4 B-frame partition.
  892. @item i8x8
  893. 8x8 I-frame partition.
  894. @item i4x4
  895. 4x4 I-frame partition.
  896. (Enabling @samp{p4x4} requires @samp{p8x8} to be enabled. Enabling
  897. @samp{i8x8} requires adaptive spatial transform (@option{8x8dct}
  898. option) to be enabled.)
  899. @item none (@emph{none})
  900. Do not consider any partitions.
  901. @item all (@emph{all})
  902. Consider every partition.
  903. @end table
  904. @item direct-pred (@emph{direct})
  905. Set direct MV prediction mode. Possible values:
  906. @table @samp
  907. @item none (@emph{none})
  908. Disable MV prediction.
  909. @item spatial (@emph{spatial})
  910. Enable spatial predicting.
  911. @item temporal (@emph{temporal})
  912. Enable temporal predicting.
  913. @item auto (@emph{auto})
  914. Automatically decided.
  915. @end table
  916. @item slice-max-size (@emph{slice-max-size})
  917. Set the limit of the size of each slice in bytes. If not specified
  918. but RTP payload size (@option{ps}) is specified, that is used.
  919. @item stats (@emph{stats})
  920. Set the file name for multi-pass stats.
  921. @item nal-hrd (@emph{nal-hrd})
  922. Set signal HRD information (requires @option{vbv-bufsize} to be set).
  923. Possible values:
  924. @table @samp
  925. @item none (@emph{none})
  926. Disable HRD information signaling.
  927. @item vbr (@emph{vbr})
  928. Variable bit rate.
  929. @item cbr (@emph{cbr})
  930. Constant bit rate (not allowed in MP4 container).
  931. @end table
  932. @item x264opts (N.A.)
  933. Set any x264 option, see @command{x264 --fullhelp} for a list.
  934. Argument is a list of @var{key}=@var{value} couples separated by
  935. ":". In @var{filter} and @var{psy-rd} options that use ":" as a separator
  936. themselves, use "," instead. They accept it as well since long ago but this
  937. is kept undocumented for some reason.
  938. For example to specify libx264 encoding options with @command{ffmpeg}:
  939. @example
  940. ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv
  941. @end example
  942. @item x264-params (N.A.)
  943. Override the x264 configuration using a :-separated list of key=value
  944. parameters.
  945. This option is functionally the same as the @option{x264opts}, but is
  946. duplicated for compability with the Libav fork.
  947. For example to specify libx264 encoding options with @command{ffmpeg}:
  948. @example
  949. ffmpeg -i INPUT -c:v libx264 -x264-params level=30:bframes=0:weightp=0:\
  950. cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:\
  951. no-fast-pskip=1:subq=6:8x8dct=0:trellis=0 OUTPUT
  952. @end example
  953. @end table
  954. Encoding ffpresets for common usages are provided so they can be used with the
  955. general presets system (e.g. passing the @option{pre} option).
  956. @section libxvid
  957. Xvid MPEG-4 Part 2 encoder wrapper.
  958. This encoder requires the presence of the libxvidcore headers and library
  959. during configuration. You need to explicitly configure the build with
  960. @code{--enable-libxvid --enable-gpl}.
  961. The native @code{mpeg4} encoder supports the MPEG-4 Part 2 format, so
  962. users can encode to this format without this library.
  963. @subsection Options
  964. The following options are supported by the libxvid wrapper. Some of
  965. the following options are listed but are not documented, and
  966. correspond to shared codec options. See @ref{codec-options,,the Codec
  967. Options chapter} for their documentation. The other shared options
  968. which are not listed have no effect for the libxvid encoder.
  969. @table @option
  970. @item b
  971. @item g
  972. @item qmin
  973. @item qmax
  974. @item mpeg_quant
  975. @item threads
  976. @item bf
  977. @item b_qfactor
  978. @item b_qoffset
  979. @item flags
  980. Set specific encoding flags. Possible values:
  981. @table @samp
  982. @item mv4
  983. Use four motion vector by macroblock.
  984. @item aic
  985. Enable high quality AC prediction.
  986. @item gray
  987. Only encode grayscale.
  988. @item gmc
  989. Enable the use of global motion compensation (GMC).
  990. @item qpel
  991. Enable quarter-pixel motion compensation.
  992. @item cgop
  993. Enable closed GOP.
  994. @item global_header
  995. Place global headers in extradata instead of every keyframe.
  996. @end table
  997. @item trellis
  998. @item me_method
  999. Set motion estimation method. Possible values in decreasing order of
  1000. speed and increasing order of quality:
  1001. @table @samp
  1002. @item zero
  1003. Use no motion estimation (default).
  1004. @item phods
  1005. @item x1
  1006. @item log
  1007. Enable advanced diamond zonal search for 16x16 blocks and half-pixel
  1008. refinement for 16x16 blocks. @samp{x1} and @samp{log} are aliases for
  1009. @samp{phods}.
  1010. @item epzs
  1011. Enable all of the things described above, plus advanced diamond zonal
  1012. search for 8x8 blocks, half-pixel refinement for 8x8 blocks, and motion
  1013. estimation on chroma planes.
  1014. @item full
  1015. Enable all of the things described above, plus extended 16x16 and 8x8
  1016. blocks search.
  1017. @end table
  1018. @item mbd
  1019. Set macroblock decision algorithm. Possible values in the increasing
  1020. order of quality:
  1021. @table @samp
  1022. @item simple
  1023. Use macroblock comparing function algorithm (default).
  1024. @item bits
  1025. Enable rate distortion-based half pixel and quarter pixel refinement for
  1026. 16x16 blocks.
  1027. @item rd
  1028. Enable all of the things described above, plus rate distortion-based
  1029. half pixel and quarter pixel refinement for 8x8 blocks, and rate
  1030. distortion-based search using square pattern.
  1031. @end table
  1032. @item lumi_aq
  1033. Enable lumi masking adaptive quantization when set to 1. Default is 0
  1034. (disabled).
  1035. @item variance_aq
  1036. Enable variance adaptive quantization when set to 1. Default is 0
  1037. (disabled).
  1038. When combined with @option{lumi_aq}, the resulting quality will not
  1039. be better than any of the two specified individually. In other
  1040. words, the resulting quality will be the worse one of the two
  1041. effects.
  1042. @item ssim
  1043. Set structural similarity (SSIM) displaying method. Possible values:
  1044. @table @samp
  1045. @item off
  1046. Disable displaying of SSIM information.
  1047. @item avg
  1048. Output average SSIM at the end of encoding to stdout. The format of
  1049. showing the average SSIM is:
  1050. @example
  1051. Average SSIM: %f
  1052. @end example
  1053. For users who are not familiar with C, %f means a float number, or
  1054. a decimal (e.g. 0.939232).
  1055. @item frame
  1056. Output both per-frame SSIM data during encoding and average SSIM at
  1057. the end of encoding to stdout. The format of per-frame information
  1058. is:
  1059. @example
  1060. SSIM: avg: %1.3f min: %1.3f max: %1.3f
  1061. @end example
  1062. For users who are not familiar with C, %1.3f means a float number
  1063. rounded to 3 digits after the dot (e.g. 0.932).
  1064. @end table
  1065. @item ssim_acc
  1066. Set SSIM accuracy. Valid options are integers within the range of
  1067. 0-4, while 0 gives the most accurate result and 4 computes the
  1068. fastest.
  1069. @end table
  1070. @section png
  1071. PNG image encoder.
  1072. @subsection Private options
  1073. @table @option
  1074. @item dpi @var{integer}
  1075. Set physical density of pixels, in dots per inch, unset by default
  1076. @item dpm @var{integer}
  1077. Set physical density of pixels, in dots per meter, unset by default
  1078. @end table
  1079. @section ProRes
  1080. Apple ProRes encoder.
  1081. FFmpeg contains 2 ProRes encoders, the prores-aw and prores-ks encoder.
  1082. The used encoder can be choosen with the @code{-vcodec} option.
  1083. @subsection Private Options for prores-ks
  1084. @table @option
  1085. @item profile @var{integer}
  1086. Select the ProRes profile to encode
  1087. @table @samp
  1088. @item proxy
  1089. @item lt
  1090. @item standard
  1091. @item hq
  1092. @item 4444
  1093. @end table
  1094. @item quant_mat @var{integer}
  1095. Select quantization matrix.
  1096. @table @samp
  1097. @item auto
  1098. @item default
  1099. @item proxy
  1100. @item lt
  1101. @item standard
  1102. @item hq
  1103. @end table
  1104. If set to @var{auto}, the matrix matching the profile will be picked.
  1105. If not set, the matrix providing the highest quality, @var{default}, will be
  1106. picked.
  1107. @item bits_per_mb @var{integer}
  1108. How many bits to allot for coding one macroblock. Different profiles use
  1109. between 200 and 2400 bits per macroblock, the maximum is 8000.
  1110. @item mbs_per_slice @var{integer}
  1111. Number of macroblocks in each slice (1-8); the default value (8)
  1112. should be good in almost all situations.
  1113. @item vendor @var{string}
  1114. Override the 4-byte vendor ID.
  1115. A custom vendor ID like @var{apl0} would claim the stream was produced by
  1116. the Apple encoder.
  1117. @item alpha_bits @var{integer}
  1118. Specify number of bits for alpha component.
  1119. Possible values are @var{0}, @var{8} and @var{16}.
  1120. Use @var{0} to disable alpha plane coding.
  1121. @end table
  1122. @subsection Speed considerations
  1123. In the default mode of operation the encoder has to honor frame constraints
  1124. (i.e. not produc frames with size bigger than requested) while still making
  1125. output picture as good as possible.
  1126. A frame containing a lot of small details is harder to compress and the encoder
  1127. would spend more time searching for appropriate quantizers for each slice.
  1128. Setting a higher @option{bits_per_mb} limit will improve the speed.
  1129. For the fastest encoding speed set the @option{qscale} parameter (4 is the
  1130. recommended value) and do not set a size constraint.
  1131. @c man end VIDEO ENCODERS