FFMPEG-CODECS(1)

πŸ’… NAME πŸ’…

ffmpeg-codecs β€” it's the FFmpeg codecs page, bestie. Straight out of the FFMPEG-CODECS(1) manual, and yes we're reading the whole thing together, grab a snack πŸ“


✨ DESCRIPTION ✨

Okay so this doc is literally the entire rundown of every codec (that's the decoders and the encoders, both πŸ’–) that the libavcodec library gives you. That's it. That's the section. Iconic, brief, moving on.


πŸŽ€ CODEC OPTIONS πŸŽ€

So libavcodec hands out some generic global options β€” these are the ones you can slap onto literally every encoder and decoder, no cap. But also? Each individual codec can have its own so-called private options that are specific to just that codec. Both things exist, keep both in your brain.

Heads up though β€” sometimes a global option only actually does something for one kind of codec, and for another kind it's just nonsense or straight-up ignored 😭 so you genuinely need to know what the option you typed means. Also some of these are decode-only or encode-only, so like... vibe check your option before you use it.

You can set options by passing -option value in the FFmpeg tools, or by setting the value explicitly in the AVCodecContext options, or by using the libavutil/opt.h API if you're doing it programmatically. Three ways. Slay.

Here's the whole list of supported options, in order, no skips πŸ”₯


  • b integer (encoding,audio,video) β€” Sets the bitrate in bits/s. Default value is 200K. That's the one everyone reaches for first, obviously.
  • ab integer (encoding,audio) β€” Sets the audio bitrate (in bits/s). Default value is 128K 🎧
  • bt integer (encoding,video) β€” Sets video bitrate tolerance (in bits/s). In 1-pass mode, bitrate tolerance is basically how far ratecontrol is willing to deviate from the target average bitrate value. Ngl it has nothing to do with min/max bitrate, don't confuse them. And lowering tolerance too much genuinely has an adverse effect on quality β€” so like, don't overdo it 😬
  • flags flags (decoding/encoding,audio,video,subtitles) β€” Sets generic flags.

Possible values:

  • mv4 β€” Use four motion vector by macroblock (mpeg4).
  • qpel β€” Use 1/4 pel motion compensation.
  • loop β€” Use loop filter.
  • qscale β€” Use fixed qscale.
  • pass1 β€” Use internal 2pass ratecontrol in first pass mode.
  • pass2 β€” Use internal 2pass ratecontrol in second pass mode.
  • gray β€” Only decode/encode grayscale.
  • psnr β€” Set error[?] variables during encoding.
  • truncated β€” Input bitstream might be randomly truncated.
  • 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.
  • ildct β€” Use interlaced DCT.
  • low_delay β€” Force low delay.
  • global_header β€” Place global headers in extradata instead of every keyframe.
  • 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.
  • aic β€” Apply H263 advanced intra coding / mpeg4 ac prediction.
  • ilme β€” Apply interlaced motion estimation.
  • cgop β€” Use closed gop.
  • output_corrupt β€” Output even potentially corrupted frames.
  • time_base rational number β€” Sets the codec time base.

This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented. For fixed-fps content, timebase should be 1 / frame_rate and timestamp increments should be identically 1. Big main-character energy for such a small option, honestly πŸ‘‘

  • g integer (encoding,video) β€” Sets the group of picture (GOP) size. Default value is 12.
  • ar integer (decoding/encoding,audio) β€” Sets audio sampling rate (in Hz).
  • ac integer (decoding/encoding,audio) β€” Sets number of audio channels.
  • cutoff integer (encoding,audio) β€” Sets cutoff bandwidth. (Supported only by selected encoders, see their respective documentation sections β€” so like, go check if yours is one of the chosen ones πŸ’…)
  • frame_size integer (encoding,audio) β€” Sets audio frame size.

Every submitted frame except the last one must contain exactly frame_size samples per channel. It may be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set β€” in that case the frame size is not restricted. Some decoders set it themselves to indicate constant frame size. Cute of them.

  • frame_number integer β€” Sets the frame number.
  • delay integer
  • qcomp float (encoding,video) β€” Sets video quantizer scale compression (VBR). It's used as a constant in the ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0.
  • qblur float (encoding,video) β€” Sets video quantizer scale blur (VBR).
  • qmin integer (encoding,video) β€” Sets min video quantizer scale (VBR). Must be included between -1 and 69, default value is 2.
  • qmax integer (encoding,video) β€” Sets max video quantizer scale (VBR). Must be included between -1 and 1024, default value is 31.
  • qdiff integer (encoding,video) β€” Sets max difference between the quantizer scale (VBR).
  • bf integer (encoding,video) β€” Sets max number of B frames between non-B-frames.

Must be an integer between -1 and 16. 0 means B-frames are disabled. If you use -1, it picks an automatic value depending on the encoder. Default value is 0.

  • b_qfactor float (encoding,video) β€” Sets qp factor between P and B frames.
  • codec_tag integer
  • bug flags (decoding,video) β€” Workaround not auto detected encoder bugs. (Yes, that's the actual framing. It's a workaround list.)

Possible values:

  • autodetect
  • xvid_ilace β€” Xvid interlacing bug (autodetected if fourcc==XVIX)
  • ump4 β€” (autodetected if fourcc==UMP4)
  • no_padding β€” padding bug (autodetected)
  • amv
  • qpel_chroma
  • std_qpel β€” old standard qpel (autodetected per fourcc/version)
  • qpel_chroma2
  • direct_blocksize β€” direct-qpel-blocksize bug (autodetected per fourcc/version)
  • edge β€” edge padding bug (autodetected per fourcc/version)
  • hpel_chroma
  • dc_clip
  • ms β€” Workaround various bugs in microsoft broken decoders.
  • trunc β€” trancated frames
Ok note: those last few have no description in the original and I'm not gonna make one up. They're just there. Sitting pretty. πŸ’€
  • strict integer (decoding/encoding,audio,video) β€” Specifies how strictly to follow the standards. Basically: how much of a rule-follower are we feeling today.

Possible values:

  • very β€” strictly conform to an older more strict version of the spec or reference software
  • strict β€” strictly conform to all the things in the spec no matter what consequences
  • normal
  • unofficial β€” allow unofficial extensions
  • experimental β€” allow non standardized experimental things, experimental (unfinished/work in progress/not well tested) decoders and encoders.
🚨 Real talk: experimental decoders can pose a security risk. Do not use this for decoding untrusted input. I'm serious, bestie. Don't do it.
  • b_qoffset float (encoding,video) β€” Sets QP offset between P and B frames.
  • err_detect flags (decoding,audio,video) β€” Sets error detection flags.

Possible values:

  • crccheck β€” verify embedded CRCs
  • bitstream β€” detect bitstream specification deviations
  • buffer β€” detect improper bitstream length
  • explode β€” abort decoding on minor error detection
  • 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.
  • careful β€” consider things that violate the spec and have not been seen in the wild as errors
  • compliant β€” consider all spec non compliancies as errors
  • aggressive β€” consider things that a sane encoder should not do as an error
  • has_b_frames integer
  • block_align integer
  • rc_override_count integer
  • maxrate integer (encoding,audio,video) β€” Sets max bitrate tolerance (in bits/s). Requires bufsize to be set β€” like, it will not work without it, so set your bufsize first 🫢
  • minrate integer (encoding,audio,video) β€” Sets min bitrate tolerance (in bits/s). Most useful in setting up a CBR encode. Otherwise it's of little use, honestly.
  • bufsize integer (encoding,audio,video) β€” Sets ratecontrol buffer size (in bits).
  • i_qfactor float (encoding,video) β€” Sets QP factor between P and I frames.
  • i_qoffset float (encoding,video) β€” Sets QP offset between P and I frames.
  • dct integer (encoding,video) β€” Sets DCT algorithm.

Possible values:

  • auto β€” autoselect a good one (default)
  • fastint β€” fast integer
  • int β€” accurate integer
  • mmx
  • altivec
  • faan β€” floating point AAN DCT
  • lumi_mask float (encoding,video) β€” Compress bright areas stronger than medium ones.
  • tcplx_mask float (encoding,video) β€” Sets temporal complexity masking.
  • scplx_mask float (encoding,video) β€” Sets spatial complexity masking.
  • p_mask float (encoding,video) β€” Sets inter masking.
  • dark_mask float (encoding,video) β€” Compress dark areas stronger than medium ones. (Sibling of lumi_mask, we love a matched set 🌸)
  • idct integer (decoding/encoding,video) β€” Selects IDCT implementation.

Possible values:

  • auto
  • int
  • simple
  • simplemmx
  • simpleauto β€” Automatically pick a IDCT compatible with the simple one
  • arm
  • altivec
  • sh4
  • simplearm
  • simplearmv5te
  • simplearmv6
  • simpleneon
  • xvid
  • faani β€” floating point AAN IDCT
  • slice_count integer
  • ec flags (decoding,video) β€” Sets error concealment strategy.

Possible values:

  • guess_mvs β€” iterative motion vector (MV) search (slow)
  • deblock β€” use strong deblock filter for damaged MBs
  • favor_inter β€” favor predicting from the previous frame instead of the current
  • bits_per_coded_sample integer
  • aspect rational number (encoding,video) β€” Sets sample aspect ratio.
  • sar rational number (encoding,video) β€” Sets sample aspect ratio. Alias to aspect. (Same thing, different name, we stan a low-effort alias πŸ’…)
  • debug flags (decoding/encoding,audio,video,subtitles) β€” Prints specific debug info.

Possible values:

  • pict β€” picture info
  • rc β€” rate control
  • bitstream
  • mb_type β€” macroblock (MB) type
  • qp β€” per-block quantization parameter (QP)
  • dct_coeff
  • green_metadata β€” display complexity metadata for the upcoming frame, GoP or for a given duration.
  • skip
  • startcode
  • er β€” error recognition
  • mmco β€” memory management control operations (H.264)
  • bugs
  • buffers β€” picture buffer allocations
  • thread_ops β€” threading operations
  • nomc β€” skip motion compensation
  • cmp integer (encoding,video) β€” Sets full pel me compare function.

Possible values:

  • sad β€” sum of absolute differences, fast (this is the default πŸ’¨)
  • sse β€” sum of squared errors
  • satd β€” sum of absolute Hadamard transformed differences
  • dct β€” sum of absolute DCT transformed differences
  • psnr β€” sum of squared quantization errors (bestie, avoid this one, it's low quality πŸ™ˆ)
  • bit β€” number of bits needed for the block
  • rd β€” rate distortion optimal, slow 🐒
  • zero β€” 0
  • vsad β€” sum of absolute vertical differences
  • vsse β€” sum of squared vertical differences
  • nsse β€” noise preserving sum of squared differences
  • w53 β€” 5/3 wavelet, only used in snow
  • w97 β€” 9/7 wavelet, only used in snow
  • dctmax
  • chroma

  • subcmp (integer, encoding, video) β€” sets the sub pel me compare function ✨ (sub-pixel motion estimation, she's precise). Possible values:
    • sad β€” sum of absolute differences, fast (default)
    • sse β€” sum of squared errors
    • satd β€” sum of absolute Hadamard transformed differences
    • dct β€” sum of absolute DCT transformed differences
    • psnr β€” sum of squared quantization errors (avoid, low quality)
    • bit β€” number of bits needed for the block
    • rd β€” rate distortion optimal, slow
    • zero β€” 0
    • vsad β€” sum of absolute vertical differences
    • vsse β€” sum of squared vertical differences
    • nsse β€” noise preserving sum of squared differences
    • w53 β€” 5/3 wavelet, only used in snow
    • w97 β€” 9/7 wavelet, only used in snow
    • dctmax
    • chroma
  • mbcmp (integer, encoding, video) β€” sets the macroblock compare function, like the vibe check for each macroblock πŸ’… Possible values:
    • sad β€” sum of absolute differences, fast (default)
    • sse β€” sum of squared errors
    • satd β€” sum of absolute Hadamard transformed differences
    • dct β€” sum of absolute DCT transformed differences
    • psnr β€” sum of squared quantization errors (avoid, low quality)
    • bit β€” number of bits needed for the block
    • rd β€” rate distortion optimal, slow
    • zero β€” 0
    • vsad β€” sum of absolute vertical differences
    • vsse β€” sum of squared vertical differences
    • nsse β€” noise preserving sum of squared differences
    • w53 β€” 5/3 wavelet, only used in snow
    • w97 β€” 9/7 wavelet, only used in snow
    • dctmax
    • chroma
  • ildctcmp (integer, encoding, video) β€” sets the interlaced dct compare function (interlaced girlies, this one's for you πŸŽ€). Possible values:
    • sad β€” sum of absolute differences, fast (default)
    • sse β€” sum of squared errors
    • satd β€” sum of absolute Hadamard transformed differences
    • dct β€” sum of absolute DCT transformed differences
    • psnr β€” sum of squared quantization errors (avoid, low quality)
    • bit β€” number of bits needed for the block
    • rd β€” rate distortion optimal, slow
    • zero β€” 0
    • vsad β€” sum of absolute vertical differences
    • vsse β€” sum of squared vertical differences
    • nsse β€” noise preserving sum of squared differences
    • w53 β€” 5/3 wavelet, only used in snow
    • w97 β€” 9/7 wavelet, only used in snow
    • dctmax
    • chroma
  • dia_size (integer, encoding, video) β€” sets the diamond type & size for motion estimation πŸ’Ž (yes, diamonds, we're fancy). The ranges map like this:
    • (1024, INT_MAX) β€” full motion estimation (slowest 🐌)
    • (768, 1024] β€” umh motion estimation
    • (512, 768] β€” hex motion estimation
    • (256, 512] β€” l2s diamond motion estimation
    • [2,256] β€” var diamond motion estimation
    • (-1, 2) β€” small diamond motion estimation
    • -1 β€” funny diamond motion estimation 😭 (that's literally what it's called)
    • (INT_MIN, -1) β€” sab diamond motion estimation
  • last_pred (integer, encoding, video) β€” sets how many motion predictors get carried over from the previous frame πŸ‘€
  • precmp (integer, encoding, video) β€” sets the pre motion estimation compare function. Possible values:
    • sad β€” sum of absolute differences, fast (default)
    • sse β€” sum of squared errors
    • satd β€” sum of absolute Hadamard transformed differences
    • dct β€” sum of absolute DCT transformed differences
    • psnr β€” sum of squared quantization errors (avoid, low quality)
    • bit β€” number of bits needed for the block
    • rd β€” rate distortion optimal, slow
    • zero β€” 0
    • vsad β€” sum of absolute vertical differences
    • vsse β€” sum of squared vertical differences
    • nsse β€” noise preserving sum of squared differences
    • w53 β€” 5/3 wavelet, only used in snow
    • w97 β€” 9/7 wavelet, only used in snow
    • dctmax
    • chroma
  • pre_dia_size (integer, encoding, video) β€” sets the diamond type & size for the motion estimation pre-pass, same diamond energy, just the warm-up round πŸ’Ž
  • subq (integer, encoding, video) β€” sets the sub pel motion estimation quality ⭐
  • me_range (integer, encoding, video) β€” sets the limit on motion vectors range (1023 for DivX player, iykyk)
  • global_quality (integer, encoding, audio, video)
  • slice_flags (integer)
  • mbd (integer, encoding, video) β€” sets the macroblock decision algorithm, aka high quality mode πŸ‘‘. Possible values:
    • simple β€” use mbcmp (default)
    • bits β€” use fewest bits
    • rd β€” use best rate distortion
  • rc_init_occupancy (integer, encoding, video) β€” sets the number of bits that should be loaded into the rc buffer before decoding even starts 🫢
  • flags2 (flags, decoding/encoding, audio, video, subtitles) β€” the little extras menu, take your pick. Possible values:
    • fast β€” allow non spec compliant speedup tricks 😈
    • noout β€” skip bitstream encoding
    • ignorecrop β€” ignore cropping information from sps
    • local_header β€” place global headers at every keyframe instead of in extradata
    • chunks β€” frame data might be split into multiple chunks
    • showall β€” show all frames before the first keyframe
    • export_mvs β€” export motion vectors into frame side-data (see "AV_FRAME_DATA_MOTION_VECTORS") for codecs that support it. See also doc/examples/export_mvs.c.
    • skip_manual β€” do not skip samples and export skip information as frame side data
    • ass_ro_flush_noop β€” do not reset ASS ReadOrder field on flush
    • icc_profiles β€” generate/parse embedded ICC profiles from/to colorimetry tags
  • export_side_data (flags, decoding/encoding, audio, video, subtitles) β€” side-data goodie bag, what are we exporting bestie? Possible values:
    • mvs β€” export motion vectors into frame side-data (see "AV_FRAME_DATA_MOTION_VECTORS") for codecs that support it. See also doc/examples/export_mvs.c.
    • prft β€” export encoder Producer Reference Time into packet side-data (see "AV_PKT_DATA_PRFT") for codecs that support it
    • venc_params β€” export video encoding parameters through frame side data (see "AV_FRAME_DATA_VIDEO_ENC_PARAMS") for codecs that support it. At present, those are H.264 and VP9.
    • film_grain β€” export film grain parameters through frame side data (see "AV_FRAME_DATA_FILM_GRAIN_PARAMS"). Supported at present by AV1 decoders.
    • enhancements β€” export picture enhancement metadata through frame side data, e.g. LCEVC (see "AV_FRAME_DATA_LCEVC")
  • threads (integer, decoding/encoding, video) β€” sets the number of threads to be used, in case the selected codec implementation supports multi-threading 🧡 (only if she supports it, don't pressure her). Possible values:
    • auto, 0 β€” automatically select the number of threads to set

Default value is auto.

  • dc (integer, encoding, video) β€” sets intra_dc_precision
  • nssew (integer, encoding, video) β€” sets nsse weight βš–οΈ
  • skip_top (integer, decoding, video) β€” sets the number of macroblock rows at the top which are skipped ⬆️
  • skip_bottom (integer, decoding, video) β€” sets the number of macroblock rows at the bottom which are skipped ⬇️
  • profile (integer, encoding, audio, video) β€” sets the encoder codec profile. Default value is unknown. Encoder specific profiles are documented in the relevant encoder documentation πŸ“š (go read hers, not mine)
  • level (integer, encoding, audio, video) β€” sets the encoder level. This level depends on the specific codec, and might correspond to the profile level. It's set by default to unknown. Possible values:
    • unknown
  • lowres (integer, decoding, audio, video) β€” decode at 1 = 1/2, 2 = 1/4, 3 = 1/8 resolutions πŸ” (tiny mode activated)
  • mblmin (integer, encoding, video) β€” sets the min macroblock lagrange factor (VBR)
  • mblmax (integer, encoding, video) β€” sets the max macroblock lagrange factor (VBR)
  • skip_loop_filter (integer, decoding, video)
  • skip_idct (integer, decoding, video)
  • skip_frame (integer, decoding, video)

These three make the decoder discard processing depending on the frame type selected by the option value πŸ’€. Specifically: skip_loop_filter skips frame loop filtering, skip_idct skips frame IDCT/dequantization, and skip_frame skips decoding. Possible values:

  • none β€” discard no frame
  • default β€” discard useless frames like 0-sized frames
  • noref β€” discard all non-reference frames
  • bidir β€” discard all bidirectional frames
  • nokey β€” discard all frames excepts keyframes
  • nointra β€” discard all frames except I frames
  • all β€” discard all frames (going full ghost mode πŸ‘»)

Default value is default.

  • bidir_refine (integer, encoding, video) β€” refine the two motion vectors used in bidirectional macroblocks 🎯
  • keyint_min (integer, encoding, video) β€” sets the minimum interval between IDR-frames
  • refs (integer, encoding, video) β€” sets reference frames to consider for motion compensation
  • trellis (integer, encoding, audio, video) β€” sets rate-distortion optimal quantization ✨
  • mv0_threshold (integer, encoding, video)
  • compression_level (integer, encoding, audio, video)
  • bits_per_raw_sample (integer)
  • channel_layout (integer, decoding/encoding, audio) β€” see the Channel Layout section in the ffmpeg-utils(1) manual for the required syntax 🎧
  • rc_max_vbv_use (float, encoding, video)
  • rc_min_vbv_use (float, encoding, video)
  • color_primaries (integer, decoding/encoding, video) β€” the whole color-primaries cinematic universe 🌈. Possible values:
    • bt709 β€” BT.709
    • bt470m β€” BT.470 M
    • bt470bg β€” BT.470 BG
    • smpte170m β€” SMPTE 170 M
    • smpte240m β€” SMPTE 240 M
    • film β€” Film
    • bt2020 β€” BT.2020
    • smpte428
    • smpte428_1 β€” SMPTE ST 428-1
    • smpte431 β€” SMPTE 431-2
    • smpte432 β€” SMPTE 432-1
    • jedec-p22 β€” JEDEC P22
  • color_trc integer (decoding/encoding, video) β€” the transfer characteristics, aka the color transfer function, bestie. possible values:
    • bt709 β€” BT.709
    • gamma22 β€” BT.470 M
    • gamma28 β€” BT.470 BG
    • smpte170m β€” SMPTE 170 M
    • smpte240m β€” SMPTE 240 M
    • linear β€” Linear
    • log, log100 β€” Log
    • log_sqrt, log316 β€” Log square root
    • iec61966_2_4, iec61966-2-4 β€” IEC 61966-2-4
    • bt1361, bt1361e β€” BT.1361
    • iec61966_2_1, iec61966-2-1 β€” IEC 61966-2-1
    • bt2020_10, bt2020_10bit β€” BT.2020 - 10 bit
    • bt2020_12, bt2020_12bit β€” BT.2020 - 12 bit
    • smpte2084 β€” SMPTE ST 2084
    • smpte428, smpte428_1 β€” SMPTE ST 428-1
    • arib-std-b67 β€” ARIB STD-B67
  • colorspace integer (decoding/encoding, video) β€” the color space, duh πŸ’…. possible values:
    • rgb β€” RGB
    • bt709 β€” BT.709
    • fcc β€” FCC
    • bt470bg β€” BT.470 BG
    • smpte170m β€” SMPTE 170 M
    • smpte240m β€” SMPTE 240 M
    • ycocg β€” YCOCG
    • bt2020nc, bt2020_ncl β€” BT.2020 NCL
    • bt2020c, bt2020_cl β€” BT.2020 CL
    • smpte2085 β€” SMPTE 2085
    • chroma-derived-nc β€” Chroma-derived NCL
    • chroma-derived-c β€” Chroma-derived CL
    • ictcp β€” ICtCp
  • color_range integer (decoding/encoding, video) β€” if you use it as an input parameter, it's basically a lil hint to the decoder about which color_range the input is carrying. possible values:
    • tv, mpeg, limited β€” MPEG (219*2^(n-8))
    • pc, jpeg, full β€” JPEG (2^n-1)
  • chroma_sample_location integer (decoding/encoding, video) β€” where the chroma lives. possible values: left, center, topleft, top, bottomleft, bottom 🌈
  • alpha_mode integer (decoding/encoding, video) β€” possible values: premultiplied and straight ✨
  • log_level_offset integer β€” sets the log level offset. that's it, that's the whole vibe πŸŽ€
  • slices integer (encoding, video) β€” number of slices, used in parallelized encoding 🧚
  • thread_type flags (decoding/encoding, video) β€” picks which multithreading methods to use, bestie.
real talk: using frame will increase decoding delay by one frame per thread, so clients that cannot provide future frames should not use it. no cap, that's a warning 🫢

possible values:

  • slice β€” decode more than one part of a single frame at once. multithreading using slices works only when the video was encoded with slices.
  • frame β€” decode more than one frame at once.

default value is slice+frame.

  • audio_service_type integer (encoding, audio) β€” sets the audio service type. possible values:
    • ma β€” Main Audio Service
    • ef β€” Effects
    • vi β€” Visually Impaired
    • hi β€” Hearing Impaired
    • di β€” Dialogue
    • co β€” Commentary
    • em β€” Emergency
    • vo β€” Voice Over
    • ka β€” Karaoke
  • request_sample_fmt sample_fmt (decoding, audio) β€” sets the sample format that audio decoders should prefer. default value is "none" πŸ™ˆ
  • pkt_timebase rational number β€” that's the whole entry, no notes, we move πŸ’€
  • sub_charenc encoding (decoding, subtitles) β€” sets the input subtitles character encoding 🌸
  • field_order field_order (video) β€” set/override the field order of the video. possible values:
    • progressive β€” Progressive video
    • tt β€” Interlaced video, top field coded and displayed first
    • bb β€” Interlaced video, bottom field coded and displayed first
    • tb β€” Interlaced video, top coded first, bottom displayed first
    • bt β€” Interlaced video, bottom coded first, top displayed first
  • skip_alpha bool (decoding, video) β€” set to 1 to disable processing alpha (transparency). it works like the gray flag in the flags option, except that one skips chroma information instead of alpha. default is 0 πŸ’…
  • codec_whitelist list (input) β€” a "," separated list of allowed decoders. by default, all are allowed πŸ‘‘
  • dump_separator string (input) β€” the separator used to separate the fields printed on the command line about the Stream parameters. for example, to separate the fields with newlines and indentation:
        ffprobe -dump_separator "
                                  "  -i ~/videos/matrixbench_mpeg2.mpg
  • max_pixels integer (decoding/encoding, video) β€” maximum number of pixels per image. use this to dodge out-of-memory failures from giant images, iconic defensive move tbh πŸ›‘οΈ
  • apply_cropping bool (decoding, video) β€” enables cropping if the cropping parameters are multiples of the required alignment for the left and top parameters. if the alignment is not met, the cropping will be partially applied in order to maintain alignment. default is 1 (enabled).
heads up, bestie: the required alignment depends on whether "AV_CODEC_FLAG_UNALIGNED" is set and on the CPU. "AV_CODEC_FLAG_UNALIGNED" cannot be changed from the command line. also, hardware decoders will not apply left/top cropping. that's just how it is 😭

πŸ’œ DECODERS πŸ’œ

decoders are configured elements in FFmpeg that let you decode multimedia streams. literally their whole job πŸŽ€

when you configure your FFmpeg build, all the supported native decoders are enabled by default. decoders that need an external library have to be enabled manually via the corresponding --enable-lib option. you can list every available decoder using the configure option --list-decoders ✨

you can disable all the decoders with the configure option --disable-decoders, and then selectively enable / disable single decoders with the options --enable-decoder=DECODER / --disable-decoder=DECODER πŸ¦‹

the option -decoders of the ff* tools will display the list of enabled decoders, iykyk πŸ”₯

VIDEO DECODERS

Okay bestie, buckle up β€” here comes the video decoder lineup. These are the actual things that turn your compressed video bits back into moving pictures. A description of some of the currently available video decoders follows, and yes, we're going through them one by one πŸ’–


av1

The AOMedia Video 1 (AV1) decoder. Royalty-free, shiny, and honestly kind of the moment.

Options

  • operating_point β€” picks an operating point of a scalable AV1 bitstream, valid range is 0 - 31. Default is 0. Slay.

hevc

The HEVC decoder (AKA ITU-T H.265 or ISO/IEC 23008-2, because of course it has three names πŸ’€).

This one is lowkey fancy: it supports MV-HEVC multiview streams with at most two views. The views that actually get output are selected by supplying a list of view IDs to the decoder (the view_ids option, more on that below). You can set this option either statically before decoder init, or from the get_format() callback β€” which is super useful for the case when the view count or IDs change dynamically during decoding.

By default, only the base layer is decoded. That's the vibe unless you say otherwise.

Heads up bestie: if you're using the ffmpeg CLI tool, you should be using view specifiers as documented in its manual, rather than the options documented here. Different layer of the stack, different rules 🫢

Options

  • view_ids (MV-HEVC) β€” specify a list of view IDs that should be output. This option can also be set to a single -1, which will cause all views defined in the VPS to be decoded and output. All of them. Every last one ✨
  • view_ids_available (MV-HEVC) β€” this option may be read by the caller to retrieve an array of view IDs available in the active VPS. The array is empty for single-layer video.

The value of this option is guaranteed to be accurate when read from the get_format() callback. It may also be set at other times (e.g. after opening the decoder), but the value is informational only and may be incorrect (e.g. when the stream contains multiple distinct VPS NALUs). So like… use it, but know what you're doing πŸ™ˆ

  • view_pos_available (MV-HEVC) β€” this option may be read by the caller to retrieve an array of view positions (left, right, or unspecified) available in the active VPS, as AVStereo3DView values. When the array is available, its elements apply to the corresponding elements of view_ids_available, i.e. view_pos_available[i] contains the position of view with ID view_ids_available[i]. Matching indices, matching energy πŸ’…

Same validity restrictions as for view_ids_available apply to this option. Same rules, same caveats, no cap.


rawvideo

The raw video decoder. It decodes rawvideo streams β€” which is exactly what it says on the tin, no surprises, kind of iconic in its simplicity.

Options

  • top, top_field_first β€” specify the assumed field type of the input video. The values are:
    • -1 β€” the video is assumed to be progressive (default). The chill option.
    • 0 β€” bottom-field-first is assumed.
    • 1 β€” top-field-first is assumed.

libdav1d

The dav1d AV1 decoder. Fast, mean, and here to decode.

libdav1d allows libavcodec to decode the AOMedia Video 1 (AV1) codec. Requires the presence of the libdav1d headers and library during configuration. You need to explicitly configure the build with --enable-libdav1d. No library, no decoder, that's the rule πŸŽ€

Options

The following options are supported by the libdav1d wrapper.

  • max_frame_delay β€” set max amount of frames the decoder may buffer internally. The default value is 0 (autodetect). Let it cook.
  • filmgrain β€” apply film grain to the decoded video if present in the bitstream. Defaults to the internal default of the library.
Okay important: this option is deprecated and will be removed in the future. See the global option export_side_data to export Film Grain parameters instead of applying it. Don't get attached πŸ’€
  • oppoint β€” select an operating point of a scalable AV1 bitstream (0 - 31). Defaults to the internal default of the library.
  • alllayers β€” output all spatial layers of a scalable AV1 bitstream. The default value is false. Turn it on for the full stack experience 🌈

libdavs2

The AVS2-P2/IEEE1857.4 video decoder wrapper.

This decoder allows libavcodec to decode AVS2 streams with the davs2 library. Short, sweet, does exactly one thing and does it well ✨


libuavs3d

The AVS3-P2/IEEE1857.10 video decoder.

libuavs3d allows libavcodec to decode AVS3 streams. Requires the presence of the libuavs3d headers and library during configuration. You need to explicitly configure the build with --enable-libuavs3d.

Options

The following option is supported by the libuavs3d wrapper.

  • frame_threads β€” set amount of frame threads to use during decoding. The default value is 0 (autodetect). Let the decoder pick, she knows what she's doing πŸ’…

libxevd

The eXtra-fast Essential Video Decoder (XEVD) MPEG-5 EVC decoder wrapper.

This decoder requires the presence of the libxevd headers and library during configuration. You need to explicitly configure the build with --enable-libxevd.

The xevd project website is at <https://github.com/mpeg5/xevd>. Go say hi πŸ¦‹

Options

The following options are supported by the libxevd wrapper. The xevd-equivalent options or values are listed in parentheses for easy migration β€” thoughtful, honestly.

To get a more accurate and extensive documentation of the libxevd options, invoke the command xevd_app --help or consult the libxevd documentation. When in doubt, read the source's own manual, bestie.

  • threads (threads) β€” force to use a specific number of threads. Exactly that many. No more, no less πŸ”₯

QSV Decoders

The whole family of Intel QuickSync Video decoders: VC1, MPEG-2, H.264, HEVC, JPEG/MJPEG, VP8, VP9, AV1, VVC. A whole squad πŸ‘‘

Common Options

The following options are supported by all qsv decoders.

  • async_depth β€” internal parallelization depth. The higher the value, the higher the latency. Speed vs. delay, the eternal tradeoff 😭
  • gpu_copy β€” a GPU-accelerated copy between video and system memory. Accepted values:
    • default
    • on
    • off

HEVC Options

Extra options for hevc_qsv.

  • load_plugin β€” a user plugin to load in an internal session. Accepted values:
    • none
    • hevc_sw
    • hevc_hw
  • load_plugins β€” a :-separate list of hexadecimal plugin UIDs to load in an internal session. Yes, colon-separated, yes, hex, no, I'm not joking πŸŽ€

v210

The uncompressed 4:2:2 10-bit decoder. Chunky, uncompressed, unbothered.

Options

  • custom_stride β€” set the line size of the v210 data in bytes. The default value is 0 (autodetect). You can use the special -1 value for a strideless v210 as seen in BOXX files. Special little snowflake value, we love her πŸ’œ

AUDIO DECODERS

And now for the ears, bestie 🎧 A description of some of the currently available audio decoders follows.


ac3

The AC-3 audio decoder.

This decoder implements part of ATSC A/52:2010 and ETSI TS 102 366, as well as the undocumented RealAudio 3 (a.k.a. dnet). Undocumented and still decoded, main character energy honestly.

AC-3 Decoder Options

  • -drc_scale value β€” Dynamic Range Scale Factor. The factor to apply to dynamic range values from the AC-3 stream. This factor is applied exponentially. The default value is 1. There are 3 notable scale factor ranges:
    • drc_scale == 0 β€” DRC disabled. Produces full range audio. Everything, all at once, no compression.
    • 0 < drc_scale <= 1 β€” DRC enabled. Applies a fraction of the stream DRC value. Audio reproduction is between full range and full compression. The middle ground 🌸
    • drc_scale > 1 β€” DRC enabled. Applies drc_scale asymmetrically. Loud sounds are fully compressed. Soft sounds are enhanced. Chaos mode, but make it intentional πŸ”₯

flac

The FLAC audio decoder.

This decoder aims to implement the complete FLAC specification from Xiph. Complete. Specification. Ambition πŸ’–

FLAC Decoder options

  • -use_buggy_lpc β€” the lavc FLAC encoder used to produce buggy streams with high lpc values (like the default value). This option makes it possible to decode such streams correctly by using lavc's old buggy lpc logic for decoding. Yes we are intentionally invoking old buggy logic, no you should not feel bad about it, it's for compatibility 🫢

ffwavesynth

Internal wave synthesizer.

This decoder generates wave patterns according to predefined sequences. Its use is purely internal and the format of the data it accepts is not publicly documented. Secret little guy. Respect the privacy πŸ™ˆ


libcelt

The libcelt decoder wrapper.

libcelt allows libavcodec to decode the Xiph CELT ultra-low delay audio codec. Requires the presence of the libcelt headers and library during configuration. You need to explicitly configure the build with --enable-libcelt.


libgsm

The libgsm decoder wrapper.

libgsm allows libavcodec to decode the GSM full rate audio codec. Requires the presence of the libgsm headers and library during configuration. You need to explicitly configure the build with --enable-libgsm.

This decoder supports both the ordinary GSM and the Microsoft variant. Two flavors, one wrapper, iconic ✨


libilbc

The libilbc decoder wrapper.

libilbc allows libavcodec to decode the Internet Low Bitrate Codec (iLBC) audio codec. Requires the presence of the libilbc headers and library during configuration. You need to explicitly configure the build with --enable-libilbc.

Options

The following option is supported by the libilbc wrapper.

  • enhance β€” enable the enhancement of the decoded audio when set to 1. The default value is 0 (disabled). Flip it on when you want the glow-up πŸ’…

libmpeghdec

The libmpeghdec decoder wrapper.

libmpeghdec allows libmpeghdec to decode the MPEG-H 3D audio codec. Requires the presence of the libmpeghdec headers and library during configuration. You need to explicitly configure the build with --enable-libmpeghdec --enable-nonfree. Note the --enable-nonfree β€” that's not optional, that's the deal πŸŽ€


libopencore-amrnb

The libopencore-amrnb decoder wrapper.

libopencore-amrnb allows libavcodec to decode the Adaptive Multi-Rate Narrowband audio codec. Using it requires the presence of the libopencore-amrnb headers and library during configuration. You need to explicitly configure the build with --enable-libopencore-amrnb.

An FFmpeg native decoder for AMR-NB exists, so users can decode AMR-NB without this library. Good news: you're not locked in πŸ’–


libopencore-amrwb

The libopencore-amrwb decoder wrapper.

libopencore-amrwb allows libavcodec to decode the Adaptive Multi-Rate Wideband audio codec. Using it requires the presence of the libopencore-amrwb headers and library during configuration. You need to explicitly configure the build with --enable-libopencore-amrwb.

An FFmpeg native decoder for AMR-WB exists, so users can decode AMR-WB without this library. Same story, wideband edition 🌈


libopus

The libopus decoder wrapper.

libopus allows libavcodec to decode the Opus Interactive Audio Codec. Requires the presence of the libopus headers and library during configuration. You need to explicitly configure the build with --enable-libopus.

An FFmpeg native decoder for Opus exists, so users can decode Opus without this library. Options, options, options β€” she's flexible πŸ¦‹

πŸ’– SUBTITLES DECODERS πŸ’–

🌸 libaribb24

Okay so this one is an ARIB STD-B24 caption decoder β€” yes, that whole Japanese broadcast caption situation. It implements profiles A and C of the ARIB STD-B24 standard, no cap.

libaribb24 Decoder Options

  • -aribb24-base-path path β€” sets the base path for the libaribb24 library. What's it for? Two things, bestie: reading config files (for those custom unicode conversions) and dumping non-text symbols as images into that location. It's unset by default, so don't come for me if it does nothing until you set it.
  • -aribb24-skip-ruby-text boolean β€” tells the decoder wrapper to skip text blocks that contain half-height ruby text. It's enabled by default ✨

πŸ¦‹ libaribcaption

Yet another ARIB STD-B24 caption decoder, but this one's using the external libaribcaption library. It implements profiles A and C of the Japanese ARIB STD-B24 standard, Brazilian ABNT NBR 15606-1, and the Philippines version of ISDB-T. Globally iconic behavior tbh.

It requires the libaribcaption headers and library (<https://github.com/xqq/libaribcaption>) to be present during configuration. You literally need to explicitly configure the build with --enable-libaribcaption. And heads up: if both libaribb24 and libaribcaption are enabled, the libaribcaption decoder precedes. It's giving main character energy πŸ‘‘

libaribcaption Decoder Options

  • -sub_type subtitle_type β€” specifies the format of the decoded subtitles:
    • bitmap β€” graphical image. πŸ–ΌοΈ
    • ass β€” ASS formatted text.
    • text β€” simple text based output without formatting.

The default is ass, same as the libaribb24 decoder. Some present players (e.g., mpv) expect ASS format for ARIB caption, so yeah.

  • -caption_encoding encoding_scheme β€” specifies the encoding scheme of the input subtitle text:
    • auto β€” automatically detect text encoding (default).
    • jis β€” 8bit-char JIS encoding defined in ARIB STD B24. This encoding is used in Japan for ISDB captions.
    • utf8 β€” UTF-8 encoding defined in ARIB STD B24. This encoding is used in Philippines for ISDB-T captions.
    • latin β€” Latin character encoding defined in ABNT NBR 15606-1. This encoding is used in South America for SBTVD / ISDB-Tb captions.
  • -font font_name[,font_name2,...] β€” specify a comma-separated list of font family names to be used for bitmap or ass type subtitle rendering. Only the first font name is used for ass type subtitle. If not specified, it uses the internally defined default font family. πŸŽ€
  • -ass_single_rect boolean β€” so ARIB STD-B24 specifies that some captions may be displayed at different positions at a time (that's a multi-rectangle subtitle). Since some players (e.g., old mpv) can't handle multiple ASS rectangles in a single AVSubtitle, or multiple ASS rectangles of indeterminate duration with the same start timestamp, this option changes the behavior so that all the texts are displayed in a single ASS rectangle. The default is false. If your player cannot handle AVSubtitles with multiple ASS rectangles properly, set this option to true or define ASS_SINGLE_RECT=1 to change the default behavior at compilation. πŸ’…
  • -force_outline_text boolean β€” specify whether to always render outline text for all characters, regardless of the indication by character style. The default is false.
  • -outline_width number (0.0 - 3.0) β€” specify width for outline text, in dots (relative). The default is 1.5.
  • -ignore_background boolean β€” specify whether to ignore background color rendering. The default is false.
  • -ignore_ruby boolean β€” specify whether to ignore rendering for ruby-like (furigana) characters. The default is false.
  • -replace_drcs boolean β€” specify whether to render replaced DRCS characters as Unicode characters. The default is true.
  • -replace_msz_ascii boolean β€” specify whether to replace MSZ (Middle Size; half width) fullwidth alphanumerics with halfwidth alphanumerics. The default is true.
  • -replace_msz_japanese boolean β€” specify whether to replace some MSZ (Middle Size; half width) fullwidth japanese special characters with halfwidth ones. The default is true.
  • -replace_msz_glyph boolean β€” specify whether to replace MSZ (Middle Size; half width) characters with halfwidth glyphs if the fonts support it. This option works under FreeType or DirectWrite renderer with Adobe-Japan1 compliant fonts. e.g., IBM Plex Sans JP, Morisawa BIZ UDGothic, Morisawa BIZ UDMincho, Yu Gothic, Yu Mincho, and Meiryo. The default is true. πŸ”₯
  • -canvas_size image_size β€” specify the resolution of the canvas to render subtitles to; usually, this should be the frame size of the input video. This only applies when -subtitle_type is set to bitmap.

The libaribcaption decoder assumes these input frame sizes for bitmap rendering:

  1. PROFILE_A : 1440 x 1080 with SAR (PAR) 4:3
  2. PROFILE_C : 320 x 180 with SAR (PAR) 1:1

If the actual frame size of the input video does not match the above assumption, the rendered captions may be distorted. 😭 To make the captions undistorted, add the -canvas_size option to specify the actual input video size.

Note that the -canvas_size option is not required for video with a different size but the same aspect ratio. In such cases, the caption will be stretched or shrunk to the actual video size if the -canvas_size option is not specified. If the -canvas_size option is specified with a different size, the caption will be stretched or shrunk to the specified size with calculated SAR.

libaribcaption decoder usage examples

Display an MPEG-TS file with ARIB subtitle using the ffplay tool:

ffplay -sub_type bitmap MPEG.TS

Display an MPEG-TS file with input frame size 1920x1080 using the ffplay tool:

ffplay -sub_type bitmap -canvas_size 1920x1080 MPEG.TS

Embed ARIB subtitle in a transcoded video:

ffmpeg -sub_type bitmap -i src.m2t -filter_complex "[0:v][0:s]overlay" -vcodec h264 dest.mp4

🧚 dvbsub

Options

  • compute_clut
    • -2 β€” compute clut once if no matching CLUT is in the stream.
    • -1 β€” compute clut if no matching CLUT is in the stream.
    • 0 β€” never compute CLUT.
    • 1 β€” always compute CLUT and override the one provided in the stream.
  • dvb_substream β€” selects the dvb substream, or all substreams if -1, which is the default. πŸ‘‘

πŸ’œ dvdsub

This codec decodes the bitmap subtitles used in DVDs; the same subtitles can also be found in VobSub file pairs and in some Matroska files. Nostalgic af.

Options

  • palette β€” specify the global palette used by the bitmaps. When stored in VobSub, the palette is normally specified in the index file; in Matroska, the palette is stored in the codec extra-data in the same format as in VobSub. In DVDs, the palette is stored in the IFO file, and therefore not available when reading from dumped VOB files.

The format for this option is a string containing 16 24-bits hexadecimal numbers (without 0x prefix) separated by commas, for example:

"0d00ee, ee450d, 101010, eaeaea, 0ce60b, ec14ed, ebff0b, 0d617a, 7b7b7b, d1d1d1, 7b2a0e, 0d950c, 0f007b, cf0dec, cfa80c, 7c127b"
  • ifo_palette β€” specify the IFO file from which the global palette is obtained. (experimental πŸ‘€)
  • forced_subs_only β€” only decode subtitle entries marked as forced. Some titles have forced and non-forced subtitles in the same track. Setting this flag to 1 will only keep the forced subtitles. Default value is 0.

🌈 libzvbi-teletext

Libzvbi allows libavcodec to decode DVB teletext pages and DVB teletext subtitles. It requires the presence of the libzvbi headers and library during configuration. You need to explicitly configure the build with --enable-libzvbi.

Options

  • txt_page β€” list of teletext page numbers to decode. Pages that do not match the specified list are dropped. You may use the special "*" string to match all pages, or "subtitle" to match all subtitle pages. Default value is *. ⭐
  • txt_default_region β€” set the default character set used for decoding, a value between 0 and 87 (see ETS 300 706, Section 15, Table 32). Default value is -1, which does not override the libzvbi default. This option is needed for some legacy level 1.0 transmissions which cannot signal the proper charset.
  • txt_chop_top β€” discards the top teletext line. Default value is 1.
  • txt_format β€” specifies the format of the decoded subtitles:
    • bitmap β€” the default format. You should use this for teletext pages, because certain graphics and colors cannot be expressed in simple text or even ASS.
    • text β€” simple text based output without formatting.
    • ass β€” formatted ASS output, subtitle pages and teletext pages are returned in different styles, subtitle pages are stripped down to text, but an effort is made to keep the text alignment and the formatting.
  • txt_left β€” X offset of generated bitmaps, default is 0.
  • txt_top β€” Y offset of generated bitmaps, default is 0.
  • txt_chop_spaces β€” chops leading and trailing spaces and removes empty lines from the generated text. This option is useful for teletext based subtitles where empty spaces may be present at the start or at the end of the lines, or empty lines may be present between the subtitle lines because of double-sized teletext characters. Default value is 1.
  • txt_duration β€” sets the display duration of the decoded teletext pages or subtitles in milliseconds. Default value is -1, which means infinity or until the next subtitle event comes. πŸ•
  • txt_transparent β€” force transparent background of the generated teletext bitmaps. Default value is 0, which means an opaque background.
  • txt_opacity β€” sets the opacity (0-255) of the teletext background. If txt_transparent is not set, it only affects characters between a start box and an end box, typically subtitles. Default value is 0 if txt_transparent is set, 255 otherwise.

πŸ‘‘ ENCODERS πŸ‘‘

Encoders are configured elements in FFmpeg which allow the encoding of multimedia streams. They're the whole vibe, honestly.

When you configure your FFmpeg build, all the supported native encoders are enabled by default. Encoders requiring an external library must be enabled manually via the corresponding --enable-lib option. You can list all available encoders using the configure option --list-encoders. πŸ“‹

You can disable all the encoders with the configure option --disable-encoders and selectively enable / disable single encoders with the options --enable-encoder=ENCODER / --disable-encoder=ENCODER.

The option -encoders of the ff* tools will display the list of enabled encoders. Slay. πŸ’…

🌸 AUDIO ENCODERS 🌸

Okay bestie, here's the lowdown on some of the audio encoders that are currently available. Not all of them β€” some β€” but the ones here are the ones you'll actually be reaching for. πŸ’–


🎧 aac

The Advanced Audio Coding (AAC) encoder. Iconic, honestly.

This is the default AAC encoder, and it's natively implemented right into FFmpeg β€” no external library drama, it's just there for you. 🫢

Options

  • b β€” Set the bit rate in bits/s. Setting this automatically activates constant bit rate (CBR) mode. If you don't specify it, it gets set to 128kbps. Slay.
  • q β€” Set the quality for variable bit rate (VBR) mode. Heads up though: this option is only valid when you're using the ffmpeg command-line tool. For library interface users, use global_quality instead. iykyk 😌
  • cutoff β€” Set the cutoff frequency. If you don't specify it, the encoder will dynamically adjust the cutoff itself to improve clarity on low bitrates. It's giving "self-care" honestly.
  • aac_coder β€” Set the AAC encoder coding method. Possible values are:
    • twoloop β€” Two loop searching (TLS) method. This is the default method. It first sets quantizers depending on band thresholds and then tries to find an optimal combination by adding or subtracting a specific value from all quantizers and adjusting some individual quantizer a little. Will tune itself based on whether aac_is, aac_ms and aac_pns are enabled. Main character energy fr fr.
    • anmr β€” Average noise to mask ratio (ANMR) trellis-based solution. This is an experimental coder which currently produces a lower quality, is more unstable and is slower than the default twoloop coder but has potential. Currently has no support for the aac_is or aac_pns options. Not currently recommended. πŸ™ˆ Like it's a work in progress bestie, don't come for it.
    • fast β€” Constant quantizer method. Uses a cheaper version of the two loop algorithm that doesn't try to do as many clever adjustments. Worse with low bitrates (less than 64kbps), but is better and much faster at higher bitrates. ⚑
  • aac_ms β€” Sets mid/side coding mode. The default value of auto will automatically use M/S with bands which will benefit from such coding. Can be forced for all bands using the value enable β€” which is mainly useful for debugging β€” or disabled using disable.
  • aac_is β€” Sets intensity stereo coding tool usage. By default it's enabled and will automatically toggle IS for similar pairs of stereo bands if it's beneficial. Can be disabled for debugging by setting the value to disable.
  • aac_pns β€” Uses perceptual noise substitution to replace low entropy high frequency bands with imperceptible white noise during the decoding process. By default it's enabled, but can be disabled for debugging purposes by using disable.
  • aac_tns β€” Enables the use of a multitap FIR filter which spans through the high frequency bands to hide quantization noise during the encoding process, and is reverted by the decoder. As well as decreasing unpleasant artifacts in the high range, this also reduces the entropy in the high bands and allows for more bits to be used by the mid-low bands. By default it's enabled but can be disabled for debugging by setting the option to disable. πŸ’…
  • aac_ltp β€” Enables the use of the long term prediction extension, which increases coding efficiency in very low bandwidth situations β€” think encoding of voice or solo piano music β€” by extending constant harmonic peaks in bands throughout frames. This option is implied by profile:a aac_low. Use it in conjunction with -ar to decrease the samplerate. 🎹
  • profile β€” Sets the encoding profile. Possible values:
    • aac_low β€” The default, AAC "Low-complexity" profile. Is the most compatible and produces decent quality. The safe pick, ngl.
    • mpeg2_aac_low β€” Equivalent to -profile:a aac_low -aac_pns 0. PNS was introduced with the MPEG4 specifications.
    • aac_ltp β€” Long term prediction profile, is enabled by and will enable the aac_ltp option. Introduced in MPEG4.

If this option is unspecified it is set to aac_low. Default behaviour, love that for us. ✨


πŸ”Š ac3 and ac3_fixed

The AC-3 audio encoders. Two of them, and they are not the same girlies.

These encoders implement part of ATSC A/52:2010 and ETSI TS 102 366. Professional stuff. πŸ‘‘

The ac3 encoder uses floating-point math, while the ac3_fixed encoder only uses fixed-point integer math. And before you ask β€” that does not mean one is always faster. It just means one or the other may be better suited to a particular system. πŸ–₯️

Heads up: the ac3_fixed encoder is not the default codec for any of the output formats, so you have to specify it explicitly using the option -acodec ac3_fixed in order to use it. No cap.

πŸ“‹ AC-3 Metadata

The AC-3 metadata options are used to set parameters that describe the audio β€” but in most cases they do not affect the audio encoding itself. Some of the options do directly affect or influence the decoding and playback of the resulting bitstream, while others are just for informational purposes. ✨

A few of the options will add bits to the output stream that could otherwise be used for audio data, and will thus affect the quality of the output. Those are marked with a note in the option list below β€” keep an eye out. πŸ‘€

These parameters are described in detail in several publicly-available documents:


βš™οΈ Metadata Control Options

  • -per_frame_metadata boolean β€” Allow Per-Frame Metadata. Specifies if the encoder should check for changing metadata for each frame.
    • 0 β€” The metadata values set at initialization will be used for every frame in the stream. (default)
    • 1 β€” Metadata values can be changed before encoding each frame.

🎚️ Downmix Levels

  • -center_mixlev level β€” Center Mix Level. The amount of gain the decoder should apply to the center channel when downmixing to stereo. This field will only be written to the bitstream if a center channel is present. The value is specified as a scale factor. There are 3 valid values:
    • 0.707 β€” Apply -3dB gain
    • 0.595 β€” Apply -4.5dB gain (default)
    • 0.500 β€” Apply -6dB gain
  • -surround_mixlev level β€” Surround Mix Level. The amount of gain the decoder should apply to the surround channel(s) when downmixing to stereo. This field will only be written to the bitstream if one or more surround channels are present. The value is specified as a scale factor. There are 3 valid values:
    • 0.707 β€” Apply -3dB gain
    • 0.500 β€” Apply -6dB gain (default)
    • 0.000 β€” Silence Surround Channel(s)

πŸŽ›οΈ Audio Production Information

Audio Production Information is optional information describing the mixing environment. Either none or both of the fields are written to the bitstream. It's an all-or-nothing situation, bestie.

  • -mixing_level number β€” Mixing Level. Specifies peak sound pressure level (SPL) in the production environment when the mix was mastered. Valid values are 80 to 111, or -1 for unknown or not indicated. The default value is -1, but that value cannot be used if the Audio Production Information is written to the bitstream. Therefore, if the room_type option is not the default value, the mixing_level option must not be -1. 🚨 Like, they're linked, okay?
  • -room_type type β€” Room Type. Describes the equalization used during the final mixing session at the studio or on the dubbing stage. A large room is a dubbing stage with the industry standard X-curve equalization; a small room has flat equalization. This field will not be written to the bitstream if both the mixing_level option and the room_type option have the default values.
    • 0, notindicated β€” Not Indicated (default)
    • 1, large β€” Large Room
    • 2, small β€” Small Room

🏷️ Other Metadata Options

  • -copyright boolean β€” Copyright Indicator. Specifies whether a copyright exists for this audio.
    • 0, off β€” No Copyright Exists (default)
    • 1, on β€” Copyright Exists
  • -dialnorm value β€” Dialogue Normalization. Indicates how far the average dialogue level of the program is below digital 100% full scale (0 dBFS). This parameter determines a level shift during audio reproduction that sets the average volume of the dialogue to a preset level. The goal is to match volume level between program sources. A value of -31dB will result in no volume level change, relative to the source volume, during audio reproduction. Valid values are whole numbers in the range -31 to -1, with -31 being the default. πŸ”‰
  • -dsur_mode mode β€” Dolby Surround Mode. Specifies whether the stereo signal uses Dolby Surround (Pro Logic). This field will only be written to the bitstream if the audio stream is stereo. Using this option does NOT mean the encoder will actually apply Dolby Surround processing. Read that again, bestie. πŸ“’
    • 0, notindicated β€” Not Indicated (default)
    • 1, off β€” Not Dolby Surround Encoded
    • 2, on β€” Dolby Surround Encoded
  • -original boolean β€” Original Bit Stream Indicator. Specifies whether this audio is from the original source and not a copy.
    • 0, off β€” Not Original Source
    • 1, on β€” Original Source (default)

🧬 Extended Bitstream Information

The extended bitstream options are part of the Alternate Bit Stream Syntax as specified in Annex D of the A/52:2010 standard. It is grouped into 2 parts. 🫢

If any one parameter in a group is specified, all values in that group will be written to the bitstream. Default values are used for those that are written but have not been specified. If the mixing levels are written, the decoder will use these values instead of the ones specified in the center_mixlev and surround_mixlev options β€” if it supports the Alternate Bit Stream Syntax. πŸ’…


🧩 Extended Bitstream Information - Part 1

  • -dmix_mode mode β€” Preferred Stereo Downmix Mode. Allows the user to select either Lt/Rt (Dolby Surround) or Lo/Ro (normal stereo) as the preferred stereo downmix mode.
    • 0, notindicated β€” Not Indicated (default)
    • 1, ltrt β€” Lt/Rt Downmix Preferred
    • 2, loro β€” Lo/Ro Downmix Preferred
  • -ltrt_cmixlev level β€” Lt/Rt Center Mix Level. The amount of gain the decoder should apply to the center channel when downmixing to stereo in Lt/Rt mode.
    • 1.414 β€” Apply +3dB gain
    • 1.189 β€” Apply +1.5dB gain
    • 1.000 β€” Apply 0dB gain
    • 0.841 β€” Apply -1.5dB gain
  • 0.707 β€” apply -3.0dB gain πŸ’…
  • 0.595 β€” apply -4.5dB gain (this one's the default ✨)
  • 0.500 β€” apply -6.0dB gain
  • 0.000 β€” silence the center channel entirely 🀫
  • -ltrt_surmixlev level β€” Lt/Rt Surround Mix Level, bestie. This is how much gain the decoder slaps on the surround channel(s) when it's downmixing to stereo in Lt/Rt mode 🎧
    • 0.841 β€” apply -1.5dB gain
    • 0.707 β€” apply -3.0dB gain
    • 0.595 β€” apply -4.5dB gain
    • 0.500 β€” apply -6.0dB gain (default, iykyk)
    • 0.000 β€” silence the surround channel(s) πŸ’€
  • -loro_cmixlev level β€” Lo/Ro Center Mix Level. The gain the decoder applies to the center channel when downmixing to stereo in Lo/Ro mode πŸŒ€
    • 1.414 β€” apply +3dB gain
    • 1.189 β€” apply +1.5dB gain
    • 1.000 β€” apply 0dB gain
    • 0.841 β€” apply -1.5dB gain
    • 0.707 β€” apply -3.0dB gain
    • 0.595 β€” apply -4.5dB gain (default ✨)
    • 0.500 β€” apply -6.0dB gain
    • 0.000 β€” silence the center channel 🀐
  • -loro_surmixlev level β€” Lo/Ro Surround Mix Level. Same deal but for the surround channel(s) when downmixing to stereo in Lo/Ro mode 🌊
    • 0.841 β€” apply -1.5dB gain
    • 0.707 β€” apply -3.0dB gain
    • 0.595 β€” apply -4.5dB gain
    • 0.500 β€” apply -6.0dB gain (default)
    • 0.000 β€” silence the surround channel(s)

Extended Bitstream Information β€” Part 2 πŸŽ€

  • -dsurex_mode mode β€” Dolby Surround EX Mode. Tells you whether the stream is out here using Dolby Surround EX (that's 7.1 matrixed down to 5.1, iconic behaviour honestly). Important caveat tho: using this option does NOT mean the encoder will actually apply Dolby Surround EX processing ⚠️
    • 0 / notindicated β€” not indicated (default)
    • 1 / on β€” Dolby Surround EX Off
    • 2 / off β€” Dolby Surround EX On
okay yes, the on/off labels there are lowkey swapped-looking, but that's literally what the page says, so we're not touching it bestie πŸ™ˆ
  • -dheadphone_mode mode β€” Dolby Headphone Mode. Indicates whether the stream uses Dolby Headphone encoding (multi-channel matrixed to 2.0 so your headphones can eat 🎧). Again, using this option does NOT mean the encoder will actually apply Dolby Headphone processing 🚫
    • 0 / notindicated β€” not indicated (default)
    • 1 / on β€” Dolby Headphone Off
    • 2 / off β€” Dolby Headphone On
  • -ad_conv_type type β€” A/D Converter Type. Says whether the audio has passed through HDCD A/D conversion πŸ”Š
    • 0 / standard β€” standard A/D converter (default)
    • 1 / hdcd β€” HDCD A/D converter

Other AC-3 Encoding Options πŸ“

  • -stereo_rematrixing boolean β€” Stereo Rematrixing. Turns rematrixing for stereo input on/off. It's this optional AC-3 feature that boosts quality by selectively encoding the left/right channels as mid/side. It's enabled by default, and the page literally says it's highly recommended you leave it enabled unless you're just testing πŸ§ͺ✨
  • cutoff frequency β€” sets the lowpass cutoff frequency. If you don't specify it, the encoder picks a default based on all the other encoding parameters it's juggling πŸŽ›οΈ

Floating-Point-Only AC-3 Encoding Options 🫧

Real talk: these options are only valid for the floating-point encoder, and they straight up don't exist in the fixed-point encoder because those features aren't implemented in fixed-point. No cap πŸ’€

  • -channel_coupling boolean β€” enables/disables channel coupling, an optional AC-3 feature that bumps quality by combining high-frequency info from multiple channels into a single channel. The per-channel high-frequency info gets sent with less accuracy in both frequency and time domains β€” which frees up more bits for the lower frequencies while still keeping enough info to reconstruct the highs. Enabled by default for the floating-point encoder, and you should generally leave it on unless you're testing or tryna speed up encoding ⚑
    • -1 / auto β€” selected by encoder (default)
    • 0 / off β€” disable channel coupling
    • 1 / on β€” enable channel coupling
  • -cpl_start_band number β€” Coupling Start Band. Sets the channel coupling start band, from 1 to 15. If you use a value higher than the bandwidth, it gets reduced to 1 less than the coupling end band. If you use auto, the start band is determined by the encoder based on bit rate, sample rate, and channel layout. This option does absolutely nothing if channel coupling is disabled, fyi πŸš«πŸŽ€
    • -1 / auto β€” selected by encoder (default)

🌸 flac 🌸

FLAC (Free Lossless Audio Codec) Encoder. Lossless girlypop behaviour, we stan πŸ¦‹

Options

These are the options FFmpeg's flac encoder supports, bestie:

  • compression_level β€” sets the compression level, which chooses the defaults for a bunch of other options if you didn't set them explicitly. Valid values run from 0 to 12, and 5 is the default 🎚️
  • frame_size β€” sets the size of the frames, in samples per channel πŸ“
  • lpc_coeff_precision β€” sets the LPC coefficient precision. Valid values are 1 to 15, and 15 is the default ✨
  • lpc_type β€” sets the first stage LPC algorithm:
    • none β€” LPC is not used
    • fixed β€” fixed LPC coefficients
    • levinson
    • cholesky
  • lpc_passes β€” number of passes to use for Cholesky factorization during LPC analysis πŸ”
  • min_partition_order β€” the minimum partition order
  • max_partition_order β€” the maximum partition order
  • prediction_order_method β€” the options are estimation, 2level, 4level, 8level, search (that one's a bruteforce search πŸ”), and log
  • ch_mode β€” channel mode:
    • auto β€” the mode is chosen automatically for each frame
    • indep β€” channels are independently coded
    • left_side
    • right_side
    • mid_side
  • exact_rice_parameters β€” chooses whether rice parameters are calculated exactly or approximately. Set it to 1 and they're chosen exactly, which slows the code down a lil bit and improves compression a lil bit. Trade-offs, babes βš–οΈ
  • multi_dim_quant β€” Multi Dimensional Quantization. Set it to 1 and a 2nd stage LPC algorithm gets applied after the first stage to finetune the coefficients. It's quite slow and only slightly improves compression, so... your call 🐌

πŸ’œ opus πŸ’œ

Opus encoder.

This is a native FFmpeg encoder for the Opus format. Currently it's still in development and only implements the CELT part of the codec. Its quality is usually worse than the libopus encoder, and at absolute best it's equal to it β€” so manage your expectations bestie 😭

Options

  • b β€” set bit rate in bits/s. If you don't specify it, it uses the number of channels and the layout to make a good guess πŸ€”
  • opus_delay β€” sets the maximum delay in milliseconds. Delays lower than 20ms will very quickly decrease quality, so like... don't 🚨

πŸ‘‘ libfdk_aac πŸ‘‘

libfdk-aac AAC (Advanced Audio Coding) encoder wrapper. Iconic.

The libfdk-aac library is based on the Fraunhofer FDK AAC code from the Android project πŸ€–

It requires the libfdk-aac headers and library to be present during configuration, and you need to explicitly configure the build with --enable-libfdk-aac. Also the library is incompatible with GPL, so if you allow the use of GPL you should configure with --enable-gpl --enable-nonfree --enable-libfdk-aac πŸ“

This encoder supports the AAC-HE profiles ✨

VBR encoding β€” enabled through the vbr or flags +qscale options β€” is experimental and only works with some combinations of parameters ⚠️

Support for encoding 7.1 audio is only available with libfdk-aac 0.1.3 or higher.

For more info, see the fdk-aac project at http://sourceforge.net/p/opencore-amr/fdk-aac/ πŸ¦‹

Options

The following options are mapped onto the shared FFmpeg codec options:

  • b β€” set bit rate in bits/s. If the bitrate isn't explicitly specified, it's automatically set to a suitable value depending on the selected profile. And if VBR mode is enabled, this option gets ignored entirely πŸ™ˆ
  • ar β€” set audio sampling rate (in Hz)
  • channels β€” set the number of audio channels
  • flags +qscale β€” enable fixed quality, VBR (Variable Bit Rate) mode. Note that VBR is implicitly enabled when the vbr value is positive ✨
  • cutoff β€” set cutoff frequency. If it's not specified (or it's explicitly set to 0) it'll use a value automatically computed by the library. Default value is 0 🎚️
  • profile β€” set audio profile. The following profiles are recognized:
    • aac_low β€” Low Complexity AAC (LC)
    • aac_he β€” High Efficiency AAC (HE-AAC)
    • aac_he_v2 β€” High Efficiency AAC version 2 (HE-AACv2)
    • aac_ld β€” Low Delay AAC (LD)
    • aac_eld β€” Enhanced Low Delay AAC (ELD)

If you don't specify it, it's set to aac_low.

The following are private options of the libfdk_aac encoder πŸ’…

  • afterburner β€” enable the afterburner feature if set to 1, disabled if set to 0. It improves quality, but also the processing power it needs πŸ”₯ Default value is 1.
  • eld_sbr β€” enable SBR (Spectral Band Replication) for ELD if set to 1, disabled if set to 0. Default value is 0.
  • eld_v2 β€” enable ELDv2 (LD-MPS extension for ELD stereo signals) for ELDv2 if set to 1, disabled if set to 0. Note that this option is available when fdk-aac version (AACENCODER_LIB_VL0.AACENCODER_LIB_VL1.AACENCODER_LIB_VL2) > (4.0.0). Default value is 0 🫢
  • signaling β€” set SBR/PS signaling style. It can assume one of these values:
    • default β€” choose signaling implicitly (explicit hierarchical by default, implicit if global header is disabled)
    • implicit β€” implicit backwards compatible signaling
    • explicit_sbr β€” explicit SBR, implicit PS signaling
    • explicit_hierarchical β€” explicit hierarchical signaling

Default value is default.

  • latm β€” output LATM/LOAS encapsulated data if set to 1, disabled if set to 0. Default value is 0 πŸ“¦
  • header_period β€” set StreamMuxConfig and PCE repetition period (in frames) for sending in-band configuration buffers within the LATM/LOAS transport layer. Must be a 16-bits non-negative integer. Default value is 0 πŸ”’
  • vbr β€” set VBR mode, from 1 to 5. 1 is the lowest quality (though still pretty good, ngl) and 5 is the highest quality. A value of 0 disables VBR, and CBR (Constant Bit Rate) is enabled instead. Currently only the aac_low profile supports VBR encoding 🌈

VBR modes 1-5 correspond to roughly the following average bit rates:

  • 1 β†’ 32 kbps/channel
  • 2 β†’ 40 kbps/channel
  • 3 β†’ 48-56 kbps/channel
  • 4 β†’ 64 kbps/channel
  • 5 β†’ about 80-96 kbps/channel

Default value is 0, bestie. Zero. The vibes-neutral option. ✨

  • frame_length β€” sets the audio frame length in samples. Default value is whatever the library's internal default is, so it's giving "ask the library, not me". Go read the library's documentation for which values are actually supported. πŸŽ€

Examples

  • Wanna yeet an audio file into VBR AAC inside an M4A (MP4) container using ffmpeg? Say less:
ffmpeg -i input.wav -codec:a libfdk_aac -vbr 3 output.m4a
  • Wanna go CBR 64k kbps AAC with the High-Efficiency AAC profile? Iconic choice, here:
ffmpeg -i input.wav -c:a libfdk_aac -profile:a aac_he -b:a 64k output.m4a

liblc3

liblc3 is the LC3 (Low Complexity Communication Codec) encoder wrapper, and it is so specific, I love her. 🌸

It requires the liblc3 headers and library to be present during configuration, meaning you have to explicitly configure the build with --enable-liblc3. No magic, no auto-detect fairy godmother. 🧚

This encoder supports the Bluetooth SIG LC3 codec for the LE Audio protocol, plus these LC3plus features:

  • Frame duration of 2.5 and 5ms.
  • High-Resolution mode, 48 KHz, and 96 kHz sampling rates.

For more info, go see the liblc3 project at <https://github.com/google/liblc3>. πŸ’–

Options

These options are mapped onto the shared FFmpeg codec options:

  • b bitrate β€” sets the bit rate in bits/s. This decides the fixed size of the encoded frames for whichever frame duration you picked. slay πŸ’…
  • ar frequency β€” sets the audio sampling rate in Hz.
  • channels β€” sets the number of audio channels.
  • frame_duration β€” sets the audio frame duration in milliseconds. Default value is 10ms. Allowed frame durations are 2.5ms, 5ms, 7.5ms and 10ms. LC3 (Bluetooth LE Audio) allows 7.5ms and 10ms; and LC3plus allows 2.5ms, 5ms and 10ms.

The 10ms frame duration is available in both LC3 and LC3plus standard. In this mode the produced bitstream can be referenced either as LC3 or LC3plus. Bestie is flexible like that. ✨

  • high_resolution boolean β€” enables the high-resolution mode when set to 1. High-resolution mode is available with all LC3plus frame durations and for a sampling rate of 48 KHz and 96 KHz.

The encoder automatically turns this mode off at lower sampling rates and activates it at 96 KHz. She makes her own decisions, honestly.

This mode should be preferred at high bitrates. In this mode the audio bandwidth is always up to the Nyquist frequency, compared to LC3 at 48 KHz, which limits the bandwidth to 20 KHz. Nyquist stays winning. πŸ‘‘

libmp3lame

LAME (Lame Ain't an MP3 Encoder) MP3 encoder wrapper β€” the classic, the main character, the one everybody knows. 🌈

Requires the libmp3lame headers and library during configuration. You need to explicitly configure the build with --enable-libmp3lame.

Check out libshine if you want a fixed-point MP3 encoder, although that one comes with lower quality. Tradeoffs, bestie.

Options

The libmp3lame wrapper supports the following options. The lame-equivalent of each option is listed in parentheses, so you can translate between worlds. πŸ¦‹

  • b (-b) β€” sets the bitrate expressed in bits/s for CBR or ABR. LAME's "bitrate" is expressed in kilobits/s, so heads up on the units, that's the whole trap.
  • q (-V) β€” sets the constant quality setting for VBR. This option is valid only using the ffmpeg command-line tool. If you're a library interface user, use global_quality instead. two different doors, same house. πŸšͺ
  • compression_level (-q) β€” sets the algorithm quality. Valid arguments are integers in the 0-9 range, where 0 means highest quality but slowest, and 9 means fastest while producing the worst quality. Pick your poison, the range is the range.
  • cutoff (--lowpass) β€” sets the lowpass cutoff frequency. If you leave it unspecified, the encoder dynamically adjusts the cutoff. she'll handle it, don't stress. πŸ’…
  • reservoir β€” enables use of the bit reservoir when set to 1. Default value is 1. LAME has this enabled by default, but it can be overridden by using the --nores option.
  • joint_stereo (-m j) β€” lets the encoder use, on a frame-by-frame basis, either L/R stereo or mid/side stereo. Default value is 1. Lowkey iconic behavior.
  • abr (--abr) β€” enables the encoder to use ABR when set to 1. The lame --abr sets the target bitrate, while this option only tells FFmpeg to use ABR β€” it still relies on b to set the bitrate. So don't forget your b, fr fr.
  • copyright (-c) β€” sets the MPEG audio copyright flag when set to 1. Default value is 0 (disabled).
  • original (-o) β€” sets the MPEG audio original flag when set to 1. Default value is 1 (enabled).

libopencore-amrnb

OpenCORE Adaptive Multi-Rate Narrowband encoder. Narrowband, as in she has a very specific lane and she stays in it. πŸŽ€

Requires the libopencore-amrnb headers and library during configuration. You need to explicitly configure the build with --enable-libopencore-amrnb --enable-version3.

This is a mono-only encoder. Officially it only supports 8000Hz sample rate, but you can override that by setting strict to unofficial or lower. Live dangerously, or don't. πŸ™ˆ

Options

  • b β€” sets the bitrate in bits per second. Only the following bitrates are supported; otherwise libavcodec will round to the nearest valid bitrate:
4750
5150
5900
6700
7400
7950
10200
12200
  • dtx β€” allows discontinuous transmission (generates comfort noise) when set to 1. The default value is 0 (disabled). Silence but make it fancy. 🀫

libopus

libopus is the Opus Interactive Audio Codec encoder wrapper, and honestly she ate. πŸ”₯

Requires the libopus headers and library during configuration. You need to explicitly configure the build with --enable-libopus.

Option Mapping

Most libopus options are modelled after the opusenc utility from opus-tools. Below is the option mapping chart describing the options this wrapper supports, with their opusenc-equivalents in parentheses. πŸ’–

  • b (bitrate) β€” sets the bit rate in bits/s. FFmpeg's b option is expressed in bits/s, while opusenc's bitrate is in kilobits/s. Yes, the units again. Write it down. ✏️
  • vbr (vbr, hard-cbr, and cvbr) β€” sets the VBR mode. The FFmpeg vbr option has the following valid arguments, with the opusenc equivalent options in parentheses:
    • off (hard-cbr) β€” use constant bit rate encoding.
    • on (vbr) β€” use variable bit rate encoding (the default). main character energy ✨
    • constrained (cvbr) β€” use constrained variable bit rate encoding.
  • compression_level (comp) β€” sets the encoding algorithm complexity. Valid options are integers in the 0-10 range. 0 gives the fastest encodes but lower quality, while 10 gives the highest quality but slowest encoding. The default is 10. bestie is a perfectionist, we respect it. πŸ’…
  • frame_duration (framesize) β€” sets the maximum frame size, or duration of a frame, in milliseconds. The argument must be exactly one of: 2.5, 5, 10, 20, 40, 60. Smaller frame sizes achieve lower latency but less quality at a given bitrate. Sizes greater than 20ms are only interesting at fairly low bitrates. The default is 20ms.
  • packet_loss (expect-loss) β€” sets the expected packet loss percentage. The default is 0.
  • fec (n/a) β€” enables inband forward error correction. packet_loss must be non-zero to take advantage of it β€” the frequency of FEC 'side-data' is proportional to the expected packet loss. Default is disabled. πŸ”₯
  • application (N.A.) β€” sets the intended application type. The valid options are listed below:
    • voip β€” favor improved speech intelligibility.
    • audio β€” favor faithfulness to the input (the default).
    • lowdelay β€” restrict to only the lowest delay modes by disabling voice-optimized modes.
  • cutoff (N.A.) β€” sets the cutoff bandwidth in Hz. The argument must be exactly one of the following: 4000, 6000, 8000, 12000, or 20000, corresponding to narrowband, mediumband, wideband, super wideband, and fullband respectively. The default is 0 (cutoff disabled). Note that libopus forces a wideband cutoff for bitrates < 15 kbps, unless CELT-only mode is used (that's when application is set to lowdelay). ⚠️
  • mapping_family (mapping_family) β€” sets the channel mapping family used by the encoder. The default value of -1 uses mapping family 0 for mono and stereo inputs, and mapping family 1 otherwise. That default also disables the surround masking and LFE bandwidth optimizations in libopus, and requires that the input contains 8 channels or fewer.

Other values include 0 for mono and stereo, 1 for surround sound with masking and LFE bandwidth optimizations, and 255 for independent streams with an unspecified channel layout. pick your lore. πŸ¦‹

  • apply_phase_inv (N.A.) (requires libopus >= 1.2) β€” if set to 0, disables the use of phase inversion for intensity stereo, which improves the quality of mono downmixes but slightly reduces normal stereo quality. The default is 1 (phase inversion enabled).

libshine

Shine Fixed-Point MP3 encoder wrapper. She's built different β€” literally, fixed-point. 🌟

Shine is a fixed-point MP3 encoder. It has far better performance on platforms without an FPU, e.g. armel CPUs, and some phones and tablets. However, since it's more targeted on performance than quality, it's not on par with LAME and other production-grade encoders quality-wise. Also, according to the project's homepage, this encoder may not be free of bugs, because the code was written a long time ago and the project was dead for at least 5 years. πŸ’€ so, you know. Manage expectations.

This encoder only supports stereo and mono input. It's also CBR-only. periodt.

The original project (last updated in early 2007) is at <http://sourceforge.net/projects/libshine-fxp/>. We only support the updated fork by the Savonet/Liquidsoap project at <https://github.com/savonet/shine>. glow-up appreciated. 🫢

Requires the presence of the libshine headers and library during configuration. You need to explicitly configure the build with --enable-libshine.

See also libmp3lame.

Options

The libshine wrapper supports the following option. The shineenc-equivalent is listed in parentheses.

  • b (-b) β€” sets the bitrate expressed in bits/s for CBR. The shineenc -b option is expressed in kilobits/s. units, units, units, always the units 😭

libtwolame

TwoLAME MP2 encoder wrapper. MP2, yes, she exists, she has a whole fanbase. πŸŽ€

Requires the presence of the libtwolame headers and library during configuration. You need to explicitly configure the build with --enable-libtwolame.

Options

The libtwolame wrapper supports the following options. The twolame-equivalent options follow the FFmpeg ones and are in parentheses. πŸ’–

  • b (-b) β€” sets the bitrate expressed in bits/s for CBR. The twolame b option is expressed in kilobits/s. Default value is 128k.
  • q (-V) β€” sets quality for experimental VBR support. Maximum value range is from -50 to 50, useful range is from -10 to 10. The higher the value, the better the quality. This option is valid only using the ffmpeg command-line tool. For library interface users, use global_quality. ✨
  • mode (--mode) β€” ok so this sets the mode of the resulting audio. Possible values:
    • auto β€” choose the mode automatically based on the input. This is the default. ✨
    • stereo β€” Stereo
    • joint_stereo β€” Joint stereo
    • dual_channel β€” Dual channel
    • mono β€” Mono
  • psymodel (--psyc-mode) β€” sets the psychoacoustic model to use in encoding. The argument must be an integer between -1 and 4, inclusive. The higher the value, the better the quality. The default value is 3.
  • energy_levels (--energy) β€” enables energy levels extensions when set to 1. The default value is 0 (disabled).
  • error_protection (--protect) β€” enables CRC error protection when set to 1. The default value is 0 (disabled).
  • copyright (--copyright) β€” sets the MPEG audio copyright flag when set to 1. The default value is 0 (disabled).
  • original (--original) β€” sets the MPEG audio original flag when set to 1. The default value is 0 (disabled).

πŸ’– libvo-amrwbenc πŸ’–

VisualOn Adaptive Multi-Rate Wideband encoder.

Requires the presence of the libvo-amrwbenc headers and library during configuration. You need to explicitly configure the build with "--enable-libvo-amrwbenc --enable-version3".

This is a mono-only encoder. Officially it only supports 16000Hz sample rate, but you can override it by setting strict to unofficial or lower.

✨ Options ✨

  • b β€” sets bitrate in bits/s. Only the following bitrates are supported, otherwise libavcodec will round to the nearest valid bitrate.
    • 6600
    • 8850
    • 12650
    • 14250
    • 15850
    • 18250
    • 19850
    • 23050
    • 23850
  • dtx β€” allows discontinuous transmission (generate comfort noise) when set to 1. The default value is 0 (disabled).

πŸ“ libvorbis πŸ“

libvorbis encoder wrapper.

Requires the presence of the libvorbisenc headers and library during configuration. You need to explicitly configure the build with "--enable-libvorbis".

πŸŽ€ Options πŸŽ€

The following options are supported by the libvorbis wrapper. The oggenc-equivalent of the options are listed in parentheses.

To get a more accurate and extensive documentation of the libvorbis options, consult the libvorbisenc's and oggenc's documentations. See <http://xiph.org/vorbis/>, <http://wiki.xiph.org/Vorbis-tools>, and oggenc(1).

  • b (-b) β€” sets bitrate expressed in bits/s for ABR. oggenc -b is expressed in kilobits/s.
  • q (-q) β€” sets constant quality setting for VBR. The value should be a float number in the range of -1.0 to 10.0. The higher the value, the better the quality. The default value is 3.0.

This option is valid only using the ffmpeg command-line tool. For library interface users, use global_quality.

  • cutoff (--advanced-encode-option lowpass_frequency=N) β€” sets cutoff bandwidth in Hz, a value of 0 disables cutoff. oggenc's related option is expressed in kHz. The default value is 0 (cutoff disabled).
  • minrate (-m) β€” sets minimum bitrate expressed in bits/s. oggenc -m is expressed in kilobits/s.
  • maxrate (-M) β€” sets maximum bitrate expressed in bits/s. oggenc -M is expressed in kilobits/s. This only has effect on ABR mode.
  • iblock (--advanced-encode-option impulse_noisetune=N) β€” sets noise floor bias for impulse blocks. The value is a float number from -15.0 to 0.0. A negative bias instructs the encoder to pay special attention to the crispness of transients in the encoded audio. The tradeoff for better transient response is a higher bitrate.

🌈 mjpeg 🌈

Motion JPEG encoder.

🌸 Options 🌸

  • huffman β€” sets the huffman encoding strategy. Possible values:
    • default β€” use the default huffman tables. This is the default strategy.
    • optimal β€” compute and use optimal huffman tables.

πŸ¦‹ wavpack πŸ¦‹

WavPack lossless audio encoder.

Options

The equivalent options for wavpack command line utility are listed in parentheses.

πŸ’œ Shared options πŸ’œ

The following shared options are effective for this encoder. Only special notes about this particular encoder will be documented here. For the general meaning of the options, see the Codec Options chapter.

  • frame_size (--blocksize) β€” for this encoder, the range for this option is between 128 and 131072. Default is automatically decided based on sample rate and number of channel.

For the complete formula of calculating default, see libavcodec/wavpackenc.c.

  • compression_level (-f, -h, -hh, and -x) β€” listed with these flags.

πŸŽ€ Private options πŸŽ€

  • joint_stereo (-j) β€” sets whether to enable joint stereo. Valid values are:
    • on (1) β€” force mid/side audio encoding.
    • off (0) β€” force left/right audio encoding.
    • auto β€” let the encoder decide automatically.
  • optimize_mono β€” sets whether to enable optimization for mono. This option is only effective for non-mono streams. Available values:
    • on β€” enabled
    • off β€” disabled

🎬 VIDEO ENCODERS 🎬

A description of some of the currently available video encoders follows.

πŸ‘‘ a64_multi, a64_multi5 πŸ‘‘

A64 / Commodore 64 multicolor charset encoder. a64_multi5 is extended with 5th color (colram).

🎞️ Cinepak 🎞️

Cinepak aka CVID encoder. Compatible with Windows 3.1 and vintage MacOS.

Options

  • g (integer) β€” keyframe interval. A keyframe is inserted at least every -g frames, sometimes sooner.
  • q:v (integer) β€” quality factor. Lower is better. Higher gives lower bitrate. The following table lists bitrates when encoding akiyo_cif.y4m for various values of -q:v with -g 100:
    • -q:v 1 β€” 1918 kb/s
    • -q:v 2 β€” 1735 kb/s
    • -q:v 4 β€” 1500 kb/s
    • -q:v 10 β€” 1041 kb/s
    • -q:v 20 β€” 826 kb/s
    • -q:v 40 β€” 553 kb/s
    • -q:v 100 β€” 394 kb/s
    • -q:v 200 β€” 312 kb/s
    • -q:v 400 β€” 266 kb/s
    • -q:v 1000 β€” 237 kb/s
  • max_extra_cb_iterations (integer) β€” max extra codebook recalculation passes, more is better and slower.
  • skip_empty_cb (boolean) β€” avoid wasting bytes, ignore vintage MacOS decoder.
  • max_strips (integer), min_strips (integer) β€” the minimum and maximum number of strips to use. Wider range sometimes improves quality. More strips is generally better quality but costs more bits. Fewer strips tend to yield more keyframes. Vintage compatible is 1..3.
  • strip_number_adaptivity (integer) β€” how much number of strips is allowed to change between frames. Higher is better but slower.

🧚 ffv1 🧚

FFv1 Encoder

Options

The following options are supported by FFmpeg's FFv1 encoder.

  • context β€” sets the context size, 0 (default) is small, 1 is big.
  • coder β€” set the coder,
    • rice β€” Golomb rice coder
    • range_def β€” Range coder with default table
    • range_tab β€” Range coder with custom table
  • slicecrc β€” -1 (default, automatic), 1 use crc with zero initial and final state, 2 use crc with non zero initial and final state
  • qtable β€”
    • default β€” default, automatic
    • 8bit β€” use 8bit default
    • greater8bit β€” use >8bit default
  • remap_optimizer β€” 0 - 5, default 3, how much effort the encoder puts into optimizing the remap table.

πŸ“ GIF πŸ“

GIF image/animation encoder.

Options

  • gifflags (integer) β€” sets the flags used for GIF encoding.
    • offsetting β€” enables picture offsetting. Default is enabled.
    • transdiff β€” enables transparency detection between frames. Default is enabled.
  • gifimage (integer) β€” enables encoding one full GIF image per frame, rather than an animated GIF. Default value is 0.
  • global_palette (integer) β€” writes a palette to the global GIF header where feasible. If disabled, every frame will always have a palette written, even if there is a global palette supplied. Default value is 1.

🌸 Hap 🌸

Vidvox Hap video encoder.

Options

  • format (integer) β€” specifies the Hap format to encode.
    • hap
    • hap_alpha
    • hap_q

Default value is hap.

  • chunks (integer) β€” specifies the number of chunks to split frames into, between 1 and 64. This permits multithreaded decoding of large frames, potentially at the cost of data-rate. The encoder may modify this value to divide frames evenly. Default value is 1.
  • compressor (integer) β€” specifies the second-stage compressor to use. If set to none, chunks will be limited to 1, as chunked uncompressed frames offer no benefit.
    • none
    • snappy

Default value is snappy.

πŸ’… jpeg2000 πŸ’…

The native jpeg 2000 encoder is lossy by default, the -q:v option can be used to set the encoding quality. Lossless encoding can be selected with -pred 1.

Options

  • format (integer) β€” can be set to either j2k or jp2 (the default) that makes it possible to store non-rgb pix_fmts.
  • tile_width (integer) β€” sets tile width. Range is 1 to 1073741824. Default is 256.
  • tile_height (integer) β€” sets tile height. Range is 1 to 1073741824. Default is 256.
  • pred (integer) β€” allows setting the discrete wavelet transform (DWT) type
    • dwt97int (Lossy)
    • dwt53 (Lossless)

Default is dwt97int.

  • sop (boolean) β€” enable this to add SOP marker at the start of each packet. Disabled by default.
  • eph (boolean) β€” enable this to add EPH marker at the end of each packet header. Disabled by default.
  • prog (integer) β€” sets the progression order to be used by the encoder. Possible values are:
    • lrcp
    • rlcp
    • rpcl
    • pcrl
    • cprl

Set to lrcp by default.

  • layer_rates (string) β€” by default, when this option is not used, compression is done using the quality metric. This option allows for compression using compression ratio. The compression ratio for each level could be specified. The compression ratio of a layer l tells you what ratio of the total file size is contained in the first l layers.

Example usage:

ffmpeg -i input.bmp -c:v jpeg2000 -layer_rates "100,10,1" output.j2k

This would compress the image to contain 3 layers, where the data contained in the first layer would be compressed by 1000 times, compressed by 100 in the first two layers, and shall contain all data while using all 3 layers.

πŸ¦‹ librav1e πŸ¦‹

rav1e AV1 encoder wrapper.

Requires the rav1e headers and library to be there when you configure, bestie. You gotta explicitly configure the build with --enable-librav1e.

✨ Options ✨

  • qmax β€” sets the maximum quantizer for bitrate mode. Cap it, queen.
  • qmin β€” sets the minimum quantizer for bitrate mode. Floor it.
  • qp β€” uses quantizer mode to encode at the quantizer you give it, from 0 to 255.
  • speed β€” picks the speed preset to encode with, 0–10.
  • tiles β€” picks how many tiles to encode with.
  • tile-rows β€” picks how many rows of tiles to encode with.
  • tile-columns β€” picks how many columns of tiles to encode with.
  • rav1e-params β€” sets rav1e options with a list of key=value pairs separated by ":". Peep rav1e --help for the option list, iykyk.

Like, say you wanna pass librav1e encoding options with -rav1e-params, it looks like this:

ffmpeg -i input -c:v librav1e -b:v 500K -rav1e-params speed=5:low_latency=true output.mp4

libaom-av1 πŸ’…

The libaom AV1 encoder wrapper. Iconic. Legendary. Fr fr.

It needs the libaom headers and library present at configuration time β€” you have to explicitly configure the build with --enable-libaom.

✨ Options ✨

This wrapper supports these standard libavcodec options:

  • b β€” sets the bitrate target in bits/second. By default this uses variable-bitrate mode. But if maxrate and minrate are also set to the same value, it switches to constant-bitrate mode; otherwise, if crf is set too, it goes constrained-quality mode. Slay, adaptive.
  • g, keyint_min β€” sets key frame placement. The GOP size sets the maximum distance between key frames; if it's zero the output stream will be intra-only. The minimum distance is ignored unless it matches the GOP size, in which case key frames always show up at a fixed interval. Not set by default, so without this option the library has completely free choice about where key frames go β€” main character energy, it decides.
  • qmin, qmax β€” sets the minimum/maximum quantisation values. Valid range is 0 to 63. ⚠️ Warning bestie: this does not match the quantiser values AV1 actually uses β€” divide by four to map real quantiser values to this range. Defaults to min/max (no constraint).
  • minrate, maxrate, bufsize, rc_init_occupancy β€” sets the rate control buffering parameters. Not used if you don't set them β€” defaults to unconstrained variable bitrate.
  • threads β€” sets how many threads to use while encoding. Ngl, this may also require the tiles or row-mt options to be set for the specified number of threads to actually get fully used. Defaults to the number of hardware threads the host machine supports.
  • profile β€” sets the encoding profile. Defaults to the profile matching the bit depth and chroma subsampling of the input.

The wrapper also has some specific options of its own:

  • cpu-used β€” sets the quality/encoding speed tradeoff. Valid range is 0 to 8, higher numbers meaning more speed and less quality. The default value is 1, which is gonna be slow and high quality. Worth it tho.
  • auto-alt-ref β€” enables alternate reference frames. Defaults to the internal default of the library.
  • arnr-max-frames (frames) β€” sets altref noise reduction max frame count. Default is -1.
  • arnr-strength (strength) β€” sets altref noise reduction filter strength. Range is -1 to 6. Default is -1.
  • aq-mode (aq-mode) β€” sets adaptive quantization mode. Possible values:
    • none (0) β€” disabled.
    • variance (1) β€” variance-based.
    • complexity (2) β€” complexity-based.
    • cyclic (3) β€” cyclic refresh.
  • tune (tune) β€” sets the distortion metric the encoder is tuned with. Default is "psnr".
    • psnr (0)
    • ssim (1)
  • lag-in-frames β€” sets the maximum number of frames the encoder may keep in flight at any one time for lookahead. Defaults to the internal default of the library.
  • error-resilience β€” enables error resilience features:
    • default β€” improves resilience against losses of whole frames.
    • Not enabled by default.
  • crf β€” sets the quality/size tradeoff for constant-quality (no bitrate target) and constrained-quality (with maximum bitrate target) modes. Valid range is 0 to 63, higher numbers meaning lower quality and smaller output size. Only used if you set it; by default only the bitrate target is used.
  • static-thresh β€” sets a change threshold on blocks below which the encoder skips them. Defined in arbitrary units as a nonnegative integer, defaulting to zero (no blocks are skipped).
  • drop-threshold β€” sets a threshold for dropping frames when you're close to the rate control bounds. Defined as a percentage of the target buffer β€” when the rate control buffer drops below this percentage, frames get dropped until it's refilled above the threshold. Defaults to zero (no frames are dropped).
  • denoise-noise-level (level) β€” how much noise to remove for grain synthesis. Grain synthesis is disabled if this option isn't set or is set to 0.
  • denoise-block-size (pixels) β€” block size used for denoising for grain synthesis. If not set, the AV1 codec uses the default value of 32.
  • undershoot-pct (pct) β€” sets the datarate undershoot (min) percentage of the target bitrate. Range is -1 to 100. Default is -1.
  • overshoot-pct (pct) β€” sets the datarate overshoot (max) percentage of the target bitrate. Range is -1 to 1000. Default is -1.
  • minsection-pct (pct) β€” minimum percentage variation of the GOP bitrate from the target bitrate. If minsection-pct isn't set, the libaomenc wrapper computes it as "(minrate * 100 / bitrate)". Range is -1 to 100. Default is -1 (unset).
  • maxsection-pct (pct) β€” maximum percentage variation of the GOP bitrate from the target bitrate. If maxsection-pct isn't set, the libaomenc wrapper computes it as "(maxrate * 100 / bitrate)". Range is -1 to 5000. Default is -1 (unset).
  • frame-parallel (boolean) β€” enables frame parallel decodability features. Default is true.
  • tiles β€” sets the number of tiles to encode the input video with, as columns x rows. Larger numbers allow greater parallelism in both encoding and decoding, but may decrease coding efficiency 😭. Defaults to the minimum number of tiles required by the size of the input video (that's 1x1 β€” literally a single tile β€” for sizes up to and including 4K).
  • tile-columns, tile-rows β€” sets the number of tiles as log2 of the number of tile rows and columns. Provided for compatibility with libvpx/VP9. iykyk.
  • row-mt (Requires libaom >= 1.0.0-759-g90a15f4f2) β€” enables row based multi-threading. Disabled by default.
  • enable-cdef (boolean) β€” enables the Constrained Directional Enhancement Filter. The libaom-av1 encoder enables CDEF by default.
  • enable-restoration (boolean) β€” enables the Loop Restoration Filter. Default is true for libaom-av1.
  • enable-global-motion (boolean) β€” enables using global motion for block prediction. Default is true.
  • enable-intrabc (boolean) β€” enables block copy mode for intra block prediction. This mode is useful for screen content. Default is true.
  • enable-rect-partitions (boolean) (Requires libaom >= v2.0.0) β€” enables rectangular partitions. Default is true.
  • enable-1to4-partitions (boolean) (Requires libaom >= v2.0.0) β€” enables 1:4/4:1 partitions. Default is true.
  • enable-ab-partitions (boolean) (Requires libaom >= v2.0.0) β€” enables AB shape partitions. Default is true.
  • enable-angle-delta (boolean) (Requires libaom >= v2.0.0) β€” enables angle delta intra prediction. Default is true.
  • enable-cfl-intra (boolean) (Requires libaom >= v2.0.0) β€” enables chroma predicted from luma intra prediction. Default is true.
  • enable-filter-intra (boolean) (Requires libaom >= v2.0.0) β€” enables filter intra predictor. Default is true.
  • enable-intra-edge-filter (boolean) (Requires libaom >= v2.0.0) β€” enables intra edge filter. Default is true.
  • enable-smooth-intra (boolean) (Requires libaom >= v2.0.0) β€” enables smooth intra prediction mode. Default is true.
  • enable-paeth-intra (boolean) (Requires libaom >= v2.0.0) β€” enables paeth predictor in intra prediction. Default is true.
  • enable-palette (boolean) (Requires libaom >= v2.0.0) β€” enables palette prediction mode. Default is true.
  • enable-flip-idtx (boolean) (Requires libaom >= v2.0.0) β€” enables extended transform type, including FLIPADST_DCT, DCT_FLIPADST, FLIPADST_FLIPADST, ADST_FLIPADST, FLIPADST_ADST, IDTX, V_DCT, H_DCT, V_ADST, H_ADST, V_FLIPADST, H_FLIPADST. Default is true.
  • enable-tx64 (boolean) (Requires libaom >= v2.0.0) β€” enables 64-pt transform. Default is true.
  • reduced-tx-type-set (boolean) (Requires libaom >= v2.0.0) β€” uses a reduced set of transform types. Default is false.
  • use-intra-dct-only (boolean) (Requires libaom >= v2.0.0) β€” uses DCT only for INTRA modes. Default is false.
  • use-inter-dct-only (boolean) (Requires libaom >= v2.0.0) β€” uses DCT only for INTER modes. Default is false.
  • use-intra-default-tx-only (boolean) (Requires libaom >= v2.0.0) β€” uses Default-transform only for INTRA modes. Default is false.
  • enable-ref-frame-mvs (boolean) (Requires libaom >= v2.0.0) β€” enables temporal mv prediction. Default is true.
  • enable-reduced-reference-set (boolean) (Requires libaom >= v2.0.0) β€” uses a reduced set of single and compound references. Default is false.
  • enable-obmc (boolean) (Requires libaom >= v2.0.0) β€” enables obmc. Default is true.
  • enable-dual-filter (boolean) (Requires libaom >= v2.0.0) β€” enables dual filter. Default is true.
  • enable-diff-wtd-comp (boolean) (Requires libaom >= v2.0.0) β€” enables difference-weighted compound. Default is true.
  • enable-dist-wtd-comp (boolean) (Requires libaom >= v2.0.0) β€” enables distance-weighted compound. Default is true.
  • enable-onesided-comp (boolean) (Requires libaom >= v2.0.0) β€” enables one sided compound. Default is true.
  • enable-interinter-wedge (boolean) (Requires libaom >= v2.0.0) β€” enables interinter wedge compound. Default is true.
  • enable-interintra-wedge (boolean) (Requires libaom >= v2.0.0) β€” enables interintra wedge compound. Default is true.
  • enable-masked-comp (boolean) (Requires libaom >= v2.0.0) β€” enables masked compound. Default is true.
  • enable-interintra-comp (boolean) (Requires libaom >= v2.0.0) β€” enables interintra compound. Default is true.
  • enable-smooth-interintra (boolean) (Requires libaom >= v2.0.0) β€” enables smooth interintra mode. Default is true.
  • aom-params β€” okay so this is how you feed libaom your own lil' pile of settings: a list of key=value pairs, all glued together with ":". Wanna know which keys actually exist? Run aomenc --help and look under the section called "AV1 Specific Options" πŸŽ€

Like, for example, to pass libaom encoding options with -aom-params:

ffmpeg -i input -c:v libaom-av1 -b:v 500K -aom-params tune=psnr:enable-tpl-model=1 output.mp4

πŸ¦‹ liboapv πŸ¦‹

The Advanced Professional Video codec encoder wrapper, bestie πŸ’…

It literally requires the liboapv headers and library to be there at configuration time β€” no library, no encoder. You gotta explicitly configure the build with --enable-liboapv.

Like, a whole bunch of liboapv encoder options get mapped onto FFmpeg's global codec options, and the one-of-a-kind encoder options come through as private options. iykyk 🌸

The apv project website lives at <https://github.com/AcademySoftwareFoundation/openapv>.

✨ Options ✨

These are the options the liboapv wrapper supports.

For a much more extensive rundown of the liboapv options, go bother the liboapv documentation πŸ“š
  • preset β€” sets the quality-speed tradeoff. Pick one of fastest, fast, medium, slow, placebo, default πŸƒβ€β™€οΈ
  • qp β€” sets the quantization parameter value for CQP rate control mode.
  • oapv-params (also spelled parse_apv_params) β€” sets liboapvenc options using a list of key=value pairs separated by ":". Peep the liboapv encoder user guide for the list of accepted parameters.

πŸ‘‘ libsvtav1 πŸ‘‘

SVT-AV1 encoder wrapper, main character energy fr fr.

Requires the SVT-AV1 headers and library to be present during configuration. You need to explicitly configure the build with --enable-libsvtav1.

Options 🌈

  • profile β€” sets the encoding profile. Your choices:
    • main
    • high
    • professional
  • level β€” sets the operating point level. Like, for example: '4.0'
  • hielevel β€” sets the Hierarchical prediction levels:
    • 3level
    • 4level β€” this one is the default πŸ’–
  • tier β€” sets the operating point tier:
    • main β€” this is the default πŸ‘‘
    • high
  • qmax β€” sets the maximum quantizer to use when you're in a bitrate mode.
  • qmin β€” sets the minimum quantizer to use when you're in a bitrate mode.
  • crf β€” the constant rate factor value used in crf rate control mode (0-63).
  • qp β€” sets the quantizer used in cqp rate control mode (0-63).
  • sc_detection β€” turns on scene change detection ✨
  • la_depth β€” sets the number of frames to look ahead (0-120).
  • preset β€” sets the quality-speed tradeoff, in the range 0 to 13. Higher values are faster but lower quality (sad but true 😭).
  • tile_rows β€” sets log2 of the number of rows of tiles to use (0-6).
  • tile_columns β€” sets log2 of the number of columns of tiles to use (0-4).
  • svtav1-params β€” sets SVT-AV1 options using a list of key=value pairs separated by ":". See the SVT-AV1 encoder user guide for the list of accepted parameters 🫢

πŸŽ€ libsvtjpegxs πŸŽ€

SVT-JPEG-XS encoder wrapper, she's niche and she's iconic.

Requires the SVT-JPEG-XS headers and library during configuration. You need to explicitly configure the build with --enable-libsvtjpegxs.

Options πŸ’œ

  • decomp_v β€” sets the vertical decomposition level.
  • decomp_h β€” sets the horizontal decomposition level.
  • quantization β€” sets the quantization algorithm:
    • deadzone
    • uniform
  • coding-signs β€” enables the Signs handling strategy:
    • disable
    • fast
    • full
  • coding-sigf β€” enables Significance coding.
  • coding-vpred β€” enables Vertical Prediction coding:
    • disable
    • no_residuals
    • no_coeffs

πŸ“ libjxl πŸ“

The libjxl JPEG XL encoder wrapper, no cap.

Requires the libjxl headers and library during configuration. You need to explicitly configure the build with --enable-libjxl.

Options ⭐

The libjxl wrapper supports these bad boys:

  • distance β€” sets the target Butteraugli distance. It's a quality setting, so listen up: lower distance = higher quality, and distance=1.0 is roughly comparable to libjpeg Quality 90 for photographic content. Setting distance=0.0 yields true lossless encoding ✨ Valid values range between 0.0 and 15.0, and sane values rarely exceed 5.0. Setting distance=0.1 usually attains transparency for most input. The default is 1.0.
  • effort β€” sets the encoding effort used. Higher effort values produce more consistent quality and usually produce a better quality/bpp curve, at the cost of more CPU time required (your poor laptop 😭). Valid values range from 1 to 9, and the default is 7.
  • modular β€” forces the encoder to use Modular mode instead of choosing automatically. The default is to use VarDCT for lossy encoding and Modular for lossless. VarDCT is generally superior to Modular for lossy encoding but does not support lossless encoding β€” important, bestie πŸ’…

🧚 libkvazaar 🧚

Kvazaar H.265/HEVC encoder, slay.

Requires the libkvazaar headers and library during configuration. You need to explicitly configure the build with --enable-libkvazaar.

Options 🌸

  • b β€” sets the target video bitrate in bit/s and enables rate control.
  • kvazaar-params β€” sets kvazaar parameters as a list of name=value pairs separated by commas (,). See the kvazaar documentation for the list of options πŸŽ€

πŸ’€ libopenh264 πŸ’€

Cisco libopenh264 H.264/MPEG-4 AVC encoder wrapper.

This encoder requires the libopenh264 headers and library to be present during configuration. You need to explicitly configure the build with --enable-libopenh264. The library gets detected using pkg-config.

For more info about the library, look at <http://www.openh264.org>.

Options πŸ”₯

Heads up: these FFmpeg global options affect how the libopenh264 encoder is configured.

  • b β€” sets the bitrate (as a number of bits per second).
  • g β€” sets the GOP size.
  • maxrate β€” sets the max bitrate (as a number of bits per second).
  • flags +global_header β€” sets global header in the bitstream.
  • slices β€” sets the number of slices, used in parallelized encoding. The default value is 0. This is only used when slice_mode is set to fixed.
  • loopfilter β€” enables the loop filter if set to 1 (it's automatically enabled). To disable it, set the value to 0.
  • profile β€” sets profile restrictions. If set to the value of main, enable CABAC (set the "SEncParamExt.iEntropyCodingModeFlag" flag to 1).
  • max_nal_size β€” sets maximum NAL size in bytes.
  • allow_skip_frames β€” allows skipping frames to hit the target bitrate if set to 1.

🌈 libtheora 🌈

libtheora Theora encoder wrapper, a classic honestly.

Requires the libtheora headers and library during configuration. You need to explicitly configure the build with --enable-libtheora.

For more info about the libtheora project, see <http://www.theora.org/>.

Options πŸ’–

The following global options get mapped to internal libtheora options, and those affect the quality and the bitrate of the encoded stream.

  • b β€” sets the video bitrate in bit/s for CBR (Constant Bit Rate) mode. In case VBR (Variable Bit Rate) mode is enabled, this option is just ignored, sorry 🫢
  • flags β€” used to enable constant quality mode (VBR) encoding through the qscale flag, and to enable the pass1 and pass2 modes.
  • g β€” sets the GOP size.
  • global_quality β€” sets the global quality as an integer in lambda units.

Only relevant when VBR mode is enabled with flags +qscale. The value gets converted to QP units by dividing it by FF_QP2LAMBDA, clipped in the [0 - 10] range, and then multiplied by 6.3 to get a value in the native libtheora range [0-63]. A higher value corresponds to a higher quality ✨

  • q β€” enables VBR mode when set to a non-negative value, and sets the constant quality value as a double floating point value in QP units.

The value gets clipped in the [0-10] range, and then multiplied by 6.3 to get a value in the native libtheora range [0-63].

This option is valid only using the ffmpeg command-line tool. For library interface users, use global_quality instead, k? πŸ’…

Examples 🌸

  • Set maximum constant quality (VBR) encoding with ffmpeg:
ffmpeg -i INPUT -codec:v libtheora -q:v 10 OUTPUT.ogg
  • Use ffmpeg to convert a CBR 1000 kbps Theora video stream:
ffmpeg -i INPUT -codec:v libtheora -b:v 1000k OUTPUT.ogg

⭐ libvpx ⭐

VP8/VP9 format supported through libvpx, the moment you've all been waiting for πŸ‘‘

Requires the libvpx headers and library during configuration. You need to explicitly configure the build with --enable-libvpx.

Options πŸ¦‹

The following options are supported by the libvpx wrapper. The vpxenc-equivalent options or values are listed in parentheses so you can migrate without crying 😭

To reduce the duplication of documentation, only the private options and some others requiring special attention are documented here. For the docs of the undocumented generic options, see the Codec Options chapter.

To get more documentation of the libvpx options, invoke the command ffmpeg -h encoder=libvpx, ffmpeg -h encoder=libvpx-vp9 or vpxenc --help. Further information is available in the libvpx API documentation πŸ“š

  • b (target-bitrate) β€” sets bitrate in bits/s. Note that FFmpeg's b option is expressed in bits/s, while vpxenc's target-bitrate is in kilobits/s β€” do not mix these up bestie πŸ’€
  • g (kf-max-dist)
  • keyint_min (kf-min-dist)
  • qmin (min-q) β€” minimum (Best Quality) Quantizer.
  • qmax (max-q) β€” maximum (Worst Quality) Quantizer. Can be changed per-frame.
  • bufsize (buf-sz, buf-optimal-sz) β€” sets ratecontrol buffer size (in bits). Note vpxenc's options are specified in milliseconds, and the libvpx wrapper converts this value as follows: buf-sz = bufsize * 1000 / bitrate, buf-optimal-sz = bufsize * 1000 / bitrate * 5 / 6.
  • rc_init_occupancy (buf-initial-sz) β€” sets the number of bits which should be loaded into the rc buffer before decoding starts. Note vpxenc's option is specified in milliseconds, and the libvpx wrapper converts this value as follows: rc_init_occupancy * 1000 / bitrate.
  • undershoot-pct β€” sets datarate undershoot (min) percentage of the target bitrate.
  • overshoot-pct β€” sets datarate overshoot (max) percentage of the target bitrate.
  • skip_threshold (drop-frame)
  • qcomp (bias-pct)
  • maxrate (maxsection-pct) β€” sets GOP max bitrate in bits/s. Note vpxenc's option is specified as a percentage of the target bitrate, and the libvpx wrapper converts this value as follows: (maxrate * 100 / bitrate).
  • minrate (minsection-pct) β€” sets GOP min bitrate in bits/s. Note vpxenc's option is specified as a percentage of the target bitrate, and the libvpx wrapper converts this value as follows: (minrate * 100 / bitrate).
  • minrate, maxrate, b end-usage=cbr β€” (minrate == maxrate == bitrate). 🫢
  • crf (end-usage=cq, cq-level) β€” constant-quality mode gang, rise up πŸ’…
  • tune (tune) β€” pick your tuning vibe:
    • psnr β€” optimise for PSNR.
    • ssim β€” optimise for SSIM.
  • quality, deadline (deadline) β€” how hard should the encoder try, bestie?
    • best β€” use the best quality deadline. Not gonna lie, it's poorly named and quite slow, and honestly you should avoid this one because it can give you worse quality output than good. Yeah. Iconic in the worst way 😭
    • good β€” use the good quality deadline. This is genuinely a good trade-off between speed and quality when you use it with the cpu-used option.
    • realtime β€” use the realtime quality deadline. Speed mode, go go go.
  • speed, cpu-used (cpu-used) β€” sets the quality/speed ratio modifier. Higher values speed up the encode at the cost of quality. No cap.
  • nr (noise-sensitivity) β€” just chilling here, the page gives no description for it, so we move 🫢
  • static-thresh β€” sets a change threshold on blocks; anything below it gets skipped by the encoder.
  • slices (token-parts) β€” heads up: FFmpeg's slices option gives the total number of partitions, while vpxenc's token-parts is given as log2(partitions). Different math, don't get caught out πŸ’€
  • max-intra-rate β€” sets the maximum I-frame bitrate as a percentage of the target bitrate. A value of 0 means unlimited.
  • force_key_frames β€” "VPX_EFLAG_FORCE_KF".
  • auto-alt-ref β€” enable use of alternate reference frames (2-pass only, okurrr). Values greater than 1 enable multi-layer alternate reference frames (VP9 only).
  • arnr-maxframes β€” set altref noise reduction max frame count.
  • arnr-type β€” set altref noise reduction filter type: backward, forward, centered.
  • arnr-strength β€” set altref noise reduction filter strength.
  • rc-lookahead, lag-in-frames (lag-in-frames) β€” set the number of frames to look ahead for frametype and ratecontrol.
  • min-gf-interval β€” set minimum golden/alternate reference frame interval (VP9 only).
  • error-resilient β€” enable error resiliency features. Built different for bad networks ✨
  • sharpness integer β€” increase sharpness at the expense of lower PSNR. The valid range is [0, 7].
  • ts-parameters β€” sets the temporal scalability configuration using a :-separated list of key=value pairs. For example, to specify temporal scalability parameters with ffmpeg:
ffmpeg -i INPUT -c:v libvpx -ts-parameters ts_number_layers=3:\
ts_target_bitrate=250,500,1000:ts_rate_decimator=4,2,1:\
ts_periodicity=4:ts_layer_id=0,2,1,2:ts_layering_mode=3 OUTPUT

Below is a brief explanation of each of the parameters, please refer to struct vpx_codec_enc_cfg in vpx/vpx_encoder.h for more details. πŸ“š

  • ts_number_layers β€” number of temporal coding layers.
  • ts_target_bitrate β€” target bitrate for each temporal layer (in kbps). (The bitrate should be inclusive of the lower temporal layer.)
  • ts_rate_decimator β€” frame rate decimation factor for each temporal layer.
  • ts_periodicity β€” length of the sequence defining frame temporal layer membership.
  • ts_layer_id β€” template defining the membership of frames to temporal layers.
  • ts_layering_mode β€” (optional) selecting the temporal structure from a set of pre-defined temporal layering modes. Currently supports the following options:
    • 0 β€” no temporal layering flags are provided internally; relies on flags being passed in using the metadata field in AVFrame with the following keys:
      • vp8-flags β€” sets the flags passed into the encoder to indicate the referencing scheme for the current frame. Refer to function vpx_codec_encode in vpx/vpx_encoder.h for more details.
      • temporal_id β€” explicitly sets the temporal id of the current frame to encode.
    • 2 β€” two temporal layers. 0-1...
    • 3 β€” three temporal layers. 0-2-1-2...; with single reference frame.
    • 4 β€” same as option 3, except there is a dependency between the two temporal layer 2 frames within the temporal period.

VP8-specific options

  • screen-content-mode β€” screen content mode, one of: 0 (off), 1 (screen), 2 (screen with more aggressive rate control). Slay your screen recordings πŸ–₯️✨

VP9-specific options

  • lossless β€” enable lossless mode.
  • tile-columns β€” set number of tile columns to use. Note this is given as log2(tile_columns). For example, 8 tile columns would be requested by setting the tile-columns option to 3.
  • tile-rows β€” set number of tile rows to use. Note this is given as log2(tile_rows). For example, 4 tile rows would be requested by setting the tile-rows option to 2.
  • frame-parallel β€” enable frame parallel decodability features.
  • aq-mode β€” set adaptive quantization mode (0: off (default), 1: variance, 2: complexity, 3: cyclic refresh, 4: equator360).
  • colorspace color-space β€” set input color space. The VP9 bitstream supports signaling the following colorspaces:
    • rgb β†’ sRGB
    • bt709 β†’ bt709
    • unspecified β†’ unknown
    • bt470bg β†’ bt601
    • smpte170m β†’ smpte170
    • smpte240m β†’ smpte240
    • bt2020_ncl β†’ bt2020
  • row-mt boolean β€” enable row based multi-threading.
  • tune-content β€” set content type: default (0), screen (1), film (2).
  • corpus-complexity β€” Corpus VBR mode is a variant of standard VBR where the complexity distribution midpoint is passed in rather than calculated for a specific clip or chunk.

The valid range is [0, 10000]. 0 (default) uses standard VBR.

  • enable-tpl boolean β€” enable temporal dependency model.
  • ref-frame-config β€” using per-frame metadata, set members of the structure vpx_svc_ref_frame_config_t in vpx/vp8cx.h to fine-control referencing schemes and frame buffer management. Use a :-separated list of key=value pairs. For example,
av_dict_set(&av_frame->metadata, "ref-frame-config", \
"rfc_update_buffer_slot=7:rfc_lst_fb_idx=0:rfc_gld_fb_idx=1:rfc_alt_fb_idx=2:rfc_reference_last=0:rfc_reference_golden=0:rfc_reference_alt_ref=0");
  • rfc_update_buffer_slot β€” indicates the buffer slot number to update
  • rfc_update_last β€” indicates whether to update the LAST frame
  • rfc_update_golden β€” indicates whether to update GOLDEN frame
  • rfc_update_alt_ref β€” indicates whether to update ALT_REF frame
  • rfc_lst_fb_idx β€” LAST frame buffer index
  • rfc_gld_fb_idx β€” GOLDEN frame buffer index
  • rfc_alt_fb_idx β€” ALT_REF frame buffer index
  • rfc_reference_last β€” indicates whether to reference LAST frame
  • rfc_reference_golden β€” indicates whether to reference GOLDEN frame
  • rfc_reference_alt_ref β€” indicates whether to reference ALT_REF frame
  • rfc_reference_duration β€” indicates frame duration
For more information about libvpx see: http://www.webmproject.org/

libvvenc

VVenC H.266/VVC encoder wrapper. New-gen codec energy, we love to see it πŸ‘‘

This encoder requires the presence of the libvvenc headers and library during configuration. You need to explicitly configure the build with --enable-libvvenc.

The VVenC project website is at https://github.com/fraunhoferhhi/vvenc.

Supported Pixel Formats

VVenC supports only 10-bit color spaces as input. But the internal (encoded) bit depth can be set to 8-bit or 10-bit at runtime. Important detail, don't forget it bestie πŸ’œ

Options

  • b β€” sets target video bitrate.
  • g β€” set the GOP size. Currently support for g=1 (Intra only) or default.
  • preset β€” set the VVenC preset.
  • levelidc β€” set level idc.
  • tier β€” set vvc tier.
  • qp β€” set constant quantization parameter.
  • subopt boolean β€” set subjective (perceptually motivated) optimization. Default is 1 (on).
  • bitdepth8 boolean β€” set 8bit coding mode instead of using 10bit. Default is 0 (off).
  • period β€” set (intra) refresh period in seconds.
  • vvenc-params β€” set vvenc options using a list of key=value couples separated by ":". See vvencapp --fullhelp or vvencFFapp --fullhelp for a list of options.

For example, the options might be provided as:

intraperiod=64:decodingrefreshtype=idr:poc0idr=1:internalbitdepth=8

For example the encoding options might be provided with -vvenc-params:

ffmpeg -i input -c:v libvvenc -b 1M -vvenc-params intraperiod=64:decodingrefreshtype=idr:poc0idr=1:internalbitdepth=8 output.mp4

libwebp

libwebp WebP Image encoder wrapper πŸŽ€

libwebp is Google's official encoder for WebP images. It can encode in either lossy or lossless mode. Lossy images are essentially a wrapper around a VP8 frame. Lossless images are a separate codec developed by Google.

Pixel Format

Currently, libwebp only supports YUV420 for lossy and RGB for lossless due to limitations of the format and libwebp. Alpha is supported for either mode. Because of API limitations, if RGB is passed in when encoding lossy or YUV is passed in for encoding lossless, the pixel format will automatically be converted using functions from libwebp. This is not ideal and is done only for convenience. Lowkey a little cursed, but it works πŸ’…

Options

  • -lossless boolean β€” enables/disables use of lossless mode. Default is 0.
  • -compression_level integer β€” for lossy, this is a quality/speed tradeoff. Higher values give better quality for a given size at the cost of increased encoding time. For lossless, this is a size/speed tradeoff. Higher values give smaller size at the cost of increased encoding time. More specifically, it controls the number of extra algorithms and compression tools used, and varies the combination of these tools. This maps to the method option in libwebp. The valid range is 0 to 6. Default is 4.
  • -quality float β€” for lossy encoding, this controls image quality. For lossless encoding, this controls the effort and time spent in compression. Range is 0 to 100. Default is 75.
  • -preset type β€” configuration preset. This does some automatic settings based on the general type of the image.
    • none β€” do not use a preset.
    • default β€” use the encoder default.
    • picture β€” digital picture, like portrait, inner shot
    • photo β€” outdoor photograph, with natural lighting
    • drawing β€” hand or line drawing, with high-contrast details
  • icon β€” small-sized colorful images ✨
    • text β€” text-like πŸŽ€

libx264, libx264rgb 🌈

Okay bestie, this is the x264 H.264/MPEG-4 AVC encoder wrapper, and it is lowkey iconic πŸ‘‘

This encoder needs the libx264 headers and library to actually be there at configure time. So you literally have to explicitly configure the build with --enable-libx264. No headers, no vibes, no encoder πŸ’…

libx264 supports an impressive number of features, and we're talking 8x8 and 4x4 adaptive spatial transform, adaptive B-frame placement, CAVLC/CABAC entropy coding, interlacing (MBAFF), lossless mode, and psy optimizations for detail retention (adaptive quantization, psy-RD, psy-trellis). It's giving main character energy fr fr πŸ”₯

Many libx264 encoder options are mapped to FFmpeg global codec options, while the unique encoder options are handed to you through private options. On top of that, the x264opts and x264-params private options let you pass a list of key=value tuples the way libx264's x264_param_parse function accepts them 🫢

The x264 project website is at <http://www.videolan.org/developers/x264.html>.

The libx264rgb encoder is the same as libx264, except it accepts packed RGB pixel formats as input instead of YUV. Same girl, different fit πŸ’–

Supported Pixel Formats πŸ¦‹

x264 supports 8- to 10-bit color spaces. The exact bit depth is controlled at x264's configure time, ngl.

Options πŸŽ€

The following options are supported by the libx264 wrapper. The x264-equivalent options or values are listed in parentheses for easy migration β€” cute little cheat sheet, iykyk 😌

To reduce the duplication of documentation, only the private options and some others requiring special attention are documented here. For the documentation of the undocumented generic options, see the Codec Options chapter.

To get a more accurate and extensive documentation of the libx264 options, invoke the command x264 --fullhelp or consult the libx264 documentation.

In the list below, note that the x264 option name is shown in parentheses after the libavcodec corresponding name, in case there is a direct mapping.

  • b (bitrate) β€” set bitrate in bits/s. Note that FFmpeg's b option is expressed in bits/s, while x264's bitrate is in kilobits/s. ⚠️ do not mix these up bestie, that's a whole vibe check fail
  • bf (bframes) β€” number of B-frames between I and P-frames
  • g (keyint) β€” maximum GOP size
  • qmin (qpmin) β€” minimum quantizer scale
  • qmax (qpmax) β€” maximum quantizer scale
  • qdiff (qpstep) β€” maximum difference between quantizer scales
  • qblur (qblur) β€” quantizer curve blur
  • qcomp (qcomp) β€” quantizer curve compression factor
  • refs (ref) β€” number of reference frames each P-frame can use. The range is 0-16.
  • level (level) β€” set the x264_param_t.i_level_idc value in case the value is positive, it is ignored otherwise.
    • This value can be set using the AVCodecContext API (e.g. by setting the AVCodecContext value directly), and is specified as an integer mapped on a corresponding level (e.g. the value 31 maps to H.264 level IDC 3.1, as defined in the x264_levels table). It is ignored when set to a non positive value.
    • Alternatively it can be set as a private option, overriding the value set in AVCodecContext, and in this case must be specified as the level IDC identifier (e.g. 3.1), as defined by H.264 Annex A.
  • sc_threshold (scenecut) β€” sets the threshold for the scene change detection.
  • trellis (trellis) β€” performs Trellis quantization to increase efficiency. Enabled by default πŸ’…
  • nr (nr) β€” noise reduction
  • me_range (merange) β€” maximum range of the motion search in pixels.
  • me_method (me) β€” set motion estimation method. Possible values in the decreasing order of speed:
    • dia (dia), epzs (dia) β€” diamond search with radius 1 (fastest). epzs is an alias for dia.
    • hex (hex) β€” hexagonal search with radius 2.
    • umh (umh) β€” uneven multi-hexagon search.
    • esa (esa) β€” exhaustive search.
    • tesa (tesa) β€” Hadamard exhaustive search (slowest). 😭 she takes her time
  • forced-idr β€” normally, when forcing a I-frame type, the encoder can select any type of I-frame. This option forces it to choose an IDR-frame.
  • subq (subme) β€” sub-pixel motion estimation method.
  • b_strategy (b-adapt) β€” adaptive B-frame placement decision algorithm. Use only on first-pass.
  • keyint_min (min-keyint) β€” minimum GOP size.
  • coder β€” set entropy encoder. Possible values:
    • ac β€” enable CABAC.
    • vlc β€” enable CAVLC and disable CABAC. It generates the same effect as x264's --no-cabac option.
  • cmp β€” set full pixel motion estimation comparison algorithm. Possible values:
    • chroma β€” enable chroma in motion estimation.
    • sad β€” ignore chroma in motion estimation. It generates the same effect as x264's --no-chroma-me option.
  • threads (threads) β€” number of encoding threads.
  • thread_type β€” set multithreading technique. Possible values:
    • slice β€” slice-based multithreading. It generates the same effect as x264's --sliced-threads option.
    • frame β€” frame-based multithreading.
  • flags β€” set encoding flags. It can be used to disable closed GOP and enable open GOP by setting it to -cgop. The result is similar to the behavior of x264's --open-gop option.
  • rc_init_occupancy (vbv-init) β€” initial VBV buffer occupancy
  • preset (preset) β€” set the encoding preset.
  • tune (tune) β€” set tuning of the encoding params.
  • profile (profile) β€” set profile restrictions.
  • fastfirstpass β€” enable fast settings when encoding first pass, when set to 1. When set to 0, it has the same effect of x264's --slow-firstpass option.
  • crf (crf) β€” set the quality for constant quality mode.
  • crf_max (crf-max) β€” in CRF mode, prevents VBV from lowering quality beyond this point.
  • qp (qp) β€” set constant quantization rate control method parameter.
  • aq-mode (aq-mode) β€” set AQ method. Possible values:
    • none (0) β€” disabled.
    • variance (1) β€” variance AQ (complexity mask).
    • autovariance (2) β€” auto-variance AQ (experimental). πŸ™ˆ experimental bestie, you've been warned
  • aq-strength (aq-strength) β€” set AQ strength, reduce blocking and blurring in flat and textured areas.
  • psy β€” use psychovisual optimizations when set to 1. When set to 0, it has the same effect as x264's --no-psy option.
  • psy-rd (psy-rd) β€” set strength of psychovisual optimization, in psy-rd:psy-trellis format.
  • rc-lookahead (rc-lookahead) β€” set number of frames to look ahead for frametype and ratecontrol.
  • weightb β€” enable weighted prediction for B-frames when set to 1. When set to 0, it has the same effect as x264's --no-weightb option.
  • weightp (weightp) β€” set weighted prediction method for P-frames. Possible values:
    • none (0) β€” disabled
    • simple (1) β€” enable only weighted refs
    • smart (2) β€” enable both weighted refs and duplicates
  • ssim (ssim) β€” enable calculation and printing SSIM stats after the encoding. numbers go brrr πŸ“Š
  • intra-refresh (intra-refresh) β€” enable the use of Periodic Intra Refresh instead of IDR frames when set to 1.
  • avcintra-class (class) β€” configure the encoder to generate AVC-Intra. Valid values are 50, 100 and 200
  • bluray-compat (bluray-compat) β€” configure the encoder to be compatible with the bluray standard. It is a shorthand for setting bluray-compat=1 force-cfr=1.
  • b-bias (b-bias) β€” set the influence on how often B-frames are used.
  • b-pyramid (b-pyramid) β€” set method for keeping of some B-frames as references. Possible values:
    • none (none) β€” disabled.
    • strict (strict) β€” strictly hierarchical pyramid.
    • normal (normal) β€” non-strict (not Blu-ray compatible).
  • mixed-refs β€” enable the use of one reference per partition, as opposed to one reference per macroblock when set to 1. When set to 0, it has the same effect as x264's --no-mixed-refs option.
  • 8x8dct β€” enable adaptive spatial transform (high profile 8x8 transform) when set to 1. When set to 0, it has the same effect as x264's --no-8x8dct option.
  • fast-pskip β€” enable early SKIP detection on P-frames when set to 1. When set to 0, it has the same effect as x264's --no-fast-pskip option.
  • aud (aud) β€” enable use of access unit delimiters when set to 1.
  • mbtree β€” enable use macroblock tree ratecontrol when set to 1. When set to 0, it has the same effect as x264's --no-mbtree option.
  • deblock (deblock) β€” set loop filter parameters, in alpha:beta form.
  • cplxblur (cplxblur) β€” set fluctuations reduction in QP (before curve compression).
  • partitions (partitions) β€” set partitions to consider as a comma-separated list of values. Possible values in the list:
    • p8x8 β€” 8x8 P-frame partition.
    • p4x4 β€” 4x4 P-frame partition.
    • b8x8 β€” 4x4 B-frame partition.
    • i8x8 β€” 8x8 I-frame partition.
    • i4x4 β€” 4x4 I-frame partition. (Enabling p4x4 requires p8x8 to be enabled. Enabling i8x8 requires adaptive spatial transform (8x8dct option) to be enabled.) πŸ”— they're a package deal, no cap
    • none (none) β€” do not consider any partitions.
    • all (all) β€” consider every partition.
  • direct-pred (direct) β€” set direct MV prediction mode. Possible values:
    • none (none) β€” disable MV prediction.
    • spatial (spatial) β€” enable spatial predicting.
    • temporal (temporal) β€” enable temporal predicting.
    • auto (auto) β€” automatically decided.
  • slice-max-size (slice-max-size) β€” set the limit of the size of each slice in bytes. If not specified but RTP payload size (ps) is specified, that is used.
  • stats (stats) β€” set the file name for multi-pass stats.
  • nal-hrd (nal-hrd) β€” set signal HRD information (requires vbv-bufsize to be set). Possible values:
    • none (none) β€” disable HRD information signaling.
    • vbr (vbr) β€” variable bit rate.
    • cbr (cbr) β€” constant bit rate (not allowed in MP4 container). πŸ’€ yeah, MP4 said absolutely not
  • x264opts opts**, **x264-params *opts* β€” override the x264 configuration using a :-separated list of key=value options.
    • The argument for both options is a list of key=value couples separated by ":". With x264opts the value can be omitted, and the value 1 is assumed in that case.

Okay so real quick, before we get into the encoder glow-ups: those filter and psy-rd option values that use ":" as a separator themselves? Use "," instead, bestie. They've accepted the comma for ages, it's just been kept undocumented "for some reason" (iconic mystery behavior, honestly).

So like, the options might show up looking like this:

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

And to specify libx264 encoding options with ffmpeg:

ffmpeg -i foo.mpg -c:v libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv

Wanna see the complete list of libx264 options? Run x264 --fullhelp or go read the libx264 documentation, periodt.

  • a53cc boolean β€” imports closed captions into the output (they have to be ATSC compatible format, no exceptions πŸ’…). Only the mpeg2 and h264 decoders even provide these. Default is 1 (on).
  • udu_sei boolean β€” imports user data unregistered SEI into the output if it's available. Default is 0 (off).
  • mb_info boolean β€” sets mb_info data through AVFrameSideData. Only actually useful when you're using it from the API. Default is 0 (off).

Also, encoding ffpresets for common usages are provided so they can be used with the general presets system (e.g. passing the pre option) πŸŽ€.


libx265

The x265 H.265/HEVC encoder wrapper, your fave.

This encoder requires the presence of the libx265 headers and library during configuration. You need to explicitly configure the build with --enable-libx265.

Options

  • b β€” Sets target video bitrate.
  • bf β€” listed, no blurb here.
  • g β€” Set the GOP size.
  • keyint_min β€” Minimum GOP size.
  • refs β€” Number of reference frames each P-frame can use. The range is from 1-16.
  • preset β€” Set the x265 preset.
  • tune β€” Set the x265 tune parameter.
  • profile β€” Set profile restrictions.
  • crf β€” Set the quality for constant quality mode.
  • qp β€” Set constant quantization rate control method parameter.
  • qmin β€” Minimum quantizer scale.
  • qmax β€” Maximum quantizer scale.
  • qdiff β€” Maximum difference between quantizer scales.
  • qblur β€” Quantizer curve blur.
  • qcomp β€” Quantizer curve compression factor.
  • i_qfactor β€” listed, no blurb here.
  • b_qfactor β€” listed, no blurb here.
  • forced-idr β€” Normally, when forcing an I-frame type, the encoder can select any type of I-frame. This option forces it to choose an IDR-frame.
  • x265-stats β€” Specify the file name for 2-pass stats. This is set automatically when using the -passlogfile option.
  • udu_sei boolean β€” Import user data unregistered SEI if available into output. Default is 0 (off).
  • x265-params β€” Set x265 options using a list of key=value couples separated by ":". See x265 --help for a list of options.

So like, to specify libx265 encoding options with -x265-params:

ffmpeg -i input -c:v libx265 -x265-params crf=26:psy-rd=1 output.mp4

libxavs2

The xavs2 AVS2-P2/IEEE1857.4 encoder wrapper 🌸.

This encoder requires the presence of the libxavs2 headers and library during configuration. You need to explicitly configure the build with --enable-libxavs2.

The following standard libavcodec options are used:

  • b / bit_rate
  • g / gop_size
  • bf / max_b_frames

The encoder also has its own specific options:

Options

  • lcu_row_threads β€” Set the number of parallel threads for rows from 1 to 8 (default 5).
  • initial_qp β€” Set the xavs2 quantization parameter from 1 to 63 (default 34). This is used to set the initial qp for the first frame.
  • qp β€” Set the xavs2 quantization parameter from 1 to 63 (default 34). This is used to set the qp value under constant-QP mode.
  • max_qp β€” Set the max qp for rate control from 1 to 63 (default 55).
  • min_qp β€” Set the min qp for rate control from 1 to 63 (default 20).
  • speed_level β€” Set the Speed level from 0 to 9 (default 0). Higher is better but slower 😭.
  • log_level β€” Set the log level from -1 to 3 (default 0). -1: none, 0: error, 1: warning, 2: info, 3: debug.
  • xavs2-params β€” Set xavs2 options using a list of key=value couples separated by ":".

Example time, to specify libxavs2 encoding options with -xavs2-params:

ffmpeg -i input -c:v libxavs2 -xavs2-params RdoqLevel=0 output.avs2

libxeve

eXtra-fast Essential Video Encoder (XEVE) MPEG-5 EVC encoder wrapper ✨. The xeve-equivalent options or values are listed in parentheses for easy migration, you're welcome.

This encoder requires the presence of the libxeve headers and library during configuration. You need to explicitly configure the build with --enable-libxeve.

Many libxeve encoder options are mapped to FFmpeg global codec options, while unique encoder options are provided through private options. Additionally the xeve-params private options allows one to pass a list of key=value tuples as accepted by the libxeve parse_xeve_params function.

The xeve project website is at https://github.com/mpeg5/xeve.

Options

The following options are supported by the libxeve wrapper. The xeve-equivalent options or values are listed in parentheses for easy migration.

To reduce the duplication of documentation, only the private options and some others requiring special attention are documented here. For the documentation of the undocumented generic options, see the Codec Options chapter.
To get a more accurate and extensive documentation of the libxeve options, invoke the command xeve_app --help or consult the libxeve documentation.
  • b (bitrate) β€” Set target video bitrate in bits/s. Note that FFmpeg's b option is expressed in bits/s, while xeve's bitrate is in kilobits/s πŸ‘€.
  • bf (bframes) β€” Set the maximum number of B frames (1,3,7,15).
  • g (keyint) β€” Set the GOP size (I-picture period).
  • preset (preset) β€” Set the xeve preset. Set the encoder preset value to determine encoding speed [fast, medium, slow, placebo].
  • tune (tune) β€” Set the encoder tune parameter [psnr, zerolatency].
  • profile (profile) β€” Set the encoder profile [0: baseline; 1: main].
  • crf (crf) β€” Set the quality for constant quality mode. Constant rate factor <10..49> [default: 32].
  • qp (qp) β€” Set constant quantization rate control method parameter. Quantization parameter qp <0..51> [default: 32].
  • threads (threads) β€” Force to use a specific number of threads.

libxvid

Xvid MPEG-4 Part 2 encoder wrapper πŸ¦‹.

This encoder requires the presence of the libxvidcore headers and library during configuration. You need to explicitly configure the build with --enable-libxvid --enable-gpl.

Fun fact: the native mpeg4 encoder supports the MPEG-4 Part 2 format, so users can encode to this format without this library at all.

Options

The following options are supported by the libxvid wrapper. Some of the following options are listed but are not documented, and correspond to shared codec options. See the Codec Options chapter for their documentation. The other shared options which are not listed have no effect for the libxvid encoder.

  • b β€” listed, not documented here (shared codec option, iykyk).
  • g β€” listed, not documented here.
  • qmin β€” listed, not documented here.
  • qmax β€” listed, not documented here.
  • mpeg_quant β€” listed, not documented here.
  • threads β€” listed, not documented here.
  • bf β€” listed, not documented here.
  • b_qfactor β€” listed, not documented here.
  • b_qoffset β€” listed, not documented here.
  • flags β€” Set specific encoding flags. Possible values:
    • mv4 β€” Use four motion vector by macroblock.
    • aic β€” Enable high quality AC prediction.
    • gray β€” Only encode grayscale.
    • qpel β€” Enable quarter-pixel motion compensation.
    • cgop β€” Enable closed GOP.
    • global_header β€” Place global headers in extradata instead of every keyframe.
  • gmc β€” Enable the use of global motion compensation (GMC). Default is 0 (disabled).
  • me_quality β€” Set motion estimation quality level. Possible values in decreasing order of speed and increasing order of quality:
    • 0 β€” Use no motion estimation (default).
    • 1, 2 β€” Enable advanced diamond zonal search for 16x16 blocks and half-pixel refinement for 16x16 blocks.
    • 3, 4 β€” Enable all of the things described above, plus advanced diamond zonal search for 8x8 blocks and half-pixel refinement for 8x8 blocks, also enable motion estimation on chroma planes for P and B-frames.
    • 5, 6 β€” Enable all of the things described above, plus extended 16x16 and 8x8 blocks search.
  • mbd β€” Set macroblock decision algorithm. Possible values in the increasing order of quality:
    • simple β€” Use macroblock comparing function algorithm (default).
    • bits β€” Enable rate distortion-based half pixel and quarter pixel refinement for 16x16 blocks.
    • rd β€” Enable all of the things described above, plus rate distortion-based half pixel and quarter pixel refinement for 8x8 blocks, and rate distortion-based search using square pattern.
  • lumi_aq β€” Enable lumi masking adaptive quantization when set to 1. Default is 0 (disabled).
  • variance_aq β€” Enable variance adaptive quantization when set to 1. Default is 0 (disabled).

When combined with lumi_aq, the resulting quality will not be better than any of the two specified individually. In other words, the resulting quality will be the worse one of the two effects πŸ’€.

  • trellis β€” Set rate-distortion optimal quantization.
  • ssim β€” Set structural similarity (SSIM) displaying method. Possible values:
    • off β€” Disable displaying of SSIM information.
    • avg β€” Output average SSIM at the end of encoding to stdout. The format of showing the average SSIM is:
Average SSIM: %f

For users who are not familiar with C, %f means a float number, or a decimal (e.g. 0.939232).

  • frame β€” Output both per-frame SSIM data during encoding and average SSIM at the end of encoding to stdout. The format of per-frame information is:
       SSIM: avg: %1.3f min: %1.3f max: %1.3f

For users who are not familiar with C, %1.3f means a float number rounded to 3 digits after the dot (e.g. 0.932).

  • ssim_acc β€” Set SSIM accuracy. Valid options are integers within the range of 0-4, while 0 gives the most accurate result and 4 computes the fastest.

MediaCodec

The MediaCodec encoder wrapper enables hardware-accelerated video encoding on Android device πŸ”₯. It supports H.264, H.265 (HEVC), VP8, VP9, MPEG-4, and AV1 encoding (whether works or not is device dependent πŸ™ˆ).

okay so Android literally gives you two whole sets of APIs for this: Java MediaCodec and NDK MediaCodec β€” and the MediaCodec encoder wrapper? It slays both πŸ’…. Huge heads up though: the NDK MediaCodec API operates without requiring a JVM, but it may fail to function outside the JVM environment because of dependencies on system framework services, particularly after Android 15. so like. keep that in mind bestie 😭

  • ndk_codec boolean β€” use the NDK-based MediaCodec API instead of the Java API. It's enabled by default if av_jni_get_java_vm() returns NULL.
  • ndk_async boolean β€” use NDK MediaCodec in async mode. Async mode has less overhead than polling in a loop in sync mode, which is the whole appeal ✨. The drawback? AV_CODEC_FLAG_GLOBAL_HEADER doesn't work in async mode (use extract_extradata bsf when necessary). Also it doesn't work at all and gets disabled automatically on devices below Android 8.0.
  • codec_name string β€” a codec type can have multiple implementations on a single device, and this option specifies which backend to use (via the MediaCodec createCodecByName API). It's NULL by default, and the encoder is created by createEncoderByType.
  • bitrate_mode integer β€” possible values:
    • cq β€” constant quality mode
    • vbr β€” variable bitrate mode
    • cbr β€” constant bitrate mode
    • cbr_fd β€” constant bitrate mode with frame drops
  • pts_as_dts boolean β€” use PTS as DTS. This is a workaround since the MediaCodec API doesn't provide a decoding timestamp. It's enabled automatically if B frame is 0.
  • operating_rate integer β€” the desired operating rate the codec will need to operate at, zero for unspecified. This is used for cases like high-speed/slow-motion video capture, where the video encoder format contains the target playback rate (e.g. 30fps), but the component must be able to handle the high operating capture rate (e.g. 240fps). This rate will be used by the codec for resource planning and setting the operating points 🎬.
  • qp_i_min integer β€” minimum quantization parameter for I frame.
  • qp_p_min integer β€” minimum quantization parameter for P frame.
  • qp_b_min integer β€” minimum quantization parameter for B frame.
  • qp_i_max integer β€” maximum quantization parameter for I frame.
  • qp_p_max integer β€” maximum quantization parameter for P frame.
  • qp_b_max integer β€” maximum quantization parameter for B frame.

🌈 MediaFoundation

these wrappers for encoders in the MediaFoundation framework are available, and they're giving Windows royalty energy:

  • h264_mf
  • hevc_mf
  • av1_mf

They support both software and hardware encoding 🫢.

Video encoders can take input in either of nv12 or yuv420p form (some encoders support both, some support only either β€” in practice, nv12 is the safer choice, especially among HW encoders).

Hardware-accelerated encoding requires D3D11, including hardware scaling capabilities through the scale_d3d11 filter.

To list all available options for the MediaFoundation encoders, use: ffmpeg -h encoder=<encoder> e.g. ffmpeg -h encoder=h264_mf

Options

  • rate_control β€” select rate control mode. Available modes:
    • default β€” Default mode
    • cbr β€” CBR mode
    • pc_vbr β€” Peak constrained VBR mode
    • u_vbr β€” Unconstrained VBR mode
    • quality β€” Quality mode
    • ld_vbr β€” Low delay VBR mode (requires Windows 8+)
    • g_vbr β€” Global VBR mode (requires Windows 8+)
    • gld_vbr β€” Global low delay VBR mode (requires Windows 8+)
  • scenario β€” select usage scenario. Available scenarios:
    • default β€” Default scenario
    • display_remoting β€” Display remoting scenario
    • video_conference β€” Video conference scenario
    • archive β€” Archive scenario
    • live_streaming β€” Live streaming scenario
    • camera_record β€” Camera record scenario
    • display_remoting_with_feature_map β€” Display remoting with feature map scenario
  • quality β€” set encoding quality (0-100). -1 means default quality.
  • hw_encoding β€” force hardware encoding (0-1). Default is 0 (disabled).

Examples

Hardware encoding, iconic behavior:

ffmpeg -i input.mp4 -c:v h264_mf -hw_encoding 1 output.mp4

Hardware-accelerated decoding with hardware encoding:

ffmpeg -hwaccel d3d11va -i input.mp4 -c:v h264_mf -hw_encoding 1 output.mp4

Hardware-accelerated decoding, HW scaling and encoding with quality setting β€” the full combo meal πŸ“:

ffmpeg -hwaccel d3d11va -hwaccel_output_format d3d11 -i input.mp4 -vf scale_d3d11=1920:1080 -c:v hevc_mf -hw_encoding 1 -quality 80 output.mp4

πŸŽ€ Microsoft RLE

Microsoft RLE aka MSRLE encoder. Only 8-bit palette mode supported, no cap. Compatible with Windows 3.1 and Windows 95 β€” yes, we're being vintage, it's giving retro πŸ’€.

Options

  • g integer β€” keyframe interval. A keyframe is inserted at least every -g frames, sometimes sooner.

⭐ mpeg2

MPEG-2 video encoder, the elder statesman of the group.

Options

  • profile β€” select the mpeg2 profile to encode:
    • 422
    • high
    • ss β€” Spatially Scalable
    • snr β€” SNR Scalable
    • main
    • simple
  • level β€” select the mpeg2 level to encode:
    • high
    • high1440
    • main
    • low
  • seq_disp_ext integer β€” specifies if the encoder should write a sequence_display_extension to the output.
    • -1, auto β€” decide automatically whether to write it or not (this is the default) by checking if the data to be written is different from the default or unspecified values.
    • 0, never β€” never write it.
    • 1, always β€” always write it.
  • video_format integer β€” specifies the video_format written into the sequence display extension, indicating the source of the video pictures. The default is unspecified, and it can be component, pal, ntsc, secam or mac. For maximum compatibility, use component.
  • a53cc boolean β€” import closed captions (which must be ATSC compatible format) into the output. Default is 1 (on).

πŸ¦‹ png

PNG image encoder. tiny but mighty.

Options

  • compression_level β€” sets the compression level, from 0 to 9 (default).

Private options

  • dpi integer β€” set physical density of pixels, in dots per inch, unset by default.
  • dpm integer β€” set physical density of pixels, in dots per meter, unset by default.
  • pred method β€” set prediction method (none, sub, up, avg, paeth, mixed), default is paeth.

πŸ‘‘ ProRes

Apple ProRes encoder. fancy.

FFmpeg contains 2 ProRes encoders β€” the prores-aw and the prores-ks encoder. The used encoder can be chosen with the -vcodec option.

Private Options for prores-ks

  • profile integer β€” select the ProRes profile to encode:
    • proxy
    • lt
    • standard
    • hq
    • 4444
    • 4444xq
  • quant_mat integer β€” select quantization matrix:
    • auto
    • default
    • proxy
    • lt
    • standard
    • hq

If set to auto, the matrix matching the profile will be picked. If not set, the matrix providing the highest quality, default, will be picked.

  • bits_per_mb integer β€” how many bits to allot for coding one macroblock. Different profiles use between 200 and 2400 bits per macroblock, and the maximum is 8000.
  • mbs_per_slice integer β€” number of macroblocks in each slice (1-8); the default value (8) should be good in almost all situations.
  • vendor string β€” override the 4-byte vendor ID. A custom vendor ID like apl0 would claim the stream was produced by the Apple encoder πŸ‘€.
  • alpha_bits integer β€” specify number of bits for alpha component. Possible values are 0, 8 and 16. Use 0 to disable alpha plane coding.

Speed considerations

In the default mode of operation the encoder has to honor frame constraints (i.e. not produce frames with size bigger than requested) while still making the output picture as good as possible. A frame containing a lot of small details is harder to compress and the encoder would spend more time searching for appropriate quantizers for each slice.

Setting a higher bits_per_mb limit will improve the speed ⚑.

For the fastest encoding speed set the qscale parameter (4 is the recommended value) and do not set a size constraint.


πŸ”₯ QSV Encoders

The family of Intel QuickSync Video encoders (MPEG-2, H.264, HEVC, JPEG/MJPEG, VP9, AV1). they're all here and they're all invited to the party.

Ratecontrol Method

The ratecontrol method is selected as follows:

  • When global_quality is specified, a quality-based mode is used. Specifically this means either:
    • CQP β€” constant quantizer scale, when the qscale codec flag is also set (the -qscale ffmpeg option).
    • LA_ICQ β€” intelligent constant quality with lookahead, when the look_ahead option is also set.
    • ICQ β€” intelligent constant quality otherwise. For the ICQ modes, global quality range is 1 to 51, with 1 being the best quality ✨.
  • Otherwise when the desired average bitrate is specified with the b option, a bitrate-based mode is used:
    • LA β€” VBR with lookahead, when the look_ahead option is specified.
    • VCM β€” video conferencing mode, when the vcm option is set.
    • CBR β€” constant bitrate, when maxrate is specified and equal to the average bitrate.
    • VBR β€” variable bitrate, when maxrate is specified, but is higher than the average bitrate.
    • AVBR β€” average VBR mode, when maxrate is not specified, both avbr_accuracy and avbr_convergence are set to non-zero. This mode is available for H264 and HEVC on Windows.
  • Otherwise the default ratecontrol method CQP is used.
ngl, depending on your system, a different mode than the one you specified may be selected by the encoder. Set the verbosity level to verbose or higher to see the actual settings used by the QSV runtime. don't get gaslit by your own hardware 😭

Global Options -> MSDK Options

Additional libavcodec global options are mapped to MSDK options like so:

  • g/gop_size -> GopPicSize
  • bf/max_b_frames+1 -> GopRefDist
  • rc_init_occupancy/rc_initial_buffer_occupancy -> InitialDelayInKB
  • slices -> NumSlice
  • refs -> NumRefFrame
  • b_strategy/b_frame_strategy -> BRefType
  • cgop/CLOSED_GOP codec flag -> GopOptFlag
  • For the CQP mode, the i_qfactor/i_qoffset and b_qfactor/b_qoffset set the difference between QPP and QPI, and QPP and QPB respectively.
  • Setting the coder option to the value vlc will make the H.264 encoder use CAVLC instead of CABAC πŸ‘‘.

Common Options

Following options are used by all qsv encoders β€” the shared group-chat of settings, coming right up πŸ’–

  • async_depth β€” how many async operations the app gets to fire off before it actually has to stop and sync the result. Set it to zero and it's just… not specified, bestie πŸ’…
  • preset β€” the vibe slider. It gives you a whole menu from veryfast (best speed) all the way to veryslow (best quality) 🐒✨
    • veryfast
    • faster
    • fast
    • medium
    • slow
    • slower
    • veryslow
  • forced_idr β€” literally forcing I frames to be IDR frames. no cap, that's the whole thing πŸŽ€
  • low_power β€” for encoders: flip this flag to ON and it eats less power and hogs less GPU. self-care for your laptop πŸ”‹πŸ’–

πŸŒ€ Runtime Options πŸŒ€

okay so these ones you can actually use during qsv encoding. mid-encode glow-ups only ✨

  • global_quality, i_quant_factor, i_quant_offset, b_quant_factor, b_quant_offset β€” supported in h264_qsv and hevc_qsv. Change these values to reset the qsv codec's qp configuration πŸ”§
  • max_frame_size β€” supported in h264_qsv and hevc_qsv. Change this value to reset the qsv codec's MaxFrameSize configuration πŸ“
  • gop_size β€” change this value to reset the qsv codec's gop configuration.
  • int_ref_type, int_ref_cycle_size, int_ref_qp_delta, int_ref_cycle_dist β€” supported in h264_qsv and hevc_qsv. Change these values to reset the qsv codec's Intra Refresh configuration πŸ’«
  • qmax, qmin, max_qp_i, min_qp_i, max_qp_p, min_qp_p, max_qp_b, min_qp_b β€” supported in h264_qsv. Change these values to reset the qsv codec's max/min qp configuration.
  • low_delay_brc β€” supported in h264_qsv, hevc_qsv and av1_qsv. Change this value to reset the qsv codec's low_delay_brc configuration.
  • framerate β€” change this value to reset the qsv codec's framerate configuration 🎞️
  • bit_rate, rc_buffer_size, rc_initial_buffer_occupancy, rc_max_rate β€” change these values to reset the qsv codec's bitrate control configuration πŸ’Έ
  • pic_timing_sei β€” supported in h264_qsv and hevc_qsv. Change this value to reset the qsv codec's pic_timing_sei configuration.
  • qsv_params β€” set QSV encoder parameters as a colon-separated list of key-value pairs. so organized, we love a structured queen πŸ‘‘

The qsv_params should be formatted as "key1=value1:key2=value2:...".

These parameters are passed directly to the underlying Intel Quick Sync Video (QSV) encoder using the MFXSetParameter function.

Example:

ffmpeg -i input.mp4 -c:v h264_qsv -qsv_params "CodingOption1=1:CodingOption2=2" output.mp4

This option allows fine-grained control over various encoder-specific settings provided by the QSV encoder. like, surgical-level control fr fr πŸ”¬

🌸 H264 options 🌸

these ones are used by h264_qsv β€” yes she has her own little collection πŸ’…

  • extbrc β€” Extended bitrate control.
  • recovery_point_sei β€” set this flag and it inserts the recovery point SEI message at the beginning of every intra refresh cycle πŸ”
  • rdo β€” enable rate distortion optimization ✨
  • max_frame_size β€” maximum encoded frame size in bytes.
  • max_frame_size_i β€” maximum encoded frame size for I frames in bytes. If this value is set as larger than zero, then for I frames the value set by max_frame_size is ignored. she overrides, respectfully πŸ’€
  • max_frame_size_p β€” maximum encoded frame size for P frames in bytes. If this value is set as larger than zero, then for P frames the value set by max_frame_size is ignored.
  • max_slice_size β€” maximum encoded slice size in bytes.
  • bitrate_limit β€” toggle bitrate limitations. It modifies bitrate to be in the range imposed by the QSV encoder. Setting this flag off may lead to violation of HRD conformance ⚠️ Mind that specifying bitrate below the QSV encoder range might significantly affect quality. If on, this option takes effect in non CQP modes: if bitrate is not in the range imposed by the QSV encoder, it will be changed to be in the range.
  • mbbrc β€” setting this flag enables macroblock level bitrate control that generally improves subjective visual quality. Enabling this flag may have negative impact on performance and objective visual quality metric. trade-offs, always trade-offs 😭
  • low_delay_brc β€” setting this flag turns on or off the LowDelayBRC feature in the qsv plugin, which provides more accurate bitrate control to minimize the variance of bitstream size frame by frame. Value: -1-default 0-off 1-on.
  • adaptive_i β€” this flag controls insertion of I frames by the QSV encoder. Turn ON this flag to allow changing of frame type from P and B to I πŸ”„
  • adaptive_b β€” this flag controls changing of frame type from B to P.
  • p_strategy β€” enable P-pyramid: 0-default 1-simple 2-pyramid (bf need to be set to 0) πŸ”οΈ
  • b_strategy β€” this option controls usage of B frames as reference.
  • dblk_idc β€” this option disable deblocking. It has value in range 0~2.
  • cavlc β€” if set, CAVLC is used; if unset, CABAC is used for encoding.
  • vcm β€” Video conferencing mode, please see ratecontrol method πŸ“Ή
  • idr_interval β€” distance (in I-frames) between IDR frames.
  • pic_timing_sei β€” insert picture timing SEI with pic_struct_syntax element.
  • single_sei_nal_unit β€” put all the SEI messages into one NALU.
  • max_dec_frame_buffering β€” maximum number of frames buffered in the DPB.
  • look_ahead β€” use VBR algorithm with look ahead πŸ‘€
  • look_ahead_depth β€” depth of look ahead in number frames.
  • look_ahead_downsampling β€” downscaling factor for the frames saved for the lookahead analysis.
    • unknown
    • auto
    • off
    • 2x
    • 4x
  • int_ref_type β€” specifies intra refresh type. The major goal of intra refresh is improvement of error resilience without significant impact on encoded bitstream size caused by I frames. The SDK encoder achieves this by encoding part of each frame in the refresh cycle using intra MBs. none means no refresh. vertical means vertical refresh, by column of MBs. horizontal means horizontal refresh, by rows of MBs. slice means horizontal refresh by slices without overlapping. In case of slice, in_ref_cycle_size is ignored. To enable intra refresh, B frame should be set to 0 🧊
  • int_ref_cycle_size β€” specifies number of pictures within the refresh cycle starting from 2. 0 and 1 are invalid values πŸ™…β€β™€οΈ
  • int_ref_qp_delta β€” specifies QP difference for inserted intra MBs. This is a signed value in [-51, 51] range if target encoding bit-depth for luma samples is 8, and this range is [-63, 63] for 10 bit-depth or [-75, 75] for 12 bit-depth respectively.
  • int_ref_cycle_dist β€” distance between the beginnings of the intra-refresh cycles in frames.
  • profile
    • unknown
    • baseline
    • main
    • high
  • a53cc β€” use A53 Closed Captions (if available).
  • aud β€” insert the Access Unit Delimiter NAL.
  • mfmode β€” Multi-Frame Mode.
    • off
    • auto
  • repeat_pps β€” repeat pps for every single frame, every time, no skips πŸ”
  • max_qp_i β€” maximum video quantizer scale for I frame.
  • min_qp_i β€” minimum video quantizer scale for I frame.
  • max_qp_p β€” maximum video quantizer scale for P frame.
  • min_qp_p β€” minimum video quantizer scale for P frame.
  • max_qp_b β€” maximum video quantizer scale for B frame.
  • min_qp_b β€” minimum video quantizer scale for B frame.
  • scenario β€” provides a hint to the encoder about the scenario for the encoding session 🎬
    • unknown
    • displayremoting
    • videoconference
    • archive
    • livestreaming
    • cameracapture
    • videosurveillance
    • gamestreaming
    • remotegaming
  • avbr_accuracy β€” accuracy of the AVBR ratecontrol (unit of tenth of percent).
  • avbr_convergence β€” convergence of the AVBR ratecontrol (unit of 100 frames).

The parameters avbr_accuracy and avbr_convergence are for the average variable bitrate control (AVBR) algorithm. The algorithm focuses on overall encoding quality while meeting the specified bitrate, target_bitrate, within the accuracy range avbr_accuracy, after an avbr_Convergence period. This method does not follow HRD and the instant bitrate is not capped or padded. it just vibes, honestly 🌈

  • skip_frame β€” use the per-frame metadata "qsv_skip_frame" to skip frames when encoding. This option defines the usage of this metadata.
    • no_skip β€” frame skipping is disabled.
    • insert_dummy β€” encoder inserts into the bitstream a frame where all macroblocks are encoded as skipped πŸ«₯
    • insert_nothing β€” similar to insert_dummy, but the encoder inserts nothing into the bitstream. The skipped frames are still used in brc. For example, gop still includes skipped frames, and the frames after skipped frames will be larger in size.
    • brc_only β€” skip_frame metadata indicates the number of missed frames before the current frame.

πŸ‘‘ HEVC Options πŸ‘‘

and these ones are used by hevc_qsv β€” she's the main character of this section, periodt πŸ’œ

  • extbrc β€” Extended bitrate control.
  • recovery_point_sei β€” set this flag and it inserts the recovery point SEI message at the beginning of every intra refresh cycle πŸ”
  • rdo β€” enable rate distortion optimization ✨
  • max_frame_size β€” maximum encoded frame size in bytes.
  • max_frame_size_i β€” maximum encoded frame size for I frames in bytes. If this value is set as larger than zero, then for I frames the value set by max_frame_size is ignored.
  • max_frame_size_p β€” maximum encoded frame size for P frames in bytes. If this value is set as larger than zero, then for P frames the value set by max_frame_size is ignored.
  • max_slice_size β€” maximum encoded slice size in bytes.
  • mbbrc β€” setting this flag enables macroblock level bitrate control that generally improves subjective visual quality. Enabling this flag may have negative impact on performance and objective visual quality metric 😭
  • low_delay_brc β€” setting this flag turns on or off the LowDelayBRC feature in the qsv plugin, which provides more accurate bitrate control to minimize the variance of bitstream size frame by frame. Value: -1-default 0-off 1-on.
  • adaptive_i β€” this flag controls insertion of I frames by the QSV encoder. Turn ON this flag to allow changing of frame type from P and B to I πŸ”„
  • adaptive_b β€” this flag controls changing of frame type from B to P.
  • p_strategy β€” enable P-pyramid: 0-default 1-simple 2-pyramid (bf need to be set to 0) πŸ”οΈ
  • b_strategy β€” this option controls usage of B frames as reference.
  • dblk_idc β€” this option disable deblocking. It has value in range 0~2.
  • idr_interval β€” distance (in I-frames) between IDR frames.
    • begin_only β€” output an IDR-frame only at the beginning of the stream πŸŒ…
  • load_plugin β€” a user plugin to load in an internal session ✨ Your picks are literally none, hevc_sw, hevc_hw.
  • load_plugins β€” same energy but a whole list: a :-separated list of hexadecimal plugin UIDs to load in an internal session. Colon, bestie, not comma πŸ’…
  • look_ahead_depth β€” depth of look ahead in number frames, and it's only available when the extbrc option is enabled 🫢
  • profile β€” set the encoding profile (scc requires libmfx >= 1.32, noted πŸ‘‘). Your values: unknown, main, main10, mainsp, rext, scc.
  • tier β€” set the encoding tier (only level >= 4 can support high tier, so like, don't get your hopes up on the low ones). This option only takes effect when the level option is specified. Values: main, high.
  • gpb β€” 1: GPB (generalized P/B frame), 0: regular P frame. That's the whole thing, no notes πŸ’€
  • tile_cols β€” number of columns for tiled encoding.
  • tile_rows β€” number of rows for tiled encoding.
  • aud β€” insert the Access Unit Delimiter NAL.
  • pic_timing_sei β€” insert picture timing SEI with pic_struct_syntax element.
  • transform_skip β€” turn this option ON to enable transformskip. It's supported on platform equal or newer than ICL, so old hardware, this is not for you πŸ™ˆ
  • int_ref_type β€” specifies intra refresh type. The major goal of intra refresh is improvement of error resilience without significant impact on encoded bitstream size caused by I frames β€” which, iconic behavior honestly. The SDK encoder achieves this by encoding part of each frame in the refresh cycle using intra MBs. Your options:
    • none means no refresh.
    • vertical means vertical refresh, by column of MBs.
    • horizontal means horizontal refresh, by rows of MBs.
    • slice means horizontal refresh by slices without overlapping.

Heads up: in the case of slice, in_ref_cycle_size is ignored 😭. And to actually enable intra refresh, B frame should be set to 0.

  • int_ref_cycle_size β€” specifies number of pictures within refresh cycle starting from 2. 0 and 1 are invalid values, so don't even try πŸ’…
  • int_ref_qp_delta β€” specifies QP difference for inserted intra MBs. This is a signed value, and the range depends on your target encoding bit-depth for luma samples: [-51, 51] if it's 8, [-63, 63] for 10 bit-depth, or [-75, 75] for 12 bit-depth respectively. Respectively, bestie.
  • int_ref_cycle_dist β€” distance between the beginnings of the intra-refresh cycles in frames.
  • max_qp_i β€” maximum video quantizer scale for I frame.
  • min_qp_i β€” minimum video quantizer scale for I frame.
  • max_qp_p β€” maximum video quantizer scale for P frame.
  • min_qp_p β€” minimum video quantizer scale for P frame.
  • max_qp_b β€” maximum video quantizer scale for B frame.
  • min_qp_b β€” minimum video quantizer scale for B frame.
  • scenario β€” gives the encoder a hint about the scenario for the encoding session, like a little vibe check for your workload 🌸 Pick one of: unknown, displayremoting, videoconference, archive, livestreaming, cameracapture, videosurveillance, gamestreaming, remotegaming.
  • avbr_accuracy β€” accuracy of the AVBR ratecontrol (unit of tenth of percent).
  • avbr_convergence β€” convergence of the AVBR ratecontrol (unit of 100 frames).

The parameters avbr_accuracy and avbr_convergence are for the average variable bitrate control (AVBR) algorithm. The algorithm focuses on overall encoding quality while meeting the specified bitrate, target_bitrate, within the accuracy range avbr_accuracy, after a avbr_Convergence period. This method does not follow HRD and the instant bitrate is not capped or padded β€” so like, don't expect HRD behavior here, fr fr.

  • skip_frame β€” use per-frame metadata "qsv_skip_frame" to skip frame when encoding. This option defines the usage of this metadata:
    • no_skip β€” frame skipping is disabled.
    • insert_dummy β€” encoder inserts into bitstream frame where all macroblocks are encoded as skipped.
    • insert_nothing β€” similar to insert_dummy, but encoder inserts nothing into bitstream. The skipped frames are still used in brc. For example, gop still include skipped frames, and the frames after skipped frames will be larger in size.
    • brc_only β€” skip_frame metadata indicates the number of missed frames before the current frame.

πŸŽ€ MPEG2 Options

These options are used by mpeg2_qsv:

  • profile β€” your values are unknown, simple, main, high.

πŸ¦‹ VP9 Options

These options are used by vp9_qsv:

  • profile β€” unknown, profile0, profile1, profile2, profile3.
  • tile_cols β€” number of columns for tiled encoding (requires libmfx >= 1.29).
  • tile_rows β€” number of rows for tiled encoding (requires libmfx >= 1.29).

πŸ”₯ AV1 Options

These options are used by av1_qsv (requires libvpl):

  • profile β€” unknown, main.
  • tile_cols β€” number of columns for tiled encoding.
  • tile_rows β€” number of rows for tiled encoding.
  • adaptive_i β€” this flag controls insertion of I frames by the QSV encoder. Turn ON this flag to allow changing of frame type from P and B to I.
  • adaptive_b β€” this flag controls changing of frame type from B to P.
  • b_strategy β€” this option controls usage of B frames as reference.
  • extbrc β€” extended bitrate control.
  • look_ahead_depth β€” depth of look ahead in number frames, available when extbrc option is enabled.
  • low_delay_brc β€” setting this flag turns on or off LowDelayBRC feature in qsv plugin, which provides more accurate bitrate control to minimize the variance of bitstream size frame by frame. Value: -1-default 0-off 1-on. Default gang rise up ✨
  • max_frame_size β€” set the allowed max size in bytes for each frame. If the frame size exceeds the limitation, encoder will adjust the QP value to control the frame size. Invalid in CQP rate control mode, so watch out πŸ’€
  • max_frame_size_i β€” maximum encoded frame size for I frames in bytes. If this value is set as larger than zero, then for I frames the value set by max_frame_size is ignored.
  • max_frame_size_p β€” maximum encoded frame size for P frames in bytes. If this value is set as larger than zero, then for P frames the value set by max_frame_size is ignored.

❄️ snow

Options:

  • iterative_dia_size β€” dia size for the iterative motion estimation.

🌈 VAAPI encoders

Wrappers for hardware encoders accessible via VAAPI 🫢

These encoders only accept input in VAAPI hardware surfaces. If you have input in software frames, use the hwupload filter to upload them to the GPU β€” that's literally the move, no cap.

The following standard libavcodec options are used:

  • g / gop_size
  • bf / max_b_frames
  • profile

If not set, this will be determined automatically from the format of the input frames and the profiles supported by the driver. It just knows πŸ’…

  • level
  • b / bit_rate
  • maxrate / rc_max_rate
  • bufsize / rc_buffer_size
  • rc_init_occupancy / rc_initial_buffer_occupancy
  • compression_level

Speed / quality tradeoff: higher values are faster / worse quality. Pick your poison bestie 😭

  • q / global_quality

Size / quality tradeoff: higher values are smaller / worse quality.

  • qmin
  • qmax
  • i_qfactor / i_quant_factor
  • i_qoffset / i_quant_offset
  • b_qfactor / b_quant_factor
  • b_qoffset / b_quant_offset
  • slices

All encoders support the following options:

  • low_power β€” some drivers/platforms offer a second encoder for some codecs intended to use less power than the default encoder; setting this option will attempt to use that encoder. Note that it may support a reduced feature set, so some other options may not be available in this mode. It's giving low-power era πŸ”‹
  • idr_interval β€” set the number of normal intra frames between full-refresh (IDR) frames in open-GOP mode. The intra frames are still IRAPs, but will not include global headers and may have non-decodable leading pictures πŸ‘€
  • b_depth β€” set the B-frame reference depth. When set to one (the default), all B-frames will refer only to P- or I-frames. When set to greater values multiple layers of B-frames will be present, frames in each layer only referring to frames in higher layers. Layers, bestie, layers 🧚
  • async_depth β€” maximum processing parallelism. Increase this to improve single channel performance. This option doesn't work if driver doesn't implement vaSyncBuffer function. Please make sure there are enough hw_frames allocated if a large number of async_depth is used β€” don't set it huge and then act surprised πŸ™ˆ
  • max_frame_size β€” set the allowed max size in bytes for each frame. If the frame size exceeds the limitation, encoder will adjust the QP value to control the frame size. Invalid in CQP rate control mode.
  • rc_mode β€” set the rate control mode to use. A given driver may only support a subset of modes, so like, check with your driver first πŸ’€ Possible modes:
    • auto β€” choose the mode automatically based on driver support and the other options. This is the default.
    • CQP β€” constant-quality.
    • CBR β€” constant-bitrate.
    • VBR β€” variable-bitrate.
    • ICQ β€” intelligent constant-quality.
    • QVBR β€” quality-defined variable-bitrate.
    • AVBR β€” average variable bitrate.
  • blbrc β€” enable block level rate control, which assigns different bitrate block by block. Invalid for CQP mode.

Each encoder also has its own specific options:

av1_vaapi

  • profile sets the value of seq_profile.
  • tier sets the value of seq_tier.
  • level sets the value of seq_level_idx.
  • tiles β€” set the number of tiles to encode the input video with, as columns x rows. (default is auto, which means use minimal tile column/row number).
  • tile_groups β€” set tile groups number. All the tiles will be distributed as evenly as possible to each tile group. (default is 1).

h264_vaapi

  • profile sets the value of profile_idc and the constraint_set*_flags.
  • level sets the value of level_idc.
  • coder β€” set entropy encoder (default is cabac). Possible values:
    • ac, cabac β€” use CABAC.
    • vlc, cavlc β€” use CAVLC.
  • aud β€” include access unit delimiters in the stream (not included by default).
  • sei β€” set SEI message types to include. Some combination of the following values:
    • identifier β€” include a user_data_unregistered message containing information about the encoder.
    • timing β€” include picture timing parameters (buffering_period and pic_timing messages).
  • recovery_point β€” drop recovery points in wherever it makes sense (like, the recovery_point messages). πŸ’…

hevc_vaapi

profile and level set the values of general_profile_idc and general_level_idc respectively. ✨

  • aud β€” include access unit delimiters in the stream. Heads up: they're not included by default, bestie.
  • tier β€” sets general_tier_flag. Lowkey important: this may affect the level chosen for the stream if you didn't explicitly set one.
  • sei β€” pick which SEI message types to include. Any combo of these:
    • hdr β€” include HDR metadata if the input frames actually have it (mastering_display_colour_volume and content_light_level messages). 🌈
  • tiles β€” sets how many tiles to encode the input video with, written as columns x rows. Bigger numbers = more parallelism in both encoding and decoding, but heads up, it may decrease coding efficiency. trade-offs, always trade-offs 😭

mjpeg_vaapi

Only baseline DCT encoding is supported, periodt. The encoder always uses the standard quantisation and huffman tables β€” global_quality scales the standard quantisation table (range 1-100).

For YUV, the 4:2:0, 4:2:2 and 4:4:4 subsampling modes are supported. RGB is supported too, and it'll create an RGB JPEG. πŸŽ€

  • jfif β€” include a JFIF header in each frame (not included by default).
  • huffman β€” include the standard huffman tables (on by default). Turning this off saves you a few hundred bytes in each output frame, but ngl it may lose compatibility with some JPEG decoders that don't fully handle MJPEG. πŸ’€

mpeg2_vaapi

profile and level set the value of profile_and_level_indication. that's it, that's the whole vibe ✨

vp8_vaapi

B-frames are not supported. sorry bestie 🫢

  • global_quality sets the q_idx used for non-key frames (range 0-127).
  • loop_filter_level and loop_filter_sharpness β€” manually set the loop filter parameters.

vp9_vaapi

  • global_quality sets the q_idx used for P-frames (range 0-255).
  • loop_filter_level and loop_filter_sharpness β€” manually set the loop filter parameters.

B-frames are supported, but plot twist: the output stream is always in encode order rather than display order. So if B-frames are enabled, you might need to use the vp9_raw_reorder bitstream filter to modify the output stream so the frames display in the correct order. πŸ™ˆ

Also, only normal frames are produced β€” the vp9_superframe bitstream filter may be required to produce a stream that's actually usable with all decoders.

vbn

The Vizrt Binary Image encoder. πŸ‘‘

This format is used by the broadcast vendor Vizrt for quick texture streaming. Advanced features of the format β€” like LZW compression of texture data or generation of mipmaps β€” are not supported. we keep it simple πŸ’…

Options

  • format string β€” sets the texture compression used by the VBN file. Can be dxt1, dxt5 or raw. Default is dxt5.

vc2

SMPTE VC-2 (previously known as BBC Dirac Pro). This codec was primarily aimed at professional broadcasting, but since it supports yuv420, yuv422 and yuv444 at 8 (limited range or full range), 10 or 12 bits, that makes it suitable for other tasks which require low overhead and low compression (like screen recording). honestly? versatile icon. πŸ¦‹

Options

  • b β€” sets the target video bitrate. Usually that's around 1:6 of the uncompressed video bitrate (e.g. for 1920x1080 50fps yuv422p10 that's around 400Mbps). Higher values (close to the uncompressed bitrate) turn on lossless compression mode. πŸ”₯
  • field_order β€” enables field coding when set (e.g. to tt β€” top field first) for interlaced inputs. Should increase compression with interlaced content, because it splits the fields and encodes each one separately.
  • wavelet_depth β€” sets the total amount of wavelet transforms to apply, between 1 and 5 (default). Lower values reduce compression and quality. Heads up: less capable decoders may not be able to handle values of wavelet_depth over 3. ⚠️
  • wavelet_type β€” sets the transform type. Currently only 5_3 (LeGall) and 9_7 (Deslauriers-Dubuc) are implemented, with 9_7 being the one with better compression, so that's the default.
  • slice_width / slice_height β€” sets the slice size for each slice. Larger values result in better compression. For compatibility with other, more limited decoders, use slice_width of 32 and slice_height of 8.
  • tolerance β€” sets the undershoot tolerance of the rate control system in percent. This is to prevent an expensive search from being run.
  • qm β€” sets the quantization matrix preset to use by default, or when wavelet_depth is set to 5:
    • default β€” uses the default quantization matrix from the specifications, extended with values for the fifth level. This provides a good balance between keeping detail and omitting artifacts. ✨
    • flat β€” use a completely zeroed out quantization matrix. This increases PSNR but might reduce perception. Use in bogus benchmarks. πŸ’€ (yeah, they said it)
    • color β€” reduces detail but attempts to preserve color at extremely low bitrates. 🌈

🌸 SUBTITLES ENCODERS 🌸

dvbsub

This codec encodes the bitmap subtitle format that's used in DVB broadcasts and recordings. The bitmaps are typically embedded in a container such as MPEG-TS as a separate stream. πŸŽ€

Options

  • min_bpp integer (2, 4, or 8) β€” set a minimum bits-per-pixel value for the subtitle color lookup tables.

So here's the tea: DVB supports 2, 4, and 8 bits-per-pixel color lookup tables. This option lets you force a particular bits-per-pixel value regardless of the number of colors. And since not all players support (or properly support) 2 bits-per-pixel, this value defaults to 4. 🫢

dvdsub

This codec encodes the bitmap subtitle format used in DVDs. Typically they're stored in VOBSUB file pairs (*.idx + *.sub), and they can also be used in Matroska files. πŸ‘‘

Options

  • palette β€” specify the global palette used by the bitmaps.

The format for this option is a string containing 16 24-bit hexadecimal numbers (without a 0x prefix) separated by commas, for example "0d00ee, ee450d, 101010, eaeaea, 0ce60b, ec14ed, ebff0b, 0d617a, 7b7b7b, d1d1d1, 7b2a0e, 0d950c, 0f007b, cf0dec, cfa80c, 7c127b". copy it exactly, bestie, no typos πŸ’…

  • even_rows_fix β€” when set to 1, enable a work-around that makes the number of pixel rows even in all subtitles. This fixes a problem with some players that cut off the bottom row if the number is odd. The work-around just adds a fully transparent row if needed. The overhead is low β€” typically one byte per subtitle on average.

By default, this work-around is disabled.

lrc

This codec encodes the LRC lyrics format. 🎡 iconic, honestly

Options

  • precision β€” specify the precision of the fractional part of the timestamp. The time base is determined based on this value.

Defaults to 2 for centiseconds. ⏱️


πŸ” SEE ALSO πŸ”

ffmpeg(1), ffplay(1), ffprobe(1), libavcodec(3)


πŸ‘‘ AUTHORS πŸ‘‘

The FFmpeg developers.

For details about the authorship, see the Git history of the project (https://git.ffmpeg.org/ffmpeg), e.g. by typing the command git log in the FFmpeg source directory, or browsing the online repository at <https://git.ffmpeg.org/ffmpeg>.

Maintainers for the specific components are listed in the file MAINTAINERS in the source code tree. 🫢


okay that's literally the whole page, we did it, bestie!! πŸŽ‰πŸ’– this page is from the FFmpeg project's docs, dated that Thursday in June 2025 (iykyk, the manpage footer has the full deets β€” go peep the source for the exact version and date ✨), and yes, it really does say FFMPEG-CODECS(1) at the bottom. slay. πŸ’…

πŸ“¦ where this page comes from