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, in 0..100, where 100 is lossless. glow-up scale. πŸ’–
  • --qalpha Q β€” quality for alpha, in 0..100, where 100 is lossless. same energy, but for the see-through bits. 🌈
  • -s, --speed S β€” encoder speed, 0..10, where 0 is the slowest and 10 is the fastest. or you can pass default or d to 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), or all to 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] β€” D is the output bit depth per channel. D must be 8, 10 or 12. (JPEG/PNG only; for y4m: D must match the input bit depth, and EXTENSION is unsupported). if you specify it, EXTENSION adds a hidden encoded image of EXTENSION bit depth in the same file as the primary image, to reach 16-bit depth at decoding. see avifSampleTransformRecipe for the supported combinations (8,8 and 12,4 and 12,8). πŸŽ€
  • -y, --yuv FORMAT β€” output format, one of auto (default), 444, 422, 420 or 400. ignored for y4m (y4m format is retained). for JPEG, auto honors the JPEG's internal format, if possible. for grayscale PNG, auto defaults to 400. for all other cases, auto defaults to 444. 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 not 420.
  • --stdin β€” read input from stdin instead of file paths. no other input is allowed. the input format is assumed to be y4m unless –input-format is 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 where auto is not supported and the default is y4m). πŸ™ˆ
  • --cicp, --nclx P/T/M β€” set CICP values (nclx colr box) (3 raw numbers, use -r to set range flag). 🎨
    • P = color primaries
    • T = transfer characteristics
    • M = matrix coefficients use 2 for any you wish to leave unspecified.
  • -r, --range RANGE β€” YUV range, one of limited or l, full or f. (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 most 4 layers can be encoded. ⭐
  • -g, --grid MxN β€” encode a single-image grid AVIF with M cols & N rows. either supply MxN identical W/H/D images, or a single image that can be evenly split into the MxN grid 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 --help or --version for the available codecs). default is auto-selected from the available codecs. 🫢 possible values are:
    • aom
    • rav1e
    • svt
  • --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 are 1 timescale in length, this is equivalent to frames per second. (Default: 30). if neither duration nor timescale are set, avifenc will attempt to use the framerate stored in a y4m header, if present. ⏱️
  • -k, --keyframe INTERVAL β€” maximum keyframe interval for image sequences (any set of INTERVAL consecutive frames will have at least one keyframe). set to 0 to 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, in 0..100, where 100 is lossless. πŸ’–
  • --pasp H,V β€” add pasp property (aspect ratio). H = horizontal spacing, V = vertical spacing.
  • --crop CROPX,CROPY,CROPW,CROPH β€” add clap property (clean aperture), but calculated from a crop rectangle. βœ‚οΈ
  • --clap WN,WD,HN,HD,HON,HOD,VON,VOD β€” add clap property (clean aperture). Width, Height, HOffset, VOffset (in numerator/denominator pairs).
  • --irot ANGLE β€” add irot property (rotation) in 0..3. makes a (90 * ANGLE) degree rotation anti-clockwise. πŸ”„
  • --imir AXIS β€” add imir property (mirroring). 0=top-to-bottom, 1=left-to-right. πŸͺž
  • --clli MaxCLL,MaxPALL β€” add clli property (content light level information).
  • --repetition-count N β€” number of times an animated image sequence will be repeated, or infinite for 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 in 0..100 where 100 is lossless.
  • --qalpha Q β€” quality for alpha in 0..100 where 100 is lossless.
  • --qgain-map Q β€” quality for the gain map in 0..100 where 100 is lossless.
  • --tilerowslog2 R β€” log2 of the number of tile rows, in 0..6. (Default: 0). if specified, switch to manual tiling.
  • --tilecolslog2 C β€” log2 of the number of tile columns, in 0..6. (Default: 0). if specified, switch to manual tiling.
  • --autotiling β€” set --tilerowslog2 and --tilecolslog2 automatically. if specified, switch to automatic tiling. avifenc starts in automatic tiling mode. ✨
  • --scaling-mode N[/D] β€” set frame (layer) scaling mode as the given fraction. if omitted, the denominator defaults to 1. (Default: 1/1).
  • --duration D β€” frame durations (in timescales) (default: 1). this option always applies to following inputs, with or without the :u suffix. πŸ‘‘
  • -a, --advanced KEY[=VALUE] β€” pass an advanced, codec-specific key/value string pair directly to the codec. avifenc will warn on any not used by the codec.

πŸ’œ AOM-SPECIFIC ADVANCED OPTIONS πŸ’œ

okay this is the deep lore, stay with me:

  1. <key>=<value> applies to both the color (YUV) planes and the alpha plane (if present).
  2. color:<key>=<value> or c:<key>=<value> applies only to the color (YUV) planes.
  3. alpha:<key>=<value> or a:<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 as enable-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 in 0..63, end-usage must be set to cq or q.
  • enable-chroma-deltaq=B β€” enable delta quantization in chroma planes. 0=disable (default), 1=enable.
  • end-usage=MODE β€” rate control mode, one of vbr, cbr, cq, or q.
  • sharpness=S β€” bias towards block sharpness in rate-distortion optimization of transform coefficients, in 0..7. (Default: 0).
  • tune=METRIC β€” tune the encoder for a distortion metric, one of psnr or ssim. (Default: psnr).
  • film-grain-test=TEST β€” film grain test vectors in 0..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 πŸ‘€

avifdec(1)


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