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