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 π₯
binteger(encoding,audio,video)β Sets the bitrate in bits/s. Default value is200K. That's the one everyone reaches for first, obviously.abinteger(encoding,audio)β Sets the audio bitrate (in bits/s). Default value is128Kπ§btinteger(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 π¬flagsflags(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β Seterror[?]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. ErrorAVERROR_INPUT_CHANGEDis 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_baserational 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 π
ginteger(encoding,video)β Sets the group of picture (GOP) size. Default value is12.arinteger(decoding/encoding,audio)β Sets audio sampling rate (in Hz).acinteger(decoding/encoding,audio)β Sets number of audio channels.cutoffinteger(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_sizeinteger(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_numberinteger β Sets the frame number.delayintegerqcompfloat(encoding,video)β Sets video quantizer scale compression (VBR). It's used as a constant in the ratecontrol equation. Recommended range for defaultrc_eq:0.0-1.0.qblurfloat(encoding,video)β Sets video quantizer scale blur (VBR).qmininteger(encoding,video)β Sets min video quantizer scale (VBR). Must be included between-1and69, default value is2.qmaxinteger(encoding,video)β Sets max video quantizer scale (VBR). Must be included between-1and1024, default value is31.qdiffinteger(encoding,video)β Sets max difference between the quantizer scale (VBR).bfinteger(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_qfactorfloat(encoding,video)β Sets qp factor between P and B frames.codec_tagintegerbugflags(decoding,video)β Workaround not auto detected encoder bugs. (Yes, that's the actual framing. It's a workaround list.)
Possible values:
autodetectxvid_ilaceβ Xvid interlacing bug (autodetected iffourcc==XVIX)ump4β (autodetected iffourcc==UMP4)no_paddingβ padding bug (autodetected)amvqpel_chromastd_qpelβ old standard qpel (autodetected per fourcc/version)qpel_chroma2direct_blocksizeβ direct-qpel-blocksize bug (autodetected per fourcc/version)edgeβ edge padding bug (autodetected per fourcc/version)hpel_chromadc_clipmsβ 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. π
strictinteger(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 softwarestrictβ strictly conform to all the things in the spec no matter what consequencesnormalunofficialβ allow unofficial extensionsexperimentalβ 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_qoffsetfloat(encoding,video)β Sets QP offset between P and B frames.err_detectflags(decoding,audio,video)β Sets error detection flags.
Possible values:
crccheckβ verify embedded CRCsbitstreamβ detect bitstream specification deviationsbufferβ detect improper bitstream lengthexplodeβ abort decoding on minor error detectionignore_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 errorscompliantβ consider all spec non compliancies as errorsaggressiveβ consider things that a sane encoder should not do as an error
has_b_framesintegerblock_alignintegerrc_override_countintegermaxrateinteger(encoding,audio,video)β Sets max bitrate tolerance (in bits/s). Requiresbufsizeto be set β like, it will not work without it, so set yourbufsizefirst π«Άminrateinteger(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.bufsizeinteger(encoding,audio,video)β Sets ratecontrol buffer size (in bits).i_qfactorfloat(encoding,video)β Sets QP factor between P and I frames.i_qoffsetfloat(encoding,video)β Sets QP offset between P and I frames.dctinteger(encoding,video)β Sets DCT algorithm.
Possible values:
autoβ autoselect a good one (default)fastintβ fast integerintβ accurate integermmxaltivecfaanβ floating point AAN DCT
lumi_maskfloat(encoding,video)β Compress bright areas stronger than medium ones.tcplx_maskfloat(encoding,video)β Sets temporal complexity masking.scplx_maskfloat(encoding,video)β Sets spatial complexity masking.p_maskfloat(encoding,video)β Sets inter masking.dark_maskfloat(encoding,video)β Compress dark areas stronger than medium ones. (Sibling oflumi_mask, we love a matched set πΈ)idctinteger(decoding/encoding,video)β Selects IDCT implementation.
Possible values:
autointsimplesimplemmxsimpleautoβ Automatically pick a IDCT compatible with the simple onearmaltivecsh4simplearmsimplearmv5tesimplearmv6simpleneonxvidfaaniβ floating point AAN IDCT
slice_countintegerecflags(decoding,video)β Sets error concealment strategy.
Possible values:
guess_mvsβ iterative motion vector (MV) search (slow)deblockβ use strong deblock filter for damaged MBsfavor_interβ favor predicting from the previous frame instead of the current
bits_per_coded_sampleintegeraspectrational number(encoding,video)β Sets sample aspect ratio.sarrational number(encoding,video)β Sets sample aspect ratio. Alias toaspect. (Same thing, different name, we stan a low-effort alias π )debugflags(decoding/encoding,audio,video,subtitles)β Prints specific debug info.
Possible values:
pictβ picture inforcβ rate controlbitstreammb_typeβ macroblock (MB) typeqpβ per-block quantization parameter (QP)dct_coeffgreen_metadataβ display complexity metadata for the upcoming frame, GoP or for a given duration.skipstartcodeerβ error recognitionmmcoβ memory management control operations (H.264)bugsbuffersβ picture buffer allocationsthread_opsβ threading operationsnomcβ skip motion compensation
cmpinteger(encoding,video)β Sets full pel me compare function.
Possible values:
sadβ sum of absolute differences, fast (this is the default π¨)sseβ sum of squared errorssatdβ sum of absolute Hadamard transformed differencesdctβ sum of absolute DCT transformed differencespsnrβ sum of squared quantization errors (bestie, avoid this one, it's low quality π)bitβ number of bits needed for the blockrdβ rate distortion optimal, slow π’zeroβ0vsadβ sum of absolute vertical differencesvsseβ sum of squared vertical differencesnsseβ noise preserving sum of squared differencesw53β 5/3 wavelet, only used insnoww97β 9/7 wavelet, only used insnowdctmaxchroma
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 errorssatdβ sum of absolute Hadamard transformed differencesdctβ sum of absolute DCT transformed differencespsnrβ sum of squared quantization errors (avoid, low quality)bitβ number of bits needed for the blockrdβ rate distortion optimal, slowzeroβ0vsadβ sum of absolute vertical differencesvsseβ sum of squared vertical differencesnsseβ noise preserving sum of squared differencesw53β 5/3 wavelet, only used insnoww97β 9/7 wavelet, only used insnowdctmaxchroma
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 errorssatdβ sum of absolute Hadamard transformed differencesdctβ sum of absolute DCT transformed differencespsnrβ sum of squared quantization errors (avoid, low quality)bitβ number of bits needed for the blockrdβ rate distortion optimal, slowzeroβ0vsadβ sum of absolute vertical differencesvsseβ sum of squared vertical differencesnsseβ noise preserving sum of squared differencesw53β 5/3 wavelet, only used insnoww97β 9/7 wavelet, only used insnowdctmaxchroma
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 errorssatdβ sum of absolute Hadamard transformed differencesdctβ sum of absolute DCT transformed differencespsnrβ sum of squared quantization errors (avoid, low quality)bitβ number of bits needed for the blockrdβ rate distortion optimal, slowzeroβ0vsadβ sum of absolute vertical differencesvsseβ sum of squared vertical differencesnsseβ noise preserving sum of squared differencesw53β 5/3 wavelet, only used insnoww97β 9/7 wavelet, only used insnowdctmaxchroma
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 errorssatdβ sum of absolute Hadamard transformed differencesdctβ sum of absolute DCT transformed differencespsnrβ sum of squared quantization errors (avoid, low quality)bitβ number of bits needed for the blockrdβ rate distortion optimal, slowzeroβ0vsadβ sum of absolute vertical differencesvsseβ sum of squared vertical differencesnsseβ noise preserving sum of squared differencesw53β 5/3 wavelet, only used insnoww97β 9/7 wavelet, only used insnowdctmaxchroma
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 (1023for 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β usembcmp(default)bitsβ use fewest bitsrdβ 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 encodingignorecropβ ignore cropping information fromspslocal_headerβ place global headers at every keyframe instead of in extradatachunksβ frame data might be split into multiple chunksshowallβ show all frames before the first keyframeexport_mvsβ export motion vectors into frame side-data (see"AV_FRAME_DATA_MOTION_VECTORS") for codecs that support it. See alsodoc/examples/export_mvs.c.skip_manualβ do not skip samples and export skip information as frame side dataass_ro_flush_noopβ do not reset ASSReadOrderfield on flushicc_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 alsodoc/examples/export_mvs.c.prftβ export encoder Producer Reference Time into packet side-data (see"AV_PKT_DATA_PRFT") for codecs that support itvenc_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) β setsintra_dc_precisionnssew(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 isunknown. 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 tounknown. Possible values:unknown
lowres(integer, decoding, audio, video) β decode at1= 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 framedefaultβ discard useless frames like 0-sized framesnorefβ discard all non-reference framesbidirβ discard all bidirectional framesnokeyβ discard all frames excepts keyframesnointraβ discard all frames except I framesallβ 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-framesrefs(integer, encoding, video) β sets reference frames to consider for motion compensationtrellis(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 theffmpeg-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.709bt470mβ BT.470 Mbt470bgβ BT.470 BGsmpte170mβ SMPTE 170 Msmpte240mβ SMPTE 240 Mfilmβ Filmbt2020β BT.2020smpte428smpte428_1β SMPTE ST 428-1smpte431β SMPTE 431-2smpte432β SMPTE 432-1jedec-p22β JEDEC P22
color_trcinteger (decoding/encoding, video) β the transfer characteristics, aka the color transfer function, bestie. possible values:bt709β BT.709gamma22β BT.470 Mgamma28β BT.470 BGsmpte170mβ SMPTE 170 Msmpte240mβ SMPTE 240 Mlinearβ Linearlog,log100β Loglog_sqrt,log316β Log square rootiec61966_2_4,iec61966-2-4β IEC 61966-2-4bt1361,bt1361eβ BT.1361iec61966_2_1,iec61966-2-1β IEC 61966-2-1bt2020_10,bt2020_10bitβ BT.2020 - 10 bitbt2020_12,bt2020_12bitβ BT.2020 - 12 bitsmpte2084β SMPTE ST 2084smpte428,smpte428_1β SMPTE ST 428-1arib-std-b67β ARIB STD-B67
colorspaceinteger (decoding/encoding, video) β the color space, duh π . possible values:rgbβ RGBbt709β BT.709fccβ FCCbt470bgβ BT.470 BGsmpte170mβ SMPTE 170 Msmpte240mβ SMPTE 240 Mycocgβ YCOCGbt2020nc,bt2020_nclβ BT.2020 NCLbt2020c,bt2020_clβ BT.2020 CLsmpte2085β SMPTE 2085chroma-derived-ncβ Chroma-derived NCLchroma-derived-cβ Chroma-derived CLictcpβ ICtCp
color_rangeinteger (decoding/encoding, video) β if you use it as an input parameter, it's basically a lil hint to the decoder about whichcolor_rangethe input is carrying. possible values:tv,mpeg,limitedβ MPEG (219*2^(n-8))pc,jpeg,fullβ JPEG (2^n-1)
chroma_sample_locationinteger (decoding/encoding, video) β where the chroma lives. possible values:left,center,topleft,top,bottomleft,bottomπalpha_modeinteger (decoding/encoding, video) β possible values:premultipliedandstraightβ¨log_level_offsetinteger β sets the log level offset. that's it, that's the whole vibe πslicesinteger (encoding, video) β number of slices, used in parallelized encoding π§thread_typeflags (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_typeinteger (encoding, audio) β sets the audio service type. possible values:maβ Main Audio Serviceefβ Effectsviβ Visually Impairedhiβ Hearing Impaireddiβ Dialoguecoβ Commentaryemβ Emergencyvoβ Voice Overkaβ Karaoke
request_sample_fmtsample_fmt (decoding, audio) β sets the sample format that audio decoders should prefer. default value is"none"πpkt_timebaserational number β that's the whole entry, no notes, we move πsub_charencencoding (decoding, subtitles) β sets the input subtitles character encoding πΈfield_orderfield_order (video) β set/override the field order of the video. possible values:progressiveβ Progressive videottβ Interlaced video, top field coded and displayed firstbbβ Interlaced video, bottom field coded and displayed firsttbβ Interlaced video, top coded first, bottom displayed firstbtβ Interlaced video, bottom coded first, top displayed first
skip_alphabool (decoding, video) β set to1to disable processing alpha (transparency). it works like thegrayflag in theflagsoption, except that one skips chroma information instead of alpha. default is0πcodec_whitelistlist (input) β a","separated list of allowed decoders. by default, all are allowed πdump_separatorstring (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_pixelsinteger (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_croppingbool (decoding, video) β enables cropping if the cropping parameters are multiples of the required alignment for theleftandtopparameters. if the alignment is not met, the cropping will be partially applied in order to maintain alignment. default is1(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 is0-31. Default is0. 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, asAVStereo3DViewvalues. When the array is available, its elements apply to the corresponding elements ofview_ids_available, i.e.view_pos_available[i]contains the position of view with IDview_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 is0(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 isfalse. 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 is0(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:defaultonoff
HEVC Options
Extra options for hevc_qsv.
load_pluginβ a user plugin to load in an internal session. Accepted values:nonehevc_swhevc_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 is0(autodetect). You can use the special-1value 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_scalevalue β 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 is1. 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. Appliesdrc_scaleasymmetrically. 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 to1. The default value is0(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-pathpath β 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-textboolean β 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_typesubtitle_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_encodingencoding_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.
-fontfont_name[,font_name2,...] β specify a comma-separated list of font family names to be used forbitmaporasstype subtitle rendering. Only the first font name is used forasstype subtitle. If not specified, it uses the internally defined default font family. π-ass_single_rectboolean β 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., oldmpv) 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 isfalse. If your player cannot handle AVSubtitles with multiple ASS rectangles properly, set this option totrueor defineASS_SINGLE_RECT=1to change the default behavior at compilation. π-force_outline_textboolean β specify whether to always render outline text for all characters, regardless of the indication by character style. The default isfalse.-outline_widthnumber (0.0 - 3.0) β specify width for outline text, in dots (relative). The default is1.5.-ignore_backgroundboolean β specify whether to ignore background color rendering. The default isfalse.-ignore_rubyboolean β specify whether to ignore rendering for ruby-like (furigana) characters. The default isfalse.-replace_drcsboolean β specify whether to render replaced DRCS characters as Unicode characters. The default istrue.-replace_msz_asciiboolean β specify whether to replace MSZ (Middle Size; half width) fullwidth alphanumerics with halfwidth alphanumerics. The default istrue.-replace_msz_japaneseboolean β specify whether to replace some MSZ (Middle Size; half width) fullwidth japanese special characters with halfwidth ones. The default istrue.-replace_msz_glyphboolean β 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 istrue. π₯-canvas_sizeimage_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_typeis set tobitmap.
The libaribcaption decoder assumes these input frame sizes for bitmap rendering:
PROFILE_A: 1440 x 1080 with SAR (PAR) 4:3PROFILE_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 to1will only keep the forced subtitles. Default value is0.
π 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 is1.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 is0.txt_topβ Y offset of generated bitmaps, default is0.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 is1.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 is0, which means an opaque background.txt_opacityβ sets the opacity (0-255) of the teletext background. Iftxt_transparentis not set, it only affects characters between a start box and an end box, typically subtitles. Default value is0iftxt_transparentis set,255otherwise.
π 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 to128kbps. Slay.qβ Set the quality for variable bit rate (VBR) mode. Heads up though: this option is only valid when you're using theffmpegcommand-line tool. For library interface users, useglobal_qualityinstead. 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 whetheraac_is,aac_msandaac_pnsare 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 defaulttwoloopcoder but has potential. Currently has no support for theaac_isoraac_pnsoptions. 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 than64kbps), but is better and much faster at higher bitrates. β‘
aac_msβ Sets mid/side coding mode. The default value ofautowill automatically use M/S with bands which will benefit from such coding. Can be forced for all bands using the valueenableβ which is mainly useful for debugging β or disabled usingdisable.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 todisable.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 usingdisable.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 todisable. π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 byprofile:a aac_low. Use it in conjunction with-arto 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 theaac_ltpoption. 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: theac3_fixedencoder is not the default codec for any of the output formats, so you have to specify it explicitly using the option-acodec ac3_fixedin 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:
http://www.atsc.org/cms/standards/a_52-2010.pdfhttp://www.atsc.org/cms/standards/a_54a_with_corr_1.pdfhttp://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/18_Metadata.Guide.pdfhttp://www.dolby.com/uploadedFiles/zz-_Shared_Assets/English_PDFs/Professional/46_DDEncodingGuidelines.pdf
βοΈ Metadata Control Options
-per_frame_metadataboolean β 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_mixlevlevel β 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-3dBgain0.595β Apply-4.5dBgain (default)0.500β Apply-6dBgain
-surround_mixlevlevel β 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-3dBgain0.500β Apply-6dBgain (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_levelnumber β Mixing Level. Specifies peak sound pressure level (SPL) in the production environment when the mix was mastered. Valid values are80to111, or-1for 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 theroom_typeoption is not the default value, themixing_leveloption must not be-1. π¨ Like, they're linked, okay?-room_typetype β 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 themixing_leveloption and theroom_typeoption have the default values.0,notindicatedβ Not Indicated (default)1,largeβ Large Room2,smallβ Small Room
π·οΈ Other Metadata Options
-copyrightboolean β Copyright Indicator. Specifies whether a copyright exists for this audio.0,offβ No Copyright Exists (default)1,onβ Copyright Exists
-dialnormvalue β 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-31dBwill result in no volume level change, relative to the source volume, during audio reproduction. Valid values are whole numbers in the range-31to-1, with-31being the default. π-dsur_modemode β 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 Encoded2,onβ Dolby Surround Encoded
-originalboolean β Original Bit Stream Indicator. Specifies whether this audio is from the original source and not a copy.0,offβ Not Original Source1,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_modemode β 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 Preferred2,loroβ Lo/Ro Downmix Preferred
-ltrt_cmixlevlevel β 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+3dBgain1.189β Apply+1.5dBgain1.000β Apply0dBgain0.841β Apply-1.5dBgain
0.707β apply -3.0dB gain π0.595β apply -4.5dB gain (this one's the default β¨)0.500β apply -6.0dB gain0.000β silence the center channel entirely π€«-ltrt_surmixlevlevel β 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 gain0.707β apply -3.0dB gain0.595β apply -4.5dB gain0.500β apply -6.0dB gain (default, iykyk)0.000β silence the surround channel(s) π
-loro_cmixlevlevel β 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 gain1.189β apply +1.5dB gain1.000β apply 0dB gain0.841β apply -1.5dB gain0.707β apply -3.0dB gain0.595β apply -4.5dB gain (default β¨)0.500β apply -6.0dB gain0.000β silence the center channel π€
-loro_surmixlevlevel β 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 gain0.707β apply -3.0dB gain0.595β apply -4.5dB gain0.500β apply -6.0dB gain (default)0.000β silence the surround channel(s)
Extended Bitstream Information β Part 2 π
-dsurex_modemode β 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 Off2/offβ Dolby Surround EX On
okay yes, theon/offlabels there are lowkey swapped-looking, but that's literally what the page says, so we're not touching it bestie π
-dheadphone_modemode β 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 Off2/offβ Dolby Headphone On
-ad_conv_typetype β 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_rematrixingboolean β 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 π§ͺβ¨cutofffrequency β 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_couplingboolean β 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 coupling1/onβ enable channel coupling
-cpl_start_bandnumber β 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 useauto, 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 from0to12, and5is the default ποΈframe_sizeβ sets the size of the frames, in samples per channel πlpc_coeff_precisionβ sets the LPC coefficient precision. Valid values are1to15, and15is the default β¨lpc_typeβ sets the first stage LPC algorithm:noneβ LPC is not usedfixedβ fixed LPC coefficientslevinsoncholesky
lpc_passesβ number of passes to use for Cholesky factorization during LPC analysis πmin_partition_orderβ the minimum partition ordermax_partition_orderβ the maximum partition orderprediction_order_methodβ the options areestimation,2level,4level,8level,search(that one's a bruteforce search π), andlogch_modeβ channel mode:autoβ the mode is chosen automatically for each frameindepβ channels are independently codedleft_sideright_sidemid_side
exact_rice_parametersβ chooses whether rice parameters are calculated exactly or approximately. Set it to1and 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 to1and 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 than20mswill 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 channelsflags +qscaleβ enable fixed quality, VBR (Variable Bit Rate) mode. Note that VBR is implicitly enabled when thevbrvalue is positive β¨cutoffβ set cutoff frequency. If it's not specified (or it's explicitly set to0) it'll use a value automatically computed by the library. Default value is0ποΈ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 to1, disabled if set to0. It improves quality, but also the processing power it needs π₯ Default value is1.eld_sbrβ enable SBR (Spectral Band Replication) for ELD if set to1, disabled if set to0. Default value is0.eld_v2β enable ELDv2 (LD-MPS extension for ELD stereo signals) for ELDv2 if set to1, disabled if set to0. Note that this option is available when fdk-aac version(AACENCODER_LIB_VL0.AACENCODER_LIB_VL1.AACENCODER_LIB_VL2)>(4.0.0). Default value is0π«Ά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 signalingexplicit_sbrβ explicit SBR, implicit PS signalingexplicit_hierarchicalβ explicit hierarchical signaling
Default value is default.
latmβ output LATM/LOAS encapsulated data if set to1, disabled if set to0. Default value is0π¦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 is0π’vbrβ set VBR mode, from1to5.1is the lowest quality (though still pretty good, ngl) and5is the highest quality. A value of0disables VBR, and CBR (Constant Bit Rate) is enabled instead. Currently only theaac_lowprofile supports VBR encoding π
VBR modes 1-5 correspond to roughly the following average bit rates:
1β 32 kbps/channel2β 40 kbps/channel3β 48-56 kbps/channel4β 64 kbps/channel5β 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.5and5ms. - High-Resolution mode,
48KHz, and96kHz 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:
bbitrate β sets the bit rate in bits/s. This decides the fixed size of the encoded frames for whichever frame duration you picked. slay πarfrequency β 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 is10ms. Allowed frame durations are2.5ms,5ms,7.5msand10ms. LC3 (Bluetooth LE Audio) allows7.5msand10ms; and LC3plus allows2.5ms,5msand10ms.
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_resolutionboolean β enables the high-resolution mode when set to1. High-resolution mode is available with all LC3plus frame durations and for a sampling rate of48KHz and96KHz.
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 theffmpegcommand-line tool. If you're a library interface user, useglobal_qualityinstead. two different doors, same house. πͺcompression_level(-q) β sets the algorithm quality. Valid arguments are integers in the0-9range, where0means highest quality but slowest, and9means 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 to1. Default value is1. LAME has this enabled by default, but it can be overridden by using the--noresoption.joint_stereo(-m j) β lets the encoder use, on a frame-by-frame basis, either L/R stereo or mid/side stereo. Default value is1. Lowkey iconic behavior.abr(--abr) β enables the encoder to use ABR when set to1. The lame--abrsets the target bitrate, while this option only tells FFmpeg to use ABR β it still relies onbto set the bitrate. So don't forget yourb, fr fr.copyright(-c) β sets the MPEG audio copyright flag when set to1. Default value is0(disabled).original(-o) β sets the MPEG audio original flag when set to1. Default value is1(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 to1. The default value is0(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'sboption is expressed in bits/s, while opusenc'sbitrateis in kilobits/s. Yes, the units again. Write it down. βοΈvbr(vbr,hard-cbr, andcvbr) β sets the VBR mode. The FFmpegvbroption 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 the0-10range.0gives the fastest encodes but lower quality, while10gives the highest quality but slowest encoding. The default is10. 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 than20msare only interesting at fairly low bitrates. The default is20ms.packet_loss(expect-loss) β sets the expected packet loss percentage. The default is0.fec(n/a) β enables inband forward error correction.packet_lossmust 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, or20000, corresponding to narrowband, mediumband, wideband, super wideband, and fullband respectively. The default is0(cutoff disabled). Note that libopus forces a wideband cutoff for bitrates <15 kbps, unless CELT-only mode is used (that's whenapplicationis set tolowdelay). β οΈmapping_family(mapping_family) β sets the channel mapping family used by the encoder. The default value of-1uses mapping family0for mono and stereo inputs, and mapping family1otherwise. 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 to0, disables the use of phase inversion for intensity stereo, which improves the quality of mono downmixes but slightly reduces normal stereo quality. The default is1(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. Theshineenc -boption 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 twolameboption is expressed in kilobits/s. Default value is128k.q(-V) β sets quality for experimental VBR support. Maximum value range is from-50to50, useful range is from-10to10. The higher the value, the better the quality. This option is valid only using theffmpegcommand-line tool. For library interface users, useglobal_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β Stereojoint_stereoβ Joint stereodual_channelβ Dual channelmonoβ Mono
psymodel(--psyc-mode) β sets the psychoacoustic model to use in encoding. The argument must be an integer between-1and4, inclusive. The higher the value, the better the quality. The default value is3.energy_levels(--energy) β enables energy levels extensions when set to1. The default value is0(disabled).error_protection(--protect) β enables CRC error protection when set to1. The default value is0(disabled).copyright(--copyright) β sets the MPEG audio copyright flag when set to1. The default value is0(disabled).original(--original) β sets the MPEG audio original flag when set to1. The default value is0(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, otherwiselibavcodecwill round to the nearest valid bitrate.6600885012650142501585018250198502305023850
dtxβ allows discontinuous transmission (generate comfort noise) when set to1. The default value is0(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 -bis expressed in kilobits/s.q(-q) β sets constant quality setting for VBR. The value should be a float number in the range of-1.0to10.0. The higher the value, the better the quality. The default value is3.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 of0disables cutoff.oggenc's related option is expressed in kHz. The default value is0(cutoff disabled).minrate(-m) β sets minimum bitrate expressed in bits/s.oggenc -mis expressed in kilobits/s.maxrate(-M) β sets maximum bitrate expressed in bits/s.oggenc -Mis 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.0to0.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 between128and131072. 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β enabledoffβ 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-gframes, sometimes sooner.q:v(integer) β quality factor. Lower is better. Higher gives lower bitrate. The following table lists bitrates when encodingakiyo_cif.y4mfor various values of-q:vwith-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 is1..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,1is big.coderβ set the coder,riceβ Golomb rice coderrange_defβ Range coder with default tablerange_tabβ Range coder with custom table
slicecrcβ-1(default, automatic),1use crc with zero initial and final state,2use crc with non zero initial and final stateqtableβdefaultβ default, automatic8bitβ use 8bit defaultgreater8bitβ use>8bitdefault
remap_optimizerβ0-5, default3, 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 is0.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 is1.
πΈ Hap πΈ
Vidvox Hap video encoder.
Options
format(integer) β specifies the Hap format to encode.haphap_alphahap_q
Default value is hap.
chunks(integer) β specifies the number of chunks to split frames into, between1and64. 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 is1.compressor(integer) β specifies the second-stage compressor to use. If set tonone, chunks will be limited to1, as chunked uncompressed frames offer no benefit.nonesnappy
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 eitherj2korjp2(the default) that makes it possible to store non-rgbpix_fmts.tile_width(integer) β sets tile width. Range is1to1073741824. Default is256.tile_height(integer) β sets tile height. Range is1to1073741824. Default is256.pred(integer) β allows setting the discrete wavelet transform (DWT) typedwt97int(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:lrcprlcprpclpcrlcprl
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 layerltells you what ratio of the total file size is contained in the firstllayers.
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, from0to255.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 ofkey=valuepairs separated by":". Peeprav1e --helpfor 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 ifmaxrateandminrateare also set to the same value, it switches to constant-bitrate mode; otherwise, ifcrfis 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 is0to63. β οΈ 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 thetilesorrow-mtoptions 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 is0to8, higher numbers meaning more speed and less quality. The default value is1, 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-1to6. 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 is0to63, 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 to0.denoise-block-size(pixels) β block size used for denoising for grain synthesis. If not set, the AV1 codec uses the default value of32.undershoot-pct(pct) β sets the datarate undershoot (min) percentage of the target bitrate. Range is-1to100. Default is-1.overshoot-pct(pct) β sets the datarate overshoot (max) percentage of the target bitrate. Range is-1to1000. Default is-1.minsection-pct(pct) β minimum percentage variation of the GOP bitrate from the target bitrate. Ifminsection-pctisn't set, the libaomenc wrapper computes it as"(minrate * 100 / bitrate)". Range is-1to100. Default is-1(unset).maxsection-pct(pct) β maximum percentage variation of the GOP bitrate from the target bitrate. Ifmaxsection-pctisn't set, the libaomenc wrapper computes it as"(maxrate * 100 / bitrate)". Range is-1to5000. Default is-1(unset).frame-parallel(boolean) β enables frame parallel decodability features. Default istrue.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's1x1β 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 istruefor libaom-av1.enable-global-motion(boolean) β enables using global motion for block prediction. Default istrue.enable-intrabc(boolean) β enables block copy mode for intra block prediction. This mode is useful for screen content. Default istrue.enable-rect-partitions(boolean) (Requires libaom >= v2.0.0) β enables rectangular partitions. Default istrue.enable-1to4-partitions(boolean) (Requires libaom >= v2.0.0) β enables 1:4/4:1 partitions. Default istrue.enable-ab-partitions(boolean) (Requires libaom >= v2.0.0) β enables AB shape partitions. Default istrue.enable-angle-delta(boolean) (Requires libaom >= v2.0.0) β enables angle delta intra prediction. Default istrue.enable-cfl-intra(boolean) (Requires libaom >= v2.0.0) β enables chroma predicted from luma intra prediction. Default istrue.enable-filter-intra(boolean) (Requires libaom >= v2.0.0) β enables filter intra predictor. Default istrue.enable-intra-edge-filter(boolean) (Requires libaom >= v2.0.0) β enables intra edge filter. Default istrue.enable-smooth-intra(boolean) (Requires libaom >= v2.0.0) β enables smooth intra prediction mode. Default istrue.enable-paeth-intra(boolean) (Requires libaom >= v2.0.0) β enables paeth predictor in intra prediction. Default istrue.enable-palette(boolean) (Requires libaom >= v2.0.0) β enables palette prediction mode. Default istrue.enable-flip-idtx(boolean) (Requires libaom >= v2.0.0) β enables extended transform type, includingFLIPADST_DCT,DCT_FLIPADST,FLIPADST_FLIPADST,ADST_FLIPADST,FLIPADST_ADST,IDTX,V_DCT,H_DCT,V_ADST,H_ADST,V_FLIPADST,H_FLIPADST. Default istrue.enable-tx64(boolean) (Requires libaom >= v2.0.0) β enables 64-pt transform. Default istrue.reduced-tx-type-set(boolean) (Requires libaom >= v2.0.0) β uses a reduced set of transform types. Default isfalse.use-intra-dct-only(boolean) (Requires libaom >= v2.0.0) β uses DCT only for INTRA modes. Default isfalse.use-inter-dct-only(boolean) (Requires libaom >= v2.0.0) β uses DCT only for INTER modes. Default isfalse.use-intra-default-tx-only(boolean) (Requires libaom >= v2.0.0) β uses Default-transform only for INTRA modes. Default isfalse.enable-ref-frame-mvs(boolean) (Requires libaom >= v2.0.0) β enables temporal mv prediction. Default istrue.enable-reduced-reference-set(boolean) (Requires libaom >= v2.0.0) β uses a reduced set of single and compound references. Default isfalse.enable-obmc(boolean) (Requires libaom >= v2.0.0) β enables obmc. Default istrue.enable-dual-filter(boolean) (Requires libaom >= v2.0.0) β enables dual filter. Default istrue.enable-diff-wtd-comp(boolean) (Requires libaom >= v2.0.0) β enables difference-weighted compound. Default istrue.enable-dist-wtd-comp(boolean) (Requires libaom >= v2.0.0) β enables distance-weighted compound. Default istrue.enable-onesided-comp(boolean) (Requires libaom >= v2.0.0) β enables one sided compound. Default istrue.enable-interinter-wedge(boolean) (Requires libaom >= v2.0.0) β enables interinter wedge compound. Default istrue.enable-interintra-wedge(boolean) (Requires libaom >= v2.0.0) β enables interintra wedge compound. Default istrue.enable-masked-comp(boolean) (Requires libaom >= v2.0.0) β enables masked compound. Default istrue.enable-interintra-comp(boolean) (Requires libaom >= v2.0.0) β enables interintra compound. Default istrue.enable-smooth-interintra(boolean) (Requires libaom >= v2.0.0) β enables smooth interintra mode. Default istrue.aom-paramsβ okay so this is how you feed libaom your own lil' pile of settings: a list ofkey=valuepairs, all glued together with":". Wanna know which keys actually exist? Runaomenc --helpand 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 offastest,fast,medium,slow,placebo,defaultπββοΈqpβ sets the quantization parameter value for CQP rate control mode.oapv-params(also spelledparse_apv_params) β sets liboapvenc options using a list ofkey=valuepairs 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:mainhighprofessional
levelβ sets the operating point level. Like, for example:'4.0'hielevelβ sets the Hierarchical prediction levels:3level4levelβ 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 range0to13. 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 ofkey=valuepairs 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:deadzoneuniform
coding-signsβ enables the Signs handling strategy:disablefastfull
coding-sigfβ enables Significance coding.coding-vpredβ enables Vertical Prediction coding:disableno_residualsno_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, anddistance=1.0is roughly comparable to libjpeg Quality 90 for photographic content. Settingdistance=0.0yields true lossless encoding β¨ Valid values range between0.0and15.0, and sane values rarely exceed5.0. Settingdistance=0.1usually attains transparency for most input. The default is1.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 from1to9, and the default is7.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 ofname=valuepairs 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 is0. This is only used whenslice_modeis set tofixed.loopfilterβ enables the loop filter if set to1(it's automatically enabled). To disable it, set the value to0.profileβ sets profile restrictions. If set to the value ofmain, enable CABAC (set the"SEncParamExt.iEntropyCodingModeFlag"flag to1).max_nal_sizeβ sets maximum NAL size in bytes.allow_skip_framesβ allows skipping frames to hit the target bitrate if set to1.
π 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 theqscaleflag, and to enable thepass1andpass2modes.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 theffmpegcommand-line tool. For library interface users, useglobal_qualityinstead, k? π
Examples πΈ
- Set maximum constant quality (VBR) encoding with
ffmpeg:
ffmpeg -i INPUT -codec:v libtheora -q:v 10 OUTPUT.ogg
- Use
ffmpegto 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'sboption is expressed in bits/s, while vpxenc'starget-bitrateis 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 thecpu-usedoption.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'sslicesoption gives the total number of partitions, whilevpxenc'stoken-partsis given aslog2(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 of0means unlimited.force_key_framesβ"VPX_EFLAG_FORCE_KF".
π Alternate reference frame related
auto-alt-refβ enable use of alternate reference frames (2-pass only, okurrr). Values greater than1enable 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 β¨sharpnessinteger β 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 ofkey=valuepairs. For example, to specify temporal scalability parameters withffmpeg:
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 themetadatafield inAVFramewith the following keys:vp8-flagsβ sets the flags passed into the encoder to indicate the referencing scheme for the current frame. Refer to functionvpx_codec_encodeinvpx/vpx_encoder.hfor 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 option3, 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 aslog2(tile_columns). For example,8tile columns would be requested by setting thetile-columnsoption to3.tile-rowsβ set number of tile rows to use. Note this is given aslog2(tile_rows). For example,4tile rows would be requested by setting thetile-rowsoption to2.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).colorspacecolor-space β set input color space. The VP9 bitstream supports signaling the following colorspaces:rgbβ sRGBbt709β bt709unspecifiedβ unknownbt470bgβ bt601smpte170mβ smpte170smpte240mβ smpte240bt2020_nclβ bt2020
row-mtboolean β 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-tplboolean β enable temporal dependency model.ref-frame-configβ using per-frame metadata, set members of the structurevpx_svc_ref_frame_config_tinvpx/vp8cx.hto fine-control referencing schemes and frame buffer management. Use a:-separated list ofkey=valuepairs. 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 updaterfc_update_lastβ indicates whether to update the LAST framerfc_update_goldenβ indicates whether to update GOLDEN framerfc_update_alt_refβ indicates whether to update ALT_REF framerfc_lst_fb_idxβ LAST frame buffer indexrfc_gld_fb_idxβ GOLDEN frame buffer indexrfc_alt_fb_idxβ ALT_REF frame buffer indexrfc_reference_lastβ indicates whether to reference LAST framerfc_reference_goldenβ indicates whether to reference GOLDEN framerfc_reference_alt_refβ indicates whether to reference ALT_REF framerfc_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 forg=1(Intra only) or default.presetβ set the VVenC preset.levelidcβ set level idc.tierβ set vvc tier.qpβ set constant quantization parameter.suboptboolean β set subjective (perceptually motivated) optimization. Default is1(on).bitdepth8boolean β set 8bit coding mode instead of using 10bit. Default is0(off).periodβ set (intra) refresh period in seconds.vvenc-paramsβ set vvenc options using a list ofkey=valuecouples separated by":". Seevvencapp --fullhelporvvencFFapp --fullhelpfor 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
-losslessboolean β enables/disables use of lossless mode. Default is0.-compression_levelinteger β 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 themethodoption in libwebp. The valid range is0to6. Default is4.-qualityfloat β for lossy encoding, this controls image quality. For lossless encoding, this controls the effort and time spent in compression. Range is0to100. Default is75.-presettype β 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 shotphotoβ outdoor photograph, with natural lightingdrawingβ 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'sboption is expressed in bits/s, while x264'sbitrateis in kilobits/s. β οΈ do not mix these up bestie, that's a whole vibe check failbf(bframes) β number of B-frames between I and P-framesg(keyint) β maximum GOP sizeqmin(qpmin) β minimum quantizer scaleqmax(qpmax) β maximum quantizer scaleqdiff(qpstep) β maximum difference between quantizer scalesqblur(qblur) β quantizer curve blurqcomp(qcomp) β quantizer curve compression factorrefs(ref) β number of reference frames each P-frame can use. The range is 0-16.level(level) β set thex264_param_t.i_level_idcvalue in case the value is positive, it is ignored otherwise.- This value can be set using the
AVCodecContextAPI (e.g. by setting theAVCodecContextvalue directly), and is specified as an integer mapped on a corresponding level (e.g. the value 31 maps to H.264 level IDC3.1, as defined in thex264_levelstable). 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.
- This value can be set using the
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 reductionme_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).epzsis an alias fordia.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-cabacoption.
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-meoption.
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-threadsoption.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-gopoption.rc_init_occupancy(vbv-init) β initial VBV buffer occupancypreset(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 to1. When set to0, it has the same effect of x264's--slow-firstpassoption.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 to1. When set to0, it has the same effect as x264's--no-psyoption.psy-rd(psy-rd) β set strength of psychovisual optimization, inpsy-rd:psy-trellisformat.rc-lookahead(rc-lookahead) β set number of frames to look ahead for frametype and ratecontrol.weightbβ enable weighted prediction for B-frames when set to1. When set to0, it has the same effect as x264's--no-weightboption.weightp(weightp) β set weighted prediction method for P-frames. Possible values:none(0) β disabledsimple(1) β enable only weighted refssmart(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 to1.avcintra-class(class) β configure the encoder to generate AVC-Intra. Valid values are50,100and200bluray-compat(bluray-compat) β configure the encoder to be compatible with the bluray standard. It is a shorthand for settingbluray-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 to1. When set to0, it has the same effect as x264's--no-mixed-refsoption.8x8dctβ enable adaptive spatial transform (high profile 8x8 transform) when set to1. When set to0, it has the same effect as x264's--no-8x8dctoption.fast-pskipβ enable early SKIP detection on P-frames when set to1. When set to0, it has the same effect as x264's--no-fast-pskipoption.aud(aud) β enable use of access unit delimiters when set to1.mbtreeβ enable use macroblock tree ratecontrol when set to1. When set to0, it has the same effect as x264's--no-mbtreeoption.deblock(deblock) β set loop filter parameters, inalpha:betaform.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. (Enablingp4x4requiresp8x8to be enabled. Enablingi8x8requires adaptive spatial transform (8x8dctoption) to be enabled.) π they're a package deal, no capnone(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 (requiresvbv-bufsizeto 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
x264optsopts**, **x264-params*opts*β override the x264 configuration using a:-separated list ofkey=valueoptions.- The argument for both options is a list of
key=valuecouples separated by":". Withx264optsthe value can be omitted, and the value1is assumed in that case.
- The argument for both options is a list of
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.
a53ccboolean β imports closed captions into the output (they have to be ATSC compatible format, no exceptions π ). Only thempeg2andh264decoders even provide these. Default is1(on).udu_seiboolean β imports user data unregistered SEI into the output if it's available. Default is0(off).mb_infoboolean β setsmb_infodata throughAVFrameSideData. Only actually useful when you're using it from the API. Default is0(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 from1-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-passlogfileoption.udu_seiboolean β Import user data unregistered SEI if available into output. Default is0(off).x265-paramsβ Set x265 options using a list ofkey=valuecouples separated by":". Seex265 --helpfor 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_rateg/gop_sizebf/max_b_frames
The encoder also has its own specific options:
Options
lcu_row_threadsβ Set the number of parallel threads for rows from1to8(default5).initial_qpβ Set the xavs2 quantization parameter from1to63(default34). This is used to set the initial qp for the first frame.qpβ Set the xavs2 quantization parameter from1to63(default34). This is used to set the qp value under constant-QP mode.max_qpβ Set the max qp for rate control from1to63(default55).min_qpβ Set the min qp for rate control from1to63(default20).speed_levelβ Set the Speed level from0to9(default0). Higher is better but slower π.log_levelβ Set the log level from-1to3(default0).-1: none,0: error,1: warning,2: info,3: debug.xavs2-paramsβ Set xavs2 options using a list ofkey=valuecouples 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 thexeve-paramsprivate options allows one to pass a list ofkey=valuetuples as accepted by the libxeveparse_xeve_paramsfunction.
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'sboption is expressed in bits/s, while xeve'sbitrateis 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 is0(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 to1. Default is0(disabled).variance_aqβ Enable variance adaptive quantization when set to1. Default is0(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 of0-4, while0gives the most accurate result and4computes 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_codecboolean β use the NDK-based MediaCodec API instead of the Java API. It's enabled by default ifav_jni_get_java_vm()returns NULL.ndk_asyncboolean β 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_HEADERdoesn't work in async mode (useextract_extradatabsf when necessary). Also it doesn't work at all and gets disabled automatically on devices below Android 8.0.codec_namestring β a codec type can have multiple implementations on a single device, and this option specifies which backend to use (via the MediaCodeccreateCodecByNameAPI). It'sNULLby default, and the encoder is created bycreateEncoderByType.bitrate_modeinteger β possible values:cqβ constant quality modevbrβ variable bitrate modecbrβ constant bitrate modecbr_fdβ constant bitrate mode with frame drops
pts_as_dtsboolean β 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 is0.operating_rateinteger β 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_mininteger β minimum quantization parameter for I frame.qp_p_mininteger β minimum quantization parameter for P frame.qp_b_mininteger β minimum quantization parameter for B frame.qp_i_maxinteger β maximum quantization parameter for I frame.qp_p_maxinteger β maximum quantization parameter for P frame.qp_b_maxinteger β 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_mfhevc_mfav1_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 modecbrβ CBR modepc_vbrβ Peak constrained VBR modeu_vbrβ Unconstrained VBR modequalityβ Quality modeld_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 scenariodisplay_remotingβ Display remoting scenariovideo_conferenceβ Video conference scenarioarchiveβ Archive scenariolive_streamingβ Live streaming scenariocamera_recordβ Camera record scenariodisplay_remoting_with_feature_mapβ Display remoting with feature map scenario
qualityβ set encoding quality (0-100).-1means default quality.hw_encodingβ force hardware encoding (0-1). Default is0(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
ginteger β keyframe interval. A keyframe is inserted at least every-gframes, sometimes sooner.
β mpeg2
MPEG-2 video encoder, the elder statesman of the group.
Options
profileβ select the mpeg2 profile to encode:422highssβ Spatially Scalablesnrβ SNR Scalablemainsimple
levelβ select the mpeg2 level to encode:highhigh1440mainlow
seq_disp_extinteger β specifies if the encoder should write asequence_display_extensionto 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_formatinteger β specifies thevideo_formatwritten into the sequence display extension, indicating the source of the video pictures. The default is unspecified, and it can becomponent,pal,ntsc,secamormac. For maximum compatibility, usecomponent.a53ccboolean β import closed captions (which must be ATSC compatible format) into the output. Default is1(on).
π¦ png
PNG image encoder. tiny but mighty.
Options
compression_levelβ sets the compression level, from0to9(default).
Private options
dpiinteger β set physical density of pixels, in dots per inch, unset by default.dpminteger β set physical density of pixels, in dots per meter, unset by default.predmethod β set prediction method (none,sub,up,avg,paeth,mixed), default ispaeth.
π 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
profileinteger β select the ProRes profile to encode:proxyltstandardhq44444444xq
quant_matinteger β select quantization matrix:autodefaultproxyltstandardhq
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_mbinteger β how many bits to allot for coding one macroblock. Different profiles use between200and2400bits per macroblock, and the maximum is8000.mbs_per_sliceinteger β number of macroblocks in each slice (1-8); the default value (8) should be good in almost all situations.vendorstring β override the 4-byte vendor ID. A custom vendor ID likeapl0would claim the stream was produced by the Apple encoder π.alpha_bitsinteger β specify number of bits for alpha component. Possible values are0,8and16. Use0to 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_qualityis specified, a quality-based mode is used. Specifically this means either:- CQP β constant quantizer scale, when the
qscalecodec flag is also set (the-qscaleffmpeg option). - LA_ICQ β intelligent constant quality with lookahead, when the
look_aheadoption is also set. - ICQ β intelligent constant quality otherwise. For the ICQ modes, global quality range is
1to51, with1being the best quality β¨.
- CQP β constant quantizer scale, when the
- Otherwise when the desired average bitrate is specified with the
boption, a bitrate-based mode is used:- LA β VBR with lookahead, when the
look_aheadoption is specified. - VCM β video conferencing mode, when the
vcmoption is set. - CBR β constant bitrate, when
maxrateis specified and equal to the average bitrate. - VBR β variable bitrate, when
maxrateis specified, but is higher than the average bitrate. - AVBR β average VBR mode, when
maxrateis not specified, bothavbr_accuracyandavbr_convergenceare set to non-zero. This mode is available for H264 and HEVC on Windows.
- LA β VBR with lookahead, when the
- 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->GopPicSizebf/max_b_frames+1->GopRefDistrc_init_occupancy/rc_initial_buffer_occupancy->InitialDelayInKBslices->NumSlicerefs->NumRefFrameb_strategy/b_frame_strategy->BRefTypecgop/CLOSED_GOPcodec flag ->GopOptFlag- For the CQP mode, the
i_qfactor/i_qoffsetandb_qfactor/b_qoffsetset the difference between QPP and QPI, and QPP and QPB respectively. - Setting the
coderoption to the valuevlcwill 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 fromveryfast(best speed) all the way toveryslow(best quality) π’β¨veryfastfasterfastmediumslowslowerveryslow
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 inh264_qsvandhevc_qsv. Change these values to reset the qsv codec's qp configuration π§max_frame_sizeβ supported inh264_qsvandhevc_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 inh264_qsvandhevc_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 inh264_qsv. Change these values to reset the qsv codec's max/min qp configuration.low_delay_brcβ supported inh264_qsv,hevc_qsvandav1_qsv. Change this value to reset the qsv codec'slow_delay_brcconfiguration.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 inh264_qsvandhevc_qsv. Change this value to reset the qsv codec'spic_timing_seiconfiguration.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 bymax_frame_sizeis 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 bymax_frame_sizeis 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-default0-off1-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-default1-simple2-pyramid (bf need to be set to0) ποΈb_strategyβ this option controls usage of B frames as reference.dblk_idcβ this option disable deblocking. It has value in range0~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 withpic_struct_syntaxelement.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.unknownautooff2x4x
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.nonemeans no refresh.verticalmeans vertical refresh, by column of MBs.horizontalmeans horizontal refresh, by rows of MBs.slicemeans horizontal refresh by slices without overlapping. In case ofslice,in_ref_cycle_sizeis ignored. To enable intra refresh, B frame should be set to0π§int_ref_cycle_sizeβ specifies number of pictures within the refresh cycle starting from 2.0and1are 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.profileunknownbaselinemainhigh
a53ccβ use A53 Closed Captions (if available).audβ insert the Access Unit Delimiter NAL.mfmodeβ Multi-Frame Mode.offauto
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 π¬unknowndisplayremotingvideoconferencearchivelivestreamingcameracapturevideosurveillancegamestreamingremotegaming
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 toinsert_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_framemetadata 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 bymax_frame_sizeis 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 bymax_frame_sizeis 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-default0-off1-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-default1-simple2-pyramid (bf need to be set to0) ποΈb_strategyβ this option controls usage of B frames as reference.dblk_idcβ this option disable deblocking. It has value in range0~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 literallynone,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 theextbrcoption is enabled π«Άprofileβ set the encoding profile (sccrequires 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 theleveloption 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 withpic_struct_syntaxelement.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:nonemeans no refresh.verticalmeans vertical refresh, by column of MBs.horizontalmeans horizontal refresh, by rows of MBs.slicemeans 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.0and1are 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 toinsert_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_framemetadata indicates the number of missed frames before the current frame.
π MPEG2 Options
These options are used by mpeg2_qsv:
profileβ your values areunknown,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 whenextbrcoption 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 bymax_frame_sizeis 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 bymax_frame_sizeis 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_sizebf/max_b_framesprofile
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 π
levelb/bit_ratemaxrate/rc_max_ratebufsize/rc_buffer_sizerc_init_occupancy/rc_initial_buffer_occupancycompression_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.
qminqmaxi_qfactor/i_quant_factori_qoffset/i_quant_offsetb_qfactor/b_quant_factorb_qoffset/b_quant_offsetslices
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 implementvaSyncBufferfunction. Please make sure there are enoughhw_framesallocated if a large number ofasync_depthis 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
profilesets the value ofseq_profile.tiersets the value ofseq_tier.levelsets the value ofseq_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
profilesets the value ofprofile_idcand theconstraint_set*_flags.levelsets the value oflevel_idc.coderβ set entropy encoder (default iscabac). 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 auser_data_unregisteredmessage containing information about the encoder.timingβ include picture timing parameters (buffering_periodandpic_timingmessages).
recovery_pointβ drop recovery points in wherever it makes sense (like, therecovery_pointmessages). π
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β setsgeneral_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_volumeandcontent_light_levelmessages). π
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_qualitysets theq_idxused for non-key frames (range0-127).loop_filter_levelandloop_filter_sharpnessβ manually set the loop filter parameters.
vp9_vaapi
global_qualitysets theq_idxused for P-frames (range0-255).loop_filter_levelandloop_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
formatstring β sets the texture compression used by the VBN file. Can bedxt1,dxt5orraw. Default isdxt5.
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. for1920x1080 50fps yuv422p10that's around400Mbps). Higher values (close to the uncompressed bitrate) turn on lossless compression mode. π₯field_orderβ enables field coding when set (e.g. tottβ 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, between1and5(default). Lower values reduce compression and quality. Heads up: less capable decoders may not be able to handle values ofwavelet_depthover3. β οΈwavelet_typeβ sets the transform type. Currently only5_3(LeGall) and9_7(Deslauriers-Dubuc) are implemented, with9_7being 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, useslice_widthof32andslice_heightof8.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 whenwavelet_depthis set to5: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_bppinteger (2,4, or8) β 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 to1, 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
- alpine 3.24: ffmpeg-doc 8.1.3-r0 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- nixos 26.05: ffmpeg 8.1.3
- nixos 26.05: ffmpeg-full 8.1.3
- nixos 26.05: ffmpeg-headless 8.1.3
- nixpkgs unstable: jellyfin-ffmpeg 8.1.3-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms