avifenc
Encode images to AVIF (AV1 Image File Format)
TLDR
Convert a specific PNG image to AVIF
Encode with a specific speed (6=default, 0=slowest, and 10=fastest)
SYNOPSIS
avifenc [options] <input> <output.avif>
PARAMETERS
-h, --help
Show help message and exit
-j N, --jobs N
Number of threads to use (default: 1)
--speed N
Encoding speed (0=slowest/best, 10=fastest; default from preset)
--preset N
Quality/speed preset (0=best/slowest, 10=fastest; default: 7)
--min N
Minimum quantizer (0-63; default: 0)
--max N
Maximum quantizer (0-63; default: 63)
-q Q, --quality Q
Quality level (0-100; default: 50)
--yuv FORMAT
YUV format (YUV400, YUV420, YUV422, YUV444; default: YUV420)
--rgb-psnr PSNR
Stop when RGB PSNR reaches this value
--ignore-icc
Ignore input ICC color profile
-s, --silent
Suppress non-error output
DESCRIPTION
avifenc is a command-line tool from the libavif library for encoding images into the AVIF (AV1 Image File Format) container. AVIF offers superior compression compared to JPEG or PNG while maintaining high quality, leveraging the AV1 video codec for still images.
It supports input formats like PNG, JPEG, and Y4M (YUV video), converting them to AVIF with customizable quality, speed, and quantization settings. Key features include multi-threaded encoding for performance, PSNR-based quality control, and advanced YUV subsampling options (YUV400, YUV420, YUV422, YUV444).
Ideal for web optimization, avifenc balances file size and visual fidelity. Use presets for quick starts or fine-tune with quantizers and quality sliders. Output files are suitable for browsers supporting AVIF, reducing bandwidth without sacrificing detail.
CAVEATS
Requires libavif and AV1 codec support (aomenc, rav1e). Large inputs may consume high memory. Not all inputs preserve alpha perfectly. Browser support varies.
INPUT FORMATS
Supports PNG, JPEG, Y4M. Use --input-format if auto-detection fails.
EXAMPLES
avifenc -j 4 input.png output.avif
avifenc --preset 4 --quality 80 photo.jpg photo.avif
HISTORY
Developed as part of libavif (Netflix, 2020+), implementing AVIF spec from Alliance for Open Media. Gained traction with AV1/AVIF adoption in Chrome/Firefox.


