avifenc
$ avifenc Foundation Low Riskavifenc is the Alliance for Open Media's reference CLI for encoding PNG, JPEG, and Y4M inputs into high-efficiency AVIF images (8/10/12-bit, lossless, or lossy). It ships alongside avifdec for decoding and inspection, and includes --no-overwrite and --stdin pipeline support.
brew install libavif CPU-intensive AVIF encoding and avifdec --info inspection execute directly on local cores without MCP.
Agent-Readiness Checklist
Local Probe EvidenceCaptured --help excerpt
Syntax: avifenc [options] input.[jpg|jpeg|png|y4m] output.avif
Standard options:
-h,--help : Show syntax help (this page)
-V,--version : Show the version number
Basic options:
-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
-s,--speed S : Encoder speed in 0..10 where 0 is the slowest, 10 is the fastest. Or 'default' or 'd' for codec internal defaults. (Default: 6)
Advanced options:
-j,--jobs J : Number of jobs (worker threads), or 'all' to potentially use as many cores as possible. (Default: all)
--no-overwrite : Never overwrite existing output file
-o,--output FILENAME : Instead of using the last filename given as output, use this filename
-l,--lossless : Set all defaults to encode losslessly, and emit warnings when settings/input don't allow for it
-d,--depth D[,Dextension] : D is the output bit depth per channel. D must be 8, 10 or 12. (JPEG/PNG only; y4m or stdin: bit depth is retained)
If specified, Dextension adds a hidden encoded image of Dextension 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 or stdin (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
-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 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 FORMAT : File format of the input data. One of: jpeg/png/y4m/auto. (Default: auto, except for stdin where auto is not supported FCRS-1.0 6-Dimension Breakdown
Clean non-interactive GNU-style options with --no-overwrite, --stdin, and --help, though it lacks --quiet and JSON output.
- Supports
--no-overwrite,--stdin, and-q/-stuning - No JSON output or
--dry-run
Explicit --no-overwrite guard protects existing files and input images are never altered.
--no-overwritefails cleanly instead of replacing existing output files
Available via brew install libavif and Linux packages, though distro versions vary on bundled AV1 encoders (aom/svt-av1).
- Packaged via Homebrew
libavifand GitHub releases
Reference AVIF implementation supporting 10/12-bit HDR, alpha channels, --sharpyuv, and --target-size.
- Full AVIF feature coverage including
--losslessand--target-size
Official Alliance for Open Media (AOMediaCodec/libavif) reference repository under BSD-2-Clause.
- Maintained by Alliance for Open Media
Detailed avifenc --help output documents defaults, ranges (0..100), and YUV behavior clearly.
- Comprehensive built-in
avifenc -hhelp text
Security, Auth & Guardrails
None required; operates on local image files or stdin.
Free BSD-2-Clause open-source binary from Alliance for Open Media.
# avifenc Agent Rules - Always pass `--no-overwrite` when generating `output.avif` to avoid clobbering existing assets. - Set explicit speed (`-s 6` for balanced, `-s 8` for fast previews) because `-s 0` can take minutes per image.
Agent-Ready Command Recipes
Safe Read-Only Queries
avifdec --info image.avif
Uses companion avifdec from libavif to print AVIF properties without decoding or writing pixels.
avifenc --version
Reports libavif version and compiled AV1 encoder backends without touching files.
Controlled Writes & Previews
avifenc --no-overwrite -q 75 -s 6 input.jpg output.avif
Encodes input.jpg at quality 75 and speed 6 into output.avif, failing safely if target exists.
Strengths for Agents
- +
--no-overwriteprevents accidental overwriting of existing.avifassets. - + Supports
--target-sizebyte budgets,--lossless, and--stdinpipelines.
Caveats & Pitfalls
- ! Lacks a
--quietflag and outputs encoding summary lines to stdout. - ! Low
-sspeed values (0–2) can cause long CPU-bound timeouts on high-res images.