1 \input texinfo @c -*- texinfo -*-
3 @settitle Libavcodec Documentation
5 @center @titlefont{Libavcodec Documentation}
13 @c man begin DESCRIPTION
15 The libavcodec library provides a generic encoding/decoding framework
16 and contains multiple decoders and encoders for audio, video and
19 The shared architecture provides various services ranging from bit
20 stream I/O to DSP optimizations, and makes it suitable for
21 implementing robust and fast codecs as well as for experimentation.
23 @c man end DESCRIPTION
25 @chapter Codec Options
26 @c man begin CODEC OPTIONS
28 libavcodec provides some generic global options, which can be set on
29 all the encoders and decoders. In addition each codec may support
30 so-called private options, which are specific for a given codec.
32 Sometimes, a global option may only affect a specific kind of codec,
33 and may be unsensical or ignored by another, so you need to be aware
34 of the meaning of the specified options. Also some options are
35 meant only for decoding or encoding.
37 Options may be set by specifying -@var{option} @var{value} in the
38 FFmpeg tools, or by setting the value explicitly in the
39 @code{AVCodecContext} options or using the @file{libavutil/opt.h} API
42 The list of supported options follow:
45 @item b @var{integer} (@emph{encoding,audio,video})
46 Set bitrate in bits/s. Default value is 200K.
48 @item ab @var{integer} (@emph{encoding,audio})
49 Set audio bitrate (in bits/s). Default value is 128K.
51 @item bt @var{integer} (@emph{encoding,video})
52 Set video bitrate tolerance (in bits/s). In 1-pass mode, bitrate
53 tolerance specifies how far ratecontrol is willing to deviate from the
54 target average bitrate value. This is not related to min/max
55 bitrate. Lowering tolerance too much has an adverse effect on quality.
57 @item flags @var{flags} (@emph{decoding/encoding,audio,video,subtitles})
63 Use four motion vector by macroblock (mpeg4).
65 Use 1/4 pel motion compensation.
73 Always try a mb with mv=<0,0>.
77 Use internal 2pass ratecontrol in first pass mode.
79 Use internal 2pass ratecontrol in second pass mode.
81 Only decode/encode grayscale.
85 Set error[?] variables during encoding.
89 Normalize adaptive quantization.
95 Place global headers in extradata instead of every keyframe.
97 Use only bitexact stuff (except (I)DCT).
99 Apply H263 advanced intra coding / mpeg4 ac prediction.
101 Deprecated, use mpegvideo private options instead.
103 Deprecated, use mpegvideo private options instead.
105 Apply interlaced motion estimation.
110 @item sub_id @var{integer}
111 Deprecated, currently unused.
113 @item me_method @var{integer} (@emph{encoding,video})
114 Set motion estimation method.
119 zero motion estimation (fastest)
121 full motion estimation (slowest)
123 EPZS motion estimation (default)
125 esa motion estimation (alias for full)
127 tesa motion estimation
129 dia motion estimation (alias for epzs)
131 log motion estimation
133 phods motion estimation
137 hex motion estimation
139 umh motion estimation
141 iter motion estimation
144 @item extradata_size @var{integer}
147 @item time_base @var{rational number}
150 It is the fundamental unit of time (in seconds) in terms of which
151 frame timestamps are represented. For fixed-fps content, timebase
152 should be 1/framerate and timestamp increments should be identically
155 @item g @var{integer} (@emph{encoding,video})
156 Set the group of picture size. Default value is 12.
158 @item ar @var{integer} (@emph{decoding/encoding,audio})
159 Set audio sampling rate (in Hz).
161 @item ac @var{integer} (@emph{decoding/encoding,audio})
162 Set number of audio channels.
164 @item cutoff @var{integer} (@emph{encoding,audio})
165 Set cutoff bandwidth.
167 @item frame_size @var{integer} (@emph{encoding,audio})
168 Set audio frame size.
170 Each submitted frame except the last must contain exactly frame_size
171 samples per channel. May be 0 when the codec has
172 CODEC_CAP_VARIABLE_FRAME_SIZE set, in that case the frame size is not
173 restricted. It is set by some decoders to indicate constant frame
176 @item frame_number @var{integer}
177 Set the frame number.
179 @item delay @var{integer}
181 @item qcomp @var{float} (@emph{encoding,video})
182 Set video quantizer scale compression (VBR). It is used as a constant
183 in the ratecontrol equation. Recommended range for default rc_eq:
186 @item qblur @var{float} (@emph{encoding,video})
187 Set video quantizer scale blur (VBR).
189 @item qmin @var{integer} (@emph{encoding,video})
190 Set min video quantizer scale (VBR). Must be included between -1 and
191 69, default value is 2.
193 @item qmax @var{integer} (@emph{encoding,video})
194 Set max video quantizer scale (VBR). Must be included between -1 and
195 1024, default value is 31.
197 @item qdiff @var{integer} (@emph{encoding,video})
198 Set max difference between the quantizer scale (VBR).
200 @item bf @var{integer} (@emph{encoding,video})
201 Set max number of B frames.
203 @item b_qfactor @var{float} (@emph{encoding,video})
204 Set qp factor between P and B frames.
206 @item rc_strategy @var{integer} (@emph{encoding,video})
207 Set ratecontrol method.
209 @item b_strategy @var{integer} (@emph{encoding,video})
210 Set strategy to choose between I/P/B-frames.
212 @item ps @var{integer} (@emph{encoding,video})
213 Set RTP payload size in bytes.
215 @item mv_bits @var{integer}
216 @item header_bits @var{integer}
217 @item i_tex_bits @var{integer}
218 @item p_tex_bits @var{integer}
219 @item i_count @var{integer}
220 @item p_count @var{integer}
221 @item skip_count @var{integer}
222 @item misc_bits @var{integer}
223 @item frame_bits @var{integer}
224 @item codec_tag @var{integer}
225 @item bug @var{flags} (@emph{decoding,video})
226 Workaround not auto detected encoder bugs.
233 some old lavc generated msmpeg4v3 files (no autodetection)
235 Xvid interlacing bug (autodetected if fourcc==XVIX)
237 (autodetected if fourcc==UMP4)
239 padding bug (autodetected)
243 illegal vlc bug (autodetected per fourcc)
247 old standard qpel (autodetected per fourcc/version)
250 @item direct_blocksize
251 direct-qpel-blocksize bug (autodetected per fourcc/version)
253 edge padding bug (autodetected per fourcc/version)
259 Workaround various bugs in microsoft broken decoders.
264 @item lelim @var{integer} (@emph{encoding,video})
265 Set single coefficient elimination threshold for luminance (negative
266 values also consider DC coefficient).
268 @item celim @var{integer} (@emph{encoding,video})
269 Set single coefficient elimination threshold for chrominance (negative
270 values also consider dc coefficient)
272 @item strict @var{integer} (@emph{decoding/encoding,audio,video})
273 Specify how strictly to follow the standards.
278 strictly conform to a older more strict version of the spec or reference software
280 strictly conform to all the things in the spec no matter what consequences
284 allow unofficial extensions
286 allow non standardized experimental things
289 @item b_qoffset @var{float} (@emph{encoding,video})
290 Set QP offset between P and B frames.
292 @item err_detect @var{flags} (@emph{decoding,audio,video})
293 Set error detection flags.
300 detect bitstream specification deviations
302 detect improper bitstream length
304 abort decoding on minor error detection
306 consider things that violate the spec and have not been seen in the wild as errors
308 consider all spec non compliancies as errors
310 consider things that a sane encoder should not do as an error
313 @item has_b_frames @var{integer}
315 @item block_align @var{integer}
317 @item mpeg_quant @var{integer} (@emph{encoding,video})
318 Use MPEG quantizers instead of H.263.
320 @item qsquish @var{float} (@emph{encoding,video})
321 How to keep quantizer between qmin and qmax (0 = clip, 1 = use
322 differentiable function).
324 @item rc_qmod_amp @var{float} (@emph{encoding,video})
325 Set experimental quantizer modulation.
327 @item rc_qmod_freq @var{integer} (@emph{encoding,video})
328 Set experimental quantizer modulation.
330 @item rc_override_count @var{integer}
332 @item rc_eq @var{string} (@emph{encoding,video})
333 Set rate control equation. When computing the expression, besides the
334 standard functions defined in the section 'Expression Evaluation', the
335 following functions are available: bits2qp(bits), qp2bits(qp). Also
336 the following constants are available: iTex pTex tex mv fCode iCount
337 mcVar var isI isP isB avgQP qComp avgIITex avgPITex avgPPTex avgBPTex
340 @item maxrate @var{integer} (@emph{encoding,audio,video})
341 Set max bitrate tolerance (in bits/s). Requires bufsize to be set.
343 @item minrate @var{integer} (@emph{encoding,audio,video})
344 Set min bitrate tolerance (in bits/s). Most useful in setting up a CBR
345 encode. It is of little use elsewise.
347 @item bufsize @var{integer} (@emph{encoding,audio,video})
348 Set ratecontrol buffer size (in bits).
350 @item rc_buf_aggressivity @var{float} (@emph{encoding,video})
353 @item i_qfactor @var{float} (@emph{encoding,video})
354 Set QP factor between P and I frames.
356 @item i_qoffset @var{float} (@emph{encoding,video})
357 Set QP offset between P and I frames.
359 @item rc_init_cplx @var{float} (@emph{encoding,video})
360 Set initial complexity for 1-pass encoding.
362 @item dct @var{integer} (@emph{encoding,video})
368 autoselect a good one (default)
378 floating point AAN DCT
381 @item lumi_mask @var{float} (@emph{encoding,video})
382 Compress bright areas stronger than medium ones.
384 @item tcplx_mask @var{float} (@emph{encoding,video})
385 Set temporal complexity masking.
387 @item scplx_mask @var{float} (@emph{encoding,video})
388 Set spatial complexity masking.
390 @item p_mask @var{float} (@emph{encoding,video})
393 @item dark_mask @var{float} (@emph{encoding,video})
394 Compress dark areas stronger than medium ones.
396 @item idct @var{integer} (@emph{decoding/encoding,video})
397 Select IDCT implementation.
438 floating point AAN IDCT
441 @item slice_count @var{integer}
443 @item ec @var{flags} (@emph{decoding,video})
444 Set error concealment strategy.
449 iterative motion vector (MV) search (slow)
451 use strong deblock filter for damaged MBs
454 @item bits_per_coded_sample @var{integer}
456 @item pred @var{integer} (@emph{encoding,video})
457 Set prediction method.
469 @item aspect @var{rational number} (@emph{encoding,video})
470 Set sample aspect ratio.
472 @item debug @var{flags} (@emph{decoding/encoding,audio,video,subtitles})
473 Print specific debug info.
486 per-block quantization parameter (QP)
500 memory management control operations (H.264)
504 visualize quantization parameter (QP), lower QP are tinted greener
506 visualize block types
508 picture buffer allocations
513 @item vismv @var{integer} (@emph{decoding,video})
514 Visualize motion vectors (MVs).
519 forward predicted MVs of P-frames
521 forward predicted MVs of B-frames
523 backward predicted MVs of B-frames
526 @item cmp @var{integer} (@emph{encoding,video})
527 Set full pel me compare function.
532 sum of absolute differences, fast (default)
534 sum of squared errors
536 sum of absolute Hadamard transformed differences
538 sum of absolute DCT transformed differences
540 sum of squared quantization errors (avoid, low quality)
542 number of bits needed for the block
544 rate distortion optimal, slow
548 sum of absolute vertical differences
550 sum of squared vertical differences
552 noise preserving sum of squared differences
554 5/3 wavelet, only used in snow
556 9/7 wavelet, only used in snow
563 @item subcmp @var{integer} (@emph{encoding,video})
564 Set sub pel me compare function.
569 sum of absolute differences, fast (default)
571 sum of squared errors
573 sum of absolute Hadamard transformed differences
575 sum of absolute DCT transformed differences
577 sum of squared quantization errors (avoid, low quality)
579 number of bits needed for the block
581 rate distortion optimal, slow
585 sum of absolute vertical differences
587 sum of squared vertical differences
589 noise preserving sum of squared differences
591 5/3 wavelet, only used in snow
593 9/7 wavelet, only used in snow
600 @item mbcmp @var{integer} (@emph{encoding,video})
601 Set macroblock compare function.
606 sum of absolute differences, fast (default)
608 sum of squared errors
610 sum of absolute Hadamard transformed differences
612 sum of absolute DCT transformed differences
614 sum of squared quantization errors (avoid, low quality)
616 number of bits needed for the block
618 rate distortion optimal, slow
622 sum of absolute vertical differences
624 sum of squared vertical differences
626 noise preserving sum of squared differences
628 5/3 wavelet, only used in snow
630 9/7 wavelet, only used in snow
637 @item ildctcmp @var{integer} (@emph{encoding,video})
638 Set interlaced dct compare function.
643 sum of absolute differences, fast (default)
645 sum of squared errors
647 sum of absolute Hadamard transformed differences
649 sum of absolute DCT transformed differences
651 sum of squared quantization errors (avoid, low quality)
653 number of bits needed for the block
655 rate distortion optimal, slow
659 sum of absolute vertical differences
661 sum of squared vertical differences
663 noise preserving sum of squared differences
665 5/3 wavelet, only used in snow
667 9/7 wavelet, only used in snow
674 @item dia_size @var{integer} (@emph{encoding,video})
675 Set diamond type & size for motion estimation.
677 @item last_pred @var{integer} (@emph{encoding,video})
678 Set amount of motion predictors from the previous frame.
680 @item preme @var{integer} (@emph{encoding,video})
681 Set pre motion estimation.
683 @item precmp @var{integer} (@emph{encoding,video})
684 Set pre motion estimation compare function.
689 sum of absolute differences, fast (default)
691 sum of squared errors
693 sum of absolute Hadamard transformed differences
695 sum of absolute DCT transformed differences
697 sum of squared quantization errors (avoid, low quality)
699 number of bits needed for the block
701 rate distortion optimal, slow
705 sum of absolute vertical differences
707 sum of squared vertical differences
709 noise preserving sum of squared differences
711 5/3 wavelet, only used in snow
713 9/7 wavelet, only used in snow
720 @item pre_dia_size @var{integer} (@emph{encoding,video})
721 Set diamond type & size for motion estimation pre-pass.
723 @item subq @var{integer} (@emph{encoding,video})
724 Set sub pel motion estimation quality.
726 @item dtg_active_format @var{integer}
728 @item me_range @var{integer} (@emph{encoding,video})
729 Set limit motion vectors range (1023 for DivX player).
731 @item ibias @var{integer} (@emph{encoding,video})
732 Set intra quant bias.
734 @item pbias @var{integer} (@emph{encoding,video})
735 Set inter quant bias.
737 @item color_table_id @var{integer}
739 @item global_quality @var{integer} (@emph{encoding,audio,video})
741 @item coder @var{integer} (@emph{encoding,video})
746 variable length coder / huffman coder
757 @item context @var{integer} (@emph{encoding,video})
760 @item slice_flags @var{integer}
762 @item xvmc_acceleration @var{integer}
764 @item mbd @var{integer} (@emph{encoding,video})
765 Set macroblock decision algorithm (high quality mode).
774 use best rate distortion
777 @item stream_codec_tag @var{integer}
779 @item sc_threshold @var{integer} (@emph{encoding,video})
780 Set scene change threshold.
782 @item lmin @var{integer} (@emph{encoding,video})
783 Set min lagrange factor (VBR).
785 @item lmax @var{integer} (@emph{encoding,video})
786 Set max lagrange factor (VBR).
788 @item nr @var{integer} (@emph{encoding,video})
791 @item rc_init_occupancy @var{integer} (@emph{encoding,video})
792 Set number of bits which should be loaded into the rc buffer before
795 @item inter_threshold @var{integer} (@emph{encoding,video})
797 @item flags2 @var{flags} (@emph{decoding/encoding,audio,video})
802 allow non spec compliant speedup tricks
804 Deprecated, use mpegvideo private options instead
806 skip bitstream encoding
808 place global headers at every keyframe instead of in extradata
810 Frame data might be split into multiple chunks
812 Show all frames before the first keyframe
814 Deprecated, use mpegvideo private options instead
817 @item error @var{integer} (@emph{encoding,video})
819 @item qns @var{integer} (@emph{encoding,video})
820 Deprecated, use mpegvideo private options instead.
822 @item threads @var{integer} (@emph{decoding/encoding,video})
827 detect a good number of threads
830 @item me_threshold @var{integer} (@emph{encoding,video})
831 Set motion estimaton threshold.
833 @item mb_threshold @var{integer} (@emph{encoding,video})
834 Set macroblock threshold.
836 @item dc @var{integer} (@emph{encoding,video})
837 Set intra_dc_precision.
839 @item nssew @var{integer} (@emph{encoding,video})
842 @item skip_top @var{integer} (@emph{decoding,video})
843 Set number of macroblock rows at the top which are skipped.
845 @item skip_bottom @var{integer} (@emph{decoding,video})
846 Set number of macroblock rows at the bottom which are skipped.
848 @item profile @var{integer} (@emph{encoding,audio,video})
882 @item level @var{integer} (@emph{encoding,audio,video})
890 @item lowres @var{integer} (@emph{decoding,audio,video})
891 Decode at 1= 1/2, 2=1/4, 3=1/8 resolutions.
893 @item skip_threshold @var{integer} (@emph{encoding,video})
894 Set frame skip threshold.
896 @item skip_factor @var{integer} (@emph{encoding,video})
897 Set frame skip factor.
899 @item skip_exp @var{integer} (@emph{encoding,video})
900 Set frame skip exponent.
902 @item skipcmp @var{integer} (@emph{encoding,video})
903 Set frame skip compare function.
908 sum of absolute differences, fast (default)
910 sum of squared errors
912 sum of absolute Hadamard transformed differences
914 sum of absolute DCT transformed differences
916 sum of squared quantization errors (avoid, low quality)
918 number of bits needed for the block
920 rate distortion optimal, slow
924 sum of absolute vertical differences
926 sum of squared vertical differences
928 noise preserving sum of squared differences
930 5/3 wavelet, only used in snow
932 9/7 wavelet, only used in snow
939 @item border_mask @var{float} (@emph{encoding,video})
940 Increase the quantizer for macroblocks close to borders.
942 @item mblmin @var{integer} (@emph{encoding,video})
943 Set min macroblock lagrange factor (VBR).
945 @item mblmax @var{integer} (@emph{encoding,video})
946 Set max macroblock lagrange factor (VBR).
948 @item mepc @var{integer} (@emph{encoding,video})
949 Set motion estimation bitrate penalty compensation (1.0 = 256).
951 @item skip_loop_filter @var{integer} (@emph{decoding,video})
969 @item skip_idct @var{integer} (@emph{decoding,video})
987 @item skip_frame @var{integer} (@emph{decoding,video})
1005 @item bidir_refine @var{integer} (@emph{encoding,video})
1006 Refine the two motion vectors used in bidirectional macroblocks.
1008 @item brd_scale @var{integer} (@emph{encoding,video})
1009 Downscale frames for dynamic B-frame decision.
1011 @item keyint_min @var{integer} (@emph{encoding,video})
1012 Set minimum interval between IDR-frames.
1014 @item refs @var{integer} (@emph{encoding,video})
1015 Set reference frames to consider for motion compensation.
1017 @item chromaoffset @var{integer} (@emph{encoding,video})
1018 Set chroma qp offset from luma.
1020 @item trellis @var{integer} (@emph{encoding,audio,video})
1021 Set rate-distortion optimal quantization.
1023 @item sc_factor @var{integer} (@emph{encoding,video})
1024 Set value multiplied by qscale for each frame and added to
1027 @item mv0_threshold @var{integer} (@emph{encoding,video})
1028 @item b_sensitivity @var{integer} (@emph{encoding,video})
1029 Adjust sensitivity of b_frame_strategy 1.
1031 @item compression_level @var{integer} (@emph{encoding,audio,video})
1032 @item min_prediction_order @var{integer} (@emph{encoding,audio})
1033 @item max_prediction_order @var{integer} (@emph{encoding,audio})
1034 @item timecode_frame_start @var{integer} (@emph{encoding,video})
1035 Set GOP timecode frame start number, in non drop frame format.
1037 @item request_channels @var{integer} (@emph{decoding,audio})
1038 Set desired number of audio channels.
1040 @item bits_per_raw_sample @var{integer}
1041 @item channel_layout @var{integer} (@emph{decoding/encoding,audio})
1046 @item request_channel_layout @var{integer} (@emph{decoding,audio})
1051 @item rc_max_vbv_use @var{float} (@emph{encoding,video})
1052 @item rc_min_vbv_use @var{float} (@emph{encoding,video})
1053 @item ticks_per_frame @var{integer} (@emph{decoding/encoding,audio,video})
1054 @item color_primaries @var{integer} (@emph{decoding/encoding,video})
1055 @item color_trc @var{integer} (@emph{decoding/encoding,video})
1056 @item colorspace @var{integer} (@emph{decoding/encoding,video})
1057 @item color_range @var{integer} (@emph{decoding/encoding,video})
1058 @item chroma_sample_location @var{integer} (@emph{decoding/encoding,video})
1060 @item log_level_offset @var{integer}
1061 Set the log level offset.
1063 @item slices @var{integer} (@emph{encoding,video})
1064 Number of slices, used in parallelized encoding.
1066 @item thread_type @var{flags} (@emph{decoding/encoding,video})
1067 Select multithreading type.
1076 @item audio_service_type @var{integer} (@emph{encoding,audio})
1077 Set audio service type.
1101 @item request_sample_fmt @var{sample_fmt} (@emph{decoding,audio})
1102 Set sample format audio decoders should prefer. Default value is
1105 @item pkt_timebase @var{rational number}
1108 @c man end CODEC OPTIONS
1110 @include decoders.texi
1111 @include encoders.texi
1115 @setfilename libavcodec
1116 @settitle media streams decoding and encoding library
1118 @c man begin SEEALSO
1119 ffmpeg(1), ffplay(1), ffprobe(1), ffserver(1)
1122 @c man begin AUTHORS
1123 See Git history (git://source.ffmpeg.org/ffmpeg)