doc: Add VAAPI encoders
[libav.git] / doc / encoders.texi
CommitLineData
0fa904c9
JZ
1@chapter Encoders
2@c man begin ENCODERS
3
f8a45fa1 4Encoders are configured elements in Libav which allow the encoding of
0fa904c9
JZ
5multimedia streams.
6
f8a45fa1 7When you configure your Libav build, all the supported native encoders
0fa904c9
JZ
8are enabled by default. Encoders requiring an external library must be enabled
9manually via the corresponding @code{--enable-lib} option. You can list all
10available encoders using the configure option @code{--list-encoders}.
11
12You can disable all the encoders with the configure option
13@code{--disable-encoders} and selectively enable / disable single encoders
14with the options @code{--enable-encoder=@var{ENCODER}} /
15@code{--disable-encoder=@var{ENCODER}}.
16
64ba831d 17The option @code{-encoders} of the av* tools will display the list of
0fa904c9
JZ
18enabled encoders.
19
a2ee2843
SS
20@c man end ENCODERS
21
22@chapter Audio Encoders
23@c man begin AUDIO ENCODERS
991f3de1 24
a2ee2843
SS
25A description of some of the currently available audio encoders
26follows.
991f3de1 27
a2ee2843 28@section ac3 and ac3_fixed
991f3de1
JR
29
30AC-3 audio encoders.
31
32These encoders implement part of ATSC A/52:2010 and ETSI TS 102 366, as well as
33the undocumented RealAudio 3 (a.k.a. dnet).
34
35The @var{ac3} encoder uses floating-point math, while the @var{ac3_fixed}
36encoder only uses fixed-point integer math. This does not mean that one is
37always faster, just that one or the other may be better suited to a
38particular system. The floating-point encoder will generally produce better
39quality audio for a given bitrate. The @var{ac3_fixed} encoder is not the
40default codec for any of the output formats, so it must be specified explicitly
4141a5a2 41using the option @code{-c:a ac3_fixed} in order to use it.
991f3de1 42
a2ee2843 43@subsection AC-3 Metadata
991f3de1
JR
44
45The AC-3 metadata options are used to set parameters that describe the audio,
46but in most cases do not affect the audio encoding itself. Some of the options
47do directly affect or influence the decoding and playback of the resulting
48bitstream, while others are just for informational purposes. A few of the
49options will add bits to the output stream that could otherwise be used for
50audio data, and will thus affect the quality of the output. Those will be
51indicated accordingly with a note in the option list below.
52
53These parameters are described in detail in several publicly-available
54documents.
55@itemize
56@item @uref{http://www.atsc.org/cms/standards/a_52-2010.pdf,A/52:2010 - Digital Audio Compression (AC-3) (E-AC-3) Standard}
57@item @uref{http://www.atsc.org/cms/standards/a_54a_with_corr_1.pdf,A/54 - Guide to the Use of the ATSC Digital Television Standard}
58@item @uref{http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/18_Metadata.Guide.pdf,Dolby Metadata Guide}
59@item @uref{http://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/46_DDEncodingGuidelines.pdf,Dolby Digital Professional Encoding Guidelines}
60@end itemize
61
a2ee2843 62@subsubsection Metadata Control Options
991f3de1
JR
63
64@table @option
65
66@item -per_frame_metadata @var{boolean}
67Allow Per-Frame Metadata. Specifies if the encoder should check for changing
68metadata for each frame.
69@table @option
70@item 0
71The metadata values set at initialization will be used for every frame in the
72stream. (default)
73@item 1
74Metadata values can be changed before encoding each frame.
75@end table
76
77@end table
78
a2ee2843 79@subsubsection Downmix Levels
991f3de1
JR
80
81@table @option
82
83@item -center_mixlev @var{level}
84Center Mix Level. The amount of gain the decoder should apply to the center
85channel when downmixing to stereo. This field will only be written to the
86bitstream if a center channel is present. The value is specified as a scale
87factor. There are 3 valid values:
88@table @option
89@item 0.707
90Apply -3dB gain
91@item 0.595
92Apply -4.5dB gain (default)
93@item 0.500
94Apply -6dB gain
95@end table
96
97@item -surround_mixlev @var{level}
98Surround Mix Level. The amount of gain the decoder should apply to the surround
99channel(s) when downmixing to stereo. This field will only be written to the
100bitstream if one or more surround channels are present. The value is specified
101as a scale factor. There are 3 valid values:
102@table @option
103@item 0.707
104Apply -3dB gain
105@item 0.500
106Apply -6dB gain (default)
107@item 0.000
108Silence Surround Channel(s)
109@end table
110
111@end table
112
a2ee2843 113@subsubsection Audio Production Information
991f3de1
JR
114Audio Production Information is optional information describing the mixing
115environment. Either none or both of the fields are written to the bitstream.
116
117@table @option
118
119@item -mixing_level @var{number}
120Mixing Level. Specifies peak sound pressure level (SPL) in the production
121environment when the mix was mastered. Valid values are 80 to 111, or -1 for
122unknown or not indicated. The default value is -1, but that value cannot be
123used if the Audio Production Information is written to the bitstream. Therefore,
124if the @code{room_type} option is not the default value, the @code{mixing_level}
125option must not be -1.
126
127@item -room_type @var{type}
128Room Type. Describes the equalization used during the final mixing session at
129the studio or on the dubbing stage. A large room is a dubbing stage with the
130industry standard X-curve equalization; a small room has flat equalization.
131This field will not be written to the bitstream if both the @code{mixing_level}
132option and the @code{room_type} option have the default values.
133@table @option
134@item 0
135@itemx notindicated
136Not Indicated (default)
137@item 1
138@itemx large
139Large Room
140@item 2
141@itemx small
142Small Room
143@end table
144
145@end table
146
a2ee2843 147@subsubsection Other Metadata Options
991f3de1
JR
148
149@table @option
150
151@item -copyright @var{boolean}
152Copyright Indicator. Specifies whether a copyright exists for this audio.
153@table @option
154@item 0
155@itemx off
156No Copyright Exists (default)
157@item 1
158@itemx on
159Copyright Exists
160@end table
161
162@item -dialnorm @var{value}
163Dialogue Normalization. Indicates how far the average dialogue level of the
164program is below digital 100% full scale (0 dBFS). This parameter determines a
165level shift during audio reproduction that sets the average volume of the
166dialogue to a preset level. The goal is to match volume level between program
167sources. A value of -31dB will result in no volume level change, relative to
168the source volume, during audio reproduction. Valid values are whole numbers in
169the range -31 to -1, with -31 being the default.
170
171@item -dsur_mode @var{mode}
172Dolby Surround Mode. Specifies whether the stereo signal uses Dolby Surround
173(Pro Logic). This field will only be written to the bitstream if the audio
174stream is stereo. Using this option does @b{NOT} mean the encoder will actually
175apply Dolby Surround processing.
176@table @option
177@item 0
178@itemx notindicated
179Not Indicated (default)
180@item 1
181@itemx off
182Not Dolby Surround Encoded
183@item 2
184@itemx on
185Dolby Surround Encoded
186@end table
187
188@item -original @var{boolean}
189Original Bit Stream Indicator. Specifies whether this audio is from the
190original source and not a copy.
191@table @option
192@item 0
193@itemx off
194Not Original Source
195@item 1
196@itemx on
197Original Source (default)
198@end table
199
200@end table
201
a2ee2843 202@subsection Extended Bitstream Information
991f3de1
JR
203The extended bitstream options are part of the Alternate Bit Stream Syntax as
204specified in Annex D of the A/52:2010 standard. It is grouped into 2 parts.
205If any one parameter in a group is specified, all values in that group will be
206written to the bitstream. Default values are used for those that are written
207but have not been specified. If the mixing levels are written, the decoder
208will use these values instead of the ones specified in the @code{center_mixlev}
209and @code{surround_mixlev} options if it supports the Alternate Bit Stream
210Syntax.
211
a2ee2843 212@subsubsection Extended Bitstream Information - Part 1
991f3de1
JR
213
214@table @option
215
216@item -dmix_mode @var{mode}
217Preferred Stereo Downmix Mode. Allows the user to select either Lt/Rt
218(Dolby Surround) or Lo/Ro (normal stereo) as the preferred stereo downmix mode.
219@table @option
220@item 0
221@itemx notindicated
222Not Indicated (default)
223@item 1
224@itemx ltrt
225Lt/Rt Downmix Preferred
226@item 2
227@itemx loro
228Lo/Ro Downmix Preferred
229@end table
230
231@item -ltrt_cmixlev @var{level}
232Lt/Rt Center Mix Level. The amount of gain the decoder should apply to the
233center channel when downmixing to stereo in Lt/Rt mode.
234@table @option
235@item 1.414
236Apply +3dB gain
237@item 1.189
238Apply +1.5dB gain
239@item 1.000
240Apply 0dB gain
241@item 0.841
242Apply -1.5dB gain
243@item 0.707
244Apply -3.0dB gain
245@item 0.595
246Apply -4.5dB gain (default)
247@item 0.500
248Apply -6.0dB gain
249@item 0.000
250Silence Center Channel
251@end table
252
253@item -ltrt_surmixlev @var{level}
254Lt/Rt Surround Mix Level. The amount of gain the decoder should apply to the
255surround channel(s) when downmixing to stereo in Lt/Rt mode.
256@table @option
257@item 0.841
258Apply -1.5dB gain
259@item 0.707
260Apply -3.0dB gain
261@item 0.595
262Apply -4.5dB gain
263@item 0.500
264Apply -6.0dB gain (default)
265@item 0.000
266Silence Surround Channel(s)
267@end table
268
269@item -loro_cmixlev @var{level}
270Lo/Ro Center Mix Level. The amount of gain the decoder should apply to the
271center channel when downmixing to stereo in Lo/Ro mode.
272@table @option
273@item 1.414
274Apply +3dB gain
275@item 1.189
276Apply +1.5dB gain
277@item 1.000
278Apply 0dB gain
279@item 0.841
280Apply -1.5dB gain
281@item 0.707
282Apply -3.0dB gain
283@item 0.595
284Apply -4.5dB gain (default)
285@item 0.500
286Apply -6.0dB gain
287@item 0.000
288Silence Center Channel
289@end table
290
291@item -loro_surmixlev @var{level}
292Lo/Ro Surround Mix Level. The amount of gain the decoder should apply to the
293surround channel(s) when downmixing to stereo in Lo/Ro mode.
294@table @option
295@item 0.841
296Apply -1.5dB gain
297@item 0.707
298Apply -3.0dB gain
299@item 0.595
300Apply -4.5dB gain
301@item 0.500
302Apply -6.0dB gain (default)
303@item 0.000
304Silence Surround Channel(s)
305@end table
306
307@end table
308
a2ee2843 309@subsubsection Extended Bitstream Information - Part 2
991f3de1
JR
310
311@table @option
312
313@item -dsurex_mode @var{mode}
314Dolby Surround EX Mode. Indicates whether the stream uses Dolby Surround EX
315(7.1 matrixed to 5.1). Using this option does @b{NOT} mean the encoder will actually
316apply Dolby Surround EX processing.
317@table @option
318@item 0
319@itemx notindicated
320Not Indicated (default)
321@item 1
322@itemx on
3e68b282 323Dolby Surround EX Off
991f3de1
JR
324@item 2
325@itemx off
3e68b282 326Dolby Surround EX On
991f3de1
JR
327@end table
328
329@item -dheadphone_mode @var{mode}
330Dolby Headphone Mode. Indicates whether the stream uses Dolby Headphone
331encoding (multi-channel matrixed to 2.0 for use with headphones). Using this
332option does @b{NOT} mean the encoder will actually apply Dolby Headphone
333processing.
334@table @option
335@item 0
336@itemx notindicated
337Not Indicated (default)
338@item 1
339@itemx on
3e68b282 340Dolby Headphone Off
991f3de1
JR
341@item 2
342@itemx off
3e68b282 343Dolby Headphone On
991f3de1
JR
344@end table
345
346@item -ad_conv_type @var{type}
347A/D Converter Type. Indicates whether the audio has passed through HDCD A/D
348conversion.
349@table @option
350@item 0
351@itemx standard
352Standard A/D Converter (default)
353@item 1
354@itemx hdcd
355HDCD A/D Converter
356@end table
357
358@end table
359
a2ee2843 360@subsection Other AC-3 Encoding Options
e0b33d47
JR
361
362@table @option
363
364@item -stereo_rematrixing @var{boolean}
365Stereo Rematrixing. Enables/Disables use of rematrixing for stereo input. This
366is an optional AC-3 feature that increases quality by selectively encoding
367the left/right channels as mid/side. This option is enabled by default, and it
368is highly recommended that it be left as enabled except for testing purposes.
369
370@end table
371
7f3a7b5c
JR
372@subheading Floating-Point-Only AC-3 Encoding Options
373
374These options are only valid for the floating-point encoder and do not exist
375for the fixed-point encoder due to the corresponding features not being
376implemented in fixed-point.
377
378@table @option
379
380@item -channel_coupling @var{boolean}
381Enables/Disables use of channel coupling, which is an optional AC-3 feature
382that increases quality by combining high frequency information from multiple
383channels into a single channel. The per-channel high frequency information is
384sent with less accuracy in both the frequency and time domains. This allows
385more bits to be used for lower frequencies while preserving enough information
386to reconstruct the high frequencies. This option is enabled by default for the
387floating-point encoder and should generally be left as enabled except for
388testing purposes or to increase encoding speed.
389@table @option
390@item -1
391@itemx auto
392Selected by Encoder (default)
393@item 0
394@itemx off
395Disable Channel Coupling
396@item 1
397@itemx on
398Enable Channel Coupling
399@end table
400
401@item -cpl_start_band @var{number}
402Coupling Start Band. Sets the channel coupling start band, from 1 to 15. If a
403value higher than the bandwidth is used, it will be reduced to 1 less than the
404coupling end band. If @var{auto} is used, the start band will be determined by
405the encoder based on the bit rate, sample rate, and channel layout. This option
406has no effect if channel coupling is disabled.
407@table @option
408@item -1
409@itemx auto
410Selected by Encoder (default)
411@end table
412
413@end table
414
84d3ff50
AK
415@section libwavpack
416
417A wrapper providing WavPack encoding through libwavpack.
418
419Only lossless mode using 32-bit integer samples is supported currently.
420The @option{compression_level} option can be used to control speed vs.
421compression tradeoff, with the values mapped to libwavpack as follows:
422
423@table @option
424
425@item 0
426Fast mode - corresponding to the wavpack @option{-f} option.
427
428@item 1
429Normal (default) settings.
430
431@item 2
432High quality - corresponding to the wavpack @option{-h} option.
433
434@item 3
435Very high quality - corresponding to the wavpack @option{-hh} option.
436
437@item 4-8
438Same as 3, but with extra processing enabled - corresponding to the wavpack
439@option{-x} option. I.e. 4 is the same as @option{-x2} and 8 is the same as
440@option{-x6}.
441
442@end table
443
a2ee2843 444@c man end AUDIO ENCODERS
ded3673d
LB
445
446@chapter Video Encoders
447@c man begin VIDEO ENCODERS
448
be7c3231
JR
449@section libwebp
450
451libwebp WebP Image encoder wrapper
452
453libwebp is Google's official encoder for WebP images. It can encode in either
454lossy or lossless mode. Lossy images are essentially a wrapper around a VP8
455frame. Lossless images are a separate codec developed by Google.
456
457@subsection Pixel Format
458
459Currently, libwebp only supports YUV420 for lossy and RGB for lossless due
460to limitations of the format and libwebp. Alpha is supported for either mode.
461Because of API limitations, if RGB is passed in when encoding lossy or YUV is
462passed in for encoding lossless, the pixel format will automatically be
463converted using functions from libwebp. This is not ideal and is done only for
464convenience.
465
466@subsection Options
467
468@table @option
469
470@item -lossless @var{boolean}
471Enables/Disables use of lossless mode. Default is 0.
472
473@item -compression_level @var{integer}
474For lossy, this is a quality/speed tradeoff. Higher values give better quality
475for a given size at the cost of increased encoding time. For lossless, this is
476a size/speed tradeoff. Higher values give smaller size at the cost of increased
477encoding time. More specifically, it controls the number of extra algorithms
478and compression tools used, and varies the combination of these tools. This
479maps to the @var{method} option in libwebp. The valid range is 0 to 6.
480Default is 4.
481
482@item -qscale @var{float}
483For lossy encoding, this controls image quality, 0 to 100. For lossless
484encoding, this controls the effort and time spent at compressing more. The
485default value is 75. Note that for usage via libavcodec, this option is called
486@var{global_quality} and must be multiplied by @var{FF_QP2LAMBDA}.
487
488@item -preset @var{type}
489Configuration preset. This does some automatic settings based on the general
490type of the image.
491@table @option
492@item none
493Do not use a preset.
494@item default
495Use the encoder default.
496@item picture
497Digital picture, like portrait, inner shot
498@item photo
499Outdoor photograph, with natural lighting
500@item drawing
501Hand or line drawing, with high-contrast details
502@item icon
503Small-sized colorful images
504@item text
505Text-like
506@end table
507
5ce7ca68
TG
508@item lumi_aq
509Enable lumi masking adaptive quantization when set to 1. Default is 0
510(disabled).
511
512@item variance_aq
513Enable variance adaptive quantization when set to 1. Default is 0
514(disabled).
515
516When combined with @option{lumi_aq}, the resulting quality will not
517be better than any of the two specified individually. In other
518words, the resulting quality will be the worse one of the two
519effects.
520
c389a804
TG
521@item ssim
522Set structural similarity (SSIM) displaying method. Possible values:
523
524@table @samp
525@item off
526Disable displaying of SSIM information.
527
528@item avg
529Output average SSIM at the end of encoding to stdout. The format of
530showing the average SSIM is:
531
532@example
533Average SSIM: %f
534@end example
535
536For users who are not familiar with C, %f means a float number, or
537a decimal (e.g. 0.939232).
538
539@item frame
540Output both per-frame SSIM data during encoding and average SSIM at
541the end of encoding to stdout. The format of per-frame information
542is:
543
544@example
545 SSIM: avg: %1.3f min: %1.3f max: %1.3f
546@end example
547
548For users who are not familiar with C, %1.3f means a float number
549rounded to 3 digits after the dot (e.g. 0.932).
550
551@end table
552
553@item ssim_acc
554Set SSIM accuracy. Valid options are integers within the range of
5550-4, while 0 gives the most accurate result and 4 computes the
556fastest.
557
be7c3231
JR
558@end table
559
ded3673d
LB
560@section libx264
561
562x264 H.264/MPEG-4 AVC encoder wrapper
563
564x264 supports an impressive number of features, including 8x8 and 4x4 adaptive
565spatial transform, adaptive B-frame placement, CAVLC/CABAC entropy coding,
566interlacing (MBAFF), lossless mode, psy optimizations for detail retention
567(adaptive quantization, psy-RD, psy-trellis).
568
569The Libav wrapper provides a mapping for most of them using global options
570that match those of the encoders and provides private options for the unique
571encoder options. Additionally an expert override is provided to directly pass
572a list of key=value tuples as accepted by x264_param_parse.
573
574@subsection Option Mapping
575
576The following options are supported by the x264 wrapper, the x264-equivalent
577options follow the Libav ones.
578
0d671ade 579@multitable { } { } { }
ded3673d 580@item b @tab bitrate
0d671ade 581@tab Libav @code{b} option is expressed in bits/s, x264 @code{bitrate} in kilobits/s.
ded3673d 582@item bf @tab bframes
0d671ade 583@tab Maximum number of B-frames.
ded3673d 584@item g @tab keyint
0d671ade 585@tab Maximum GOP size.
ded3673d 586@item qmin @tab qpmin
e6e8be54 587@tab Minimum quantizer scale.
ded3673d 588@item qmax @tab qpmax
e6e8be54 589@tab Maximum quantizer scale.
ded3673d 590@item qdiff @tab qpstep
e6e8be54 591@tab Maximum difference between quantizer scales.
ded3673d 592@item qblur @tab qblur
e6e8be54 593@tab Quantizer curve blur
ded3673d 594@item qcomp @tab qcomp
e6e8be54 595@tab Quantizer curve compression factor
ded3673d 596@item refs @tab ref
e6e8be54 597@tab Number of reference frames each P-frame can use. The range is from @var{0-16}.
ded3673d 598@item sc_threshold @tab scenecut
e6e8be54 599@tab Sets the threshold for the scene change detection.
ded3673d 600@item trellis @tab trellis
e6e8be54 601@tab Performs Trellis quantization to increase efficiency. Enabled by default.
ded3673d 602@item nr @tab nr
0d671ade 603@tab Noise reduction.
ded3673d 604@item me_range @tab merange
e6e8be54 605@tab Maximum range of the motion search in pixels.
ded3673d 606@item subq @tab subme
e6e8be54 607@tab Sub-pixel motion estimation method.
ded3673d 608@item b_strategy @tab b-adapt
e6e8be54
LB
609@tab Adaptive B-frame placement decision algorithm. Use only on first-pass.
610@item keyint_min @tab min-keyint
611@tab Minimum GOP size.
ded3673d 612@item coder @tab cabac
0d671ade 613@tab Set coder to @code{ac} to use CABAC.
ded3673d 614@item cmp @tab chroma-me
0d671ade 615@tab Set to @code{chroma} to use chroma motion estimation.
ded3673d 616@item threads @tab threads
e6e8be54 617@tab Number of encoding threads.
ded3673d 618@item thread_type @tab sliced_threads
0d671ade 619@tab Set to @code{slice} to use sliced threading instead of frame threading.
ded3673d 620@item flags -cgop @tab open-gop
0d671ade 621@tab Set @code{-cgop} to use recovery points to close GOPs.
ded3673d 622@item rc_init_occupancy @tab vbv-init
0d671ade 623@tab Initial buffer occupancy.
ded3673d
LB
624@end multitable
625
626@subsection Private Options
627@table @option
628@item -preset @var{string}
629Set the encoding preset (cf. x264 --fullhelp).
630@item -tune @var{string}
631Tune the encoding params (cf. x264 --fullhelp).
632@item -profile @var{string}
633Set profile restrictions (cf. x264 --fullhelp).
634@item -fastfirstpass @var{integer}
635Use fast settings when encoding first pass.
636@item -crf @var{float}
637Select the quality for constant quality mode.
638@item -crf_max @var{float}
639In CRF mode, prevents VBV from lowering quality beyond this point.
640@item -qp @var{integer}
641Constant quantization parameter rate control method.
642@item -aq-mode @var{integer}
643AQ method
644
645Possible values:
646@table @samp
647@item none
648
649@item variance
650Variance AQ (complexity mask).
651@item autovariance
652Auto-variance AQ (experimental).
653@end table
654@item -aq-strength @var{float}
655AQ strength, reduces blocking and blurring in flat and textured areas.
656@item -psy @var{integer}
657Use psychovisual optimizations.
658@item -psy-rd @var{string}
659Strength of psychovisual optimization, in <psy-rd>:<psy-trellis> format.
660@item -rc-lookahead @var{integer}
661Number of frames to look ahead for frametype and ratecontrol.
662@item -weightb @var{integer}
663Weighted prediction for B-frames.
664@item -weightp @var{integer}
665Weighted prediction analysis method.
666
667Possible values:
668@table @samp
669@item none
670
671@item simple
672
673@item smart
674
675@end table
676@item -ssim @var{integer}
677Calculate and print SSIM stats.
678@item -intra-refresh @var{integer}
679Use Periodic Intra Refresh instead of IDR frames.
bc54c2ae
LB
680@item -bluray-compat @var{integer}
681Configure the encoder to be compatible with the bluray standard.
682It is a shorthand for setting "bluray-compat=1 force-cfr=1".
ded3673d
LB
683@item -b-bias @var{integer}
684Influences how often B-frames are used.
685@item -b-pyramid @var{integer}
686Keep some B-frames as references.
687
688Possible values:
689@table @samp
690@item none
691
692@item strict
693Strictly hierarchical pyramid.
694@item normal
695Non-strict (not Blu-ray compatible).
696@end table
697@item -mixed-refs @var{integer}
698One reference per partition, as opposed to one reference per macroblock.
699@item -8x8dct @var{integer}
700High profile 8x8 transform.
701@item -fast-pskip @var{integer}
702@item -aud @var{integer}
703Use access unit delimiters.
704@item -mbtree @var{integer}
705Use macroblock tree ratecontrol.
706@item -deblock @var{string}
707Loop filter parameters, in <alpha:beta> form.
708@item -cplxblur @var{float}
709Reduce fluctuations in QP (before curve compression).
710@item -partitions @var{string}
711A comma-separated list of partitions to consider, possible values: p8x8, p4x4, b8x8, i8x8, i4x4, none, all.
712@item -direct-pred @var{integer}
713Direct MV prediction mode
714
715Possible values:
716@table @samp
717@item none
718
719@item spatial
720
721@item temporal
722
723@item auto
724
725@end table
726@item -slice-max-size @var{integer}
727Limit the size of each slice in bytes.
728@item -stats @var{string}
729Filename for 2 pass stats.
730@item -nal-hrd @var{integer}
731Signal HRD information (requires vbv-bufsize; cbr not allowed in .mp4).
732
733Possible values:
734@table @samp
735@item none
736
737@item vbr
738
739@item cbr
740
741@end table
742@item -x264-params @var{string}
743Override the x264 configuration using a :-separated list of key=value parameters.
744@example
745-x264-params level=30:bframes=0:weightp=0:cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:no-fast-pskip=1:subq=6:8x8dct=0:trellis=0
746@end example
747@end table
748
749Encoding avpresets for common usages are provided so they can be used with the
750general presets system (e.g. passing the @code{-pre} option).
751
f223ad1e
AK
752@section ProRes
753
754Apple ProRes encoder.
755
756@subsection Private Options
757
758@table @option
759@item profile @var{integer}
760Select the ProRes profile to encode
761@table @samp
762@item proxy
763@item lt
764@item standard
765@item hq
0b0953ba 766@item 4444
f223ad1e
AK
767@end table
768
769@item quant_mat @var{integer}
770Select quantization matrix.
771@table @samp
772@item auto
773@item default
774@item proxy
775@item lt
776@item standard
777@item hq
778@end table
779If set to @var{auto}, the matrix matching the profile will be picked.
780If not set, the matrix providing the highest quality, @var{default}, will be
781picked.
782
783@item bits_per_mb @var{integer}
784How many bits to allot for coding one macroblock. Different profiles use
785between 200 and 2400 bits per macroblock, the maximum is 8000.
786
787@item mbs_per_slice @var{integer}
788Number of macroblocks in each slice (1-8); the default value (8)
789should be good in almost all situations.
790
791@item vendor @var{string}
792Override the 4-byte vendor ID.
793A custom vendor ID like @var{apl0} would claim the stream was produced by
794the Apple encoder.
795
0b0953ba
KS
796@item alpha_bits @var{integer}
797Specify number of bits for alpha component.
798Possible values are @var{0}, @var{8} and @var{16}.
799Use @var{0} to disable alpha plane coding.
800
f223ad1e
AK
801@end table
802
803@subsection Speed considerations
804
805In the default mode of operation the encoder has to honor frame constraints
41ed7ab4
VG
806(i.e. not produce frames with a size larger than requested) while still making
807the output picture as good as possible.
f223ad1e
AK
808A frame containing a lot of small details is harder to compress and the encoder
809would spend more time searching for appropriate quantizers for each slice.
810
811Setting a higher @option{bits_per_mb} limit will improve the speed.
812
813For the fastest encoding speed set the @option{qscale} parameter (4 is the
814recommended value) and do not set a size constraint.
815
233d2fa0
AYO
816@section libkvazaar
817
818Kvazaar H.265/HEVC encoder.
819
820Requires the presence of the libkvazaar headers and library during
821configuration. You need to explicitly configure the build with
822@option{--enable-libkvazaar}.
823
824@subsection Options
825
826@table @option
827
828@item b
829Set target video bitrate in bit/s and enable rate control.
830
831@item kvazaar-params
832Set kvazaar parameters as a list of @var{name}=@var{value} pairs separated
833by commas (,). See kvazaar documentation for a list of options.
834
835@end table
836
8a9de5c5
AK
837@section QSV encoders
838
839The family of Intel QuickSync Video encoders (MPEG-2, H.264 and HEVC)
840
841The ratecontrol method is selected as follows:
842
843@itemize @bullet
844@item
845When @option{global_quality} is specified, a quality-based mode is used.
846Specifically this means either
847@itemize @minus
848@item
849@var{CQP} - constant quantizer scale, when the @option{qscale} codec flag is
850also set (the @option{-qscale} avconv option).
851
852@item
853@var{LA_ICQ} - intelligent constant quality with lookahead, when the
854@option{la_depth} option is also set.
855
856@item
857@var{ICQ} -- intelligent constant quality otherwise.
858@end itemize
859
860@item
861Otherwise, a bitrate-based mode is used. For all of those, you should specify at
862least the desired average bitrate with the @option{b} option.
863@itemize @minus
864@item
865@var{LA} - VBR with lookahead, when the @option{la_depth} option is specified.
866
867@item
868@var{VCM} - video conferencing mode, when the @option{vcm} option is set.
869
870@item
871@var{CBR} - constant bitrate, when @option{maxrate} is specified and equal to
872the average bitrate.
873
874@item
875@var{VBR} - variable bitrate, when @option{maxrate} is specified, but is higher
876than the average bitrate.
877
878@item
879@var{AVBR} - average VBR mode, when @option{maxrate} is not specified. This mode
880is further configured by the @option{avbr_accuracy} and
881@option{avbr_convergence} options.
882@end itemize
883@end itemize
884
885Note that depending on your system, a different mode than the one you specified
886may be selected by the encoder. Set the verbosity level to @var{verbose} or
887higher to see the actual settings used by the QSV runtime.
888
889Additional libavcodec global options are mapped to MSDK options as follows:
890
891@itemize
892@item
893@option{g/gop_size} -> @option{GopPicSize}
894
895@item
896@option{bf/max_b_frames}+1 -> @option{GopRefDist}
897
898@item
899@option{rc_init_occupancy/rc_initial_buffer_occupancy} ->
900@option{InitialDelayInKB}
901
902@item
903@option{slices} -> @option{NumSlice}
904
905@item
906@option{refs} -> @option{NumRefFrame}
907
908@item
909@option{b_strategy/b_frame_strategy} -> @option{BRefType}
910
911@item
912@option{cgop/CLOSED_GOP} codec flag -> @option{GopOptFlag}
913
914@item
915For the @var{CQP} mode, the @option{i_qfactor/i_qoffset} and
916@option{b_qfactor/b_qoffset} set the difference between @var{QPP} and @var{QPI},
917and @var{QPP} and @var{QPB} respectively.
918
919@item
920Setting the @option{coder} option to the value @var{vlc} will make the H.264
921encoder use CAVLC instead of CABAC.
922
923@end itemize
924
41dda860
MT
925@section VAAPI encoders
926
927Wrappers for hardware encoders accessible via VAAPI.
928
929These encoders only accept input in VAAPI hardware surfaces. If you have input
930in software frames, use the @option{hwupload} filter to upload them to the GPU.
931
932The following standard libavcodec options are used:
933@itemize
934@item
935@option{g} / @option{gop_size}
936@item
937@option{bf} / @option{max_b_frames}
938@item
939@option{profile}
940@item
941@option{level}
942@item
943@option{b} / @option{bit_rate}
944@item
945@option{maxrate} / @option{rc_max_rate}
946@item
947@option{bufsize} / @option{rc_buffer_size}
948@item
949@option{rc_init_occupancy} / @option{rc_initial_buffer_occupancy}
950@item
951@option{q} / @option{global_quality}
952@item
953@option{qmin}
954(only: @option{qmax} is not supported)
955@item
956@option{i_qfactor} / @option{i_quant_factor}
957@item
958@option{i_qoffset} / @option{i_quant_offset}
959@item
960@option{b_qfactor} / @option{b_quant_factor}
961@item
962@option{b_qoffset} / @option{b_quant_offset}
963@end itemize
964
965@table @option
966
967@item vaapi_h264
968@option{profile} sets the value of @emph{profile_idc} and the @emph{constraint_set*_flag}s.
969@option{level} sets the value of @emph{level_idc}.
970
971@table @option
972@item quality
973Set the local encoding quality/speed tradeoff (range 1-8, higher values are faster; not all
974systems implement all levels).
975@item low_power
976Use low-power encoding mode.
977@end table
978
979@item vaapi_hevc
980@option{profile} and @option{level} set the values of
981@emph{general_profile_idc} and @emph{general_level_idc} respectively.
982
983@item vaapi_mjpeg
984Always encodes using the standard quantisation and huffman tables -
985@option{global_quality} scales the standard quantisation table (range 1-100).
986
987@item vaapi_mpeg2
988@option{profile} and @option{level} set the value of @emph{profile_and_level_indication}.
989
990No rate control is supported.
991
992@item vaapi_vp8
993B-frames are not supported.
994
995@option{global_quality} sets the @emph{q_idx} used for non-key frames (range 0-127).
996
997@table @option
998@item loop_filter_level
999@item loop_filter_sharpness
1000Manually set the loop filter parameters.
1001@end table
1002
1003@item vaapi_vp9
1004@option{global_quality} sets the @emph{q_idx} used for P-frames (range 0-255).
1005
1006@table @option
1007@item loop_filter_level
1008@item loop_filter_sharpness
1009Manually set the loop filter parameters.
1010@end table
1011
1012B-frames are supported, but the output stream is always in encode order rather than display
1013order. If B-frames are enabled, it may be necessary to use the @option{vp9_raw_reorder}
1014bitstream filter to modify the output stream to display frames in the correct order.
1015
1016Only normal frames are produced - the @option{vp9_superframe} bitstream filter may be
1017required to produce a stream usable with all decoders.
1018
1019@end table
1020
ded3673d 1021@c man end VIDEO ENCODERS