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