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