3 @c man begin CODEC OPTIONS
5 libavcodec provides some generic global options, which can be set on
6 all the encoders and decoders. In addition each codec may support
7 so-called private options, which are specific for a given codec.
9 Sometimes, a global option may only affect a specific kind of codec,
10 and may be nonsensical or ignored by another, so you need to be aware
11 of the meaning of the specified options. Also some options are
12 meant only for decoding or encoding.
14 Options may be set by specifying -@var{option} @var{value} in the
15 FFmpeg tools, or by setting the value explicitly in the
16 @code{AVCodecContext} options or using the @file{libavutil/opt.h} API
19 The list of supported options follow:
22 @item b @var{integer} (@emph{encoding,audio,video})
23 Set bitrate in bits/s. Default value is 200K.
25 @item ab @var{integer} (@emph{encoding,audio})
26 Set audio bitrate (in bits/s). Default value is 128K.
28 @item bt @var{integer} (@emph{encoding,video})
29 Set video bitrate tolerance (in bits/s). In 1-pass mode, bitrate
30 tolerance specifies how far ratecontrol is willing to deviate from the
31 target average bitrate value. This is not related to min/max
32 bitrate. Lowering tolerance too much has an adverse effect on quality.
34 @item flags @var{flags} (@emph{decoding/encoding,audio,video,subtitles})
40 Use four motion vector by macroblock (mpeg4).
42 Use 1/4 pel motion compensation.
48 Use internal 2pass ratecontrol in first pass mode.
50 Use internal 2pass ratecontrol in second pass mode.
52 Only decode/encode grayscale.
54 Set error[?] variables during encoding.
56 Input bitstream might be randomly truncated.
58 Don't output frames whose parameters differ from first decoded frame in stream.
59 Error AVERROR_INPUT_CHANGED is returned when a frame is dropped.
66 Place global headers in extradata instead of every keyframe.
68 Only write platform-, build- and time-independent data. (except (I)DCT).
69 This ensures that file and data checksums are reproducible and match between
70 platforms. Its primary use is for regression testing.
72 Apply H263 advanced intra coding / mpeg4 ac prediction.
74 Apply interlaced motion estimation.
78 Output even potentially corrupted frames.
81 @item time_base @var{rational number}
84 It is the fundamental unit of time (in seconds) in terms of which
85 frame timestamps are represented. For fixed-fps content, timebase
86 should be @code{1 / frame_rate} and timestamp increments should be
89 @item g @var{integer} (@emph{encoding,video})
90 Set the group of picture (GOP) size. Default value is 12.
92 @item ar @var{integer} (@emph{decoding/encoding,audio})
93 Set audio sampling rate (in Hz).
95 @item ac @var{integer} (@emph{decoding/encoding,audio})
96 Set number of audio channels.
98 @item cutoff @var{integer} (@emph{encoding,audio})
99 Set cutoff bandwidth. (Supported only by selected encoders, see
100 their respective documentation sections.)
102 @item frame_size @var{integer} (@emph{encoding,audio})
103 Set audio frame size.
105 Each submitted frame except the last must contain exactly frame_size
106 samples per channel. May be 0 when the codec has
107 CODEC_CAP_VARIABLE_FRAME_SIZE set, in that case the frame size is not
108 restricted. It is set by some decoders to indicate constant frame
111 @item frame_number @var{integer}
112 Set the frame number.
114 @item delay @var{integer}
116 @item qcomp @var{float} (@emph{encoding,video})
117 Set video quantizer scale compression (VBR). It is used as a constant
118 in the ratecontrol equation. Recommended range for default rc_eq:
121 @item qblur @var{float} (@emph{encoding,video})
122 Set video quantizer scale blur (VBR).
124 @item qmin @var{integer} (@emph{encoding,video})
125 Set min video quantizer scale (VBR). Must be included between -1 and
126 69, default value is 2.
128 @item qmax @var{integer} (@emph{encoding,video})
129 Set max video quantizer scale (VBR). Must be included between -1 and
130 1024, default value is 31.
132 @item qdiff @var{integer} (@emph{encoding,video})
133 Set max difference between the quantizer scale (VBR).
135 @item bf @var{integer} (@emph{encoding,video})
136 Set max number of B frames between non-B-frames.
138 Must be an integer between -1 and 16. 0 means that B-frames are
139 disabled. If a value of -1 is used, it will choose an automatic value
140 depending on the encoder.
144 @item b_qfactor @var{float} (@emph{encoding,video})
145 Set qp factor between P and B frames.
147 @item b_strategy @var{integer} (@emph{encoding,video})
148 Set strategy to choose between I/P/B-frames.
150 @item ps @var{integer} (@emph{encoding,video})
151 Set RTP payload size in bytes.
153 @item mv_bits @var{integer}
154 @item header_bits @var{integer}
155 @item i_tex_bits @var{integer}
156 @item p_tex_bits @var{integer}
157 @item i_count @var{integer}
158 @item p_count @var{integer}
159 @item skip_count @var{integer}
160 @item misc_bits @var{integer}
161 @item frame_bits @var{integer}
162 @item codec_tag @var{integer}
163 @item bug @var{flags} (@emph{decoding,video})
164 Workaround not auto detected encoder bugs.
171 Xvid interlacing bug (autodetected if fourcc==XVIX)
173 (autodetected if fourcc==UMP4)
175 padding bug (autodetected)
181 old standard qpel (autodetected per fourcc/version)
184 @item direct_blocksize
185 direct-qpel-blocksize bug (autodetected per fourcc/version)
187 edge padding bug (autodetected per fourcc/version)
193 Workaround various bugs in microsoft broken decoders.
198 @item strict @var{integer} (@emph{decoding/encoding,audio,video})
199 Specify how strictly to follow the standards.
204 strictly conform to an older more strict version of the spec or reference software
206 strictly conform to all the things in the spec no matter what consequences
210 allow unofficial extensions
212 allow non standardized experimental things, experimental
213 (unfinished/work in progress/not well tested) decoders and encoders.
214 Note: experimental decoders can pose a security risk, do not use this for
215 decoding untrusted input.
218 @item b_qoffset @var{float} (@emph{encoding,video})
219 Set QP offset between P and B frames.
221 @item err_detect @var{flags} (@emph{decoding,audio,video})
222 Set error detection flags.
229 detect bitstream specification deviations
231 detect improper bitstream length
233 abort decoding on minor error detection
235 ignore decoding errors, and continue decoding.
236 This is useful if you want to analyze the content of a video and thus want
237 everything to be decoded no matter what. This option will not result in a video
238 that is pleasing to watch in case of errors.
240 consider things that violate the spec and have not been seen in the wild as errors
242 consider all spec non compliancies as errors
244 consider things that a sane encoder should not do as an error
247 @item has_b_frames @var{integer}
249 @item block_align @var{integer}
251 @item mpeg_quant @var{integer} (@emph{encoding,video})
252 Use MPEG quantizers instead of H.263.
254 @item rc_override_count @var{integer}
256 @item maxrate @var{integer} (@emph{encoding,audio,video})
257 Set max bitrate tolerance (in bits/s). Requires bufsize to be set.
259 @item minrate @var{integer} (@emph{encoding,audio,video})
260 Set min bitrate tolerance (in bits/s). Most useful in setting up a CBR
261 encode. It is of little use elsewise.
263 @item bufsize @var{integer} (@emph{encoding,audio,video})
264 Set ratecontrol buffer size (in bits).
266 @item i_qfactor @var{float} (@emph{encoding,video})
267 Set QP factor between P and I frames.
269 @item i_qoffset @var{float} (@emph{encoding,video})
270 Set QP offset between P and I frames.
272 @item dct @var{integer} (@emph{encoding,video})
278 autoselect a good one (default)
288 floating point AAN DCT
291 @item lumi_mask @var{float} (@emph{encoding,video})
292 Compress bright areas stronger than medium ones.
294 @item tcplx_mask @var{float} (@emph{encoding,video})
295 Set temporal complexity masking.
297 @item scplx_mask @var{float} (@emph{encoding,video})
298 Set spatial complexity masking.
300 @item p_mask @var{float} (@emph{encoding,video})
303 @item dark_mask @var{float} (@emph{encoding,video})
304 Compress dark areas stronger than medium ones.
306 @item idct @var{integer} (@emph{decoding/encoding,video})
307 Select IDCT implementation.
320 Automatically pick a IDCT compatible with the simple one
339 floating point AAN IDCT
342 @item slice_count @var{integer}
344 @item ec @var{flags} (@emph{decoding,video})
345 Set error concealment strategy.
350 iterative motion vector (MV) search (slow)
352 use strong deblock filter for damaged MBs
354 favor predicting from the previous frame instead of the current
357 @item bits_per_coded_sample @var{integer}
359 @item pred @var{integer} (@emph{encoding,video})
360 Set prediction method.
372 @item aspect @var{rational number} (@emph{encoding,video})
373 Set sample aspect ratio.
375 @item sar @var{rational number} (@emph{encoding,video})
376 Set sample aspect ratio. Alias to @var{aspect}.
378 @item debug @var{flags} (@emph{decoding/encoding,audio,video,subtitles})
379 Print specific debug info.
392 per-block quantization parameter (QP)
396 display complexity metadata for the upcoming frame, GoP or for a given duration.
405 memory management control operations (H.264)
409 picture buffer allocations
413 skip motion compensation
416 @item cmp @var{integer} (@emph{encoding,video})
417 Set full pel me compare function.
422 sum of absolute differences, fast (default)
424 sum of squared errors
426 sum of absolute Hadamard transformed differences
428 sum of absolute DCT transformed differences
430 sum of squared quantization errors (avoid, low quality)
432 number of bits needed for the block
434 rate distortion optimal, slow
438 sum of absolute vertical differences
440 sum of squared vertical differences
442 noise preserving sum of squared differences
444 5/3 wavelet, only used in snow
446 9/7 wavelet, only used in snow
453 @item subcmp @var{integer} (@emph{encoding,video})
454 Set sub pel me compare function.
459 sum of absolute differences, fast (default)
461 sum of squared errors
463 sum of absolute Hadamard transformed differences
465 sum of absolute DCT transformed differences
467 sum of squared quantization errors (avoid, low quality)
469 number of bits needed for the block
471 rate distortion optimal, slow
475 sum of absolute vertical differences
477 sum of squared vertical differences
479 noise preserving sum of squared differences
481 5/3 wavelet, only used in snow
483 9/7 wavelet, only used in snow
490 @item mbcmp @var{integer} (@emph{encoding,video})
491 Set macroblock compare function.
496 sum of absolute differences, fast (default)
498 sum of squared errors
500 sum of absolute Hadamard transformed differences
502 sum of absolute DCT transformed differences
504 sum of squared quantization errors (avoid, low quality)
506 number of bits needed for the block
508 rate distortion optimal, slow
512 sum of absolute vertical differences
514 sum of squared vertical differences
516 noise preserving sum of squared differences
518 5/3 wavelet, only used in snow
520 9/7 wavelet, only used in snow
527 @item ildctcmp @var{integer} (@emph{encoding,video})
528 Set interlaced dct compare function.
533 sum of absolute differences, fast (default)
535 sum of squared errors
537 sum of absolute Hadamard transformed differences
539 sum of absolute DCT transformed differences
541 sum of squared quantization errors (avoid, low quality)
543 number of bits needed for the block
545 rate distortion optimal, slow
549 sum of absolute vertical differences
551 sum of squared vertical differences
553 noise preserving sum of squared differences
555 5/3 wavelet, only used in snow
557 9/7 wavelet, only used in snow
564 @item dia_size @var{integer} (@emph{encoding,video})
565 Set diamond type & size for motion estimation.
567 @item (1024, INT_MAX)
568 full motion estimation(slowest)
570 umh motion estimation
572 hex motion estimation
574 l2s diamond motion estimation
576 var diamond motion estimation
578 small diamond motion estimation
580 funny diamond motion estimation
582 sab diamond motion estimation
585 @item last_pred @var{integer} (@emph{encoding,video})
586 Set amount of motion predictors from the previous frame.
588 @item preme @var{integer} (@emph{encoding,video})
589 Set pre motion estimation.
591 @item precmp @var{integer} (@emph{encoding,video})
592 Set pre motion estimation compare function.
597 sum of absolute differences, fast (default)
599 sum of squared errors
601 sum of absolute Hadamard transformed differences
603 sum of absolute DCT transformed differences
605 sum of squared quantization errors (avoid, low quality)
607 number of bits needed for the block
609 rate distortion optimal, slow
613 sum of absolute vertical differences
615 sum of squared vertical differences
617 noise preserving sum of squared differences
619 5/3 wavelet, only used in snow
621 9/7 wavelet, only used in snow
628 @item pre_dia_size @var{integer} (@emph{encoding,video})
629 Set diamond type & size for motion estimation pre-pass.
631 @item subq @var{integer} (@emph{encoding,video})
632 Set sub pel motion estimation quality.
634 @item me_range @var{integer} (@emph{encoding,video})
635 Set limit motion vectors range (1023 for DivX player).
637 @item global_quality @var{integer} (@emph{encoding,audio,video})
639 @item coder @var{integer} (@emph{encoding,video})
644 variable length coder / huffman coder
653 @item context @var{integer} (@emph{encoding,video})
656 @item slice_flags @var{integer}
658 @item mbd @var{integer} (@emph{encoding,video})
659 Set macroblock decision algorithm (high quality mode).
668 use best rate distortion
671 @item sc_threshold @var{integer} (@emph{encoding,video})
672 Set scene change threshold.
674 @item nr @var{integer} (@emph{encoding,video})
677 @item rc_init_occupancy @var{integer} (@emph{encoding,video})
678 Set number of bits which should be loaded into the rc buffer before
681 @item flags2 @var{flags} (@emph{decoding/encoding,audio,video,subtitles})
686 Allow non spec compliant speedup tricks.
688 Skip bitstream encoding.
690 Ignore cropping information from sps.
692 Place global headers at every keyframe instead of in extradata.
694 Frame data might be split into multiple chunks.
696 Show all frames before the first keyframe.
698 Export motion vectors into frame side-data (see @code{AV_FRAME_DATA_MOTION_VECTORS})
699 for codecs that support it. See also @file{doc/examples/export_mvs.c}.
701 Do not skip samples and export skip information as frame side data.
702 @item ass_ro_flush_noop
703 Do not reset ASS ReadOrder field on flush.
706 @item export_side_data @var{flags} (@emph{decoding/encoding,audio,video,subtitles})
711 Export motion vectors into frame side-data (see @code{AV_FRAME_DATA_MOTION_VECTORS})
712 for codecs that support it. See also @file{doc/examples/export_mvs.c}.
714 Export encoder Producer Reference Time into packet side-data (see @code{AV_PKT_DATA_PRFT})
715 for codecs that support it.
717 Export video encoding parameters through frame side data (see @code{AV_FRAME_DATA_VIDEO_ENC_PARAMS})
718 for codecs that support it. At present, those are H.264 and VP9.
720 Export film grain parameters through frame side data (see @code{AV_FRAME_DATA_FILM_GRAIN_PARAMS}).
721 Supported at present by AV1 decoders.
724 @item threads @var{integer} (@emph{decoding/encoding,video})
725 Set the number of threads to be used, in case the selected codec
726 implementation supports multi-threading.
731 automatically select the number of threads to set
734 Default value is @samp{auto}.
736 @item dc @var{integer} (@emph{encoding,video})
737 Set intra_dc_precision.
739 @item nssew @var{integer} (@emph{encoding,video})
742 @item skip_top @var{integer} (@emph{decoding,video})
743 Set number of macroblock rows at the top which are skipped.
745 @item skip_bottom @var{integer} (@emph{decoding,video})
746 Set number of macroblock rows at the bottom which are skipped.
748 @item profile @var{integer} (@emph{encoding,audio,video})
750 Set encoder codec profile. Default value is @samp{unknown}. Encoder specific
751 profiles are documented in the relevant encoder documentation.
753 @item level @var{integer} (@emph{encoding,audio,video})
761 @item lowres @var{integer} (@emph{decoding,audio,video})
762 Decode at 1= 1/2, 2=1/4, 3=1/8 resolutions.
764 @item skip_threshold @var{integer} (@emph{encoding,video})
765 Set frame skip threshold.
767 @item skip_factor @var{integer} (@emph{encoding,video})
768 Set frame skip factor.
770 @item skip_exp @var{integer} (@emph{encoding,video})
771 Set frame skip exponent.
772 Negative values behave identical to the corresponding positive ones, except
773 that the score is normalized.
774 Positive values exist primarily for compatibility reasons and are not so useful.
776 @item skipcmp @var{integer} (@emph{encoding,video})
777 Set frame skip compare function.
782 sum of absolute differences, fast (default)
784 sum of squared errors
786 sum of absolute Hadamard transformed differences
788 sum of absolute DCT transformed differences
790 sum of squared quantization errors (avoid, low quality)
792 number of bits needed for the block
794 rate distortion optimal, slow
798 sum of absolute vertical differences
800 sum of squared vertical differences
802 noise preserving sum of squared differences
804 5/3 wavelet, only used in snow
806 9/7 wavelet, only used in snow
813 @item mblmin @var{integer} (@emph{encoding,video})
814 Set min macroblock lagrange factor (VBR).
816 @item mblmax @var{integer} (@emph{encoding,video})
817 Set max macroblock lagrange factor (VBR).
819 @item mepc @var{integer} (@emph{encoding,video})
820 Set motion estimation bitrate penalty compensation (1.0 = 256).
822 @item skip_loop_filter @var{integer} (@emph{decoding,video})
823 @item skip_idct @var{integer} (@emph{decoding,video})
824 @item skip_frame @var{integer} (@emph{decoding,video})
826 Make decoder discard processing depending on the frame type selected
829 @option{skip_loop_filter} skips frame loop filtering, @option{skip_idct}
830 skips frame IDCT/dequantization, @option{skip_frame} skips decoding.
838 Discard useless frames like 0-sized frames.
841 Discard all non-reference frames.
844 Discard all bidirectional frames.
847 Discard all frames excepts keyframes.
850 Discard all frames except I frames.
856 Default value is @samp{default}.
858 @item bidir_refine @var{integer} (@emph{encoding,video})
859 Refine the two motion vectors used in bidirectional macroblocks.
861 @item brd_scale @var{integer} (@emph{encoding,video})
862 Downscale frames for dynamic B-frame decision.
864 @item keyint_min @var{integer} (@emph{encoding,video})
865 Set minimum interval between IDR-frames.
867 @item refs @var{integer} (@emph{encoding,video})
868 Set reference frames to consider for motion compensation.
870 @item chromaoffset @var{integer} (@emph{encoding,video})
871 Set chroma qp offset from luma.
873 @item trellis @var{integer} (@emph{encoding,audio,video})
874 Set rate-distortion optimal quantization.
876 @item mv0_threshold @var{integer} (@emph{encoding,video})
877 @item b_sensitivity @var{integer} (@emph{encoding,video})
878 Adjust sensitivity of b_frame_strategy 1.
880 @item compression_level @var{integer} (@emph{encoding,audio,video})
881 @item min_prediction_order @var{integer} (@emph{encoding,audio})
882 @item max_prediction_order @var{integer} (@emph{encoding,audio})
883 @item timecode_frame_start @var{integer} (@emph{encoding,video})
884 Set GOP timecode frame start number, in non drop frame format.
886 @item bits_per_raw_sample @var{integer}
887 @item channel_layout @var{integer} (@emph{decoding/encoding,audio})
892 @item request_channel_layout @var{integer} (@emph{decoding,audio})
897 @item rc_max_vbv_use @var{float} (@emph{encoding,video})
898 @item rc_min_vbv_use @var{float} (@emph{encoding,video})
899 @item ticks_per_frame @var{integer} (@emph{decoding/encoding,audio,video})
901 @item color_primaries @var{integer} (@emph{decoding/encoding,video})
929 @item color_trc @var{integer} (@emph{decoding/encoding,video})
974 @item colorspace @var{integer} (@emph{decoding/encoding,video})
999 @item chroma-derived-nc
1001 @item chroma-derived-c
1007 @item color_range @var{integer} (@emph{decoding/encoding,video})
1008 If used as input parameter, it serves as a hint to the decoder, which
1009 color_range the input has.
1020 @item chroma_sample_location @var{integer} (@emph{decoding/encoding,video})
1037 @item log_level_offset @var{integer}
1038 Set the log level offset.
1040 @item slices @var{integer} (@emph{encoding,video})
1041 Number of slices, used in parallelized encoding.
1043 @item thread_type @var{flags} (@emph{decoding/encoding,video})
1044 Select which multithreading methods to use.
1046 Use of @samp{frame} will increase decoding delay by one frame per
1047 thread, so clients which cannot provide future frames should not use
1053 Decode more than one part of a single frame at once.
1055 Multithreading using slices works only when the video was encoded with
1059 Decode more than one frame at once.
1062 Default value is @samp{slice+frame}.
1064 @item audio_service_type @var{integer} (@emph{encoding,audio})
1065 Set audio service type.
1089 @item request_sample_fmt @var{sample_fmt} (@emph{decoding,audio})
1090 Set sample format audio decoders should prefer. Default value is
1093 @item pkt_timebase @var{rational number}
1095 @item sub_charenc @var{encoding} (@emph{decoding,subtitles})
1096 Set the input subtitles character encoding.
1098 @item field_order @var{field_order} (@emph{video})
1099 Set/override the field order of the video.
1105 Interlaced video, top field coded and displayed first
1107 Interlaced video, bottom field coded and displayed first
1109 Interlaced video, top coded first, bottom displayed first
1111 Interlaced video, bottom coded first, top displayed first
1114 @item skip_alpha @var{bool} (@emph{decoding,video})
1115 Set to 1 to disable processing alpha (transparency). This works like the
1116 @samp{gray} flag in the @option{flags} option which skips chroma information
1117 instead of alpha. Default is 0.
1119 @item codec_whitelist @var{list} (@emph{input})
1120 "," separated list of allowed decoders. By default all are allowed.
1122 @item dump_separator @var{string} (@emph{input})
1123 Separator used to separate the fields printed on the command line about the
1125 For example, to separate the fields with newlines and indentation:
1127 ffprobe -dump_separator "
1128 " -i ~/videos/matrixbench_mpeg2.mpg
1131 @item max_pixels @var{integer} (@emph{decoding/encoding,video})
1132 Maximum number of pixels per image. This value can be used to avoid out of
1133 memory failures due to large images.
1135 @item apply_cropping @var{bool} (@emph{decoding,video})
1136 Enable cropping if cropping parameters are multiples of the required
1137 alignment for the left and top parameters. If the alignment is not met the
1138 cropping will be partially applied to maintain alignment.
1139 Default is 1 (enabled).
1140 Note: The required alignment depends on if @code{AV_CODEC_FLAG_UNALIGNED} is set and the
1141 CPU. @code{AV_CODEC_FLAG_UNALIGNED} cannot be changed from the command line. Also hardware
1142 decoders will not apply left/top Cropping.
1147 @c man end CODEC OPTIONS
1149 @ifclear config-writeonly
1150 @include decoders.texi
1152 @ifclear config-readonly
1153 @include encoders.texi