1 \input texinfo @c -*- texinfo -*-
3 @settitle FFmpeg Codecs Documentation
5 @center @titlefont{FFmpeg Codecs Documentation}
12 @chapter Codec Options
13 @c man begin CODEC OPTIONS
15 libavcodec provides some generic global options, which can be set on
16 all the encoders and decoders. In addition each codec may support
17 so-called private options, which are specific for a given codec.
19 Sometimes, a global option may only affect a specific kind of codec,
20 and may be unsensical or ignored by another, so you need to be aware
21 of the meaning of the specified options. Also some options are
22 meant only for decoding or encoding.
24 Options may be set by specifying -@var{option} @var{value} in the
25 FFmpeg tools, or by setting the value explicitly in the
26 @code{AVCodecContext} options or using the @file{libavutil/opt.h} API
29 The list of supported options follow:
32 @item b @var{integer} (@emph{encoding,audio,video})
33 Set bitrate in bits/s. Default value is 200K.
35 @item ab @var{integer} (@emph{encoding,audio})
36 Set audio bitrate (in bits/s). Default value is 128K.
38 @item bt @var{integer} (@emph{encoding,video})
39 Set video bitrate tolerance (in bits/s). In 1-pass mode, bitrate
40 tolerance specifies how far ratecontrol is willing to deviate from the
41 target average bitrate value. This is not related to min/max
42 bitrate. Lowering tolerance too much has an adverse effect on quality.
44 @item flags @var{flags} (@emph{decoding/encoding,audio,video,subtitles})
50 Use four motion vector by macroblock (mpeg4).
52 Use 1/4 pel motion compensation.
60 Always try a mb with mv=<0,0>.
64 Use internal 2pass ratecontrol in first pass mode.
66 Use internal 2pass ratecontrol in second pass mode.
68 Only decode/encode grayscale.
72 Set error[?] variables during encoding.
76 Normalize adaptive quantization.
82 Place global headers in extradata instead of every keyframe.
84 Use only bitexact stuff (except (I)DCT).
86 Apply H263 advanced intra coding / mpeg4 ac prediction.
88 Deprecated, use mpegvideo private options instead.
90 Deprecated, use mpegvideo private options instead.
92 Apply interlaced motion estimation.
97 @item sub_id @var{integer}
98 Deprecated, currently unused.
100 @item me_method @var{integer} (@emph{encoding,video})
101 Set motion estimation method.
106 zero motion estimation (fastest)
108 full motion estimation (slowest)
110 EPZS motion estimation (default)
112 esa motion estimation (alias for full)
114 tesa motion estimation
116 dia motion estimation (alias for epzs)
118 log motion estimation
120 phods motion estimation
124 hex motion estimation
126 umh motion estimation
128 iter motion estimation
131 @item extradata_size @var{integer}
134 @item time_base @var{rational number}
137 It is the fundamental unit of time (in seconds) in terms of which
138 frame timestamps are represented. For fixed-fps content, timebase
139 should be 1/framerate and timestamp increments should be identically
142 @item g @var{integer} (@emph{encoding,video})
143 Set the group of picture size. Default value is 12.
145 @item ar @var{integer} (@emph{decoding/encoding,audio})
146 Set audio sampling rate (in Hz).
148 @item ac @var{integer} (@emph{decoding/encoding,audio})
149 Set number of audio channels.
151 @item cutoff @var{integer} (@emph{encoding,audio})
152 Set cutoff bandwidth.
154 @item frame_size @var{integer} (@emph{encoding,audio})
155 Set audio frame size.
157 Each submitted frame except the last must contain exactly frame_size
158 samples per channel. May be 0 when the codec has
159 CODEC_CAP_VARIABLE_FRAME_SIZE set, in that case the frame size is not
160 restricted. It is set by some decoders to indicate constant frame
163 @item frame_number @var{integer}
164 Set the frame number.
166 @item delay @var{integer}
168 @item qcomp @var{float} (@emph{encoding,video})
169 Set video quantizer scale compression (VBR). It is used as a constant
170 in the ratecontrol equation. Recommended range for default rc_eq:
173 @item qblur @var{float} (@emph{encoding,video})
174 Set video quantizer scale blur (VBR).
176 @item qmin @var{integer} (@emph{encoding,video})
177 Set min video quantizer scale (VBR). Must be included between -1 and
178 69, default value is 2.
180 @item qmax @var{integer} (@emph{encoding,video})
181 Set max video quantizer scale (VBR). Must be included between -1 and
182 1024, default value is 31.
184 @item qdiff @var{integer} (@emph{encoding,video})
185 Set max difference between the quantizer scale (VBR).
187 @item bf @var{integer} (@emph{encoding,video})
188 Set max number of B frames.
190 @item b_qfactor @var{float} (@emph{encoding,video})
191 Set qp factor between P and B frames.
193 @item rc_strategy @var{integer} (@emph{encoding,video})
194 Set ratecontrol method.
196 @item b_strategy @var{integer} (@emph{encoding,video})
197 Set strategy to choose between I/P/B-frames.
199 @item ps @var{integer} (@emph{encoding,video})
200 Set RTP payload size in bytes.
202 @item mv_bits @var{integer}
203 @item header_bits @var{integer}
204 @item i_tex_bits @var{integer}
205 @item p_tex_bits @var{integer}
206 @item i_count @var{integer}
207 @item p_count @var{integer}
208 @item skip_count @var{integer}
209 @item misc_bits @var{integer}
210 @item frame_bits @var{integer}
211 @item codec_tag @var{integer}
212 @item bug @var{flags} (@emph{decoding,video})
213 Workaround not auto detected encoder bugs.
220 some old lavc generated msmpeg4v3 files (no autodetection)
222 Xvid interlacing bug (autodetected if fourcc==XVIX)
224 (autodetected if fourcc==UMP4)
226 padding bug (autodetected)
230 illegal vlc bug (autodetected per fourcc)
234 old standard qpel (autodetected per fourcc/version)
237 @item direct_blocksize
238 direct-qpel-blocksize bug (autodetected per fourcc/version)
240 edge padding bug (autodetected per fourcc/version)
246 Workaround various bugs in microsoft broken decoders.
251 @item lelim @var{integer} (@emph{encoding,video})
252 Set single coefficient elimination threshold for luminance (negative
253 values also consider DC coefficient).
255 @item celim @var{integer} (@emph{encoding,video})
256 Set single coefficient elimination threshold for chrominance (negative
257 values also consider dc coefficient)
259 @item strict @var{integer} (@emph{decoding/encoding,audio,video})
260 Specify how strictly to follow the standards.
265 strictly conform to a older more strict version of the spec or reference software
267 strictly conform to all the things in the spec no matter what consequences
271 allow unofficial extensions
273 allow non standardized experimental things
276 @item b_qoffset @var{float} (@emph{encoding,video})
277 Set QP offset between P and B frames.
279 @item err_detect @var{flags} (@emph{decoding,audio,video})
280 Set error detection flags.
287 detect bitstream specification deviations
289 detect improper bitstream length
291 abort decoding on minor error detection
293 consider things that violate the spec and have not been seen in the wild as errors
295 consider all spec non compliancies as errors
297 consider things that a sane encoder should not do as an error
300 @item has_b_frames @var{integer}
302 @item block_align @var{integer}
304 @item mpeg_quant @var{integer} (@emph{encoding,video})
305 Use MPEG quantizers instead of H.263.
307 @item qsquish @var{float} (@emph{encoding,video})
308 How to keep quantizer between qmin and qmax (0 = clip, 1 = use
309 differentiable function).
311 @item rc_qmod_amp @var{float} (@emph{encoding,video})
312 Set experimental quantizer modulation.
314 @item rc_qmod_freq @var{integer} (@emph{encoding,video})
315 Set experimental quantizer modulation.
317 @item rc_override_count @var{integer}
319 @item rc_eq @var{string} (@emph{encoding,video})
320 Set rate control equation. When computing the expression, besides the
321 standard functions defined in the section 'Expression Evaluation', the
322 following functions are available: bits2qp(bits), qp2bits(qp). Also
323 the following constants are available: iTex pTex tex mv fCode iCount
324 mcVar var isI isP isB avgQP qComp avgIITex avgPITex avgPPTex avgBPTex
327 @item maxrate @var{integer} (@emph{encoding,audio,video})
328 Set max bitrate tolerance (in bits/s). Requires bufsize to be set.
330 @item minrate @var{integer} (@emph{encoding,audio,video})
331 Set min bitrate tolerance (in bits/s). Most useful in setting up a CBR
332 encode. It is of little use elsewise.
334 @item bufsize @var{integer} (@emph{encoding,audio,video})
335 Set ratecontrol buffer size (in bits).
337 @item rc_buf_aggressivity @var{float} (@emph{encoding,video})
340 @item i_qfactor @var{float} (@emph{encoding,video})
341 Set QP factor between P and I frames.
343 @item i_qoffset @var{float} (@emph{encoding,video})
344 Set QP offset between P and I frames.
346 @item rc_init_cplx @var{float} (@emph{encoding,video})
347 Set initial complexity for 1-pass encoding.
349 @item dct @var{integer} (@emph{encoding,video})
355 autoselect a good one (default)
365 floating point AAN DCT
368 @item lumi_mask @var{float} (@emph{encoding,video})
369 Compress bright areas stronger than medium ones.
371 @item tcplx_mask @var{float} (@emph{encoding,video})
372 Set temporal complexity masking.
374 @item scplx_mask @var{float} (@emph{encoding,video})
375 Set spatial complexity masking.
377 @item p_mask @var{float} (@emph{encoding,video})
380 @item dark_mask @var{float} (@emph{encoding,video})
381 Compress dark areas stronger than medium ones.
383 @item idct @var{integer} (@emph{decoding/encoding,video})
384 Select IDCT implementation.
425 floating point AAN IDCT
428 @item slice_count @var{integer}
430 @item ec @var{flags} (@emph{decoding,video})
431 Set error concealment strategy.
436 iterative motion vector (MV) search (slow)
438 use strong deblock filter for damaged MBs
441 @item bits_per_coded_sample @var{integer}
443 @item pred @var{integer} (@emph{encoding,video})
444 Set prediction method.
456 @item aspect @var{rational number} (@emph{encoding,video})
457 Set sample aspect ratio.
459 @item debug @var{flags} (@emph{decoding/encoding,audio,video,subtitles})
460 Print specific debug info.
473 per-block quantization parameter (QP)
487 memory management control operations (H.264)
491 visualize quantization parameter (QP), lower QP are tinted greener
493 visualize block types
495 picture buffer allocations
500 @item vismv @var{integer} (@emph{decoding,video})
501 Visualize motion vectors (MVs).
506 forward predicted MVs of P-frames
508 forward predicted MVs of B-frames
510 backward predicted MVs of B-frames
513 @item cmp @var{integer} (@emph{encoding,video})
514 Set full pel me compare function.
519 sum of absolute differences, fast (default)
521 sum of squared errors
523 sum of absolute Hadamard transformed differences
525 sum of absolute DCT transformed differences
527 sum of squared quantization errors (avoid, low quality)
529 number of bits needed for the block
531 rate distortion optimal, slow
535 sum of absolute vertical differences
537 sum of squared vertical differences
539 noise preserving sum of squared differences
541 5/3 wavelet, only used in snow
543 9/7 wavelet, only used in snow
550 @item subcmp @var{integer} (@emph{encoding,video})
551 Set sub pel me compare function.
556 sum of absolute differences, fast (default)
558 sum of squared errors
560 sum of absolute Hadamard transformed differences
562 sum of absolute DCT transformed differences
564 sum of squared quantization errors (avoid, low quality)
566 number of bits needed for the block
568 rate distortion optimal, slow
572 sum of absolute vertical differences
574 sum of squared vertical differences
576 noise preserving sum of squared differences
578 5/3 wavelet, only used in snow
580 9/7 wavelet, only used in snow
587 @item mbcmp @var{integer} (@emph{encoding,video})
588 Set macroblock compare function.
593 sum of absolute differences, fast (default)
595 sum of squared errors
597 sum of absolute Hadamard transformed differences
599 sum of absolute DCT transformed differences
601 sum of squared quantization errors (avoid, low quality)
603 number of bits needed for the block
605 rate distortion optimal, slow
609 sum of absolute vertical differences
611 sum of squared vertical differences
613 noise preserving sum of squared differences
615 5/3 wavelet, only used in snow
617 9/7 wavelet, only used in snow
624 @item ildctcmp @var{integer} (@emph{encoding,video})
625 Set interlaced dct compare function.
630 sum of absolute differences, fast (default)
632 sum of squared errors
634 sum of absolute Hadamard transformed differences
636 sum of absolute DCT transformed differences
638 sum of squared quantization errors (avoid, low quality)
640 number of bits needed for the block
642 rate distortion optimal, slow
646 sum of absolute vertical differences
648 sum of squared vertical differences
650 noise preserving sum of squared differences
652 5/3 wavelet, only used in snow
654 9/7 wavelet, only used in snow
661 @item dia_size @var{integer} (@emph{encoding,video})
662 Set diamond type & size for motion estimation.
664 @item last_pred @var{integer} (@emph{encoding,video})
665 Set amount of motion predictors from the previous frame.
667 @item preme @var{integer} (@emph{encoding,video})
668 Set pre motion estimation.
670 @item precmp @var{integer} (@emph{encoding,video})
671 Set pre motion estimation compare function.
676 sum of absolute differences, fast (default)
678 sum of squared errors
680 sum of absolute Hadamard transformed differences
682 sum of absolute DCT transformed differences
684 sum of squared quantization errors (avoid, low quality)
686 number of bits needed for the block
688 rate distortion optimal, slow
692 sum of absolute vertical differences
694 sum of squared vertical differences
696 noise preserving sum of squared differences
698 5/3 wavelet, only used in snow
700 9/7 wavelet, only used in snow
707 @item pre_dia_size @var{integer} (@emph{encoding,video})
708 Set diamond type & size for motion estimation pre-pass.
710 @item subq @var{integer} (@emph{encoding,video})
711 Set sub pel motion estimation quality.
713 @item dtg_active_format @var{integer}
715 @item me_range @var{integer} (@emph{encoding,video})
716 Set limit motion vectors range (1023 for DivX player).
718 @item ibias @var{integer} (@emph{encoding,video})
719 Set intra quant bias.
721 @item pbias @var{integer} (@emph{encoding,video})
722 Set inter quant bias.
724 @item color_table_id @var{integer}
726 @item global_quality @var{integer} (@emph{encoding,audio,video})
728 @item coder @var{integer} (@emph{encoding,video})
733 variable length coder / huffman coder
744 @item context @var{integer} (@emph{encoding,video})
747 @item slice_flags @var{integer}
749 @item xvmc_acceleration @var{integer}
751 @item mbd @var{integer} (@emph{encoding,video})
752 Set macroblock decision algorithm (high quality mode).
761 use best rate distortion
764 @item stream_codec_tag @var{integer}
766 @item sc_threshold @var{integer} (@emph{encoding,video})
767 Set scene change threshold.
769 @item lmin @var{integer} (@emph{encoding,video})
770 Set min lagrange factor (VBR).
772 @item lmax @var{integer} (@emph{encoding,video})
773 Set max lagrange factor (VBR).
775 @item nr @var{integer} (@emph{encoding,video})
778 @item rc_init_occupancy @var{integer} (@emph{encoding,video})
779 Set number of bits which should be loaded into the rc buffer before
782 @item inter_threshold @var{integer} (@emph{encoding,video})
784 @item flags2 @var{flags} (@emph{decoding/encoding,audio,video})
789 allow non spec compliant speedup tricks
791 Deprecated, use mpegvideo private options instead
793 skip bitstream encoding
795 place global headers at every keyframe instead of in extradata
797 Frame data might be split into multiple chunks
799 Show all frames before the first keyframe
801 Deprecated, use mpegvideo private options instead
804 @item error @var{integer} (@emph{encoding,video})
806 @item qns @var{integer} (@emph{encoding,video})
807 Deprecated, use mpegvideo private options instead.
809 @item threads @var{integer} (@emph{decoding/encoding,video})
814 detect a good number of threads
817 @item me_threshold @var{integer} (@emph{encoding,video})
818 Set motion estimaton threshold.
820 @item mb_threshold @var{integer} (@emph{encoding,video})
821 Set macroblock threshold.
823 @item dc @var{integer} (@emph{encoding,video})
824 Set intra_dc_precision.
826 @item nssew @var{integer} (@emph{encoding,video})
829 @item skip_top @var{integer} (@emph{decoding,video})
830 Set number of macroblock rows at the top which are skipped.
832 @item skip_bottom @var{integer} (@emph{decoding,video})
833 Set number of macroblock rows at the bottom which are skipped.
835 @item profile @var{integer} (@emph{encoding,audio,video})
869 @item level @var{integer} (@emph{encoding,audio,video})
877 @item lowres @var{integer} (@emph{decoding,audio,video})
878 Decode at 1= 1/2, 2=1/4, 3=1/8 resolutions.
880 @item skip_threshold @var{integer} (@emph{encoding,video})
881 Set frame skip threshold.
883 @item skip_factor @var{integer} (@emph{encoding,video})
884 Set frame skip factor.
886 @item skip_exp @var{integer} (@emph{encoding,video})
887 Set frame skip exponent.
889 @item skipcmp @var{integer} (@emph{encoding,video})
890 Set frame skip compare function.
895 sum of absolute differences, fast (default)
897 sum of squared errors
899 sum of absolute Hadamard transformed differences
901 sum of absolute DCT transformed differences
903 sum of squared quantization errors (avoid, low quality)
905 number of bits needed for the block
907 rate distortion optimal, slow
911 sum of absolute vertical differences
913 sum of squared vertical differences
915 noise preserving sum of squared differences
917 5/3 wavelet, only used in snow
919 9/7 wavelet, only used in snow
926 @item border_mask @var{float} (@emph{encoding,video})
927 Increase the quantizer for macroblocks close to borders.
929 @item mblmin @var{integer} (@emph{encoding,video})
930 Set min macroblock lagrange factor (VBR).
932 @item mblmax @var{integer} (@emph{encoding,video})
933 Set max macroblock lagrange factor (VBR).
935 @item mepc @var{integer} (@emph{encoding,video})
936 Set motion estimation bitrate penalty compensation (1.0 = 256).
938 @item skip_loop_filter @var{integer} (@emph{decoding,video})
956 @item skip_idct @var{integer} (@emph{decoding,video})
974 @item skip_frame @var{integer} (@emph{decoding,video})
992 @item bidir_refine @var{integer} (@emph{encoding,video})
993 Refine the two motion vectors used in bidirectional macroblocks.
995 @item brd_scale @var{integer} (@emph{encoding,video})
996 Downscale frames for dynamic B-frame decision.
998 @item keyint_min @var{integer} (@emph{encoding,video})
999 Set minimum interval between IDR-frames.
1001 @item refs @var{integer} (@emph{encoding,video})
1002 Set reference frames to consider for motion compensation.
1004 @item chromaoffset @var{integer} (@emph{encoding,video})
1005 Set chroma qp offset from luma.
1007 @item trellis @var{integer} (@emph{encoding,audio,video})
1008 Set rate-distortion optimal quantization.
1010 @item sc_factor @var{integer} (@emph{encoding,video})
1011 Set value multiplied by qscale for each frame and added to
1014 @item mv0_threshold @var{integer} (@emph{encoding,video})
1015 @item b_sensitivity @var{integer} (@emph{encoding,video})
1016 Adjust sensitivity of b_frame_strategy 1.
1018 @item compression_level @var{integer} (@emph{encoding,audio,video})
1019 @item min_prediction_order @var{integer} (@emph{encoding,audio})
1020 @item max_prediction_order @var{integer} (@emph{encoding,audio})
1021 @item timecode_frame_start @var{integer} (@emph{encoding,video})
1022 Set GOP timecode frame start number, in non drop frame format.
1024 @item request_channels @var{integer} (@emph{decoding,audio})
1025 Set desired number of audio channels.
1027 @item bits_per_raw_sample @var{integer}
1028 @item channel_layout @var{integer} (@emph{decoding/encoding,audio})
1033 @item request_channel_layout @var{integer} (@emph{decoding,audio})
1038 @item rc_max_vbv_use @var{float} (@emph{encoding,video})
1039 @item rc_min_vbv_use @var{float} (@emph{encoding,video})
1040 @item ticks_per_frame @var{integer} (@emph{decoding/encoding,audio,video})
1041 @item color_primaries @var{integer} (@emph{decoding/encoding,video})
1042 @item color_trc @var{integer} (@emph{decoding/encoding,video})
1043 @item colorspace @var{integer} (@emph{decoding/encoding,video})
1044 @item color_range @var{integer} (@emph{decoding/encoding,video})
1045 @item chroma_sample_location @var{integer} (@emph{decoding/encoding,video})
1047 @item log_level_offset @var{integer}
1048 Set the log level offset.
1050 @item slices @var{integer} (@emph{encoding,video})
1051 Number of slices, used in parallelized encoding.
1053 @item thread_type @var{flags} (@emph{decoding/encoding,video})
1054 Select multithreading type.
1063 @item audio_service_type @var{integer} (@emph{encoding,audio})
1064 Set audio service type.
1088 @item request_sample_fmt @var{sample_fmt} (@emph{decoding,audio})
1089 Set sample format audio decoders should prefer. Default value is
1092 @item pkt_timebase @var{rational number}
1095 @c man end CODEC OPTIONS
1097 @include decoders.texi
1098 @include encoders.texi
1102 @setfilename ffmpeg-codecs
1103 @settitle FFmpeg codecs
1105 @c man begin SEEALSO
1106 ffmpeg(1), ffplay(1), ffprobe(1), ffserver(1), libavcodec(3)
1109 @c man begin AUTHORS
1110 See Git history (git://source.ffmpeg.org/ffmpeg)