@anchor{codec-options}@chapter Codec Options@c man begin CODEC OPTIONS libavcodec provides some generic global options, which can be set onall the encoders and decoders. In addition, each codec may supportso-called private options, which are specific for a given codec. Sometimes, a global option may only affect a specific kind of codec,and may be nonsensical or ignored by another, so you need to be awareof the meaning of the specified options. Also some options aremeant only for decoding or encoding. Options may be set by specifying -@var{option} @var{value} in theFFmpeg tools, or by setting the value explicitly in the@code{AVCodecContext} options or using the @file{libavutil/opt.h} APIfor programmatic use. The list of supported options follow: @table @option@item b @var{integer} (@emph{encoding,audio,video})Set bitrate in bits/s. Default value is 200K. @item ab @var{integer} (@emph{encoding,audio})Set audio bitrate (in bits/s). Default value is 128K. @item bt @var{integer} (@emph{encoding,video})Set video bitrate tolerance (in bits/s). In 1-pass mode, bitratetolerance specifies how far ratecontrol is willing to deviate from thetarget average bitrate value. This is not related to min/maxbitrate. Lowering tolerance too much has an adverse effect on quality. @item flags @var{flags} (@emph{decoding/encoding,audio,video,subtitles})Set generic flags. Possible values:@table @samp@item mv4Use four motion vector by macroblock (mpeg4).@item qpelUse 1/4 pel motion compensation.@item loopUse loop filter.@item qscaleUse fixed qscale.@item pass1Use internal 2pass ratecontrol in first pass mode.@item pass2Use internal 2pass ratecontrol in second pass mode.@item grayOnly decode/encode grayscale.@item psnrSet error[?] variables during encoding.@item truncatedInput bitstream might be randomly truncated.@item drop_changedDon't output frames whose parameters differ from first decoded frame in stream.Error AVERROR_INPUT_CHANGED is returned when a frame is dropped. @item ildctUse interlaced DCT.@item low_delayForce low delay.@item global_headerPlace global headers in extradata instead of every keyframe.@item bitexactOnly write platform-, build- and time-independent data. (except (I)DCT).This ensures that file and data checksums are reproducible and match betweenplatforms. Its primary use is for regression testing.@item aicApply H263 advanced intra coding / mpeg4 ac prediction.@item ilmeApply interlaced motion estimation.@item cgopUse closed gop.@item output_corruptOutput even potentially corrupted frames.@end table @item time_base @var{rational number}Set codec time base. It is the fundamental unit of time (in seconds) in terms of whichframe timestamps are represented. For fixed-fps content, timebaseshould be @code{1 / frame_rate} and timestamp increments should beidentically 1. @item g @var{integer} (@emph{encoding,video})Set the group of picture (GOP) size. Default value is 12. @item ar @var{integer} (@emph{decoding/encoding,audio})Set audio sampling rate (in Hz). @item ac @var{integer} (@emph{decoding/encoding,audio})Set number of audio channels. @item cutoff @var{integer} (@emph{encoding,audio})Set cutoff bandwidth. (Supported only by selected encoders, seetheir respective documentation sections.) @item frame_size @var{integer} (@emph{encoding,audio})Set audio frame size. Each submitted frame except the last must contain exactly frame_sizesamples per channel. May be 0 when the codec hasCODEC_CAP_VARIABLE_FRAME_SIZE set, in that case the frame size is notrestricted. It is set by some decoders to indicate constant framesize. @item frame_number @var{integer}Set the frame number. @item delay @var{integer} @item qcomp @var{float} (@emph{encoding,video})Set video quantizer scale compression (VBR). It is used as a constantin the ratecontrol equation. Recommended range for default rc_eq:0.0-1.0. @item qblur @var{float} (@emph{encoding,video})Set video quantizer scale blur (VBR). @item qmin @var{integer} (@emph{encoding,video})Set min video quantizer scale (VBR). Must be included between -1 and69, default value is 2. @item qmax @var{integer} (@emph{encoding,video})Set max video quantizer scale (VBR). Must be included between -1 and1024, default value is 31. @item qdiff @var{integer} (@emph{encoding,video})Set max difference between the quantizer scale (VBR). @item bf @var{integer} (@emph{encoding,video})Set max number of B frames between non-B-frames. Must be an integer between -1 and 16. 0 means that B-frames aredisabled. If a value of -1 is used, it will choose an automatic valuedepending on the encoder. Default value is 0. @item b_qfactor @var{float} (@emph{encoding,video})Set qp factor between P and B frames. @item codec_tag @var{integer}@item bug @var{flags} (@emph{decoding,video})Workaround not auto detected encoder bugs. Possible values:@table @samp@item autodetect @item xvid_ilaceXvid interlacing bug (autodetected if fourcc==XVIX)@item ump4(autodetected if fourcc==UMP4)@item no_paddingpadding bug (autodetected)@item amv @item qpel_chroma @item std_qpelold standard qpel (autodetected per fourcc/version)@item qpel_chroma2 @item direct_blocksizedirect-qpel-blocksize bug (autodetected per fourcc/version)@item edgeedge padding bug (autodetected per fourcc/version)@item hpel_chroma @item dc_clip @item msWorkaround various bugs in microsoft broken decoders.@item trunctrancated frames@end table @item strict @var{integer} (@emph{decoding/encoding,audio,video})Specify how strictly to follow the standards. Possible values:@table @samp@item verystrictly conform to an older more strict version of the spec or reference software@item strictstrictly conform to all the things in the spec no matter what consequences@item normal @item unofficialallow unofficial extensions@item experimentalallow non standardized experimental things, experimental(unfinished/work in progress/not well tested) decoders and encoders.Note: experimental decoders can pose a security risk, do not use this fordecoding untrusted input.@end table @item b_qoffset @var{float} (@emph{encoding,video})Set QP offset between P and B frames. @item err_detect @var{flags} (@emph{decoding,audio,video})Set error detection flags. Possible values:@table @samp@item crccheckverify embedded CRCs@item bitstreamdetect bitstream specification deviations@item bufferdetect improper bitstream length@item explodeabort decoding on minor error detection@item ignore_errignore decoding errors, and continue decoding.This is useful if you want to analyze the content of a video and thus wanteverything to be decoded no matter what. This option will not result in a videothat is pleasing to watch in case of errors.@item carefulconsider things that violate the spec and have not been seen in the wild as errors@item compliantconsider all spec non compliancies as errors@item aggressiveconsider things that a sane encoder should not do as an error@end table @item has_b_frames @var{integer} @item block_align @var{integer} @item rc_override_count @var{integer} @item maxrate @var{integer} (@emph{encoding,audio,video})Set max bitrate tolerance (in bits/s). Requires bufsize to be set. @item minrate @var{integer} (@emph{encoding,audio,video})Set min bitrate tolerance (in bits/s). Most useful in setting up a CBRencode. It is of little use elsewise. @item bufsize @var{integer} (@emph{encoding,audio,video})Set ratecontrol buffer size (in bits). @item i_qfactor @var{float} (@emph{encoding,video})Set QP factor between P and I frames. @item i_qoffset @var{float} (@emph{encoding,video})Set QP offset between P and I frames. @item dct @var{integer} (@emph{encoding,video})Set DCT algorithm. Possible values:@table @samp@item autoautoselect a good one (default)@item fastintfast integer@item intaccurate integer@item mmx @item altivec @item faanfloating point AAN DCT@end table @item lumi_mask @var{float} (@emph{encoding,video})Compress bright areas stronger than medium ones. @item tcplx_mask @var{float} (@emph{encoding,video})Set temporal complexity masking. @item scplx_mask @var{float} (@emph{encoding,video})Set spatial complexity masking. @item p_mask @var{float} (@emph{encoding,video})Set inter masking. @item dark_mask @var{float} (@emph{encoding,video})Compress dark areas stronger than medium ones. @item idct @var{integer} (@emph{decoding/encoding,video})Select IDCT implementation. Possible values:@table @samp@item auto @item int @item simple @item simplemmx @item simpleautoAutomatically pick a IDCT compatible with the simple one @item arm @item altivec @item sh4 @item simplearm @item simplearmv5te @item simplearmv6 @item simpleneon @item xvid @item faanifloating point AAN IDCT@end table @item slice_count @var{integer} @item ec @var{flags} (@emph{decoding,video})Set error concealment strategy. Possible values:@table @samp@item guess_mvsiterative motion vector (MV) search (slow)@item deblockuse strong deblock filter for damaged MBs@item favor_interfavor predicting from the previous frame instead of the current@end table @item bits_per_coded_sample @var{integer} @item aspect @var{rational number} (@emph{encoding,video})Set sample aspect ratio. @item sar @var{rational number} (@emph{encoding,video})Set sample aspect ratio. Alias to @var{aspect}. @item debug @var{flags} (@emph{decoding/encoding,audio,video,subtitles})Print specific debug info. Possible values:@table @samp@item pictpicture info@item rcrate control@item bitstream @item mb_typemacroblock (MB) type@item qpper-block quantization parameter (QP)@item dct_coeff @item green_metadatadisplay complexity metadata for the upcoming frame, GoP or for a given duration. @item skip @item startcode @item ererror recognition@item mmcomemory management control operations (H.264)@item bugs @item bufferspicture buffer allocations@item thread_opsthreading operations@item nomcskip motion compensation@end table @item cmp @var{integer} (@emph{encoding,video})Set full pel me compare function. Possible values:@table @samp@item sadsum of absolute differences, fast (default)@item ssesum of squared errors@item satdsum of absolute Hadamard transformed differences@item dctsum of absolute DCT transformed differences@item psnrsum of squared quantization errors (avoid, low quality)@item bitnumber of bits needed for the block@item rdrate distortion optimal, slow@item zero0@item vsadsum of absolute vertical differences@item vssesum of squared vertical differences@item nssenoise preserving sum of squared differences@item w535/3 wavelet, only used in snow@item w979/7 wavelet, only used in snow@item dctmax @item chroma @end table @item subcmp @var{integer} (@emph{encoding,video})Set sub pel me compare function. Possible values:@table @samp@item sadsum of absolute differences, fast (default)@item ssesum of squared errors@item satdsum of absolute Hadamard transformed differences@item dctsum of absolute DCT transformed differences@item psnrsum of squared quantization errors (avoid, low quality)@item bitnumber of bits needed for the block@item rdrate distortion optimal, slow@item zero0@item vsadsum of absolute vertical differences@item vssesum of squared vertical differences@item nssenoise preserving sum of squared differences@item w535/3 wavelet, only used in snow@item w979/7 wavelet, only used in snow@item dctmax @item chroma @end table @item mbcmp @var{integer} (@emph{encoding,video})Set macroblock compare function. Possible values:@table @samp@item sadsum of absolute differences, fast (default)@item ssesum of squared errors@item satdsum of absolute Hadamard transformed differences@item dctsum of absolute DCT transformed differences@item psnrsum of squared quantization errors (avoid, low quality)@item bitnumber of bits needed for the block@item rdrate distortion optimal, slow@item zero0@item vsadsum of absolute vertical differences@item vssesum of squared vertical differences@item nssenoise preserving sum of squared differences@item w535/3 wavelet, only used in snow@item w979/7 wavelet, only used in snow@item dctmax @item chroma @end table @item ildctcmp @var{integer} (@emph{encoding,video})Set interlaced dct compare function. Possible values:@table @sampLines 1–500 of 1033. Load more
@anchor{codec-options} @chapter Codec Options @c man begin CODEC OPTIONS libavcodec provides some generic global options, which can be set on all the encoders and decoders. In addition, each codec may support so-called private options, which are specific for a given codec. Sometimes, a global option may only affect a specific kind of codec, and may be nonsensical or ignored by another, so you need to be aware of the meaning of the specified options. Also some options are meant only for decoding or encoding. Options may be set by specifying -@var{option} @var{value} in the FFmpeg tools, or by setting the value explicitly in the @code{AVCodecContext} options or using the @file{libavutil/opt.h} API for programmatic use. The list of supported options follow: @table @option @item b @var{integer} (@emph{encoding,audio,video}) Set bitrate in bits/s. Default value is 200K. @item ab @var{integer} (@emph{encoding,audio}) Set audio bitrate (in bits/s). Default value is 128K. @item bt @var{integer} (@emph{encoding,video}) Set video bitrate tolerance (in bits/s). In 1-pass mode, bitrate tolerance specifies how far ratecontrol is willing to deviate from the target average bitrate value. This is not related to min/max bitrate. Lowering tolerance too much has an adverse effect on quality. @item flags @var{flags} (@emph{decoding/encoding,audio,video,subtitles}) Set generic flags. Possible values: @table @samp @item mv4 Use four motion vector by macroblock (mpeg4). @item qpel Use 1/4 pel motion compensation. @item loop Use loop filter. @item qscale Use fixed qscale. @item pass1 Use internal 2pass ratecontrol in first pass mode. @item pass2 Use internal 2pass ratecontrol in second pass mode. @item gray Only decode/encode grayscale. @item psnr Set error[?] variables during encoding. @item truncated Input bitstream might be randomly truncated. @item drop_changed Don't output frames whose parameters differ from first decoded frame in stream. Error AVERROR_INPUT_CHANGED is returned when a frame is dropped. @item ildct Use interlaced DCT. @item low_delay Force low delay. @item global_header Place global headers in extradata instead of every keyframe. @item bitexact Only write platform-, build- and time-independent data. (except (I)DCT). This ensures that file and data checksums are reproducible and match between platforms. Its primary use is for regression testing. @item aic Apply H263 advanced intra coding / mpeg4 ac prediction. @item ilme Apply interlaced motion estimation. @item cgop Use closed gop. @item output_corrupt Output even potentially corrupted frames. @end table @item time_base @var{rational number} Set codec time base. It is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented. For fixed-fps content, timebase should be @code{1 / frame_rate} and timestamp increments should be identically 1. @item g @var{integer} (@emph{encoding,video}) Set the group of picture (GOP) size. Default value is 12. @item ar @var{integer} (@emph{decoding/encoding,audio}) Set audio sampling rate (in Hz). @item ac @var{integer} (@emph{decoding/encoding,audio}) Set number of audio channels. @item cutoff @var{integer} (@emph{encoding,audio}) Set cutoff bandwidth. (Supported only by selected encoders, see their respective documentation sections.) @item frame_size @var{integer} (@emph{encoding,audio}) Set audio frame size. Each submitted frame except the last must contain exactly frame_size samples per channel. May be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set, in that case the frame size is not restricted. It is set by some decoders to indicate constant frame size. @item frame_number @var{integer} Set the frame number. @item delay @var{integer} @item qcomp @var{float} (@emph{encoding,video}) Set video quantizer scale compression (VBR). It is used as a constant in the ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0. @item qblur @var{float} (@emph{encoding,video}) Set video quantizer scale blur (VBR). @item qmin @var{integer} (@emph{encoding,video}) Set min video quantizer scale (VBR). Must be included between -1 and 69, default value is 2. @item qmax @var{integer} (@emph{encoding,video}) Set max video quantizer scale (VBR). Must be included between -1 and 1024, default value is 31. @item qdiff @var{integer} (@emph{encoding,video}) Set max difference between the quantizer scale (VBR). @item bf @var{integer} (@emph{encoding,video}) Set max number of B frames between non-B-frames. Must be an integer between -1 and 16. 0 means that B-frames are disabled. If a value of -1 is used, it will choose an automatic value depending on the encoder. Default value is 0. @item b_qfactor @var{float} (@emph{encoding,video}) Set qp factor between P and B frames. @item codec_tag @var{integer} @item bug @var{flags} (@emph{decoding,video}) Workaround not auto detected encoder bugs. Possible values: @table @samp @item autodetect @item xvid_ilace Xvid interlacing bug (autodetected if fourcc==XVIX) @item ump4 (autodetected if fourcc==UMP4) @item no_padding padding bug (autodetected) @item amv @item qpel_chroma @item std_qpel old standard qpel (autodetected per fourcc/version) @item qpel_chroma2 @item direct_blocksize direct-qpel-blocksize bug (autodetected per fourcc/version) @item edge edge padding bug (autodetected per fourcc/version) @item hpel_chroma @item dc_clip @item ms Workaround various bugs in microsoft broken decoders. @item trunc trancated frames @end table @item strict @var{integer} (@emph{decoding/encoding,audio,video}) Specify how strictly to follow the standards. Possible values: @table @samp @item very strictly conform to an older more strict version of the spec or reference software @item strict strictly conform to all the things in the spec no matter what consequences @item normal @item unofficial allow unofficial extensions @item experimental allow non standardized experimental things, experimental (unfinished/work in progress/not well tested) decoders and encoders. Note: experimental decoders can pose a security risk, do not use this for decoding untrusted input. @end table @item b_qoffset @var{float} (@emph{encoding,video}) Set QP offset between P and B frames. @item err_detect @var{flags} (@emph{decoding,audio,video}) Set error detection flags. Possible values: @table @samp @item crccheck verify embedded CRCs @item bitstream detect bitstream specification deviations @item buffer detect improper bitstream length @item explode abort decoding on minor error detection @item ignore_err ignore decoding errors, and continue decoding. This is useful if you want to analyze the content of a video and thus want everything to be decoded no matter what. This option will not result in a video that is pleasing to watch in case of errors. @item careful consider things that violate the spec and have not been seen in the wild as errors @item compliant consider all spec non compliancies as errors @item aggressive consider things that a sane encoder should not do as an error @end table @item has_b_frames @var{integer} @item block_align @var{integer} @item rc_override_count @var{integer} @item maxrate @var{integer} (@emph{encoding,audio,video}) Set max bitrate tolerance (in bits/s). Requires bufsize to be set. @item minrate @var{integer} (@emph{encoding,audio,video}) Set min bitrate tolerance (in bits/s). Most useful in setting up a CBR encode. It is of little use elsewise. @item bufsize @var{integer} (@emph{encoding,audio,video}) Set ratecontrol buffer size (in bits). @item i_qfactor @var{float} (@emph{encoding,video}) Set QP factor between P and I frames. @item i_qoffset @var{float} (@emph{encoding,video}) Set QP offset between P and I frames. @item dct @var{integer} (@emph{encoding,video}) Set DCT algorithm. Possible values: @table @samp @item auto autoselect a good one (default) @item fastint fast integer @item int accurate integer @item mmx @item altivec @item faan floating point AAN DCT @end table @item lumi_mask @var{float} (@emph{encoding,video}) Compress bright areas stronger than medium ones. @item tcplx_mask @var{float} (@emph{encoding,video}) Set temporal complexity masking. @item scplx_mask @var{float} (@emph{encoding,video}) Set spatial complexity masking. @item p_mask @var{float} (@emph{encoding,video}) Set inter masking. @item dark_mask @var{float} (@emph{encoding,video}) Compress dark areas stronger than medium ones. @item idct @var{integer} (@emph{decoding/encoding,video}) Select IDCT implementation. Possible values: @table @samp @item auto @item int @item simple @item simplemmx @item simpleauto Automatically pick a IDCT compatible with the simple one @item arm @item altivec @item sh4 @item simplearm @item simplearmv5te @item simplearmv6 @item simpleneon @item xvid @item faani floating point AAN IDCT @end table @item slice_count @var{integer} @item ec @var{flags} (@emph{decoding,video}) Set error concealment strategy. Possible values: @table @samp @item guess_mvs iterative motion vector (MV) search (slow) @item deblock use strong deblock filter for damaged MBs @item favor_inter favor predicting from the previous frame instead of the current @end table @item bits_per_coded_sample @var{integer} @item aspect @var{rational number} (@emph{encoding,video}) Set sample aspect ratio. @item sar @var{rational number} (@emph{encoding,video}) Set sample aspect ratio. Alias to @var{aspect}. @item debug @var{flags} (@emph{decoding/encoding,audio,video,subtitles}) Print specific debug info. Possible values: @table @samp @item pict picture info @item rc rate control @item bitstream @item mb_type macroblock (MB) type @item qp per-block quantization parameter (QP) @item dct_coeff @item green_metadata display complexity metadata for the upcoming frame, GoP or for a given duration. @item skip @item startcode @item er error recognition @item mmco memory management control operations (H.264) @item bugs @item buffers picture buffer allocations @item thread_ops threading operations @item nomc skip motion compensation @end table @item cmp @var{integer} (@emph{encoding,video}) Set full pel me compare function. Possible values: @table @samp @item sad sum of absolute differences, fast (default) @item sse sum of squared errors @item satd sum of absolute Hadamard transformed differences @item dct sum of absolute DCT transformed differences @item psnr sum of squared quantization errors (avoid, low quality) @item bit number of bits needed for the block @item rd rate distortion optimal, slow @item zero 0 @item vsad sum of absolute vertical differences @item vsse sum of squared vertical differences @item nsse noise preserving sum of squared differences @item w53 5/3 wavelet, only used in snow @item w97 9/7 wavelet, only used in snow @item dctmax @item chroma @end table @item subcmp @var{integer} (@emph{encoding,video}) Set sub pel me compare function. Possible values: @table @samp @item sad sum of absolute differences, fast (default) @item sse sum of squared errors @item satd sum of absolute Hadamard transformed differences @item dct sum of absolute DCT transformed differences @item psnr sum of squared quantization errors (avoid, low quality) @item bit number of bits needed for the block @item rd rate distortion optimal, slow @item zero 0 @item vsad sum of absolute vertical differences @item vsse sum of squared vertical differences @item nsse noise preserving sum of squared differences @item w53 5/3 wavelet, only used in snow @item w97 9/7 wavelet, only used in snow @item dctmax @item chroma @end table @item mbcmp @var{integer} (@emph{encoding,video}) Set macroblock compare function. Possible values: @table @samp @item sad sum of absolute differences, fast (default) @item sse sum of squared errors @item satd sum of absolute Hadamard transformed differences @item dct sum of absolute DCT transformed differences @item psnr sum of squared quantization errors (avoid, low quality) @item bit number of bits needed for the block @item rd rate distortion optimal, slow @item zero 0 @item vsad sum of absolute vertical differences @item vsse sum of squared vertical differences @item nsse noise preserving sum of squared differences @item w53 5/3 wavelet, only used in snow @item w97 9/7 wavelet, only used in snow @item dctmax @item chroma @end table @item ildctcmp @var{integer} (@emph{encoding,video}) Set interlaced dct compare function. Possible values: @table @samp