AVIFENC(1)
π avifenc(1) β the vibe-coded guide to squishing images into AVIF π
okay bestie, pull up a chair, we're getting into avifenc, from the libavif girlies, and honestly? it's giving main character energy. π
β¨ NAME β¨
avifenc β compress an image file to an AVIF file. that's it, that's the whole job, and she does it beautifully. π¦
πΈ SYNOPSIS πΈ
avifenc [options] input.[jpg|jpeg|png|y4m] output.avif
π DESCRIPTION π
avifenc compresses an image file to an AVIF file. your input can be JPEG, PNG or YUV4MPEG2 (Y4M). no cap, those are the three. π«Ά
π₯ OPTIONS π₯
-h,--helpβ shows you the syntax help. the "help me bestie" button. π-V,--versionβ shows the version number. identity check! π
β¨ BASIC OPTIONS β¨
-q,--qcolor Qβ quality for color, in0..100, where100is lossless. glow-up scale. π--qalpha Qβ quality for alpha, in0..100, where100is lossless. same energy, but for the see-through bits. π-s,--speed Sβ encoder speed,0..10, where0is the slowest and10is the fastest. or you can passdefaultordto get the codec's internal defaults. (Default:6). slow = pretty, fast = now. pick your fighter. β‘
π ADVANCED OPTIONS π
-j,--jobs Jβ number of jobs (worker threads), orallto potentially use as many cores as possible. (Default:all). she will use your whole CPU and she's not sorry. π--no-overwriteβ never overwrite an existing output file. protecting your files like a good friend. π«Ά-o,--output FILENAMEβ instead of using the last filename given as output, use this filename instead.-l,--losslessβ sets all the defaults to encode losslessly, and emits warnings when your settings/input don't allow for it. perfectionist mode. π-d,--depth D[,EXTENSION]βDis the output bit depth per channel.Dmust be8,10or12. (JPEG/PNG only; for y4m:Dmust match the input bit depth, andEXTENSIONis unsupported). if you specify it,EXTENSIONadds a hidden encoded image ofEXTENSIONbit depth in the same file as the primary image, to reach 16-bit depth at decoding. seeavifSampleTransformRecipefor the supported combinations (8,8and12,4and12,8). π-y,--yuv FORMATβ output format, one ofauto(default),444,422,420or400. ignored for y4m (y4m format is retained). for JPEG,autohonors the JPEG's internal format, if possible. for grayscale PNG,autodefaults to400. for all other cases,autodefaults to444. iykyk. π¦-p,--premultiplyβ premultiply color by the alpha channel and signal this in the AVIF.--sharpyuvβ use sharp RGB to YUV420 conversion (if supported). ignored for y4m, or if the output is not420.--stdinβ read input from stdin instead of file paths. no other input is allowed. the input format is assumed to be y4m unlessβinput-formatis specified. the output file path must still be provided. β¨--input-formatβ file format of the input data. one of:jpeg/png/y4m/auto. (Default:auto, except for stdin whereautois not supported and the default isy4m). π--cicp,--nclx P/T/Mβ set CICP values (nclx colr box) (3 raw numbers, use-rto set range flag). π¨P= color primariesT= transfer characteristicsM= matrix coefficients use2for any you wish to leave unspecified.
-r,--range RANGEβ YUV range, one oflimitedorl,fullorf. (JPEG/PNG only, default:full; for y4m, range is retained). π--target-size Sβ set target file size in bytes (up to 7 times slower). worth it tho. π--progressiveβ automatically set parameters to encode a simple layered image supporting progressive rendering from a single input frame. she's layered. π--layeredβ encode a layered AVIF. each input is encoded as one layer, and at most4layers can be encoded. β-g,--grid MxNβ encode a single-image grid AVIF withMcols &Nrows. either supplyMxNidentical W/H/D images, or a single image that can be evenly split into theMxNgrid and follow AVIF grid image restrictions. the grid will adopt the color profile of the first image supplied. π§©-c,--codec Cβ codec to use. possible values depend on the codecs enabled at build time (see--helpor--versionfor the available codecs). default is auto-selected from the available codecs. π«Ά possible values are:aomrav1esvt
--exif FILENAMEβ provide an Exif metadata payload to be associated with the primary item (implies--ignore-exif).--xmp FILENAMEβ provide an XMP metadata payload to be associated with the primary item (implies--ignore-xmp).--icc FILENAMEβ provide an ICC profile payload to be associated with the primary item (implies--ignore-profile).--timescale,--fps Vβ timescale for image sequences. if all frames are1timescale in length, this is equivalent to frames per second. (Default:30). if neither duration nor timescale are set,avifencwill attempt to use the framerate stored in a y4m header, if present. β±οΈ-k,--keyframe INTERVALβ maximum keyframe interval for image sequences (any set ofINTERVALconsecutive frames will have at least one keyframe). set to0to disable (default).--ignore-exifβ if the input file contains embedded Exif metadata, ignore it (no-op if absent). π--ignore-xmpβ if the input file contains embedded XMP metadata, ignore it (no-op if absent).--ignore-profile,--ignore-iccβ if the input file contains an embedded color profile, ignore it (no-op if absent).--ignore-gain-mapβ if the input file contains an embedded gain map, ignore it (no-op if absent).--qgain-map Qβ quality for the gain map, in0..100, where100is lossless. π--pasp H,Vβ addpaspproperty (aspect ratio).H= horizontal spacing,V= vertical spacing.--crop CROPX,CROPY,CROPW,CROPHβ addclapproperty (clean aperture), but calculated from a crop rectangle. βοΈ--clap WN,WD,HN,HD,HON,HOD,VON,VODβ addclapproperty (clean aperture). Width, Height, HOffset, VOffset (in numerator/denominator pairs).--irot ANGLEβ addirotproperty (rotation) in0..3. makes a(90 * ANGLE)degree rotation anti-clockwise. π--imir AXISβ addimirproperty (mirroring).0=top-to-bottom,1=left-to-right. πͺ--clli MaxCLL,MaxPALLβ addclliproperty (content light level information).--repetition-count Nβ number of times an animated image sequence will be repeated, orinfinitefor infinite repetitions. (Default:infinite). she loops forever, periodt. π--β signal the end of options. everything after this is interpreted as file names. π
π UPDATABLE OPTIONS π
the following options can optionally have a :u (or :update) suffix, like -q:u Q, to apply only to input files appearing after the option. so like, "this rule applies from here onward bestie":
-q,--qcolor Qβ quality for color in0..100where100is lossless.--qalpha Qβ quality for alpha in0..100where100is lossless.--qgain-map Qβ quality for the gain map in0..100where100is lossless.--tilerowslog2 Rβ log2 of the number of tile rows, in0..6. (Default:0). if specified, switch to manual tiling.--tilecolslog2 Cβ log2 of the number of tile columns, in0..6. (Default:0). if specified, switch to manual tiling.--autotilingβ set--tilerowslog2and--tilecolslog2automatically. if specified, switch to automatic tiling.avifencstarts in automatic tiling mode. β¨--scaling-mode N[/D]β set frame (layer) scaling mode as the given fraction. if omitted, the denominator defaults to1. (Default:1/1).--duration Dβ frame durations (in timescales) (default:1). this option always applies to following inputs, with or without the:usuffix. π-a,--advanced KEY[=VALUE]β pass an advanced, codec-specific key/value string pair directly to the codec.avifencwill warn on any not used by the codec.
π AOM-SPECIFIC ADVANCED OPTIONS π
okay this is the deep lore, stay with me:
<key>=<value>applies to both the color (YUV) planes and the alpha plane (if present).color:<key>=<value>orc:<key>=<value>applies only to the color (YUV) planes.alpha:<key>=<value>ora:<key>=<value>applies only to the alpha plane (if present). since the alpha plane is encoded as a monochrome image, the options that refer to the chroma planes, such asenable-chroma-deltaq=B, should not be used with the alpha plane. in addition, the film grain options are unlikely to make sense for the alpha plane. π
when used with libaom 3.0.0 or later, any key-value pairs supported by the aom_codec_set_option() function can be used. when used with libaom 2.0.x or older, the following key-value pairs can be used:
aq-mode=Mβ adaptive quantization mode.0=off (default),1=variance,2=complexity,3=cyclic refresh.cq-level=Qβ constant/constrained quality level in0..63,end-usagemust be set tocqorq.enable-chroma-deltaq=Bβ enable delta quantization in chroma planes.0=disable (default),1=enable.end-usage=MODEβ rate control mode, one ofvbr,cbr,cq, orq.sharpness=Sβ bias towards block sharpness in rate-distortion optimization of transform coefficients, in0..7. (Default:0).tune=METRICβ tune the encoder for a distortion metric, one ofpsnrorssim. (Default:psnr).film-grain-test=TESTβ film grain test vectors in0..16.0=none (default),1=test1,2=test2, ...16=test16.film-grain-table=FILENAMEβ path to file containing film grain parameters.
β EXAMPLES β
compress a PNG file to an AVIF file:
$ avifenc input.png output.avif
look at her go. she ate and left no crumbs. π
π REPORTING BUGS π
bugs can be reported on GitHub at:
https://github.com/AOMediaCodec/libavif/issues
(be nice, they're doing their best π«Ά)
π SEE ALSO π
that's the whole page, bestie. you're officially literate in avifenc now. no cap. πβ¨
this page ships with libavif 1.4.2, dated 2025-04-11. mwah. π
π¦ where this page comes from
- ubuntu stonking: libavif-bin 1.4.2-1ubuntu1 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms