LinuxCommandLibrary

cavif

Convert images to AVIF format

TLDR

Convert a JPEG file to AVIF, saving it to file.avif

$ cavif [path/to/image.jpg]
copy

Adjust the image quality and convert a PNG file to AVIF
$ cavif --quality [1..100] [path/to/image.png]
copy

Specify the output location
$ cavif [path/to/image.jpg] --output [path/to/output.avif]
copy

Overwrite the destination file if it already exists
$ cavif --overwrite [path/to/image.jpg]
copy

SYNOPSIS

cavif [options...] <input> [<output.avif>]

PARAMETERS

-q, --quality=<Q>
    Quantizer value (0-63, lower=better quality, default ~50)

--preset=<0-10>
    Quality/speed preset (0=slowest/best, 10=fastest/worst, default=7)

--speed=<0-10>
    Encoding speed (0=slowest/best, 10=fastest, default=preset)

--min-q=<Q>
    Min quantizer for two-pass mode (0-63)

--max-q=<Q>
    Max quantizer for two-pass mode (0-63)

--yuv=<fmt>
    YUV format (400/411/420/422/444, default=420)

--jobs=<N>
    Parallel jobs (0=auto-detect, default=1)

-v, --verbose
    Enable verbose logging

-h, --help
    Display help

--version
    Print version info

--quiet
    Suppress progress output

DESCRIPTION

cavif is a lightweight command-line tool from the libavif project for converting raster images to the AVIF (AV1 Image File Format). AVIF offers dramatically better compression than JPEG or PNG while maintaining quality, ideal for web, apps, and archives.

It accepts PNG (lossless/lossy, with alpha) and JPEG inputs, outputting single AVIF files. Encoding uses AV1 video codecs via backends like libaom, rav1e, or SVT-AV1. Features include:
• Quantizer-based quality control (-q 0-63, lower=better).
• Presets (0=slowest/best to 10=fastest).
• Two-pass mode (--min-q/--max-q) for precise bitrate targeting.
• YUV subsampling options, multi-threading (--jobs), and alpha separation.

Encoding prioritizes quality over speed by default but is tunable. Progress is shown unless --quiet. No decoding or editing; purely an encoder. Install via package managers (e.g., apt install libavif-bin) on Linux.

CAVEATS

Slow encoding times, especially at high quality; limited to PNG/JPEG input; AVIF support varies by browser/app; requires libavif >=0.9 with AV1 encoder backend.

EXAMPLES

cavif input.png output.avif (default settings)
cavif -q 30 --preset 3 --jobs=0 input.jpg out.avif (high quality, auto-threads)
cavif --min-q=20 --max-q=40 input.png out.avif (two-pass)

INPUT/OUTPUT

Input: PNG (alpha supported), JPEG.
Output: AVIF only (.avif extension recommended). Alpha-mode splits to separate files (--alpha-output).

HISTORY

Developed within Netflix's libavif project (2020), providing AVIF encode/decode in C. cavif added as demo tool; matured in versions 0.9+ with multi-encoder support. Now in major distros.

SEE ALSO

avifenc(1), cwebp(1), pngquant(1), rav1e(1)

Copied to clipboard