Imported Upstream version 6.1
[platform/upstream/ffmpeg.git] / doc / encoders.texi
1 @chapter Encoders
2 @c man begin ENCODERS
3
4 Encoders are configured elements in FFmpeg which allow the encoding of
5 multimedia streams.
6
7 When you configure your FFmpeg build, all the supported native encoders
8 are enabled by default. Encoders requiring an external library must be enabled
9 manually via the corresponding @code{--enable-lib} option. You can list all
10 available encoders using the configure option @code{--list-encoders}.
11
12 You can disable all the encoders with the configure option
13 @code{--disable-encoders} and selectively enable / disable single encoders
14 with the options @code{--enable-encoder=@var{ENCODER}} /
15 @code{--disable-encoder=@var{ENCODER}}.
16
17 The option @code{-encoders} of the ff* tools will display the list of
18 enabled encoders.
19
20 @c man end ENCODERS
21
22 @chapter Audio Encoders
23 @c man begin AUDIO ENCODERS
24
25 A description of some of the currently available audio encoders
26 follows.
27
28 @anchor{aacenc}
29 @section aac
30
31 Advanced Audio Coding (AAC) encoder.
32
33 This encoder is the default AAC encoder, natively implemented into FFmpeg.
34
35 @subsection Options
36
37 @table @option
38 @item b
39 Set bit rate in bits/s. Setting this automatically activates constant bit rate
40 (CBR) mode. If this option is unspecified it is set to 128kbps.
41
42 @item q
43 Set quality for variable bit rate (VBR) mode. This option is valid only using
44 the @command{ffmpeg} command-line tool. For library interface users, use
45 @option{global_quality}.
46
47 @item cutoff
48 Set cutoff frequency. If unspecified will allow the encoder to dynamically
49 adjust the cutoff to improve clarity on low bitrates.
50
51 @item aac_coder
52 Set AAC encoder coding method. Possible values:
53
54 @table @samp
55 @item twoloop
56 Two loop searching (TLS) method. This is the default method.
57
58 This method first sets quantizers depending on band thresholds and then tries
59 to find an optimal combination by adding or subtracting a specific value from
60 all quantizers and adjusting some individual quantizer a little.  Will tune
61 itself based on whether @option{aac_is}, @option{aac_ms} and @option{aac_pns}
62 are enabled.
63
64 @item anmr
65 Average noise to mask ratio (ANMR) trellis-based solution.
66
67 This is an experimental coder which currently produces a lower quality, is more
68 unstable and is slower than the default twoloop coder but has potential.
69 Currently has no support for the @option{aac_is} or @option{aac_pns} options.
70 Not currently recommended.
71
72 @item fast
73 Constant quantizer method.
74
75 Uses a cheaper version of twoloop algorithm that doesn't try to do as many
76 clever adjustments. Worse with low bitrates (less than 64kbps), but is better
77 and much faster at higher bitrates.
78
79 @end table
80
81 @item aac_ms
82 Sets mid/side coding mode. The default value of "auto" will automatically use
83 M/S with bands which will benefit from such coding. Can be forced for all bands
84 using the value "enable", which is mainly useful for debugging or disabled using
85 "disable".
86
87 @item aac_is
88 Sets intensity stereo coding tool usage. By default, it's enabled and will
89 automatically toggle IS for similar pairs of stereo bands if it's beneficial.
90 Can be disabled for debugging by setting the value to "disable".
91
92 @item aac_pns
93 Uses perceptual noise substitution to replace low entropy high frequency bands
94 with imperceptible white noise during the decoding process. By default, it's
95 enabled, but can be disabled for debugging purposes by using "disable".
96
97 @item aac_tns
98 Enables the use of a multitap FIR filter which spans through the high frequency
99 bands to hide quantization noise during the encoding process and is reverted
100 by the decoder. As well as decreasing unpleasant artifacts in the high range
101 this also reduces the entropy in the high bands and allows for more bits to
102 be used by the mid-low bands. By default it's enabled but can be disabled for
103 debugging by setting the option to "disable".
104
105 @item aac_ltp
106 Enables the use of the long term prediction extension which increases coding
107 efficiency in very low bandwidth situations such as encoding of voice or
108 solo piano music by extending constant harmonic peaks in bands throughout
109 frames. This option is implied by profile:a aac_low and is incompatible with
110 aac_pred. Use in conjunction with @option{-ar} to decrease the samplerate.
111
112 @item aac_pred
113 Enables the use of a more traditional style of prediction where the spectral
114 coefficients transmitted are replaced by the difference of the current
115 coefficients minus the previous "predicted" coefficients. In theory and sometimes
116 in practice this can improve quality for low to mid bitrate audio.
117 This option implies the aac_main profile and is incompatible with aac_ltp.
118
119 @item profile
120 Sets the encoding profile, possible values:
121
122 @table @samp
123 @item aac_low
124 The default, AAC "Low-complexity" profile. Is the most compatible and produces
125 decent quality.
126
127 @item mpeg2_aac_low
128 Equivalent to @code{-profile:a aac_low -aac_pns 0}. PNS was introduced with the
129 MPEG4 specifications.
130
131 @item aac_ltp
132 Long term prediction profile, is enabled by and will enable the @option{aac_ltp}
133 option. Introduced in MPEG4.
134
135 @item aac_main
136 Main-type prediction profile, is enabled by and will enable the @option{aac_pred}
137 option. Introduced in MPEG2.
138
139 @end table
140 If this option is unspecified it is set to @samp{aac_low}.
141 @end table
142
143 @section ac3 and ac3_fixed
144
145 AC-3 audio encoders.
146
147 These encoders implement part of ATSC A/52:2010 and ETSI TS 102 366, as well as
148 the undocumented RealAudio 3 (a.k.a. dnet).
149
150 The @var{ac3} encoder uses floating-point math, while the @var{ac3_fixed}
151 encoder only uses fixed-point integer math. This does not mean that one is
152 always faster, just that one or the other may be better suited to a
153 particular system. The @var{ac3_fixed} encoder is not the default codec for
154 any of the output formats, so it must be specified explicitly using the option
155 @code{-acodec ac3_fixed} in order to use it.
156
157 @subsection AC-3 Metadata
158
159 The AC-3 metadata options are used to set parameters that describe the audio,
160 but in most cases do not affect the audio encoding itself. Some of the options
161 do directly affect or influence the decoding and playback of the resulting
162 bitstream, while others are just for informational purposes. A few of the
163 options will add bits to the output stream that could otherwise be used for
164 audio data, and will thus affect the quality of the output. Those will be
165 indicated accordingly with a note in the option list below.
166
167 These parameters are described in detail in several publicly-available
168 documents.
169 @itemize
170 @item @uref{http://www.atsc.org/cms/standards/a_52-2010.pdf,A/52:2010 - Digital Audio Compression (AC-3) (E-AC-3) Standard}
171 @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}
172 @item @uref{http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/18_Metadata.Guide.pdf,Dolby Metadata Guide}
173 @item @uref{http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/46_DDEncodingGuidelines.pdf,Dolby Digital Professional Encoding Guidelines}
174 @end itemize
175
176 @subsubsection Metadata Control Options
177
178 @table @option
179
180 @item -per_frame_metadata @var{boolean}
181 Allow Per-Frame Metadata. Specifies if the encoder should check for changing
182 metadata for each frame.
183 @table @option
184 @item 0
185 The metadata values set at initialization will be used for every frame in the
186 stream. (default)
187 @item 1
188 Metadata values can be changed before encoding each frame.
189 @end table
190
191 @end table
192
193 @subsubsection Downmix Levels
194
195 @table @option
196
197 @item -center_mixlev @var{level}
198 Center Mix Level. The amount of gain the decoder should apply to the center
199 channel when downmixing to stereo. This field will only be written to the
200 bitstream if a center channel is present. The value is specified as a scale
201 factor. There are 3 valid values:
202 @table @option
203 @item 0.707
204 Apply -3dB gain
205 @item 0.595
206 Apply -4.5dB gain (default)
207 @item 0.500
208 Apply -6dB gain
209 @end table
210
211 @item -surround_mixlev @var{level}
212 Surround Mix Level. The amount of gain the decoder should apply to the surround
213 channel(s) when downmixing to stereo. This field will only be written to the
214 bitstream if one or more surround channels are present. The value is specified
215 as a scale factor.  There are 3 valid values:
216 @table @option
217 @item 0.707
218 Apply -3dB gain
219 @item 0.500
220 Apply -6dB gain (default)
221 @item 0.000
222 Silence Surround Channel(s)
223 @end table
224
225 @end table
226
227 @subsubsection Audio Production Information
228 Audio Production Information is optional information describing the mixing
229 environment.  Either none or both of the fields are written to the bitstream.
230
231 @table @option
232
233 @item -mixing_level @var{number}
234 Mixing Level. Specifies peak sound pressure level (SPL) in the production
235 environment when the mix was mastered. Valid values are 80 to 111, or -1 for
236 unknown or not indicated. The default value is -1, but that value cannot be
237 used if the Audio Production Information is written to the bitstream. Therefore,
238 if the @code{room_type} option is not the default value, the @code{mixing_level}
239 option must not be -1.
240
241 @item -room_type @var{type}
242 Room Type. Describes the equalization used during the final mixing session at
243 the studio or on the dubbing stage. A large room is a dubbing stage with the
244 industry standard X-curve equalization; a small room has flat equalization.
245 This field will not be written to the bitstream if both the @code{mixing_level}
246 option and the @code{room_type} option have the default values.
247 @table @option
248 @item 0
249 @itemx notindicated
250 Not Indicated (default)
251 @item 1
252 @itemx large
253 Large Room
254 @item 2
255 @itemx small
256 Small Room
257 @end table
258
259 @end table
260
261 @subsubsection Other Metadata Options
262
263 @table @option
264
265 @item -copyright @var{boolean}
266 Copyright Indicator. Specifies whether a copyright exists for this audio.
267 @table @option
268 @item 0
269 @itemx off
270 No Copyright Exists (default)
271 @item 1
272 @itemx on
273 Copyright Exists
274 @end table
275
276 @item -dialnorm @var{value}
277 Dialogue Normalization. Indicates how far the average dialogue level of the
278 program is below digital 100% full scale (0 dBFS). This parameter determines a
279 level shift during audio reproduction that sets the average volume of the
280 dialogue to a preset level. The goal is to match volume level between program
281 sources. A value of -31dB will result in no volume level change, relative to
282 the source volume, during audio reproduction. Valid values are whole numbers in
283 the range -31 to -1, with -31 being the default.
284
285 @item -dsur_mode @var{mode}
286 Dolby Surround Mode. Specifies whether the stereo signal uses Dolby Surround
287 (Pro Logic). This field will only be written to the bitstream if the audio
288 stream is stereo. Using this option does @b{NOT} mean the encoder will actually
289 apply Dolby Surround processing.
290 @table @option
291 @item 0
292 @itemx notindicated
293 Not Indicated (default)
294 @item 1
295 @itemx off
296 Not Dolby Surround Encoded
297 @item 2
298 @itemx on
299 Dolby Surround Encoded
300 @end table
301
302 @item -original @var{boolean}
303 Original Bit Stream Indicator. Specifies whether this audio is from the
304 original source and not a copy.
305 @table @option
306 @item 0
307 @itemx off
308 Not Original Source
309 @item 1
310 @itemx on
311 Original Source (default)
312 @end table
313
314 @end table
315
316 @subsection Extended Bitstream Information
317 The extended bitstream options are part of the Alternate Bit Stream Syntax as
318 specified in Annex D of the A/52:2010 standard. It is grouped into 2 parts.
319 If any one parameter in a group is specified, all values in that group will be
320 written to the bitstream.  Default values are used for those that are written
321 but have not been specified.  If the mixing levels are written, the decoder
322 will use these values instead of the ones specified in the @code{center_mixlev}
323 and @code{surround_mixlev} options if it supports the Alternate Bit Stream
324 Syntax.
325
326 @subsubsection Extended Bitstream Information - Part 1
327
328 @table @option
329
330 @item -dmix_mode @var{mode}
331 Preferred Stereo Downmix Mode. Allows the user to select either Lt/Rt
332 (Dolby Surround) or Lo/Ro (normal stereo) as the preferred stereo downmix mode.
333 @table @option
334 @item 0
335 @itemx notindicated
336 Not Indicated (default)
337 @item 1
338 @itemx ltrt
339 Lt/Rt Downmix Preferred
340 @item 2
341 @itemx loro
342 Lo/Ro Downmix Preferred
343 @end table
344
345 @item -ltrt_cmixlev @var{level}
346 Lt/Rt Center Mix Level. The amount of gain the decoder should apply to the
347 center channel when downmixing to stereo in Lt/Rt mode.
348 @table @option
349 @item 1.414
350 Apply +3dB gain
351 @item 1.189
352 Apply +1.5dB gain
353 @item 1.000
354 Apply 0dB gain
355 @item 0.841
356 Apply -1.5dB gain
357 @item 0.707
358 Apply -3.0dB gain
359 @item 0.595
360 Apply -4.5dB gain (default)
361 @item 0.500
362 Apply -6.0dB gain
363 @item 0.000
364 Silence Center Channel
365 @end table
366
367 @item -ltrt_surmixlev @var{level}
368 Lt/Rt Surround Mix Level. The amount of gain the decoder should apply to the
369 surround channel(s) when downmixing to stereo in Lt/Rt mode.
370 @table @option
371 @item 0.841
372 Apply -1.5dB gain
373 @item 0.707
374 Apply -3.0dB gain
375 @item 0.595
376 Apply -4.5dB gain
377 @item 0.500
378 Apply -6.0dB gain (default)
379 @item 0.000
380 Silence Surround Channel(s)
381 @end table
382
383 @item -loro_cmixlev @var{level}
384 Lo/Ro Center Mix Level. The amount of gain the decoder should apply to the
385 center channel when downmixing to stereo in Lo/Ro mode.
386 @table @option
387 @item 1.414
388 Apply +3dB gain
389 @item 1.189
390 Apply +1.5dB gain
391 @item 1.000
392 Apply 0dB gain
393 @item 0.841
394 Apply -1.5dB gain
395 @item 0.707
396 Apply -3.0dB gain
397 @item 0.595
398 Apply -4.5dB gain (default)
399 @item 0.500
400 Apply -6.0dB gain
401 @item 0.000
402 Silence Center Channel
403 @end table
404
405 @item -loro_surmixlev @var{level}
406 Lo/Ro Surround Mix Level. The amount of gain the decoder should apply to the
407 surround channel(s) when downmixing to stereo in Lo/Ro mode.
408 @table @option
409 @item 0.841
410 Apply -1.5dB gain
411 @item 0.707
412 Apply -3.0dB gain
413 @item 0.595
414 Apply -4.5dB gain
415 @item 0.500
416 Apply -6.0dB gain (default)
417 @item 0.000
418 Silence Surround Channel(s)
419 @end table
420
421 @end table
422
423 @subsubsection Extended Bitstream Information - Part 2
424
425 @table @option
426
427 @item -dsurex_mode @var{mode}
428 Dolby Surround EX Mode. Indicates whether the stream uses Dolby Surround EX
429 (7.1 matrixed to 5.1). Using this option does @b{NOT} mean the encoder will actually
430 apply Dolby Surround EX processing.
431 @table @option
432 @item 0
433 @itemx notindicated
434 Not Indicated (default)
435 @item 1
436 @itemx on
437 Dolby Surround EX Off
438 @item 2
439 @itemx off
440 Dolby Surround EX On
441 @end table
442
443 @item -dheadphone_mode @var{mode}
444 Dolby Headphone Mode. Indicates whether the stream uses Dolby Headphone
445 encoding (multi-channel matrixed to 2.0 for use with headphones). Using this
446 option does @b{NOT} mean the encoder will actually apply Dolby Headphone
447 processing.
448 @table @option
449 @item 0
450 @itemx notindicated
451 Not Indicated (default)
452 @item 1
453 @itemx on
454 Dolby Headphone Off
455 @item 2
456 @itemx off
457 Dolby Headphone On
458 @end table
459
460 @item -ad_conv_type @var{type}
461 A/D Converter Type. Indicates whether the audio has passed through HDCD A/D
462 conversion.
463 @table @option
464 @item 0
465 @itemx standard
466 Standard A/D Converter (default)
467 @item 1
468 @itemx hdcd
469 HDCD A/D Converter
470 @end table
471
472 @end table
473
474 @subsection Other AC-3 Encoding Options
475
476 @table @option
477
478 @item -stereo_rematrixing @var{boolean}
479 Stereo Rematrixing. Enables/Disables use of rematrixing for stereo input. This
480 is an optional AC-3 feature that increases quality by selectively encoding
481 the left/right channels as mid/side. This option is enabled by default, and it
482 is highly recommended that it be left as enabled except for testing purposes.
483
484 @item cutoff @var{frequency}
485 Set lowpass cutoff frequency. If unspecified, the encoder selects a default
486 determined by various other encoding parameters.
487
488 @end table
489
490 @subsection Floating-Point-Only AC-3 Encoding Options
491
492 These options are only valid for the floating-point encoder and do not exist
493 for the fixed-point encoder due to the corresponding features not being
494 implemented in fixed-point.
495
496 @table @option
497
498 @item -channel_coupling @var{boolean}
499 Enables/Disables use of channel coupling, which is an optional AC-3 feature
500 that increases quality by combining high frequency information from multiple
501 channels into a single channel. The per-channel high frequency information is
502 sent with less accuracy in both the frequency and time domains. This allows
503 more bits to be used for lower frequencies while preserving enough information
504 to reconstruct the high frequencies. This option is enabled by default for the
505 floating-point encoder and should generally be left as enabled except for
506 testing purposes or to increase encoding speed.
507 @table @option
508 @item -1
509 @itemx auto
510 Selected by Encoder (default)
511 @item 0
512 @itemx off
513 Disable Channel Coupling
514 @item 1
515 @itemx on
516 Enable Channel Coupling
517 @end table
518
519 @item -cpl_start_band @var{number}
520 Coupling Start Band. Sets the channel coupling start band, from 1 to 15. If a
521 value higher than the bandwidth is used, it will be reduced to 1 less than the
522 coupling end band. If @var{auto} is used, the start band will be determined by
523 the encoder based on the bit rate, sample rate, and channel layout. This option
524 has no effect if channel coupling is disabled.
525 @table @option
526 @item -1
527 @itemx auto
528 Selected by Encoder (default)
529 @end table
530
531 @end table
532
533 @anchor{flac}
534 @section flac
535
536 FLAC (Free Lossless Audio Codec) Encoder
537
538 @subsection Options
539
540 The following options are supported by FFmpeg's flac encoder.
541
542 @table @option
543 @item compression_level
544 Sets the compression level, which chooses defaults for many other options
545 if they are not set explicitly. Valid values are from 0 to 12, 5 is the
546 default.
547
548 @item frame_size
549 Sets the size of the frames in samples per channel.
550
551 @item lpc_coeff_precision
552 Sets the LPC coefficient precision, valid values are from 1 to 15, 15 is the
553 default.
554
555 @item lpc_type
556 Sets the first stage LPC algorithm
557 @table @samp
558 @item none
559 LPC is not used
560
561 @item fixed
562 fixed LPC coefficients
563
564 @item levinson
565
566 @item cholesky
567 @end table
568
569 @item lpc_passes
570 Number of passes to use for Cholesky factorization during LPC analysis
571
572 @item min_partition_order
573 The minimum partition order
574
575 @item max_partition_order
576 The maximum partition order
577
578 @item prediction_order_method
579 @table @samp
580 @item estimation
581 @item 2level
582 @item 4level
583 @item 8level
584 @item search
585 Bruteforce search
586 @item log
587 @end table
588
589 @item ch_mode
590 Channel mode
591 @table @samp
592 @item auto
593 The mode is chosen automatically for each frame
594 @item indep
595 Channels are independently coded
596 @item left_side
597 @item right_side
598 @item mid_side
599 @end table
600
601 @item exact_rice_parameters
602 Chooses if rice parameters are calculated exactly or approximately.
603 if set to 1 then they are chosen exactly, which slows the code down slightly and
604 improves compression slightly.
605
606 @item multi_dim_quant
607 Multi Dimensional Quantization. If set to 1 then a 2nd stage LPC algorithm is
608 applied after the first stage to finetune the coefficients. This is quite slow
609 and slightly improves compression.
610
611 @end table
612
613 @anchor{opusenc}
614 @section opus
615
616 Opus encoder.
617
618 This is a native FFmpeg encoder for the Opus format. Currently its in development and
619 only implements the CELT part of the codec. Its quality is usually worse and at best
620 is equal to the libopus encoder.
621
622 @subsection Options
623
624 @table @option
625 @item b
626 Set bit rate in bits/s. If unspecified it uses the number of channels and the layout
627 to make a good guess.
628
629 @item opus_delay
630 Sets the maximum delay in milliseconds. Lower delays than 20ms will very quickly
631 decrease quality.
632 @end table
633
634 @anchor{libfdk-aac-enc}
635 @section libfdk_aac
636
637 libfdk-aac AAC (Advanced Audio Coding) encoder wrapper.
638
639 The libfdk-aac library is based on the Fraunhofer FDK AAC code from
640 the Android project.
641
642 Requires the presence of the libfdk-aac headers and library during
643 configuration. You need to explicitly configure the build with
644 @code{--enable-libfdk-aac}. The library is also incompatible with GPL,
645 so if you allow the use of GPL, you should configure with
646 @code{--enable-gpl --enable-nonfree --enable-libfdk-aac}.
647
648 This encoder has support for the AAC-HE profiles.
649
650 VBR encoding, enabled through the @option{vbr} or @option{flags
651 +qscale} options, is experimental and only works with some
652 combinations of parameters.
653
654 Support for encoding 7.1 audio is only available with libfdk-aac 0.1.3 or
655 higher.
656
657 For more information see the fdk-aac project at
658 @url{http://sourceforge.net/p/opencore-amr/fdk-aac/}.
659
660 @subsection Options
661
662 The following options are mapped on the shared FFmpeg codec options.
663
664 @table @option
665 @item b
666 Set bit rate in bits/s. If the bitrate is not explicitly specified, it
667 is automatically set to a suitable value depending on the selected
668 profile.
669
670 In case VBR mode is enabled the option is ignored.
671
672 @item ar
673 Set audio sampling rate (in Hz).
674
675 @item channels
676 Set the number of audio channels.
677
678 @item flags +qscale
679 Enable fixed quality, VBR (Variable Bit Rate) mode.
680 Note that VBR is implicitly enabled when the @option{vbr} value is
681 positive.
682
683 @item cutoff
684 Set cutoff frequency. If not specified (or explicitly set to 0) it
685 will use a value automatically computed by the library. Default value
686 is 0.
687
688 @item profile
689 Set audio profile.
690
691 The following profiles are recognized:
692 @table @samp
693 @item aac_low
694 Low Complexity AAC (LC)
695
696 @item aac_he
697 High Efficiency AAC (HE-AAC)
698
699 @item aac_he_v2
700 High Efficiency AAC version 2 (HE-AACv2)
701
702 @item aac_ld
703 Low Delay AAC (LD)
704
705 @item aac_eld
706 Enhanced Low Delay AAC (ELD)
707 @end table
708
709 If not specified it is set to @samp{aac_low}.
710 @end table
711
712 The following are private options of the libfdk_aac encoder.
713
714 @table @option
715 @item afterburner
716 Enable afterburner feature if set to 1, disabled if set to 0. This
717 improves the quality but also the required processing power.
718
719 Default value is 1.
720
721 @item eld_sbr
722 Enable SBR (Spectral Band Replication) for ELD if set to 1, disabled
723 if set to 0.
724
725 Default value is 0.
726
727 @item eld_v2
728 Enable ELDv2 (LD-MPS extension for ELD stereo signals) for ELDv2 if set to 1,
729 disabled if set to 0.
730
731 Note that option is available when fdk-aac version (AACENCODER_LIB_VL0.AACENCODER_LIB_VL1.AACENCODER_LIB_VL2) > (4.0.0).
732
733 Default value is 0.
734
735 @item signaling
736 Set SBR/PS signaling style.
737
738 It can assume one of the following values:
739 @table @samp
740 @item default
741 choose signaling implicitly (explicit hierarchical by default,
742 implicit if global header is disabled)
743
744 @item implicit
745 implicit backwards compatible signaling
746
747 @item explicit_sbr
748 explicit SBR, implicit PS signaling
749
750 @item explicit_hierarchical
751 explicit hierarchical signaling
752 @end table
753
754 Default value is @samp{default}.
755
756 @item latm
757 Output LATM/LOAS encapsulated data if set to 1, disabled if set to 0.
758
759 Default value is 0.
760
761 @item header_period
762 Set StreamMuxConfig and PCE repetition period (in frames) for sending
763 in-band configuration buffers within LATM/LOAS transport layer.
764
765 Must be a 16-bits non-negative integer.
766
767 Default value is 0.
768
769 @item vbr
770 Set VBR mode, from 1 to 5. 1 is lowest quality (though still pretty
771 good) and 5 is highest quality. A value of 0 will disable VBR, and CBR
772 (Constant Bit Rate) is enabled.
773
774 Currently only the @samp{aac_low} profile supports VBR encoding.
775
776 VBR modes 1-5 correspond to roughly the following average bit rates:
777
778 @table @samp
779 @item 1
780 32 kbps/channel
781 @item 2
782 40 kbps/channel
783 @item 3
784 48-56 kbps/channel
785 @item 4
786 64 kbps/channel
787 @item 5
788 about 80-96 kbps/channel
789 @end table
790
791 Default value is 0.
792
793 @item frame_length
794 Set the audio frame length in samples. Default value is the internal
795 default of the library. Refer to the library's documentation for information
796 about supported values.
797 @end table
798
799 @subsection Examples
800
801 @itemize
802 @item
803 Use @command{ffmpeg} to convert an audio file to VBR AAC in an M4A (MP4)
804 container:
805 @example
806 ffmpeg -i input.wav -codec:a libfdk_aac -vbr 3 output.m4a
807 @end example
808
809 @item
810 Use @command{ffmpeg} to convert an audio file to CBR 64k kbps AAC, using the
811 High-Efficiency AAC profile:
812 @example
813 ffmpeg -i input.wav -c:a libfdk_aac -profile:a aac_he -b:a 64k output.m4a
814 @end example
815 @end itemize
816
817 @anchor{libmp3lame}
818 @section libmp3lame
819
820 LAME (Lame Ain't an MP3 Encoder) MP3 encoder wrapper.
821
822 Requires the presence of the libmp3lame headers and library during
823 configuration. You need to explicitly configure the build with
824 @code{--enable-libmp3lame}.
825
826 See @ref{libshine} for a fixed-point MP3 encoder, although with a
827 lower quality.
828
829 @subsection Options
830
831 The following options are supported by the libmp3lame wrapper. The
832 @command{lame}-equivalent of the options are listed in parentheses.
833
834 @table @option
835 @item b (@emph{-b})
836 Set bitrate expressed in bits/s for CBR or ABR. LAME @code{bitrate} is
837 expressed in kilobits/s.
838
839 @item q (@emph{-V})
840 Set constant quality setting for VBR. This option is valid only
841 using the @command{ffmpeg} command-line tool. For library interface
842 users, use @option{global_quality}.
843
844 @item compression_level (@emph{-q})
845 Set algorithm quality. Valid arguments are integers in the 0-9 range,
846 with 0 meaning highest quality but slowest, and 9 meaning fastest
847 while producing the worst quality.
848
849 @item cutoff (@emph{--lowpass})
850 Set lowpass cutoff frequency. If unspecified, the encoder dynamically
851 adjusts the cutoff.
852
853 @item reservoir
854 Enable use of bit reservoir when set to 1. Default value is 1. LAME
855 has this enabled by default, but can be overridden by use
856 @option{--nores} option.
857
858 @item joint_stereo (@emph{-m j})
859 Enable the encoder to use (on a frame by frame basis) either L/R
860 stereo or mid/side stereo. Default value is 1.
861
862 @item abr (@emph{--abr})
863 Enable the encoder to use ABR when set to 1. The @command{lame}
864 @option{--abr} sets the target bitrate, while this options only
865 tells FFmpeg to use ABR still relies on @option{b} to set bitrate.
866
867 @item copyright (@emph{-c})
868 Set MPEG audio copyright flag when set to 1. The default value is 0
869 (disabled).
870
871 @item original (@emph{-o})
872 Set MPEG audio original flag when set to 1. The default value is 1
873 (enabled).
874 @end table
875
876 @section libopencore-amrnb
877
878 OpenCORE Adaptive Multi-Rate Narrowband encoder.
879
880 Requires the presence of the libopencore-amrnb headers and library during
881 configuration. You need to explicitly configure the build with
882 @code{--enable-libopencore-amrnb --enable-version3}.
883
884 This is a mono-only encoder. Officially it only supports 8000Hz sample rate,
885 but you can override it by setting @option{strict} to @samp{unofficial} or
886 lower.
887
888 @subsection Options
889
890 @table @option
891
892 @item b
893 Set bitrate in bits per second. Only the following bitrates are supported,
894 otherwise libavcodec will round to the nearest valid bitrate.
895
896 @table @option
897 @item 4750
898 @item 5150
899 @item 5900
900 @item 6700
901 @item 7400
902 @item 7950
903 @item 10200
904 @item 12200
905 @end table
906
907 @item dtx
908 Allow discontinuous transmission (generate comfort noise) when set to 1. The
909 default value is 0 (disabled).
910
911 @end table
912
913 @section libopus
914
915 libopus Opus Interactive Audio Codec encoder wrapper.
916
917 Requires the presence of the libopus headers and library during
918 configuration. You need to explicitly configure the build with
919 @code{--enable-libopus}.
920
921 @subsection Option Mapping
922
923 Most libopus options are modelled after the @command{opusenc} utility from
924 opus-tools. The following is an option mapping chart describing options
925 supported by the libopus wrapper, and their @command{opusenc}-equivalent
926 in parentheses.
927
928 @table @option
929
930 @item b (@emph{bitrate})
931 Set the bit rate in bits/s.  FFmpeg's @option{b} option is
932 expressed in bits/s, while @command{opusenc}'s @option{bitrate} in
933 kilobits/s.
934
935 @item vbr (@emph{vbr}, @emph{hard-cbr}, and @emph{cvbr})
936 Set VBR mode. The FFmpeg @option{vbr} option has the following
937 valid arguments, with the @command{opusenc} equivalent options
938 in parentheses:
939
940 @table @samp
941 @item off (@emph{hard-cbr})
942 Use constant bit rate encoding.
943
944 @item on (@emph{vbr})
945 Use variable bit rate encoding (the default).
946
947 @item constrained (@emph{cvbr})
948 Use constrained variable bit rate encoding.
949 @end table
950
951 @item compression_level (@emph{comp})
952 Set encoding algorithm complexity. Valid options are integers in
953 the 0-10 range. 0 gives the fastest encodes but lower quality, while 10
954 gives the highest quality but slowest encoding. The default is 10.
955
956 @item frame_duration (@emph{framesize})
957 Set maximum frame size, or duration of a frame in milliseconds. The
958 argument must be exactly the following: 2.5, 5, 10, 20, 40, 60. Smaller
959 frame sizes achieve lower latency but less quality at a given bitrate.
960 Sizes greater than 20ms are only interesting at fairly low bitrates.
961 The default is 20ms.
962
963 @item packet_loss (@emph{expect-loss})
964 Set expected packet loss percentage. The default is 0.
965
966 @item fec (@emph{n/a})
967 Enable inband forward error correction. @option{packet_loss} must be non-zero
968 to take advantage - frequency of FEC 'side-data' is proportional to expected packet loss.
969 Default is disabled.
970
971 @item application (N.A.)
972 Set intended application type. Valid options are listed below:
973
974 @table @samp
975 @item voip
976 Favor improved speech intelligibility.
977 @item audio
978 Favor faithfulness to the input (the default).
979 @item lowdelay
980 Restrict to only the lowest delay modes by disabling voice-optimized
981 modes.
982 @end table
983
984 @item cutoff (N.A.)
985 Set cutoff bandwidth in Hz. The argument must be exactly one of the
986 following: 4000, 6000, 8000, 12000, or 20000, corresponding to
987 narrowband, mediumband, wideband, super wideband, and fullband
988 respectively. The default is 0 (cutoff disabled). Note that libopus
989 forces a wideband cutoff for bitrates < 15 kbps, unless CELT-only
990 (@option{application} set to @samp{lowdelay}) mode is used.
991
992 @item mapping_family (@emph{mapping_family})
993 Set channel mapping family to be used by the encoder. The default value of -1
994 uses mapping family 0 for mono and stereo inputs, and mapping family 1
995 otherwise. The default also disables the surround masking and LFE bandwidth
996 optimzations in libopus, and requires that the input contains 8 channels or
997 fewer.
998
999 Other values include 0 for mono and stereo, 1 for surround sound with masking
1000 and LFE bandwidth optimizations, and 255 for independent streams with an
1001 unspecified channel layout.
1002
1003 @item apply_phase_inv (N.A.) (requires libopus >= 1.2)
1004 If set to 0, disables the use of phase inversion for intensity stereo,
1005 improving the quality of mono downmixes, but slightly reducing normal stereo
1006 quality. The default is 1 (phase inversion enabled).
1007
1008 @end table
1009
1010 @anchor{libshine}
1011 @section libshine
1012
1013 Shine Fixed-Point MP3 encoder wrapper.
1014
1015 Shine is a fixed-point MP3 encoder. It has a far better performance on
1016 platforms without an FPU, e.g. armel CPUs, and some phones and tablets.
1017 However, as it is more targeted on performance than quality, it is not on par
1018 with LAME and other production-grade encoders quality-wise. Also, according to
1019 the project's homepage, this encoder may not be free of bugs as the code was
1020 written a long time ago and the project was dead for at least 5 years.
1021
1022 This encoder only supports stereo and mono input. This is also CBR-only.
1023
1024 The original project (last updated in early 2007) is at
1025 @url{http://sourceforge.net/projects/libshine-fxp/}. We only support the
1026 updated fork by the Savonet/Liquidsoap project at @url{https://github.com/savonet/shine}.
1027
1028 Requires the presence of the libshine headers and library during
1029 configuration. You need to explicitly configure the build with
1030 @code{--enable-libshine}.
1031
1032 See also @ref{libmp3lame}.
1033
1034 @subsection Options
1035
1036 The following options are supported by the libshine wrapper. The
1037 @command{shineenc}-equivalent of the options are listed in parentheses.
1038
1039 @table @option
1040 @item b (@emph{-b})
1041 Set bitrate expressed in bits/s for CBR. @command{shineenc} @option{-b} option
1042 is expressed in kilobits/s.
1043
1044 @end table
1045
1046 @section libtwolame
1047
1048 TwoLAME MP2 encoder wrapper.
1049
1050 Requires the presence of the libtwolame headers and library during
1051 configuration. You need to explicitly configure the build with
1052 @code{--enable-libtwolame}.
1053
1054 @subsection Options
1055
1056 The following options are supported by the libtwolame wrapper. The
1057 @command{twolame}-equivalent options follow the FFmpeg ones and are in
1058 parentheses.
1059
1060 @table @option
1061 @item b (@emph{-b})
1062 Set bitrate expressed in bits/s for CBR. @command{twolame} @option{b}
1063 option is expressed in kilobits/s. Default value is 128k.
1064
1065 @item q (@emph{-V})
1066 Set quality for experimental VBR support. Maximum value range is
1067 from -50 to 50, useful range is from -10 to 10. The higher the
1068 value, the better the quality. This option is valid only using the
1069 @command{ffmpeg} command-line tool. For library interface users,
1070 use @option{global_quality}.
1071
1072 @item mode (@emph{--mode})
1073 Set the mode of the resulting audio. Possible values:
1074
1075 @table @samp
1076 @item auto
1077 Choose mode automatically based on the input. This is the default.
1078 @item stereo
1079 Stereo
1080 @item joint_stereo
1081 Joint stereo
1082 @item dual_channel
1083 Dual channel
1084 @item mono
1085 Mono
1086 @end table
1087
1088 @item psymodel (@emph{--psyc-mode})
1089 Set psychoacoustic model to use in encoding. The argument must be
1090 an integer between -1 and 4, inclusive. The higher the value, the
1091 better the quality. The default value is 3.
1092
1093 @item energy_levels (@emph{--energy})
1094 Enable energy levels extensions when set to 1. The default value is
1095 0 (disabled).
1096
1097 @item error_protection (@emph{--protect})
1098 Enable CRC error protection when set to 1. The default value is 0
1099 (disabled).
1100
1101 @item copyright (@emph{--copyright})
1102 Set MPEG audio copyright flag when set to 1. The default value is 0
1103 (disabled).
1104
1105 @item original (@emph{--original})
1106 Set MPEG audio original flag when set to 1. The default value is 0
1107 (disabled).
1108
1109 @end table
1110
1111 @section libvo-amrwbenc
1112
1113 VisualOn Adaptive Multi-Rate Wideband encoder.
1114
1115 Requires the presence of the libvo-amrwbenc headers and library during
1116 configuration. You need to explicitly configure the build with
1117 @code{--enable-libvo-amrwbenc --enable-version3}.
1118
1119 This is a mono-only encoder. Officially it only supports 16000Hz sample
1120 rate, but you can override it by setting @option{strict} to
1121 @samp{unofficial} or lower.
1122
1123 @subsection Options
1124
1125 @table @option
1126
1127 @item b
1128 Set bitrate in bits/s. Only the following bitrates are supported, otherwise
1129 libavcodec will round to the nearest valid bitrate.
1130
1131 @table @samp
1132 @item 6600
1133 @item 8850
1134 @item 12650
1135 @item 14250
1136 @item 15850
1137 @item 18250
1138 @item 19850
1139 @item 23050
1140 @item 23850
1141 @end table
1142
1143 @item dtx
1144 Allow discontinuous transmission (generate comfort noise) when set to 1. The
1145 default value is 0 (disabled).
1146
1147 @end table
1148
1149 @section libvorbis
1150
1151 libvorbis encoder wrapper.
1152
1153 Requires the presence of the libvorbisenc headers and library during
1154 configuration. You need to explicitly configure the build with
1155 @code{--enable-libvorbis}.
1156
1157 @subsection Options
1158
1159 The following options are supported by the libvorbis wrapper. The
1160 @command{oggenc}-equivalent of the options are listed in parentheses.
1161
1162 To get a more accurate and extensive documentation of the libvorbis
1163 options, consult the libvorbisenc's and @command{oggenc}'s documentations.
1164 See @url{http://xiph.org/vorbis/},
1165 @url{http://wiki.xiph.org/Vorbis-tools}, and oggenc(1).
1166
1167 @table @option
1168 @item b (@emph{-b})
1169 Set bitrate expressed in bits/s for ABR. @command{oggenc} @option{-b} is
1170 expressed in kilobits/s.
1171
1172 @item q (@emph{-q})
1173 Set constant quality setting for VBR. The value should be a float
1174 number in the range of -1.0 to 10.0. The higher the value, the better
1175 the quality. The default value is @samp{3.0}.
1176
1177 This option is valid only using the @command{ffmpeg} command-line tool.
1178 For library interface users, use @option{global_quality}.
1179
1180 @item cutoff (@emph{--advanced-encode-option lowpass_frequency=N})
1181 Set cutoff bandwidth in Hz, a value of 0 disables cutoff. @command{oggenc}'s
1182 related option is expressed in kHz. The default value is @samp{0} (cutoff
1183 disabled).
1184
1185 @item minrate (@emph{-m})
1186 Set minimum bitrate expressed in bits/s. @command{oggenc} @option{-m} is
1187 expressed in kilobits/s.
1188
1189 @item maxrate (@emph{-M})
1190 Set maximum bitrate expressed in bits/s. @command{oggenc} @option{-M} is
1191 expressed in kilobits/s. This only has effect on ABR mode.
1192
1193 @item iblock (@emph{--advanced-encode-option impulse_noisetune=N})
1194 Set noise floor bias for impulse blocks. The value is a float number from
1195 -15.0 to 0.0. A negative bias instructs the encoder to pay special attention
1196 to the crispness of transients in the encoded audio. The tradeoff for better
1197 transient response is a higher bitrate.
1198
1199 @end table
1200
1201 @anchor{mjpegenc}
1202 @section mjpeg
1203
1204 Motion JPEG encoder.
1205
1206 @subsection Options
1207
1208 @table @option
1209 @item huffman
1210 Set the huffman encoding strategy. Possible values:
1211
1212 @table @samp
1213 @item default
1214 Use the default huffman tables. This is the default strategy.
1215
1216 @item optimal
1217 Compute and use optimal huffman tables.
1218
1219 @end table
1220 @end table
1221
1222 @anchor{wavpackenc}
1223 @section wavpack
1224
1225 WavPack lossless audio encoder.
1226
1227 @subsection Options
1228
1229 The equivalent options for @command{wavpack} command line utility are listed in
1230 parentheses.
1231
1232 @subsubsection Shared options
1233
1234 The following shared options are effective for this encoder. Only special notes
1235 about this particular encoder will be documented here. For the general meaning
1236 of the options, see @ref{codec-options,,the Codec Options chapter}.
1237
1238 @table @option
1239 @item frame_size (@emph{--blocksize})
1240 For this encoder, the range for this option is between 128 and 131072. Default
1241 is automatically decided based on sample rate and number of channel.
1242
1243 For the complete formula of calculating default, see
1244 @file{libavcodec/wavpackenc.c}.
1245
1246 @item compression_level (@emph{-f}, @emph{-h}, @emph{-hh}, and @emph{-x})
1247 @end table
1248
1249 @subsubsection Private options
1250
1251 @table @option
1252 @item joint_stereo (@emph{-j})
1253 Set whether to enable joint stereo. Valid values are:
1254
1255 @table @samp
1256 @item on (@emph{1})
1257 Force mid/side audio encoding.
1258 @item off (@emph{0})
1259 Force left/right audio encoding.
1260 @item auto
1261 Let the encoder decide automatically.
1262 @end table
1263
1264 @item optimize_mono
1265 Set whether to enable optimization for mono. This option is only effective for
1266 non-mono streams. Available values:
1267
1268 @table @samp
1269 @item on
1270 enabled
1271 @item off
1272 disabled
1273 @end table
1274
1275 @end table
1276
1277 @c man end AUDIO ENCODERS
1278
1279 @chapter Video Encoders
1280 @c man begin VIDEO ENCODERS
1281
1282 A description of some of the currently available video encoders
1283 follows.
1284
1285 @section a64_multi, a64_multi5
1286
1287 A64 / Commodore 64 multicolor charset encoder. @code{a64_multi5} is extended with 5th color (colram).
1288
1289 @section Cinepak
1290
1291 Cinepak aka CVID encoder.
1292 Compatible with Windows 3.1 and vintage MacOS.
1293
1294 @subsection Options
1295
1296 @table @option
1297 @item g @var{integer}
1298 Keyframe interval.
1299 A keyframe is inserted at least every @code{-g} frames, sometimes sooner.
1300
1301 @item q:v @var{integer}
1302 Quality factor. Lower is better. Higher gives lower bitrate.
1303 The following table lists bitrates when encoding akiyo_cif.y4m for various values of @code{-q:v} with @code{-g 100}:
1304
1305 @table @option
1306 @item @code{-q:v 1} 1918 kb/s
1307 @item @code{-q:v 2} 1735 kb/s
1308 @item @code{-q:v 4} 1500 kb/s
1309 @item @code{-q:v 10} 1041 kb/s
1310 @item @code{-q:v 20} 826 kb/s
1311 @item @code{-q:v 40} 553 kb/s
1312 @item @code{-q:v 100} 394 kb/s
1313 @item @code{-q:v 200} 312 kb/s
1314 @item @code{-q:v 400} 266 kb/s
1315 @item @code{-q:v 1000} 237 kb/s
1316 @end table
1317
1318 @item max_extra_cb_iterations @var{integer}
1319 Max extra codebook recalculation passes, more is better and slower.
1320
1321 @item skip_empty_cb @var{boolean}
1322 Avoid wasting bytes, ignore vintage MacOS decoder.
1323
1324 @item max_strips @var{integer}
1325 @itemx min_strips @var{integer}
1326 The minimum and maximum number of strips to use.
1327 Wider range sometimes improves quality.
1328 More strips is generally better quality but costs more bits.
1329 Fewer strips tend to yield more keyframes.
1330 Vintage compatible is 1..3.
1331
1332 @item strip_number_adaptivity @var{integer}
1333 How much number of strips is allowed to change between frames.
1334 Higher is better but slower.
1335
1336 @end table
1337
1338 @section GIF
1339
1340 GIF image/animation encoder.
1341
1342 @subsection Options
1343
1344 @table @option
1345 @item gifflags @var{integer}
1346 Sets the flags used for GIF encoding.
1347
1348 @table @option
1349 @item offsetting
1350 Enables picture offsetting.
1351
1352 Default is enabled.
1353
1354 @item transdiff
1355 Enables transparency detection between frames.
1356
1357 Default is enabled.
1358
1359 @end table
1360
1361 @item gifimage @var{integer}
1362 Enables encoding one full GIF image per frame, rather than an animated GIF.
1363
1364 Default value is @option{0}.
1365
1366 @item global_palette @var{integer}
1367 Writes a palette to the global GIF header where feasible.
1368
1369 If disabled, every frame will always have a palette written, even if there
1370 is a global palette supplied.
1371
1372 Default value is @option{1}.
1373
1374 @end table
1375
1376 @section Hap
1377
1378 Vidvox Hap video encoder.
1379
1380 @subsection Options
1381
1382 @table @option
1383 @item format @var{integer}
1384 Specifies the Hap format to encode.
1385
1386 @table @option
1387 @item hap
1388 @item hap_alpha
1389 @item hap_q
1390 @end table
1391
1392 Default value is @option{hap}.
1393
1394 @item chunks @var{integer}
1395 Specifies the number of chunks to split frames into, between 1 and 64. This
1396 permits multithreaded decoding of large frames, potentially at the cost of
1397 data-rate. The encoder may modify this value to divide frames evenly.
1398
1399 Default value is @var{1}.
1400
1401 @item compressor @var{integer}
1402 Specifies the second-stage compressor to use. If set to @option{none},
1403 @option{chunks} will be limited to 1, as chunked uncompressed frames offer no
1404 benefit.
1405
1406 @table @option
1407 @item none
1408 @item snappy
1409 @end table
1410
1411 Default value is @option{snappy}.
1412
1413 @end table
1414
1415 @section jpeg2000
1416
1417 The native jpeg 2000 encoder is lossy by default, the @code{-q:v}
1418 option can be used to set the encoding quality. Lossless encoding
1419 can be selected with @code{-pred 1}.
1420
1421 @subsection Options
1422
1423 @table @option
1424 @item format @var{integer}
1425 Can be set to either @code{j2k} or @code{jp2} (the default) that
1426 makes it possible to store non-rgb pix_fmts.
1427
1428 @item tile_width @var{integer}
1429 Sets tile width. Range is 1 to 1073741824. Default is 256.
1430
1431 @item tile_height @var{integer}
1432 Sets tile height. Range is 1 to 1073741824. Default is 256.
1433
1434 @item pred @var{integer}
1435 Allows setting the discrete wavelet transform (DWT) type
1436 @table @option
1437 @item dwt97int (Lossy)
1438 @item dwt53 (Lossless)
1439 @end table
1440 Default is @code{dwt97int}
1441
1442 @item sop @var{boolean}
1443 Enable this to add SOP marker at the start of each packet. Disabled by default.
1444
1445 @item eph @var{boolean}
1446 Enable this to add EPH marker at the end of each packet header. Disabled by default.
1447
1448 @item prog @var{integer}
1449 Sets the progression order to be used by the encoder.
1450 Possible values are:
1451 @table @option
1452 @item lrcp
1453 @item rlcp
1454 @item rpcl
1455 @item pcrl
1456 @item cprl
1457 @end table
1458 Set to @code{lrcp} by default.
1459
1460 @item layer_rates @var{string}
1461 By default, when this option is not used, compression is done using the quality metric.
1462 This option allows for compression using compression ratio. The compression ratio for each
1463 level could be specified. The compression ratio of a layer @code{l} species the what ratio of
1464 total file size is contained in the first @code{l} layers.
1465
1466 Example usage:
1467
1468 @example
1469 ffmpeg -i input.bmp -c:v jpeg2000 -layer_rates "100,10,1" output.j2k
1470 @end example
1471
1472 This would compress the image to contain 3 layers, where the data contained in the
1473 first layer would be compressed by 1000 times, compressed by 100 in the first two layers,
1474 and shall contain all data while using all 3 layers.
1475
1476 @end table
1477
1478 @section librav1e
1479
1480 rav1e AV1 encoder wrapper.
1481
1482 Requires the presence of the rav1e headers and library during configuration.
1483 You need to explicitly configure the build with @code{--enable-librav1e}.
1484
1485 @subsection Options
1486
1487 @table @option
1488 @item qmax
1489 Sets the maximum quantizer to use when using bitrate mode.
1490
1491 @item qmin
1492 Sets the minimum quantizer to use when using bitrate mode.
1493
1494 @item qp
1495 Uses quantizer mode to encode at the given quantizer (0-255).
1496
1497 @item speed
1498 Selects the speed preset (0-10) to encode with.
1499
1500 @item tiles
1501 Selects how many tiles to encode with.
1502
1503 @item tile-rows
1504 Selects how many rows of tiles to encode with.
1505
1506 @item tile-columns
1507 Selects how many columns of tiles to encode with.
1508
1509 @item rav1e-params
1510 Set rav1e options using a list of @var{key}=@var{value} pairs separated
1511 by ":". See @command{rav1e --help} for a list of options.
1512
1513 For example to specify librav1e encoding options with @option{-rav1e-params}:
1514
1515 @example
1516 ffmpeg -i input -c:v librav1e -b:v 500K -rav1e-params speed=5:low_latency=true output.mp4
1517 @end example
1518
1519 @end table
1520
1521 @section libaom-av1
1522
1523 libaom AV1 encoder wrapper.
1524
1525 Requires the presence of the libaom headers and library during
1526 configuration.  You need to explicitly configure the build with
1527 @code{--enable-libaom}.
1528
1529 @subsection Options
1530
1531 The wrapper supports the following standard libavcodec options:
1532
1533 @table @option
1534
1535 @item b
1536 Set bitrate target in bits/second.  By default this will use
1537 variable-bitrate mode.  If @option{maxrate} and @option{minrate} are
1538 also set to the same value then it will use constant-bitrate mode,
1539 otherwise if @option{crf} is set as well then it will use
1540 constrained-quality mode.
1541
1542 @item g keyint_min
1543 Set key frame placement.  The GOP size sets the maximum distance between
1544 key frames; if zero the output stream will be intra-only.  The minimum
1545 distance is ignored unless it is the same as the GOP size, in which case
1546 key frames will always appear at a fixed interval.  Not set by default,
1547 so without this option the library has completely free choice about
1548 where to place key frames.
1549
1550 @item qmin qmax
1551 Set minimum/maximum quantisation values.  Valid range is from 0 to 63
1552 (warning: this does not match the quantiser values actually used by AV1
1553 - divide by four to map real quantiser values to this range).  Defaults
1554 to min/max (no constraint).
1555
1556 @item minrate maxrate bufsize rc_init_occupancy
1557 Set rate control buffering parameters.  Not used if not set - defaults
1558 to unconstrained variable bitrate.
1559
1560 @item threads
1561 Set the number of threads to use while encoding.  This may require the
1562 @option{tiles} or @option{row-mt} options to also be set to actually
1563 use the specified number of threads fully. Defaults to the number of
1564 hardware threads supported by the host machine.
1565
1566 @item profile
1567 Set the encoding profile.  Defaults to using the profile which matches
1568 the bit depth and chroma subsampling of the input.
1569
1570 @end table
1571
1572 The wrapper also has some specific options:
1573
1574 @table @option
1575
1576 @item cpu-used
1577 Set the quality/encoding speed tradeoff.  Valid range is from 0 to 8,
1578 higher numbers indicating greater speed and lower quality.  The default
1579 value is 1, which will be slow and high quality.
1580
1581 @item auto-alt-ref
1582 Enable use of alternate reference frames.  Defaults to the internal
1583 default of the library.
1584
1585 @item arnr-max-frames (@emph{frames})
1586 Set altref noise reduction max frame count. Default is -1.
1587
1588 @item arnr-strength (@emph{strength})
1589 Set altref noise reduction filter strength. Range is -1 to 6. Default is -1.
1590
1591 @item aq-mode (@emph{aq-mode})
1592 Set adaptive quantization mode. Possible values:
1593
1594 @table @samp
1595 @item none (@emph{0})
1596 Disabled.
1597
1598 @item variance (@emph{1})
1599 Variance-based.
1600
1601 @item complexity (@emph{2})
1602 Complexity-based.
1603
1604 @item cyclic (@emph{3})
1605 Cyclic refresh.
1606 @end table
1607
1608 @item tune (@emph{tune})
1609 Set the distortion metric the encoder is tuned with. Default is @code{psnr}.
1610
1611 @table @samp
1612 @item psnr (@emph{0})
1613
1614 @item ssim (@emph{1})
1615 @end table
1616
1617 @item lag-in-frames
1618 Set the maximum number of frames which the encoder may keep in flight
1619 at any one time for lookahead purposes.  Defaults to the internal
1620 default of the library.
1621
1622 @item error-resilience
1623 Enable error resilience features:
1624 @table @option
1625 @item default
1626 Improve resilience against losses of whole frames.
1627 @end table
1628 Not enabled by default.
1629
1630 @item crf
1631 Set the quality/size tradeoff for constant-quality (no bitrate target)
1632 and constrained-quality (with maximum bitrate target) modes. Valid
1633 range is 0 to 63, higher numbers indicating lower quality and smaller
1634 output size.  Only used if set; by default only the bitrate target is
1635 used.
1636
1637 @item static-thresh
1638 Set a change threshold on blocks below which they will be skipped by
1639 the encoder.  Defined in arbitrary units as a nonnegative integer,
1640 defaulting to zero (no blocks are skipped).
1641
1642 @item drop-threshold
1643 Set a threshold for dropping frames when close to rate control bounds.
1644 Defined as a percentage of the target buffer - when the rate control
1645 buffer falls below this percentage, frames will be dropped until it
1646 has refilled above the threshold.  Defaults to zero (no frames are
1647 dropped).
1648
1649 @item denoise-noise-level (@emph{level})
1650 Amount of noise to be removed for grain synthesis. Grain synthesis is disabled if
1651 this option is not set or set to 0.
1652
1653 @item denoise-block-size (@emph{pixels})
1654 Block size used for denoising for grain synthesis. If not set, AV1 codec
1655 uses the default value of 32.
1656
1657 @item undershoot-pct (@emph{pct})
1658 Set datarate undershoot (min) percentage of the target bitrate. Range is -1 to 100.
1659 Default is -1.
1660
1661 @item overshoot-pct (@emph{pct})
1662 Set datarate overshoot (max) percentage of the target bitrate. Range is -1 to 1000.
1663 Default is -1.
1664
1665 @item minsection-pct (@emph{pct})
1666 Minimum percentage variation of the GOP bitrate from the target bitrate. If minsection-pct
1667 is not set, the libaomenc wrapper computes it as follows: @code{(minrate * 100 / bitrate)}.
1668 Range is -1 to 100. Default is -1 (unset).
1669
1670 @item maxsection-pct (@emph{pct})
1671 Maximum percentage variation of the GOP bitrate from the target bitrate. If maxsection-pct
1672 is not set, the libaomenc wrapper computes it as follows: @code{(maxrate * 100 / bitrate)}.
1673 Range is -1 to 5000. Default is -1 (unset).
1674
1675 @item frame-parallel (@emph{boolean})
1676 Enable frame parallel decodability features. Default is true.
1677
1678 @item tiles
1679 Set the number of tiles to encode the input video with, as columns x
1680 rows.  Larger numbers allow greater parallelism in both encoding and
1681 decoding, but may decrease coding efficiency.  Defaults to the minimum
1682 number of tiles required by the size of the input video (this is 1x1
1683 (that is, a single tile) for sizes up to and including 4K).
1684
1685 @item tile-columns tile-rows
1686 Set the number of tiles as log2 of the number of tile rows and columns.
1687 Provided for compatibility with libvpx/VP9.
1688
1689 @item row-mt (Requires libaom >= 1.0.0-759-g90a15f4f2)
1690 Enable row based multi-threading. Disabled by default.
1691
1692 @item enable-cdef (@emph{boolean})
1693 Enable Constrained Directional Enhancement Filter. The libaom-av1
1694 encoder enables CDEF by default.
1695
1696 @item enable-restoration (@emph{boolean})
1697 Enable Loop Restoration Filter. Default is true for libaom-av1.
1698
1699 @item enable-global-motion (@emph{boolean})
1700 Enable the use of global motion for block prediction. Default is true.
1701
1702 @item enable-intrabc (@emph{boolean})
1703 Enable block copy mode for intra block prediction. This mode is
1704 useful for screen content. Default is true.
1705
1706 @item enable-rect-partitions (@emph{boolean}) (Requires libaom >= v2.0.0)
1707 Enable rectangular partitions. Default is true.
1708
1709 @item enable-1to4-partitions (@emph{boolean}) (Requires libaom >= v2.0.0)
1710 Enable 1:4/4:1 partitions. Default is true.
1711
1712 @item enable-ab-partitions (@emph{boolean}) (Requires libaom >= v2.0.0)
1713 Enable AB shape partitions. Default is true.
1714
1715 @item enable-angle-delta (@emph{boolean}) (Requires libaom >= v2.0.0)
1716 Enable angle delta intra prediction. Default is true.
1717
1718 @item enable-cfl-intra (@emph{boolean}) (Requires libaom >= v2.0.0)
1719 Enable chroma predicted from luma intra prediction. Default is true.
1720
1721 @item enable-filter-intra (@emph{boolean}) (Requires libaom >= v2.0.0)
1722 Enable filter intra predictor. Default is true.
1723
1724 @item enable-intra-edge-filter (@emph{boolean}) (Requires libaom >= v2.0.0)
1725 Enable intra edge filter. Default is true.
1726
1727 @item enable-smooth-intra (@emph{boolean}) (Requires libaom >= v2.0.0)
1728 Enable smooth intra prediction mode. Default is true.
1729
1730 @item enable-paeth-intra (@emph{boolean}) (Requires libaom >= v2.0.0)
1731 Enable paeth predictor in intra prediction. Default is true.
1732
1733 @item enable-palette (@emph{boolean}) (Requires libaom >= v2.0.0)
1734 Enable palette prediction mode. Default is true.
1735
1736 @item enable-flip-idtx (@emph{boolean}) (Requires libaom >= v2.0.0)
1737 Enable extended transform type, including FLIPADST_DCT, DCT_FLIPADST,
1738 FLIPADST_FLIPADST, ADST_FLIPADST, FLIPADST_ADST, IDTX, V_DCT, H_DCT,
1739 V_ADST, H_ADST, V_FLIPADST, H_FLIPADST. Default is true.
1740
1741 @item enable-tx64 (@emph{boolean}) (Requires libaom >= v2.0.0)
1742 Enable 64-pt transform. Default is true.
1743
1744 @item reduced-tx-type-set (@emph{boolean}) (Requires libaom >= v2.0.0)
1745 Use reduced set of transform types. Default is false.
1746
1747 @item use-intra-dct-only (@emph{boolean}) (Requires libaom >= v2.0.0)
1748 Use DCT only for INTRA modes. Default is false.
1749
1750 @item use-inter-dct-only (@emph{boolean}) (Requires libaom >= v2.0.0)
1751 Use DCT only for INTER modes. Default is false.
1752
1753 @item use-intra-default-tx-only (@emph{boolean}) (Requires libaom >= v2.0.0)
1754 Use Default-transform only for INTRA modes. Default is false.
1755
1756 @item enable-ref-frame-mvs (@emph{boolean}) (Requires libaom >= v2.0.0)
1757 Enable temporal mv prediction. Default is true.
1758
1759 @item enable-reduced-reference-set (@emph{boolean}) (Requires libaom >= v2.0.0)
1760 Use reduced set of single and compound references. Default is false.
1761
1762 @item enable-obmc (@emph{boolean}) (Requires libaom >= v2.0.0)
1763 Enable obmc. Default is true.
1764
1765 @item enable-dual-filter (@emph{boolean}) (Requires libaom >= v2.0.0)
1766 Enable dual filter. Default is true.
1767
1768 @item enable-diff-wtd-comp (@emph{boolean}) (Requires libaom >= v2.0.0)
1769 Enable difference-weighted compound. Default is true.
1770
1771 @item enable-dist-wtd-comp (@emph{boolean}) (Requires libaom >= v2.0.0)
1772 Enable distance-weighted compound. Default is true.
1773
1774 @item enable-onesided-comp (@emph{boolean}) (Requires libaom >= v2.0.0)
1775 Enable one sided compound. Default is true.
1776
1777 @item enable-interinter-wedge (@emph{boolean}) (Requires libaom >= v2.0.0)
1778 Enable interinter wedge compound. Default is true.
1779
1780 @item enable-interintra-wedge (@emph{boolean}) (Requires libaom >= v2.0.0)
1781 Enable interintra wedge compound. Default is true.
1782
1783 @item enable-masked-comp (@emph{boolean}) (Requires libaom >= v2.0.0)
1784 Enable masked compound. Default is true.
1785
1786 @item enable-interintra-comp (@emph{boolean}) (Requires libaom >= v2.0.0)
1787 Enable interintra compound. Default is true.
1788
1789 @item enable-smooth-interintra (@emph{boolean}) (Requires libaom >= v2.0.0)
1790 Enable smooth interintra mode. Default is true.
1791
1792 @item aom-params
1793 Set libaom options using a list of @var{key}=@var{value} pairs separated
1794 by ":". For a list of supported options, see @command{aomenc --help} under the
1795 section "AV1 Specific Options".
1796
1797 For example to specify libaom encoding options with @option{-aom-params}:
1798
1799 @example
1800 ffmpeg -i input -c:v libaom-av1 -b:v 500K -aom-params tune=psnr:enable-tpl-model=1 output.mp4
1801 @end example
1802
1803 @end table
1804
1805 @section libsvtav1
1806
1807 SVT-AV1 encoder wrapper.
1808
1809 Requires the presence of the SVT-AV1 headers and library during configuration.
1810 You need to explicitly configure the build with @code{--enable-libsvtav1}.
1811
1812 @subsection Options
1813
1814 @table @option
1815 @item profile
1816 Set the encoding profile.
1817 @table @samp
1818 @item main
1819 @item high
1820 @item professional
1821 @end table
1822
1823 @item level
1824 Set the operating point level. For example: '4.0'
1825
1826 @item hielevel
1827 Set the Hierarchical prediction levels.
1828 @table @samp
1829 @item 3level
1830 @item 4level
1831 This is the default.
1832 @end table
1833
1834 @item tier
1835 Set the operating point tier.
1836 @table @samp
1837 @item main
1838 This is the default.
1839 @item high
1840 @end table
1841
1842 @item qmax
1843 Set the maximum quantizer to use when using a bitrate mode.
1844
1845 @item qmin
1846 Set the minimum quantizer to use when using a bitrate mode.
1847
1848 @item crf
1849 Constant rate factor value used in crf rate control mode (0-63).
1850
1851 @item qp
1852 Set the quantizer used in cqp rate control mode (0-63).
1853
1854 @item sc_detection
1855 Enable scene change detection.
1856
1857 @item la_depth
1858 Set number of frames to look ahead (0-120).
1859
1860 @item preset
1861 Set the quality-speed tradeoff, in the range 0 to 13.  Higher values are
1862 faster but lower quality.
1863
1864 @item tile_rows
1865 Set log2 of the number of rows of tiles to use (0-6).
1866
1867 @item tile_columns
1868 Set log2 of the number of columns of tiles to use (0-4).
1869
1870 @item svtav1-params
1871 Set SVT-AV1 options using a list of @var{key}=@var{value} pairs separated
1872 by ":". See the SVT-AV1 encoder user guide for a list of accepted parameters.
1873
1874 @end table
1875
1876 @section libjxl
1877
1878 libjxl JPEG XL encoder wrapper.
1879
1880 Requires the presence of the libjxl headers and library during
1881 configuration. You need to explicitly configure the build with
1882 @code{--enable-libjxl}.
1883
1884 @subsection Options
1885
1886 The libjxl wrapper supports the following options:
1887
1888 @table @option
1889
1890 @item distance
1891 Set the target Butteraugli distance. This is a quality setting: lower
1892 distance yields higher quality, with distance=1.0 roughly comparable to
1893 libjpeg Quality 90 for photographic content. Setting distance=0.0 yields
1894 true lossless encoding. Valid values range between 0.0 and 15.0, and sane
1895 values rarely exceed 5.0. Setting distance=0.1 usually attains
1896 transparency for most input. The default is 1.0.
1897
1898 @item effort
1899 Set the encoding effort used. Higher effort values produce more consistent
1900 quality and usually produces a better quality/bpp curve, at the cost of
1901 more CPU time required. Valid values range from 1 to 9, and the default is 7.
1902
1903 @item modular
1904 Force the encoder to use Modular mode instead of choosing automatically. The
1905 default is to use VarDCT for lossy encoding and Modular for lossless. VarDCT
1906 is generally superior to Modular for lossy encoding but does not support
1907 lossless encoding.
1908
1909 @end table
1910
1911 @section libkvazaar
1912
1913 Kvazaar H.265/HEVC encoder.
1914
1915 Requires the presence of the libkvazaar headers and library during
1916 configuration. You need to explicitly configure the build with
1917 @option{--enable-libkvazaar}.
1918
1919 @subsection Options
1920
1921 @table @option
1922
1923 @item b
1924 Set target video bitrate in bit/s and enable rate control.
1925
1926 @item kvazaar-params
1927 Set kvazaar parameters as a list of @var{name}=@var{value} pairs separated
1928 by commas (,). See kvazaar documentation for a list of options.
1929
1930 @end table
1931
1932 @section libopenh264
1933
1934 Cisco libopenh264 H.264/MPEG-4 AVC encoder wrapper.
1935
1936 This encoder requires the presence of the libopenh264 headers and
1937 library during configuration. You need to explicitly configure the
1938 build with @code{--enable-libopenh264}. The library is detected using
1939 @command{pkg-config}.
1940
1941 For more information about the library see
1942 @url{http://www.openh264.org}.
1943
1944 @subsection Options
1945
1946 The following FFmpeg global options affect the configurations of the
1947 libopenh264 encoder.
1948
1949 @table @option
1950 @item b
1951 Set the bitrate (as a number of bits per second).
1952
1953 @item g
1954 Set the GOP size.
1955
1956 @item maxrate
1957 Set the max bitrate (as a number of bits per second).
1958
1959 @item flags +global_header
1960 Set global header in the bitstream.
1961
1962 @item slices
1963 Set the number of slices, used in parallelized encoding. Default value
1964 is 0. This is only used when @option{slice_mode} is set to
1965 @samp{fixed}.
1966
1967 @item loopfilter
1968 Enable loop filter, if set to 1 (automatically enabled). To disable
1969 set a value of 0.
1970
1971 @item profile
1972 Set profile restrictions. If set to the value of @samp{main} enable
1973 CABAC (set the @code{SEncParamExt.iEntropyCodingModeFlag} flag to 1).
1974
1975 @item max_nal_size
1976 Set maximum NAL size in bytes.
1977
1978 @item allow_skip_frames
1979 Allow skipping frames to hit the target bitrate if set to 1.
1980 @end table
1981
1982 @section libtheora
1983
1984 libtheora Theora encoder wrapper.
1985
1986 Requires the presence of the libtheora headers and library during
1987 configuration. You need to explicitly configure the build with
1988 @code{--enable-libtheora}.
1989
1990 For more information about the libtheora project see
1991 @url{http://www.theora.org/}.
1992
1993 @subsection Options
1994
1995 The following global options are mapped to internal libtheora options
1996 which affect the quality and the bitrate of the encoded stream.
1997
1998 @table @option
1999 @item b
2000 Set the video bitrate in bit/s for CBR (Constant Bit Rate) mode.  In
2001 case VBR (Variable Bit Rate) mode is enabled this option is ignored.
2002
2003 @item flags
2004 Used to enable constant quality mode (VBR) encoding through the
2005 @option{qscale} flag, and to enable the @code{pass1} and @code{pass2}
2006 modes.
2007
2008 @item g
2009 Set the GOP size.
2010
2011 @item global_quality
2012 Set the global quality as an integer in lambda units.
2013
2014 Only relevant when VBR mode is enabled with @code{flags +qscale}. The
2015 value is converted to QP units by dividing it by @code{FF_QP2LAMBDA},
2016 clipped in the [0 - 10] range, and then multiplied by 6.3 to get a
2017 value in the native libtheora range [0-63]. A higher value corresponds
2018 to a higher quality.
2019
2020 @item q
2021 Enable VBR mode when set to a non-negative value, and set constant
2022 quality value as a double floating point value in QP units.
2023
2024 The value is clipped in the [0-10] range, and then multiplied by 6.3
2025 to get a value in the native libtheora range [0-63].
2026
2027 This option is valid only using the @command{ffmpeg} command-line
2028 tool. For library interface users, use @option{global_quality}.
2029 @end table
2030
2031 @subsection Examples
2032
2033 @itemize
2034 @item
2035 Set maximum constant quality (VBR) encoding with @command{ffmpeg}:
2036 @example
2037 ffmpeg -i INPUT -codec:v libtheora -q:v 10 OUTPUT.ogg
2038 @end example
2039
2040 @item
2041 Use @command{ffmpeg} to convert a CBR 1000 kbps Theora video stream:
2042 @example
2043 ffmpeg -i INPUT -codec:v libtheora -b:v 1000k OUTPUT.ogg
2044 @end example
2045 @end itemize
2046
2047 @section libvpx
2048
2049 VP8/VP9 format supported through libvpx.
2050
2051 Requires the presence of the libvpx headers and library during configuration.
2052 You need to explicitly configure the build with @code{--enable-libvpx}.
2053
2054 @subsection Options
2055
2056 The following options are supported by the libvpx wrapper. The
2057 @command{vpxenc}-equivalent options or values are listed in parentheses
2058 for easy migration.
2059
2060 To reduce the duplication of documentation, only the private options
2061 and some others requiring special attention are documented here. For
2062 the documentation of the undocumented generic options, see
2063 @ref{codec-options,,the Codec Options chapter}.
2064
2065 To get more documentation of the libvpx options, invoke the command
2066 @command{ffmpeg -h encoder=libvpx}, @command{ffmpeg -h encoder=libvpx-vp9} or
2067 @command{vpxenc --help}. Further information is available in the libvpx API
2068 documentation.
2069
2070 @table @option
2071
2072 @item b (@emph{target-bitrate})
2073 Set bitrate in bits/s. Note that FFmpeg's @option{b} option is
2074 expressed in bits/s, while @command{vpxenc}'s @option{target-bitrate} is in
2075 kilobits/s.
2076
2077 @item g (@emph{kf-max-dist})
2078
2079 @item keyint_min (@emph{kf-min-dist})
2080
2081 @item qmin (@emph{min-q})
2082 Minimum (Best Quality) Quantizer.
2083
2084 @item qmax (@emph{max-q})
2085 Maximum (Worst Quality) Quantizer.
2086 Can be changed per-frame.
2087
2088 @item bufsize (@emph{buf-sz}, @emph{buf-optimal-sz})
2089 Set ratecontrol buffer size (in bits). Note @command{vpxenc}'s options are
2090 specified in milliseconds, the libvpx wrapper converts this value as follows:
2091 @code{buf-sz = bufsize * 1000 / bitrate},
2092 @code{buf-optimal-sz = bufsize * 1000 / bitrate * 5 / 6}.
2093
2094 @item rc_init_occupancy (@emph{buf-initial-sz})
2095 Set number of bits which should be loaded into the rc buffer before decoding
2096 starts. Note @command{vpxenc}'s option is specified in milliseconds, the libvpx
2097 wrapper converts this value as follows:
2098 @code{rc_init_occupancy * 1000 / bitrate}.
2099
2100 @item undershoot-pct
2101 Set datarate undershoot (min) percentage of the target bitrate.
2102
2103 @item overshoot-pct
2104 Set datarate overshoot (max) percentage of the target bitrate.
2105
2106 @item skip_threshold (@emph{drop-frame})
2107
2108 @item qcomp (@emph{bias-pct})
2109
2110 @item maxrate (@emph{maxsection-pct})
2111 Set GOP max bitrate in bits/s. Note @command{vpxenc}'s option is specified as a
2112 percentage of the target bitrate, the libvpx wrapper converts this value as
2113 follows: @code{(maxrate * 100 / bitrate)}.
2114
2115 @item minrate (@emph{minsection-pct})
2116 Set GOP min bitrate in bits/s. Note @command{vpxenc}'s option is specified as a
2117 percentage of the target bitrate, the libvpx wrapper converts this value as
2118 follows: @code{(minrate * 100 / bitrate)}.
2119
2120 @item minrate, maxrate, b @emph{end-usage=cbr}
2121 @code{(minrate == maxrate == bitrate)}.
2122
2123 @item crf (@emph{end-usage=cq}, @emph{cq-level})
2124
2125 @item tune (@emph{tune})
2126 @table @samp
2127 @item psnr (@emph{psnr})
2128 @item ssim (@emph{ssim})
2129 @end table
2130
2131 @item quality, deadline (@emph{deadline})
2132 @table @samp
2133 @item best
2134 Use best quality deadline. Poorly named and quite slow, this option should be
2135 avoided as it may give worse quality output than good.
2136 @item good
2137 Use good quality deadline. This is a good trade-off between speed and quality
2138 when used with the @option{cpu-used} option.
2139 @item realtime
2140 Use realtime quality deadline.
2141 @end table
2142
2143 @item speed, cpu-used (@emph{cpu-used})
2144 Set quality/speed ratio modifier. Higher values speed up the encode at the cost
2145 of quality.
2146
2147 @item nr (@emph{noise-sensitivity})
2148
2149 @item static-thresh
2150 Set a change threshold on blocks below which they will be skipped by the
2151 encoder.
2152
2153 @item slices (@emph{token-parts})
2154 Note that FFmpeg's @option{slices} option gives the total number of partitions,
2155 while @command{vpxenc}'s @option{token-parts} is given as
2156 @code{log2(partitions)}.
2157
2158 @item max-intra-rate
2159 Set maximum I-frame bitrate as a percentage of the target bitrate. A value of 0
2160 means unlimited.
2161
2162 @item force_key_frames
2163 @code{VPX_EFLAG_FORCE_KF}
2164
2165 @item Alternate reference frame related
2166 @table @option
2167 @item auto-alt-ref
2168 Enable use of alternate reference frames (2-pass only).
2169 Values greater than 1 enable multi-layer alternate reference frames (VP9 only).
2170 @item arnr-maxframes
2171 Set altref noise reduction max frame count.
2172 @item arnr-type
2173 Set altref noise reduction filter type: backward, forward, centered.
2174 @item arnr-strength
2175 Set altref noise reduction filter strength.
2176 @item rc-lookahead, lag-in-frames (@emph{lag-in-frames})
2177 Set number of frames to look ahead for frametype and ratecontrol.
2178 @item min-gf-interval
2179 Set minimum golden/alternate reference frame interval (VP9 only).
2180 @end table
2181
2182 @item error-resilient
2183 Enable error resiliency features.
2184
2185 @item sharpness @var{integer}
2186 Increase sharpness at the expense of lower PSNR.
2187 The valid range is [0, 7].
2188
2189 @item ts-parameters
2190 Sets the temporal scalability configuration using a :-separated list of
2191 key=value pairs. For example, to specify temporal scalability parameters
2192 with @code{ffmpeg}:
2193 @example
2194 ffmpeg -i INPUT -c:v libvpx -ts-parameters ts_number_layers=3:\
2195 ts_target_bitrate=250,500,1000:ts_rate_decimator=4,2,1:\
2196 ts_periodicity=4:ts_layer_id=0,2,1,2:ts_layering_mode=3 OUTPUT
2197 @end example
2198 Below is a brief explanation of each of the parameters, please
2199 refer to @code{struct vpx_codec_enc_cfg} in @code{vpx/vpx_encoder.h} for more
2200 details.
2201 @table @option
2202 @item ts_number_layers
2203 Number of temporal coding layers.
2204 @item ts_target_bitrate
2205 Target bitrate for each temporal layer (in kbps).
2206 (bitrate should be inclusive of the lower temporal layer).
2207 @item ts_rate_decimator
2208 Frame rate decimation factor for each temporal layer.
2209 @item ts_periodicity
2210 Length of the sequence defining frame temporal layer membership.
2211 @item ts_layer_id
2212 Template defining the membership of frames to temporal layers.
2213 @item ts_layering_mode
2214 (optional) Selecting the temporal structure from a set of pre-defined temporal layering modes.
2215 Currently supports the following options.
2216 @table @option
2217 @item 0
2218 No temporal layering flags are provided internally,
2219 relies on flags being passed in using @code{metadata} field in @code{AVFrame}
2220 with following keys.
2221 @table @option
2222 @item vp8-flags
2223 Sets the flags passed into the encoder to indicate the referencing scheme for
2224 the current frame.
2225 Refer to function @code{vpx_codec_encode} in @code{vpx/vpx_encoder.h} for more
2226 details.
2227 @item temporal_id
2228 Explicitly sets the temporal id of the current frame to encode.
2229 @end table
2230 @item 2
2231 Two temporal layers. 0-1...
2232 @item 3
2233 Three temporal layers. 0-2-1-2...; with single reference frame.
2234 @item 4
2235 Same as option "3", except there is a dependency between
2236 the two temporal layer 2 frames within the temporal period.
2237 @end table
2238 @end table
2239
2240 @item VP9-specific options
2241 @table @option
2242 @item lossless
2243 Enable lossless mode.
2244 @item tile-columns
2245 Set number of tile columns to use. Note this is given as
2246 @code{log2(tile_columns)}. For example, 8 tile columns would be requested by
2247 setting the @option{tile-columns} option to 3.
2248 @item tile-rows
2249 Set number of tile rows to use. Note this is given as @code{log2(tile_rows)}.
2250 For example, 4 tile rows would be requested by setting the @option{tile-rows}
2251 option to 2.
2252 @item frame-parallel
2253 Enable frame parallel decodability features.
2254 @item aq-mode
2255 Set adaptive quantization mode (0: off (default), 1: variance 2: complexity, 3:
2256 cyclic refresh, 4: equator360).
2257 @item colorspace @emph{color-space}
2258 Set input color space. The VP9 bitstream supports signaling the following
2259 colorspaces:
2260 @table @option
2261 @item @samp{rgb} @emph{sRGB}
2262 @item @samp{bt709} @emph{bt709}
2263 @item @samp{unspecified} @emph{unknown}
2264 @item @samp{bt470bg} @emph{bt601}
2265 @item @samp{smpte170m} @emph{smpte170}
2266 @item @samp{smpte240m} @emph{smpte240}
2267 @item @samp{bt2020_ncl} @emph{bt2020}
2268 @end table
2269 @item row-mt @var{boolean}
2270 Enable row based multi-threading.
2271 @item tune-content
2272 Set content type: default (0), screen (1), film (2).
2273 @item corpus-complexity
2274 Corpus VBR mode is a variant of standard VBR where the complexity distribution
2275 midpoint is passed in rather than calculated for a specific clip or chunk.
2276
2277 The valid range is [0, 10000]. 0 (default) uses standard VBR.
2278 @item enable-tpl @var{boolean}
2279 Enable temporal dependency model.
2280 @item ref-frame-config
2281 Using per-frame metadata, set members of the structure @code{vpx_svc_ref_frame_config_t} in @code{vpx/vp8cx.h} to fine-control referencing schemes and frame buffer management.
2282 @*Use a :-separated list of key=value pairs.
2283 For example,
2284 @example
2285 av_dict_set(&av_frame->metadata, "ref-frame-config", \
2286 "rfc_update_buffer_slot=7:rfc_lst_fb_idx=0:rfc_gld_fb_idx=1:rfc_alt_fb_idx=2:rfc_reference_last=0:rfc_reference_golden=0:rfc_reference_alt_ref=0");
2287 @end example
2288 @table @option
2289 @item rfc_update_buffer_slot
2290 Indicates the buffer slot number to update
2291 @item rfc_update_last
2292 Indicates whether to update the LAST frame
2293 @item rfc_update_golden
2294 Indicates whether to update GOLDEN frame
2295 @item rfc_update_alt_ref
2296 Indicates whether to update ALT_REF frame
2297 @item rfc_lst_fb_idx
2298 LAST frame buffer index
2299 @item rfc_gld_fb_idx
2300 GOLDEN frame buffer index
2301 @item rfc_alt_fb_idx
2302 ALT_REF frame buffer index
2303 @item rfc_reference_last
2304 Indicates whether to reference LAST frame
2305 @item rfc_reference_golden
2306 Indicates whether to reference GOLDEN frame
2307 @item rfc_reference_alt_ref
2308 Indicates whether to reference ALT_REF frame
2309 @item rfc_reference_duration
2310 Indicates frame duration
2311 @end table
2312 @end table
2313
2314 @end table
2315
2316 For more information about libvpx see:
2317 @url{http://www.webmproject.org/}
2318
2319 @section libwebp
2320
2321 libwebp WebP Image encoder wrapper
2322
2323 libwebp is Google's official encoder for WebP images. It can encode in either
2324 lossy or lossless mode. Lossy images are essentially a wrapper around a VP8
2325 frame. Lossless images are a separate codec developed by Google.
2326
2327 @subsection Pixel Format
2328
2329 Currently, libwebp only supports YUV420 for lossy and RGB for lossless due
2330 to limitations of the format and libwebp. Alpha is supported for either mode.
2331 Because of API limitations, if RGB is passed in when encoding lossy or YUV is
2332 passed in for encoding lossless, the pixel format will automatically be
2333 converted using functions from libwebp. This is not ideal and is done only for
2334 convenience.
2335
2336 @subsection Options
2337
2338 @table @option
2339
2340 @item -lossless @var{boolean}
2341 Enables/Disables use of lossless mode. Default is 0.
2342
2343 @item -compression_level @var{integer}
2344 For lossy, this is a quality/speed tradeoff. Higher values give better quality
2345 for a given size at the cost of increased encoding time. For lossless, this is
2346 a size/speed tradeoff. Higher values give smaller size at the cost of increased
2347 encoding time. More specifically, it controls the number of extra algorithms
2348 and compression tools used, and varies the combination of these tools. This
2349 maps to the @var{method} option in libwebp. The valid range is 0 to 6.
2350 Default is 4.
2351
2352 @item -quality @var{float}
2353 For lossy encoding, this controls image quality. For lossless encoding, this
2354 controls the effort and time spent in compression.
2355 Range is 0 to 100. Default is 75.
2356
2357 @item -preset @var{type}
2358 Configuration preset. This does some automatic settings based on the general
2359 type of the image.
2360 @table @option
2361 @item none
2362 Do not use a preset.
2363 @item default
2364 Use the encoder default.
2365 @item picture
2366 Digital picture, like portrait, inner shot
2367 @item photo
2368 Outdoor photograph, with natural lighting
2369 @item drawing
2370 Hand or line drawing, with high-contrast details
2371 @item icon
2372 Small-sized colorful images
2373 @item text
2374 Text-like
2375 @end table
2376
2377 @end table
2378
2379 @section libx264, libx264rgb
2380
2381 x264 H.264/MPEG-4 AVC encoder wrapper.
2382
2383 This encoder requires the presence of the libx264 headers and library
2384 during configuration. You need to explicitly configure the build with
2385 @code{--enable-libx264}.
2386
2387 libx264 supports an impressive number of features, including 8x8 and
2388 4x4 adaptive spatial transform, adaptive B-frame placement, CAVLC/CABAC
2389 entropy coding, interlacing (MBAFF), lossless mode, psy optimizations
2390 for detail retention (adaptive quantization, psy-RD, psy-trellis).
2391
2392 Many libx264 encoder options are mapped to FFmpeg global codec
2393 options, while unique encoder options are provided through private
2394 options. Additionally the @option{x264opts} and @option{x264-params}
2395 private options allows one to pass a list of key=value tuples as accepted
2396 by the libx264 @code{x264_param_parse} function.
2397
2398 The x264 project website is at
2399 @url{http://www.videolan.org/developers/x264.html}.
2400
2401 The libx264rgb encoder is the same as libx264, except it accepts packed RGB
2402 pixel formats as input instead of YUV.
2403
2404 @subsection Supported Pixel Formats
2405
2406 x264 supports 8- to 10-bit color spaces. The exact bit depth is controlled at
2407 x264's configure time.
2408
2409 @subsection Options
2410
2411 The following options are supported by the libx264 wrapper. The
2412 @command{x264}-equivalent options or values are listed in parentheses
2413 for easy migration.
2414
2415 To reduce the duplication of documentation, only the private options
2416 and some others requiring special attention are documented here. For
2417 the documentation of the undocumented generic options, see
2418 @ref{codec-options,,the Codec Options chapter}.
2419
2420 To get a more accurate and extensive documentation of the libx264
2421 options, invoke the command @command{x264 --fullhelp} or consult
2422 the libx264 documentation.
2423
2424 @table @option
2425 @item b (@emph{bitrate})
2426 Set bitrate in bits/s. Note that FFmpeg's @option{b} option is
2427 expressed in bits/s, while @command{x264}'s @option{bitrate} is in
2428 kilobits/s.
2429
2430 @item bf (@emph{bframes})
2431
2432 @item g (@emph{keyint})
2433
2434 @item qmin (@emph{qpmin})
2435 Minimum quantizer scale.
2436
2437 @item qmax (@emph{qpmax})
2438 Maximum quantizer scale.
2439
2440 @item qdiff (@emph{qpstep})
2441 Maximum difference between quantizer scales.
2442
2443 @item qblur (@emph{qblur})
2444 Quantizer curve blur
2445
2446 @item qcomp (@emph{qcomp})
2447 Quantizer curve compression factor
2448
2449 @item refs (@emph{ref})
2450 Number of reference frames each P-frame can use. The range is from @var{0-16}.
2451
2452 @item level (@emph{level})
2453 Set the @code{x264_param_t.i_level_idc} value in case the value is
2454 positive, it is ignored otherwise.
2455
2456 This value can be set using the @code{AVCodecContext} API (e.g. by
2457 setting the @code{AVCodecContext} value directly), and is specified as
2458 an integer mapped on a corresponding level (e.g. the value 31 maps
2459 to H.264 level IDC "3.1", as defined in the @code{x264_levels}
2460 table). It is ignored when set to a non positive value.
2461
2462 Alternatively it can be set as a private option, overriding the value
2463 set in @code{AVCodecContext}, and in this case must be specified as
2464 the level IDC identifier (e.g. "3.1"), as defined by H.264 Annex A.
2465
2466 @item sc_threshold (@emph{scenecut})
2467 Sets the threshold for the scene change detection.
2468
2469 @item trellis (@emph{trellis})
2470 Performs Trellis quantization to increase efficiency. Enabled by default.
2471
2472 @item nr  (@emph{nr})
2473
2474 @item me_range (@emph{merange})
2475 Maximum range of the motion search in pixels.
2476
2477 @item me_method (@emph{me})
2478 Set motion estimation method. Possible values in the decreasing order
2479 of speed:
2480
2481 @table @samp
2482 @item dia (@emph{dia})
2483 @item epzs (@emph{dia})
2484 Diamond search with radius 1 (fastest). @samp{epzs} is an alias for
2485 @samp{dia}.
2486 @item hex (@emph{hex})
2487 Hexagonal search with radius 2.
2488 @item umh (@emph{umh})
2489 Uneven multi-hexagon search.
2490 @item esa (@emph{esa})
2491 Exhaustive search.
2492 @item tesa (@emph{tesa})
2493 Hadamard exhaustive search (slowest).
2494 @end table
2495
2496 @item forced-idr
2497 Normally, when forcing a I-frame type, the encoder can select any type
2498 of I-frame. This option forces it to choose an IDR-frame.
2499
2500 @item subq (@emph{subme})
2501 Sub-pixel motion estimation method.
2502
2503 @item b_strategy (@emph{b-adapt})
2504 Adaptive B-frame placement decision algorithm. Use only on first-pass.
2505
2506 @item keyint_min (@emph{min-keyint})
2507 Minimum GOP size.
2508
2509 @item coder
2510 Set entropy encoder. Possible values:
2511
2512 @table @samp
2513 @item ac
2514 Enable CABAC.
2515
2516 @item vlc
2517 Enable CAVLC and disable CABAC. It generates the same effect as
2518 @command{x264}'s @option{--no-cabac} option.
2519 @end table
2520
2521 @item cmp
2522 Set full pixel motion estimation comparison algorithm. Possible values:
2523
2524 @table @samp
2525 @item chroma
2526 Enable chroma in motion estimation.
2527
2528 @item sad
2529 Ignore chroma in motion estimation. It generates the same effect as
2530 @command{x264}'s @option{--no-chroma-me} option.
2531 @end table
2532
2533 @item threads (@emph{threads})
2534 Number of encoding threads.
2535
2536 @item thread_type
2537 Set multithreading technique. Possible values:
2538
2539 @table @samp
2540 @item slice
2541 Slice-based multithreading. It generates the same effect as
2542 @command{x264}'s @option{--sliced-threads} option.
2543 @item frame
2544 Frame-based multithreading.
2545 @end table
2546
2547 @item flags
2548 Set encoding flags. It can be used to disable closed GOP and enable
2549 open GOP by setting it to @code{-cgop}. The result is similar to
2550 the behavior of @command{x264}'s @option{--open-gop} option.
2551
2552 @item rc_init_occupancy (@emph{vbv-init})
2553
2554 @item preset (@emph{preset})
2555 Set the encoding preset.
2556
2557 @item tune (@emph{tune})
2558 Set tuning of the encoding params.
2559
2560 @item profile (@emph{profile})
2561 Set profile restrictions.
2562
2563 @item fastfirstpass
2564 Enable fast settings when encoding first pass, when set to 1. When set
2565 to 0, it has the same effect of @command{x264}'s
2566 @option{--slow-firstpass} option.
2567
2568 @item crf (@emph{crf})
2569 Set the quality for constant quality mode.
2570
2571 @item crf_max (@emph{crf-max})
2572 In CRF mode, prevents VBV from lowering quality beyond this point.
2573
2574 @item qp (@emph{qp})
2575 Set constant quantization rate control method parameter.
2576
2577 @item aq-mode (@emph{aq-mode})
2578 Set AQ method. Possible values:
2579
2580 @table @samp
2581 @item none (@emph{0})
2582 Disabled.
2583
2584 @item variance (@emph{1})
2585 Variance AQ (complexity mask).
2586
2587 @item autovariance (@emph{2})
2588 Auto-variance AQ (experimental).
2589 @end table
2590
2591 @item aq-strength (@emph{aq-strength})
2592 Set AQ strength, reduce blocking and blurring in flat and textured areas.
2593
2594 @item psy
2595 Use psychovisual optimizations when set to 1. When set to 0, it has the
2596 same effect as @command{x264}'s @option{--no-psy} option.
2597
2598 @item psy-rd  (@emph{psy-rd})
2599 Set strength of psychovisual optimization, in
2600 @var{psy-rd}:@var{psy-trellis} format.
2601
2602 @item rc-lookahead (@emph{rc-lookahead})
2603 Set number of frames to look ahead for frametype and ratecontrol.
2604
2605 @item weightb
2606 Enable weighted prediction for B-frames when set to 1. When set to 0,
2607 it has the same effect as @command{x264}'s @option{--no-weightb} option.
2608
2609 @item weightp (@emph{weightp})
2610 Set weighted prediction method for P-frames. Possible values:
2611
2612 @table @samp
2613 @item none (@emph{0})
2614 Disabled
2615 @item simple (@emph{1})
2616 Enable only weighted refs
2617 @item smart (@emph{2})
2618 Enable both weighted refs and duplicates
2619 @end table
2620
2621 @item ssim (@emph{ssim})
2622 Enable calculation and printing SSIM stats after the encoding.
2623
2624 @item intra-refresh (@emph{intra-refresh})
2625 Enable the use of Periodic Intra Refresh instead of IDR frames when set
2626 to 1.
2627
2628 @item avcintra-class (@emph{class})
2629 Configure the encoder to generate AVC-Intra.
2630 Valid values are 50,100 and 200
2631
2632 @item bluray-compat (@emph{bluray-compat})
2633 Configure the encoder to be compatible with the bluray standard.
2634 It is a shorthand for setting "bluray-compat=1 force-cfr=1".
2635
2636 @item b-bias (@emph{b-bias})
2637 Set the influence on how often B-frames are used.
2638
2639 @item b-pyramid (@emph{b-pyramid})
2640 Set method for keeping of some B-frames as references. Possible values:
2641
2642 @table @samp
2643 @item none (@emph{none})
2644 Disabled.
2645 @item strict (@emph{strict})
2646 Strictly hierarchical pyramid.
2647 @item normal (@emph{normal})
2648 Non-strict (not Blu-ray compatible).
2649 @end table
2650
2651 @item mixed-refs
2652 Enable the use of one reference per partition, as opposed to one
2653 reference per macroblock when set to 1. When set to 0, it has the
2654 same effect as @command{x264}'s @option{--no-mixed-refs} option.
2655
2656 @item 8x8dct
2657 Enable adaptive spatial transform (high profile 8x8 transform)
2658 when set to 1. When set to 0, it has the same effect as
2659 @command{x264}'s @option{--no-8x8dct} option.
2660
2661 @item fast-pskip
2662 Enable early SKIP detection on P-frames when set to 1. When set
2663 to 0, it has the same effect as @command{x264}'s
2664 @option{--no-fast-pskip} option.
2665
2666 @item aud (@emph{aud})
2667 Enable use of access unit delimiters when set to 1.
2668
2669 @item mbtree
2670 Enable use macroblock tree ratecontrol when set to 1. When set
2671 to 0, it has the same effect as @command{x264}'s
2672 @option{--no-mbtree} option.
2673
2674 @item deblock (@emph{deblock})
2675 Set loop filter parameters, in @var{alpha}:@var{beta} form.
2676
2677 @item cplxblur (@emph{cplxblur})
2678 Set fluctuations reduction in QP (before curve compression).
2679
2680 @item partitions (@emph{partitions})
2681 Set partitions to consider as a comma-separated list of. Possible
2682 values in the list:
2683
2684 @table @samp
2685 @item p8x8
2686 8x8 P-frame partition.
2687 @item p4x4
2688 4x4 P-frame partition.
2689 @item b8x8
2690 4x4 B-frame partition.
2691 @item i8x8
2692 8x8 I-frame partition.
2693 @item i4x4
2694 4x4 I-frame partition.
2695 (Enabling @samp{p4x4} requires @samp{p8x8} to be enabled. Enabling
2696 @samp{i8x8} requires adaptive spatial transform (@option{8x8dct}
2697 option) to be enabled.)
2698 @item none (@emph{none})
2699 Do not consider any partitions.
2700 @item all (@emph{all})
2701 Consider every partition.
2702 @end table
2703
2704 @item direct-pred (@emph{direct})
2705 Set direct MV prediction mode. Possible values:
2706
2707 @table @samp
2708 @item none (@emph{none})
2709 Disable MV prediction.
2710 @item spatial (@emph{spatial})
2711 Enable spatial predicting.
2712 @item temporal (@emph{temporal})
2713 Enable temporal predicting.
2714 @item auto (@emph{auto})
2715 Automatically decided.
2716 @end table
2717
2718 @item slice-max-size (@emph{slice-max-size})
2719 Set the limit of the size of each slice in bytes. If not specified
2720 but RTP payload size (@option{ps}) is specified, that is used.
2721
2722 @item stats (@emph{stats})
2723 Set the file name for multi-pass stats.
2724
2725 @item nal-hrd (@emph{nal-hrd})
2726 Set signal HRD information (requires @option{vbv-bufsize} to be set).
2727 Possible values:
2728
2729 @table @samp
2730 @item none (@emph{none})
2731 Disable HRD information signaling.
2732 @item vbr (@emph{vbr})
2733 Variable bit rate.
2734 @item cbr (@emph{cbr})
2735 Constant bit rate (not allowed in MP4 container).
2736 @end table
2737
2738 @item x264opts (N.A.)
2739 Set any x264 option, see @command{x264 --fullhelp} for a list.
2740
2741 Argument is a list of @var{key}=@var{value} couples separated by
2742 ":". In @var{filter} and @var{psy-rd} options that use ":" as a separator
2743 themselves, use "," instead. They accept it as well since long ago but this
2744 is kept undocumented for some reason.
2745
2746 For example to specify libx264 encoding options with @command{ffmpeg}:
2747 @example
2748 ffmpeg -i foo.mpg -c:v libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv
2749 @end example
2750
2751 @item a53cc @var{boolean}
2752 Import closed captions (which must be ATSC compatible format) into output.
2753 Only the mpeg2 and h264 decoders provide these. Default is 1 (on).
2754
2755 @item udu_sei @var{boolean}
2756 Import user data unregistered SEI if available into output. Default is 0 (off).
2757
2758 @item mb_info @var{boolean}
2759 Set mb_info data through AVFrameSideData, only useful when used from the
2760 API. Default is 0 (off).
2761
2762 @item x264-params (N.A.)
2763 Override the x264 configuration using a :-separated list of key=value
2764 parameters.
2765
2766 This option is functionally the same as the @option{x264opts}, but is
2767 duplicated for compatibility with the Libav fork.
2768
2769 For example to specify libx264 encoding options with @command{ffmpeg}:
2770 @example
2771 ffmpeg -i INPUT -c:v libx264 -x264-params level=30:bframes=0:weightp=0:\
2772 cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:\
2773 no-fast-pskip=1:subq=6:8x8dct=0:trellis=0 OUTPUT
2774 @end example
2775 @end table
2776
2777 Encoding ffpresets for common usages are provided so they can be used with the
2778 general presets system (e.g. passing the @option{pre} option).
2779
2780 @section libx265
2781
2782 x265 H.265/HEVC encoder wrapper.
2783
2784 This encoder requires the presence of the libx265 headers and library
2785 during configuration. You need to explicitly configure the build with
2786 @option{--enable-libx265}.
2787
2788 @subsection Options
2789
2790 @table @option
2791 @item b
2792 Sets target video bitrate.
2793
2794 @item bf
2795
2796 @item g
2797 Set the GOP size.
2798
2799 @item keyint_min
2800 Minimum GOP size.
2801
2802 @item refs
2803 Number of reference frames each P-frame can use. The range is from @var{1-16}.
2804
2805 @item preset
2806 Set the x265 preset.
2807
2808 @item tune
2809 Set the x265 tune parameter.
2810
2811 @item profile
2812 Set profile restrictions.
2813
2814 @item crf
2815 Set the quality for constant quality mode.
2816
2817 @item qp
2818 Set constant quantization rate control method parameter.
2819
2820 @item qmin
2821 Minimum quantizer scale.
2822
2823 @item qmax
2824 Maximum quantizer scale.
2825
2826 @item qdiff
2827 Maximum difference between quantizer scales.
2828
2829 @item qblur
2830 Quantizer curve blur
2831
2832 @item qcomp
2833 Quantizer curve compression factor
2834
2835 @item i_qfactor
2836
2837 @item b_qfactor
2838
2839 @item forced-idr
2840 Normally, when forcing a I-frame type, the encoder can select any type
2841 of I-frame. This option forces it to choose an IDR-frame.
2842
2843 @item udu_sei @var{boolean}
2844 Import user data unregistered SEI if available into output. Default is 0 (off).
2845
2846 @item x265-params
2847 Set x265 options using a list of @var{key}=@var{value} couples separated
2848 by ":". See @command{x265 --help} for a list of options.
2849
2850 For example to specify libx265 encoding options with @option{-x265-params}:
2851
2852 @example
2853 ffmpeg -i input -c:v libx265 -x265-params crf=26:psy-rd=1 output.mp4
2854 @end example
2855 @end table
2856
2857 @section libxavs2
2858
2859 xavs2 AVS2-P2/IEEE1857.4 encoder wrapper.
2860
2861 This encoder requires the presence of the libxavs2 headers and library
2862 during configuration. You need to explicitly configure the build with
2863 @option{--enable-libxavs2}.
2864
2865 The following standard libavcodec options are used:
2866 @itemize
2867 @item
2868 @option{b} / @option{bit_rate}
2869 @item
2870 @option{g} / @option{gop_size}
2871 @item
2872 @option{bf} / @option{max_b_frames}
2873 @end itemize
2874
2875 The encoder also has its own specific options:
2876 @subsection Options
2877
2878 @table @option
2879 @item lcu_row_threads
2880 Set the number of parallel threads for rows from 1 to 8 (default 5).
2881
2882 @item initial_qp
2883 Set the xavs2 quantization parameter from 1 to 63 (default 34). This is
2884 used to set the initial qp for the first frame.
2885
2886 @item qp
2887 Set the xavs2 quantization parameter from 1 to 63 (default 34). This is
2888 used to set the qp value under constant-QP mode.
2889
2890 @item max_qp
2891 Set the max qp for rate control from 1 to 63 (default 55).
2892
2893 @item min_qp
2894 Set the min qp for rate control from 1 to 63 (default 20).
2895
2896 @item speed_level
2897 Set the Speed level from 0 to 9 (default 0). Higher is better but slower.
2898
2899 @item log_level
2900 Set the log level from -1 to 3 (default 0). -1: none, 0: error,
2901 1: warning, 2: info, 3: debug.
2902
2903 @item xavs2-params
2904 Set xavs2 options using a list of @var{key}=@var{value} couples separated
2905 by ":".
2906
2907 For example to specify libxavs2 encoding options with @option{-xavs2-params}:
2908
2909 @example
2910 ffmpeg -i input -c:v libxavs2 -xavs2-params RdoqLevel=0 output.avs2
2911 @end example
2912 @end table
2913
2914 @section libxvid
2915
2916 Xvid MPEG-4 Part 2 encoder wrapper.
2917
2918 This encoder requires the presence of the libxvidcore headers and library
2919 during configuration. You need to explicitly configure the build with
2920 @code{--enable-libxvid --enable-gpl}.
2921
2922 The native @code{mpeg4} encoder supports the MPEG-4 Part 2 format, so
2923 users can encode to this format without this library.
2924
2925 @subsection Options
2926
2927 The following options are supported by the libxvid wrapper. Some of
2928 the following options are listed but are not documented, and
2929 correspond to shared codec options. See @ref{codec-options,,the Codec
2930 Options chapter} for their documentation. The other shared options
2931 which are not listed have no effect for the libxvid encoder.
2932
2933 @table @option
2934 @item b
2935
2936 @item g
2937
2938 @item qmin
2939
2940 @item qmax
2941
2942 @item mpeg_quant
2943
2944 @item threads
2945
2946 @item bf
2947
2948 @item b_qfactor
2949
2950 @item b_qoffset
2951
2952 @item flags
2953 Set specific encoding flags. Possible values:
2954
2955 @table @samp
2956
2957 @item mv4
2958 Use four motion vector by macroblock.
2959
2960 @item aic
2961 Enable high quality AC prediction.
2962
2963 @item gray
2964 Only encode grayscale.
2965
2966 @item gmc
2967 Enable the use of global motion compensation (GMC).
2968
2969 @item qpel
2970 Enable quarter-pixel motion compensation.
2971
2972 @item cgop
2973 Enable closed GOP.
2974
2975 @item global_header
2976 Place global headers in extradata instead of every keyframe.
2977
2978 @end table
2979
2980 @item trellis
2981
2982 @item me_quality
2983 Set motion estimation quality level. Possible values in decreasing order of
2984 speed and increasing order of quality:
2985
2986 @table @samp
2987 @item 0
2988 Use no motion estimation (default).
2989
2990 @item 1, 2
2991 Enable advanced diamond zonal search for 16x16 blocks and half-pixel
2992 refinement for 16x16 blocks.
2993
2994 @item 3, 4
2995 Enable all of the things described above, plus advanced diamond zonal
2996 search for 8x8 blocks and half-pixel refinement for 8x8 blocks, also
2997 enable motion estimation on chroma planes for P and B-frames.
2998
2999 @item 5, 6
3000 Enable all of the things described above, plus extended 16x16 and 8x8
3001 blocks search.
3002 @end table
3003
3004 @item mbd
3005 Set macroblock decision algorithm. Possible values in the increasing
3006 order of quality:
3007
3008 @table @samp
3009 @item simple
3010 Use macroblock comparing function algorithm (default).
3011
3012 @item bits
3013 Enable rate distortion-based half pixel and quarter pixel refinement for
3014 16x16 blocks.
3015
3016 @item rd
3017 Enable all of the things described above, plus rate distortion-based
3018 half pixel and quarter pixel refinement for 8x8 blocks, and rate
3019 distortion-based search using square pattern.
3020 @end table
3021
3022 @item lumi_aq
3023 Enable lumi masking adaptive quantization when set to 1. Default is 0
3024 (disabled).
3025
3026 @item variance_aq
3027 Enable variance adaptive quantization when set to 1. Default is 0
3028 (disabled).
3029
3030 When combined with @option{lumi_aq}, the resulting quality will not
3031 be better than any of the two specified individually. In other
3032 words, the resulting quality will be the worse one of the two
3033 effects.
3034
3035 @item ssim
3036 Set structural similarity (SSIM) displaying method. Possible values:
3037
3038 @table @samp
3039 @item off
3040 Disable displaying of SSIM information.
3041
3042 @item avg
3043 Output average SSIM at the end of encoding to stdout. The format of
3044 showing the average SSIM is:
3045
3046 @example
3047 Average SSIM: %f
3048 @end example
3049
3050 For users who are not familiar with C, %f means a float number, or
3051 a decimal (e.g. 0.939232).
3052
3053 @item frame
3054 Output both per-frame SSIM data during encoding and average SSIM at
3055 the end of encoding to stdout. The format of per-frame information
3056 is:
3057
3058 @example
3059        SSIM: avg: %1.3f min: %1.3f max: %1.3f
3060 @end example
3061
3062 For users who are not familiar with C, %1.3f means a float number
3063 rounded to 3 digits after the dot (e.g. 0.932).
3064
3065 @end table
3066
3067 @item ssim_acc
3068 Set SSIM accuracy. Valid options are integers within the range of
3069 0-4, while 0 gives the most accurate result and 4 computes the
3070 fastest.
3071
3072 @end table
3073
3074 @section MediaFoundation
3075
3076 This provides wrappers to encoders (both audio and video) in the
3077 MediaFoundation framework. It can access both SW and HW encoders.
3078 Video encoders can take input in either of nv12 or yuv420p form
3079 (some encoders support both, some support only either - in practice,
3080 nv12 is the safer choice, especially among HW encoders).
3081
3082 @section Microsoft RLE
3083
3084 Microsoft RLE aka MSRLE encoder.
3085 Only 8-bit palette mode supported.
3086 Compatible with Windows 3.1 and Windows 95.
3087
3088 @subsection Options
3089
3090 @table @option
3091 @item g @var{integer}
3092 Keyframe interval.
3093 A keyframe is inserted at least every @code{-g} frames, sometimes sooner.
3094 @end table
3095
3096 @section mpeg2
3097
3098 MPEG-2 video encoder.
3099
3100 @subsection Options
3101
3102 @table @option
3103 @item profile
3104 Select the mpeg2 profile to encode:
3105
3106 @table @samp
3107 @item 422
3108 @item high
3109 @item ss
3110 Spatially Scalable
3111 @item snr
3112 SNR Scalable
3113 @item main
3114 @item simple
3115 @end table
3116
3117 @item level
3118 Select the mpeg2 level to encode:
3119
3120 @table @samp
3121 @item high
3122 @item high1440
3123 @item main
3124 @item low
3125 @end table
3126
3127 @item seq_disp_ext @var{integer}
3128 Specifies if the encoder should write a sequence_display_extension to the
3129 output.
3130 @table @option
3131 @item -1
3132 @itemx auto
3133 Decide automatically to write it or not (this is the default) by checking if
3134 the data to be written is different from the default or unspecified values.
3135 @item 0
3136 @itemx never
3137 Never write it.
3138 @item 1
3139 @itemx always
3140 Always write it.
3141 @end table
3142 @item video_format @var{integer}
3143 Specifies the video_format written into the sequence display extension
3144 indicating the source of the video pictures. The default is @samp{unspecified},
3145 can be @samp{component}, @samp{pal}, @samp{ntsc}, @samp{secam} or @samp{mac}.
3146 For maximum compatibility, use @samp{component}.
3147 @item a53cc @var{boolean}
3148 Import closed captions (which must be ATSC compatible format) into output.
3149 Default is 1 (on).
3150 @end table
3151
3152 @section png
3153
3154 PNG image encoder.
3155
3156 @subsection Private options
3157
3158 @table @option
3159 @item dpi @var{integer}
3160 Set physical density of pixels, in dots per inch, unset by default
3161 @item dpm @var{integer}
3162 Set physical density of pixels, in dots per meter, unset by default
3163 @end table
3164
3165 @section ProRes
3166
3167 Apple ProRes encoder.
3168
3169 FFmpeg contains 2 ProRes encoders, the prores-aw and prores-ks encoder.
3170 The used encoder can be chosen with the @code{-vcodec} option.
3171
3172 @subsection Private Options for prores-ks
3173
3174 @table @option
3175 @item profile @var{integer}
3176 Select the ProRes profile to encode
3177 @table @samp
3178 @item proxy
3179 @item lt
3180 @item standard
3181 @item hq
3182 @item 4444
3183 @item 4444xq
3184 @end table
3185
3186 @item quant_mat @var{integer}
3187 Select quantization matrix.
3188 @table @samp
3189 @item auto
3190 @item default
3191 @item proxy
3192 @item lt
3193 @item standard
3194 @item hq
3195 @end table
3196 If set to @var{auto}, the matrix matching the profile will be picked.
3197 If not set, the matrix providing the highest quality, @var{default}, will be
3198 picked.
3199
3200 @item bits_per_mb @var{integer}
3201 How many bits to allot for coding one macroblock. Different profiles use
3202 between 200 and 2400 bits per macroblock, the maximum is 8000.
3203
3204 @item mbs_per_slice @var{integer}
3205 Number of macroblocks in each slice (1-8); the default value (8)
3206 should be good in almost all situations.
3207
3208 @item vendor @var{string}
3209 Override the 4-byte vendor ID.
3210 A custom vendor ID like @var{apl0} would claim the stream was produced by
3211 the Apple encoder.
3212
3213 @item alpha_bits @var{integer}
3214 Specify number of bits for alpha component.
3215 Possible values are @var{0}, @var{8} and @var{16}.
3216 Use @var{0} to disable alpha plane coding.
3217
3218 @end table
3219
3220 @subsection Speed considerations
3221
3222 In the default mode of operation the encoder has to honor frame constraints
3223 (i.e. not produce frames with size bigger than requested) while still making
3224 output picture as good as possible.
3225 A frame containing a lot of small details is harder to compress and the encoder
3226 would spend more time searching for appropriate quantizers for each slice.
3227
3228 Setting a higher @option{bits_per_mb} limit will improve the speed.
3229
3230 For the fastest encoding speed set the @option{qscale} parameter (4 is the
3231 recommended value) and do not set a size constraint.
3232
3233 @section QSV Encoders
3234
3235 The family of Intel QuickSync Video encoders (MPEG-2, H.264, HEVC, JPEG/MJPEG,
3236 VP9, AV1)
3237
3238 @subsection Ratecontrol Method
3239 The ratecontrol method is selected as follows:
3240 @itemize @bullet
3241 @item
3242 When @option{global_quality} is specified, a quality-based mode is used.
3243 Specifically this means either
3244 @itemize @minus
3245 @item
3246 @var{CQP} - constant quantizer scale, when the @option{qscale} codec flag is
3247 also set (the @option{-qscale} ffmpeg option).
3248
3249 @item
3250 @var{LA_ICQ} - intelligent constant quality with lookahead, when the
3251 @option{look_ahead} option is also set.
3252
3253 @item
3254 @var{ICQ} -- intelligent constant quality otherwise. For the ICQ modes, global
3255 quality range is 1 to 51, with 1 being the best quality.
3256 @end itemize
3257
3258 @item
3259 Otherwise, a bitrate-based mode is used. For all of those, you should specify at
3260 least the desired average bitrate with the @option{b} option.
3261 @itemize @minus
3262 @item
3263 @var{LA} - VBR with lookahead, when the @option{look_ahead} option is specified.
3264
3265 @item
3266 @var{VCM} - video conferencing mode, when the @option{vcm} option is set.
3267
3268 @item
3269 @var{CBR} - constant bitrate, when @option{maxrate} is specified and equal to
3270 the average bitrate.
3271
3272 @item
3273 @var{VBR} - variable bitrate, when @option{maxrate} is specified, but is higher
3274 than the average bitrate.
3275
3276 @item
3277 @var{AVBR} - average VBR mode, when @option{maxrate} is not specified, both
3278 @option{avbr_accuracy} and @option{avbr_convergence} are set to non-zero. This
3279 mode is available for H264 and HEVC on Windows.
3280 @end itemize
3281 @end itemize
3282
3283 Note that depending on your system, a different mode than the one you specified
3284 may be selected by the encoder. Set the verbosity level to @var{verbose} or
3285 higher to see the actual settings used by the QSV runtime.
3286
3287 @subsection Global Options -> MSDK Options
3288 Additional libavcodec global options are mapped to MSDK options as follows:
3289
3290 @itemize
3291 @item
3292 @option{g/gop_size} -> @option{GopPicSize}
3293
3294 @item
3295 @option{bf/max_b_frames}+1 -> @option{GopRefDist}
3296
3297 @item
3298 @option{rc_init_occupancy/rc_initial_buffer_occupancy} ->
3299 @option{InitialDelayInKB}
3300
3301 @item
3302 @option{slices} -> @option{NumSlice}
3303
3304 @item
3305 @option{refs} -> @option{NumRefFrame}
3306
3307 @item
3308 @option{b_strategy/b_frame_strategy} -> @option{BRefType}
3309
3310 @item
3311 @option{cgop/CLOSED_GOP} codec flag -> @option{GopOptFlag}
3312
3313 @item
3314 For the @var{CQP} mode, the @option{i_qfactor/i_qoffset} and
3315 @option{b_qfactor/b_qoffset} set the difference between @var{QPP} and @var{QPI},
3316 and @var{QPP} and @var{QPB} respectively.
3317
3318 @item
3319 Setting the @option{coder} option to the value @var{vlc} will make the H.264
3320 encoder use CAVLC instead of CABAC.
3321
3322 @end itemize
3323
3324 @subsection Common Options
3325 Following options are used by all qsv encoders.
3326
3327 @table @option
3328 @item @var{async_depth}
3329 Specifies how many asynchronous operations an application performs
3330 before the application explicitly synchronizes the result. If zero,
3331 the value is not specified.
3332
3333 @item @var{preset}
3334 This option itemizes a range of choices from veryfast (best speed) to veryslow
3335 (best quality).
3336 @table @samp
3337 @item veryfast
3338 @item faster
3339 @item fast
3340 @item medium
3341 @item slow
3342 @item slower
3343 @item veryslow
3344 @end table
3345
3346 @item @var{forced_idr}
3347 Forcing I frames as IDR frames.
3348
3349 @item @var{low_power}
3350 For encoders set this flag to ON to reduce power consumption and GPU usage.
3351 @end table
3352
3353 @subsection Runtime Options
3354 Following options can be used durning qsv encoding.
3355
3356 @table @option
3357 @item @var{global_quality}
3358 @item @var{i_quant_factor}
3359 @item @var{i_quant_offset}
3360 @item @var{b_quant_factor}
3361 @item @var{b_quant_offset}
3362 Supported in h264_qsv and hevc_qsv.
3363 Change these value to reset qsv codec's qp configuration.
3364
3365 @item @var{max_frame_size}
3366 Supported in h264_qsv and hevc_qsv.
3367 Change this value to reset qsv codec's MaxFrameSize configuration.
3368
3369 @item @var{gop_size}
3370 Change this value to reset qsv codec's gop configuration.
3371
3372 @item @var{int_ref_type}
3373 @item @var{int_ref_cycle_size}
3374 @item @var{int_ref_qp_delta}
3375 @item @var{int_ref_cycle_dist}
3376 Supported in h264_qsv and hevc_qsv.
3377 Change these value to reset qsv codec's Intra Refresh configuration.
3378
3379 @item @var{qmax}
3380 @item @var{qmin}
3381 @item @var{max_qp_i}
3382 @item @var{min_qp_i}
3383 @item @var{max_qp_p}
3384 @item @var{min_qp_p}
3385 @item @var{max_qp_b}
3386 @item @var{min_qp_b}
3387 Supported in h264_qsv.
3388 Change these value to reset qsv codec's max/min qp configuration.
3389
3390 @item @var{low_delay_brc}
3391 Supported in h264_qsv, hevc_qsv and av1_qsv.
3392 Change this value to reset qsv codec's low_delay_brc configuration.
3393
3394 @item @var{framerate}
3395 Change this value to reset qsv codec's framerate configuration.
3396
3397 @item @var{bit_rate}
3398 @item @var{rc_buffer_size}
3399 @item @var{rc_initial_buffer_occupancy}
3400 @item @var{rc_max_rate}
3401 Change these value to reset qsv codec's bitrate control configuration.
3402
3403 @item @var{pic_timing_sei}
3404 Supported in h264_qsv and hevc_qsv.
3405 Change this value to reset qsv codec's pic_timing_sei configuration.
3406 @end table
3407
3408 @subsection H264 options
3409 These options are used by h264_qsv
3410
3411 @table @option
3412 @item @var{extbrc}
3413 Extended bitrate control.
3414
3415 @item @var{recovery_point_sei}
3416 Set this flag to insert the recovery point SEI message at the beginning of every
3417 intra refresh cycle.
3418
3419 @item @var{rdo}
3420 Enable rate distortion optimization.
3421
3422 @item @var{max_frame_size}
3423 Maximum encoded frame size in bytes.
3424
3425 @item @var{max_frame_size_i}
3426 Maximum encoded frame size for I frames in bytes. If this value is set as larger
3427 than zero, then for I frames the value set by max_frame_size is ignored.
3428
3429 @item @var{max_frame_size_p}
3430 Maximum encoded frame size for P frames in bytes. If this value is set as larger
3431 than zero, then for P frames the value set by max_frame_size is ignored.
3432
3433 @item @var{max_slice_size}
3434 Maximum encoded slice size in bytes.
3435
3436 @item @var{bitrate_limit}
3437 Toggle bitrate limitations.
3438 Modifies bitrate to be in the range imposed by the QSV encoder. Setting this
3439 flag off may lead to violation of HRD conformance. Mind that specifying bitrate
3440 below the QSV encoder range might significantly affect quality. If on this
3441 option takes effect in non CQP modes: if bitrate is not in the range imposed
3442 by the QSV encoder, it will be changed to be in the range.
3443
3444 @item @var{mbbrc}
3445 Setting this flag enables macroblock level bitrate control that generally
3446 improves subjective visual quality. Enabling this flag may have negative impact
3447 on performance and objective visual quality metric.
3448
3449 @item @var{low_delay_brc}
3450 Setting this flag turns on or off LowDelayBRC feautre in qsv plugin, which provides
3451 more accurate bitrate control to minimize the variance of bitstream size frame
3452 by frame. Value: -1-default 0-off 1-on
3453
3454 @item @var{adaptive_i}
3455 This flag controls insertion of I frames by the QSV encoder. Turn ON this flag
3456 to allow changing of frame type from P and B to I.
3457
3458 @item @var{adaptive_b}
3459 This flag controls changing of frame type from B to P.
3460
3461 @item @var{p_strategy}
3462 Enable P-pyramid: 0-default 1-simple 2-pyramid(bf need to be set to 0).
3463
3464 @item @var{b_strategy}
3465 This option controls usage of B frames as reference.
3466
3467 @item @var{dblk_idc}
3468 This option disable deblocking. It has value in range 0~2.
3469
3470 @item @var{cavlc}
3471 If set, CAVLC is used; if unset, CABAC is used for encoding.
3472
3473 @item @var{vcm}
3474 Video conferencing mode, please see ratecontrol method.
3475
3476 @item @var{idr_interval}
3477 Distance (in I-frames) between IDR frames.
3478
3479 @item @var{pic_timing_sei}
3480 Insert picture timing SEI with pic_struct_syntax element.
3481
3482 @item @var{single_sei_nal_unit}
3483 Put all the SEI messages into one NALU.
3484
3485 @item @var{max_dec_frame_buffering}
3486 Maximum number of frames buffered in the DPB.
3487
3488 @item @var{look_ahead}
3489 Use VBR algorithm with look ahead.
3490
3491 @item @var{look_ahead_depth}
3492 Depth of look ahead in number frames.
3493
3494 @item @var{look_ahead_downsampling}
3495 Downscaling factor for the frames saved for the lookahead analysis.
3496 @table @samp
3497 @item unknown
3498 @item auto
3499 @item off
3500 @item 2x
3501 @item 4x
3502 @end table
3503
3504 @item @var{int_ref_type}
3505 Specifies intra refresh type. The major goal of intra refresh is improvement of
3506 error resilience without significant impact on encoded bitstream size caused by
3507 I frames. The SDK encoder achieves this by encoding part of each frame in
3508 refresh cycle using intra MBs. @var{none} means no refresh. @var{vertical} means
3509 vertical refresh, by column of MBs. @var{horizontal} means horizontal refresh,
3510 by rows of MBs. @var{slice} means horizontal refresh by slices without
3511 overlapping. In case of @var{slice}, in_ref_cycle_size is ignored. To enable
3512 intra refresh, B frame should be set to 0.
3513
3514 @item @var{int_ref_cycle_size}
3515 Specifies number of pictures within refresh cycle starting from 2. 0 and 1 are
3516 invalid values.
3517
3518 @item @var{int_ref_qp_delta}
3519 Specifies QP difference for inserted intra MBs. This is signed value in
3520 [-51, 51] range if target encoding bit-depth for luma samples is 8 and this
3521 range is [-63, 63] for 10 bit-depth or [-75, 75] for 12 bit-depth respectively.
3522
3523 @item @var{int_ref_cycle_dist}
3524 Distance between the beginnings of the intra-refresh cycles in frames.
3525
3526 @item @var{profile}
3527 @table @samp
3528 @item unknown
3529 @item baseline
3530 @item main
3531 @item high
3532 @end table
3533
3534 @item @var{a53cc}
3535 Use A53 Closed Captions (if available).
3536
3537 @item @var{aud}
3538 Insert the Access Unit Delimiter NAL.
3539
3540 @item @var{mfmode}
3541 Multi-Frame Mode.
3542 @table @samp
3543 @item off
3544 @item auto
3545 @end table
3546
3547 @item @var{repeat_pps}
3548 Repeat pps for every frame.
3549
3550 @item @var{max_qp_i}
3551 Maximum video quantizer scale for I frame.
3552
3553 @item @var{min_qp_i}
3554 Minimum video quantizer scale for I frame.
3555
3556 @item @var{max_qp_p}
3557 Maximum video quantizer scale for P frame.
3558
3559 @item @var{min_qp_p}
3560 Minimum video quantizer scale for P frame.
3561
3562 @item @var{max_qp_b}
3563 Maximum video quantizer scale for B frame.
3564
3565 @item @var{min_qp_b}
3566 Minimum video quantizer scale for B frame.
3567
3568 @item @var{scenario}
3569 Provides a hint to encoder about the scenario for the encoding session.
3570 @table @samp
3571 @item unknown
3572 @item displayremoting
3573 @item videoconference
3574 @item archive
3575 @item livestreaming
3576 @item cameracapture
3577 @item videosurveillance
3578 @item gamestreaming
3579 @item remotegaming
3580 @end table
3581
3582 @item @var{avbr_accuracy}
3583 Accuracy of the AVBR ratecontrol (unit of tenth of percent).
3584
3585 @item @var{avbr_convergence}
3586 Convergence of the AVBR ratecontrol (unit of 100 frames)
3587
3588 The parameters @var{avbr_accuracy} and @var{avbr_convergence} are for the
3589 average variable bitrate control (AVBR) algorithm.
3590 The algorithm focuses on overall encoding quality while meeting the specified
3591 bitrate, @var{target_bitrate}, within the accuracy range @var{avbr_accuracy},
3592 after a @var{avbr_Convergence} period. This method does not follow HRD and the
3593 instant bitrate is not capped or padded.
3594
3595 @item @var{skip_frame}
3596 Use per-frame metadata "qsv_skip_frame" to skip frame when encoding. This option
3597 defines the usage of this metadata.
3598 @table @samp
3599 @item no_skip
3600 Frame skipping is disabled.
3601 @item insert_dummy
3602 Encoder inserts into bitstream frame where all macroblocks are encoded as
3603 skipped.
3604 @item insert_nothing
3605 Similar to insert_dummy, but encoder inserts nothing into bitstream. The skipped
3606 frames are still used in brc. For example, gop still include skipped frames, and
3607 the frames after skipped frames will be larger in size.
3608 @item brc_only
3609 skip_frame metadata indicates the number of missed frames before the current
3610 frame.
3611 @end table
3612
3613 @end table
3614
3615 @subsection HEVC Options
3616 These options are used by hevc_qsv
3617
3618 @table @option
3619 @item @var{extbrc}
3620 Extended bitrate control.
3621
3622 @item @var{recovery_point_sei}
3623 Set this flag to insert the recovery point SEI message at the beginning of every
3624 intra refresh cycle.
3625
3626 @item @var{rdo}
3627 Enable rate distortion optimization.
3628
3629 @item @var{max_frame_size}
3630 Maximum encoded frame size in bytes.
3631
3632 @item @var{max_frame_size_i}
3633 Maximum encoded frame size for I frames in bytes. If this value is set as larger
3634 than zero, then for I frames the value set by max_frame_size is ignored.
3635
3636 @item @var{max_frame_size_p}
3637 Maximum encoded frame size for P frames in bytes. If this value is set as larger
3638 than zero, then for P frames the value set by max_frame_size is ignored.
3639
3640 @item @var{max_slice_size}
3641 Maximum encoded slice size in bytes.
3642
3643 @item @var{mbbrc}
3644 Setting this flag enables macroblock level bitrate control that generally
3645 improves subjective visual quality. Enabling this flag may have negative impact
3646 on performance and objective visual quality metric.
3647
3648 @item @var{low_delay_brc}
3649 Setting this flag turns on or off LowDelayBRC feautre in qsv plugin, which provides
3650 more accurate bitrate control to minimize the variance of bitstream size frame
3651 by frame. Value: -1-default 0-off 1-on
3652
3653 @item @var{adaptive_i}
3654 This flag controls insertion of I frames by the QSV encoder. Turn ON this flag
3655 to allow changing of frame type from P and B to I.
3656
3657 @item @var{adaptive_b}
3658 This flag controls changing of frame type from B to P.
3659
3660 @item @var{p_strategy}
3661 Enable P-pyramid: 0-default 1-simple 2-pyramid(bf need to be set to 0).
3662
3663 @item @var{b_strategy}
3664 This option controls usage of B frames as reference.
3665
3666 @item @var{dblk_idc}
3667 This option disable deblocking. It has value in range 0~2.
3668
3669 @item @var{idr_interval}
3670 Distance (in I-frames) between IDR frames.
3671 @table @samp
3672 @item begin_only
3673 Output an IDR-frame only at the beginning of the stream.
3674 @end table
3675
3676 @item @var{load_plugin}
3677 A user plugin to load in an internal session.
3678 @table @samp
3679 @item none
3680 @item hevc_sw
3681 @item hevc_hw
3682 @end table
3683
3684 @item @var{load_plugins}
3685 A :-separate list of hexadecimal plugin UIDs to load in
3686 an internal session.
3687
3688 @item @var{look_ahead_depth}
3689 Depth of look ahead in number frames, available when extbrc option is enabled.
3690
3691 @item @var{profile}
3692 Set the encoding profile (scc requires libmfx >= 1.32).
3693
3694 @table @samp
3695 @item unknown
3696 @item main
3697 @item main10
3698 @item mainsp
3699 @item rext
3700 @item scc
3701 @end table
3702
3703 @item @var{tier}
3704 Set the encoding tier (only level >= 4 can support high tier).
3705 This option only takes effect when the level option is specified.
3706
3707 @table @samp
3708 @item main
3709 @item high
3710 @end table
3711
3712 @item @var{gpb}
3713 1: GPB (generalized P/B frame)
3714
3715 0: regular P frame.
3716
3717 @item @var{tile_cols}
3718 Number of columns for tiled encoding.
3719
3720 @item @var{tile_rows}
3721 Number of rows for tiled encoding.
3722
3723 @item @var{aud}
3724 Insert the Access Unit Delimiter NAL.
3725
3726 @item @var{pic_timing_sei}
3727 Insert picture timing SEI with pic_struct_syntax element.
3728
3729 @item @var{transform_skip}
3730 Turn this option ON to enable transformskip. It is supported on platform equal
3731 or newer than ICL.
3732
3733 @item @var{int_ref_type}
3734 Specifies intra refresh type. The major goal of intra refresh is improvement of
3735 error resilience without significant impact on encoded bitstream size caused by
3736 I frames. The SDK encoder achieves this by encoding part of each frame in
3737 refresh cycle using intra MBs. @var{none} means no refresh. @var{vertical} means
3738 vertical refresh, by column of MBs. @var{horizontal} means horizontal refresh,
3739 by rows of MBs. @var{slice} means horizontal refresh by slices without
3740 overlapping. In case of @var{slice}, in_ref_cycle_size is ignored. To enable
3741 intra refresh, B frame should be set to 0.
3742
3743 @item @var{int_ref_cycle_size}
3744 Specifies number of pictures within refresh cycle starting from 2. 0 and 1 are
3745 invalid values.
3746
3747 @item @var{int_ref_qp_delta}
3748 Specifies QP difference for inserted intra MBs. This is signed value in
3749 [-51, 51] range if target encoding bit-depth for luma samples is 8 and this
3750 range is [-63, 63] for 10 bit-depth or [-75, 75] for 12 bit-depth respectively.
3751
3752 @item @var{int_ref_cycle_dist}
3753 Distance between the beginnings of the intra-refresh cycles in frames.
3754
3755 @item @var{max_qp_i}
3756 Maximum video quantizer scale for I frame.
3757
3758 @item @var{min_qp_i}
3759 Minimum video quantizer scale for I frame.
3760
3761 @item @var{max_qp_p}
3762 Maximum video quantizer scale for P frame.
3763
3764 @item @var{min_qp_p}
3765 Minimum video quantizer scale for P frame.
3766
3767 @item @var{max_qp_b}
3768 Maximum video quantizer scale for B frame.
3769
3770 @item @var{min_qp_b}
3771 Minimum video quantizer scale for B frame.
3772
3773 @item @var{scenario}
3774 Provides a hint to encoder about the scenario for the encoding session.
3775 @table @samp
3776 @item unknown
3777 @item displayremoting
3778 @item videoconference
3779 @item archive
3780 @item livestreaming
3781 @item cameracapture
3782 @item videosurveillance
3783 @item gamestreaming
3784 @item remotegaming
3785 @end table
3786
3787 @item @var{avbr_accuracy}
3788 Accuracy of the AVBR ratecontrol (unit of tenth of percent).
3789
3790 @item @var{avbr_convergence}
3791 Convergence of the AVBR ratecontrol (unit of 100 frames)
3792
3793 The parameters @var{avbr_accuracy} and @var{avbr_convergence} are for the
3794 average variable bitrate control (AVBR) algorithm.
3795 The algorithm focuses on overall encoding quality while meeting the specified
3796 bitrate, @var{target_bitrate}, within the accuracy range @var{avbr_accuracy},
3797 after a @var{avbr_Convergence} period. This method does not follow HRD and the
3798 instant bitrate is not capped or padded.
3799
3800 @item @var{skip_frame}
3801 Use per-frame metadata "qsv_skip_frame" to skip frame when encoding. This option
3802 defines the usage of this metadata.
3803 @table @samp
3804 @item no_skip
3805 Frame skipping is disabled.
3806 @item insert_dummy
3807 Encoder inserts into bitstream frame where all macroblocks are encoded as
3808 skipped.
3809 @item insert_nothing
3810 Similar to insert_dummy, but encoder inserts nothing into bitstream. The skipped
3811 frames are still used in brc. For example, gop still include skipped frames, and
3812 the frames after skipped frames will be larger in size.
3813 @item brc_only
3814 skip_frame metadata indicates the number of missed frames before the current
3815 frame.
3816 @end table
3817
3818 @end table
3819
3820 @subsection MPEG2 Options
3821 These options are used by mpeg2_qsv
3822 @table @option
3823 @item @var{profile}
3824 @table @samp
3825 @item unknown
3826 @item simple
3827 @item main
3828 @item high
3829 @end table
3830 @end table
3831
3832 @subsection VP9 Options
3833 These options are used by vp9_qsv
3834 @table @option
3835 @item @var{profile}
3836 @table @samp
3837 @item unknown
3838 @item profile0
3839 @item profile1
3840 @item profile2
3841 @item profile3
3842 @end table
3843
3844 @item @var{tile_cols}
3845 Number of columns for tiled encoding (requires libmfx >= 1.29).
3846
3847 @item @var{tile_rows}
3848 Number of rows for tiled encoding (requires libmfx  >= 1.29).
3849 @end table
3850
3851 @subsection AV1 Options
3852 These options are used by av1_qsv (requires libvpl).
3853 @table @option
3854 @item @var{profile}
3855 @table @samp
3856 @item unknown
3857 @item main
3858 @end table
3859
3860 @item @var{tile_cols}
3861 Number of columns for tiled encoding.
3862
3863 @item @var{tile_rows}
3864 Number of rows for tiled encoding.
3865
3866 @item @var{adaptive_i}
3867 This flag controls insertion of I frames by the QSV encoder. Turn ON this flag
3868 to allow changing of frame type from P and B to I.
3869
3870 @item @var{adaptive_b}
3871 This flag controls changing of frame type from B to P.
3872
3873 @item @var{b_strategy}
3874 This option controls usage of B frames as reference.
3875
3876 @item @var{extbrc}
3877 Extended bitrate control.
3878
3879 @item @var{look_ahead_depth}
3880 Depth of look ahead in number frames, available when extbrc option is enabled.
3881
3882 @item @var{low_delay_brc}
3883 Setting this flag turns on or off LowDelayBRC feautre in qsv plugin, which provides
3884 more accurate bitrate control to minimize the variance of bitstream size frame
3885 by frame. Value: -1-default 0-off 1-on
3886
3887 @item max_frame_size
3888 Set the allowed max size in bytes for each frame. If the frame size exceeds
3889 the limitation, encoder will adjust the QP value to control the frame size.
3890 Invalid in CQP rate control mode.
3891 @end table
3892
3893 @section snow
3894
3895 @subsection Options
3896
3897 @table @option
3898 @item iterative_dia_size
3899 dia size for the iterative motion estimation
3900 @end table
3901
3902 @section VAAPI encoders
3903
3904 Wrappers for hardware encoders accessible via VAAPI.
3905
3906 These encoders only accept input in VAAPI hardware surfaces.  If you have input
3907 in software frames, use the @option{hwupload} filter to upload them to the GPU.
3908
3909 The following standard libavcodec options are used:
3910 @itemize
3911 @item
3912 @option{g} / @option{gop_size}
3913 @item
3914 @option{bf} / @option{max_b_frames}
3915 @item
3916 @option{profile}
3917
3918 If not set, this will be determined automatically from the format of the input
3919 frames and the profiles supported by the driver.
3920 @item
3921 @option{level}
3922 @item
3923 @option{b} / @option{bit_rate}
3924 @item
3925 @option{maxrate} / @option{rc_max_rate}
3926 @item
3927 @option{bufsize} / @option{rc_buffer_size}
3928 @item
3929 @option{rc_init_occupancy} / @option{rc_initial_buffer_occupancy}
3930 @item
3931 @option{compression_level}
3932
3933 Speed / quality tradeoff: higher values are faster / worse quality.
3934 @item
3935 @option{q} / @option{global_quality}
3936
3937 Size / quality tradeoff: higher values are smaller / worse quality.
3938 @item
3939 @option{qmin}
3940 @item
3941 @option{qmax}
3942 @item
3943 @option{i_qfactor} / @option{i_quant_factor}
3944 @item
3945 @option{i_qoffset} / @option{i_quant_offset}
3946 @item
3947 @option{b_qfactor} / @option{b_quant_factor}
3948 @item
3949 @option{b_qoffset} / @option{b_quant_offset}
3950 @item
3951 @option{slices}
3952 @end itemize
3953
3954 All encoders support the following options:
3955 @table @option
3956 @item low_power
3957 Some drivers/platforms offer a second encoder for some codecs intended to use
3958 less power than the default encoder; setting this option will attempt to use
3959 that encoder.  Note that it may support a reduced feature set, so some other
3960 options may not be available in this mode.
3961
3962 @item idr_interval
3963 Set the number of normal intra frames between full-refresh (IDR) frames in
3964 open-GOP mode.  The intra frames are still IRAPs, but will not include global
3965 headers and may have non-decodable leading pictures.
3966
3967 @item b_depth
3968 Set the B-frame reference depth.  When set to one (the default), all B-frames
3969 will refer only to P- or I-frames.  When set to greater values multiple layers
3970 of B-frames will be present, frames in each layer only referring to frames in
3971 higher layers.
3972
3973 @item async_depth
3974 Maximum processing parallelism. Increase this to improve single channel
3975 performance. This option doesn't work if driver doesn't implement vaSyncBuffer
3976 function. Please make sure there are enough hw_frames allocated if a large
3977 number of async_depth is used.
3978
3979 @item max_frame_size
3980 Set the allowed max size in bytes for each frame. If the frame size exceeds
3981 the limitation, encoder will adjust the QP value to control the frame size.
3982 Invalid in CQP rate control mode.
3983
3984 @item rc_mode
3985 Set the rate control mode to use.  A given driver may only support a subset of
3986 modes.
3987
3988 Possible modes:
3989 @table @option
3990 @item auto
3991 Choose the mode automatically based on driver support and the other options.
3992 This is the default.
3993 @item CQP
3994 Constant-quality.
3995 @item CBR
3996 Constant-bitrate.
3997 @item VBR
3998 Variable-bitrate.
3999 @item ICQ
4000 Intelligent constant-quality.
4001 @item QVBR
4002 Quality-defined variable-bitrate.
4003 @item AVBR
4004 Average variable bitrate.
4005 @end table
4006
4007 @end table
4008
4009 Each encoder also has its own specific options:
4010 @table @option
4011
4012 @item av1_vaapi
4013 @option{profile} sets the value of @emph{seq_profile}.
4014 @option{tier} sets the value of @emph{seq_tier}.
4015 @option{level} sets the value of @emph{seq_level_idx}.
4016
4017 @table @option
4018 @item tiles
4019 Set the number of tiles to encode the input video with, as columns x rows.
4020 (default is auto, which means use minimal tile column/row number).
4021 @item tile_groups
4022 Set tile groups number. All the tiles will be distributed as evenly as possible to
4023 each tile group. (default is 1).
4024 @end table
4025
4026 @item h264_vaapi
4027 @option{profile} sets the value of @emph{profile_idc} and the @emph{constraint_set*_flag}s.
4028 @option{level} sets the value of @emph{level_idc}.
4029
4030 @table @option
4031 @item coder
4032 Set entropy encoder (default is @emph{cabac}).  Possible values:
4033
4034 @table @samp
4035 @item ac
4036 @item cabac
4037 Use CABAC.
4038
4039 @item vlc
4040 @item cavlc
4041 Use CAVLC.
4042 @end table
4043
4044 @item aud
4045 Include access unit delimiters in the stream (not included by default).
4046
4047 @item sei
4048 Set SEI message types to include.
4049 Some combination of the following values:
4050 @table @samp
4051 @item identifier
4052 Include a @emph{user_data_unregistered} message containing information about
4053 the encoder.
4054 @item timing
4055 Include picture timing parameters (@emph{buffering_period} and
4056 @emph{pic_timing} messages).
4057 @item recovery_point
4058 Include recovery points where appropriate (@emph{recovery_point} messages).
4059 @end table
4060
4061 @end table
4062
4063 @item hevc_vaapi
4064 @option{profile} and @option{level} set the values of
4065 @emph{general_profile_idc} and @emph{general_level_idc} respectively.
4066
4067 @table @option
4068 @item aud
4069 Include access unit delimiters in the stream (not included by default).
4070
4071 @item tier
4072 Set @emph{general_tier_flag}.  This may affect the level chosen for the stream
4073 if it is not explicitly specified.
4074
4075 @item sei
4076 Set SEI message types to include.
4077 Some combination of the following values:
4078 @table @samp
4079 @item hdr
4080 Include HDR metadata if the input frames have it
4081 (@emph{mastering_display_colour_volume} and @emph{content_light_level}
4082 messages).
4083 @end table
4084
4085 @item tiles
4086 Set the number of tiles to encode the input video with, as columns x rows.
4087 Larger numbers allow greater parallelism in both encoding and decoding, but
4088 may decrease coding efficiency.
4089
4090 @end table
4091
4092 @item mjpeg_vaapi
4093 Only baseline DCT encoding is supported.  The encoder always uses the standard
4094 quantisation and huffman tables - @option{global_quality} scales the standard
4095 quantisation table (range 1-100).
4096
4097 For YUV, 4:2:0, 4:2:2 and 4:4:4 subsampling modes are supported.  RGB is also
4098 supported, and will create an RGB JPEG.
4099
4100 @table @option
4101 @item jfif
4102 Include JFIF header in each frame (not included by default).
4103 @item huffman
4104 Include standard huffman tables (on by default).  Turning this off will save
4105 a few hundred bytes in each output frame, but may lose compatibility with some
4106 JPEG decoders which don't fully handle MJPEG.
4107 @end table
4108
4109 @item mpeg2_vaapi
4110 @option{profile} and @option{level} set the value of @emph{profile_and_level_indication}.
4111
4112 @item vp8_vaapi
4113 B-frames are not supported.
4114
4115 @option{global_quality} sets the @emph{q_idx} used for non-key frames (range 0-127).
4116
4117 @table @option
4118 @item loop_filter_level
4119 @item loop_filter_sharpness
4120 Manually set the loop filter parameters.
4121 @end table
4122
4123 @item vp9_vaapi
4124 @option{global_quality} sets the @emph{q_idx} used for P-frames (range 0-255).
4125
4126 @table @option
4127 @item loop_filter_level
4128 @item loop_filter_sharpness
4129 Manually set the loop filter parameters.
4130 @end table
4131
4132 B-frames are supported, but the output stream is always in encode order rather than display
4133 order.  If B-frames are enabled, it may be necessary to use the @option{vp9_raw_reorder}
4134 bitstream filter to modify the output stream to display frames in the correct order.
4135
4136 Only normal frames are produced - the @option{vp9_superframe} bitstream filter may be
4137 required to produce a stream usable with all decoders.
4138
4139 @end table
4140
4141 @section vbn
4142
4143 Vizrt Binary Image encoder.
4144
4145 This format is used by the broadcast vendor Vizrt for quick texture streaming.
4146 Advanced features of the format such as LZW compression of texture data or
4147 generation of mipmaps are not supported.
4148
4149 @subsection Options
4150
4151 @table @option
4152 @item format @var{string}
4153 Sets the texture compression used by the VBN file. Can be @var{dxt1},
4154 @var{dxt5} or @var{raw}. Default is @var{dxt5}.
4155 @end table
4156
4157 @section vc2
4158
4159 SMPTE VC-2 (previously BBC Dirac Pro). This codec was primarily aimed at
4160 professional broadcasting but since it supports yuv420, yuv422 and yuv444 at
4161 8 (limited range or full range), 10 or 12 bits, this makes it suitable for
4162 other tasks which require low overhead and low compression (like screen
4163 recording).
4164
4165 @subsection Options
4166
4167 @table @option
4168
4169 @item b
4170 Sets target video bitrate. Usually that's around 1:6 of the uncompressed
4171 video bitrate (e.g. for 1920x1080 50fps yuv422p10 that's around 400Mbps). Higher
4172 values (close to the uncompressed bitrate) turn on lossless compression mode.
4173
4174 @item field_order
4175 Enables field coding when set (e.g. to tt - top field first) for interlaced
4176 inputs. Should increase compression with interlaced content as it splits the
4177 fields and encodes each separately.
4178
4179 @item wavelet_depth
4180 Sets the total amount of wavelet transforms to apply, between 1 and 5 (default).
4181 Lower values reduce compression and quality. Less capable decoders may not be
4182 able to handle values of @option{wavelet_depth} over 3.
4183
4184 @item wavelet_type
4185 Sets the transform type. Currently only @var{5_3} (LeGall) and @var{9_7}
4186 (Deslauriers-Dubuc)
4187 are implemented, with 9_7 being the one with better compression and thus
4188 is the default.
4189
4190 @item slice_width
4191 @item slice_height
4192 Sets the slice size for each slice. Larger values result in better compression.
4193 For compatibility with other more limited decoders use @option{slice_width} of
4194 32 and @option{slice_height} of 8.
4195
4196 @item tolerance
4197 Sets the undershoot tolerance of the rate control system in percent. This is
4198 to prevent an expensive search from being run.
4199
4200 @item qm
4201 Sets the quantization matrix preset to use by default or when @option{wavelet_depth}
4202 is set to 5
4203 @itemize @minus
4204 @item
4205 @var{default}
4206 Uses the default quantization matrix from the specifications, extended with
4207 values for the fifth level. This provides a good balance between keeping detail
4208 and omitting artifacts.
4209
4210 @item
4211 @var{flat}
4212 Use a completely zeroed out quantization matrix. This increases PSNR but might
4213 reduce perception. Use in bogus benchmarks.
4214
4215 @item
4216 @var{color}
4217 Reduces detail but attempts to preserve color at extremely low bitrates.
4218 @end itemize
4219
4220 @end table
4221
4222 @c man end VIDEO ENCODERS
4223
4224 @chapter Subtitles Encoders
4225 @c man begin SUBTITLES ENCODERS
4226
4227 @section dvdsub
4228
4229 This codec encodes the bitmap subtitle format that is used in DVDs.
4230 Typically they are stored in VOBSUB file pairs (*.idx + *.sub),
4231 and they can also be used in Matroska files.
4232
4233 @subsection Options
4234
4235 @table @option
4236 @item palette
4237 Specify the global palette used by the bitmaps.
4238
4239 The format for this option is a string containing 16 24-bits hexadecimal
4240 numbers (without 0x prefix) separated by commas, for example @code{0d00ee,
4241 ee450d, 101010, eaeaea, 0ce60b, ec14ed, ebff0b, 0d617a, 7b7b7b, d1d1d1,
4242 7b2a0e, 0d950c, 0f007b, cf0dec, cfa80c, 7c127b}.
4243
4244 @item even_rows_fix
4245 When set to 1, enable a work-around that makes the number of pixel rows
4246 even in all subtitles.  This fixes a problem with some players that
4247 cut off the bottom row if the number is odd.  The work-around just adds
4248 a fully transparent row if needed.  The overhead is low, typically
4249 one byte per subtitle on average.
4250
4251 By default, this work-around is disabled.
4252 @end table
4253
4254 @c man end SUBTITLES ENCODERS