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