CLI 目录 横向对比 FCRS-1.0 标准 /llms.txt
← 返回 CLI 目录

avifenc

$ avifenc 基金会 低风险
Alliance for Open Media · AI 能力与音视频 · BSD-2-Clause · macos / linux / windows

avifenc 是开放媒体联盟(AOMedia)推出的参考 CLI,用于将 PNG、JPEG 和 Y4M 输入编码为高压缩率 AVIF 图像(支持 8/10/12 位、无损或有损)。它与负责解码和检查的 avifdec 同包发布,并支持 --no-overwrite 与 --stdin 管道。

FCRS-1.0 综合评分
83 /100
良好 (Good)
高置信度 (实测)
零摩擦安装命令
brew install libavif
CLI vs MCP 选型建议 仅 CLI 可用

高 CPU 消耗的 AVIF 编码与 avifdec --info 信息检查直接在本地核心运行,无需 MCP。

Agent 友好度体检单

本地探针实测证据
— 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
✓ 支持 NO_COLOR
✓ 自省/Schema 发现
— 官方 SKILL.md
实测版本
Version: 1.4.0 (dav1d [dec]:1.5.3, aom [enc/dec]:3.13.1)
冷启动耗时
22 ms
退出码 (help / 非法参数)
0 / 1
NO_COLOR 无色码污染 / 无 TTY 不挂起
Yes / Safe
抓取的 --help 摘要
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 六维评分拆解

Agent 友好度 18 / 25

整洁的非交互式 GNU 风格参数,支持 --no-overwrite、--stdin 与 --help,但缺少 --quiet 与 JSON 输出。

  • Supports --no-overwrite, --stdin, and -q/-s tuning
  • No JSON output or --dry-run
安全与权限边界 22 / 25

显式提供 --no-overwrite 保护已有文件,且绝不修改源图像。

  • --no-overwrite fails cleanly instead of replacing existing output files
安装与运行摩擦 13 / 15

可通过 brew install libavif 与 Linux 包安装,但不同发行版内置的 AV1 编码后端(aom/svt-av1)略有差异。

  • Packaged via Homebrew libavif and GitHub releases
能力覆盖与边际价值 13 / 15

参考级 AVIF 实现,支持 10/12 位 HDR、Alpha 通道、--sharpyuv 与 --target-size。

  • Full AVIF feature coverage including --lossless and --target-size
维护与来源背书 9 / 10

开放媒体联盟(AOMediaCodec/libavif)官方参考仓库,采用 BSD-2-Clause 协议。

  • Maintained by Alliance for Open Media
文档与可验证性 8 / 10

avifenc --help 输出详尽,清晰标注默认值、范围(0..100)与 YUV 处理规则。

  • Comprehensive built-in avifenc -h help text

安全边界、鉴权与放权指南

鉴权方式
无需鉴权
凭证存储位置

无需凭据;仅处理本地图像文件或标准输入。

潜在副作用
只读查询 本地写入
费用与配额提示

免费,开放媒体联盟出品的 BSD-2-Clause 开源二进制工具。

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# 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 高频安全命令配方

只读查询(安全推荐)

检查 AVIF 尺寸、位深与色彩元数据
avifdec --info image.avif

使用 libavif 随附的 avifdec 打印 AVIF 属性,不解码像素也不写入文件。

检查 avifenc 版本与编码后端
avifenc --version

报告 libavif 版本及已编译的 AV1 编码器后端,不触碰任何文件。

受控写入与预演

安全将 JPEG 编码为 AVIF 且不覆盖已有文件
avifenc --no-overwrite -q 75 -s 6 input.jpg output.avif

以质量 75、速度 6 将 input.jpg 编码为 output.avif,若目标已存在则安全报错退出。

核心优势

  • + --no-overwrite 可有效防止意外覆盖已有 .avif 资源。
  • + 支持 --target-size 目标字节预算、--lossless 与 --stdin 管道。

注意事项与踩坑点

  • ! 缺少 --quiet 静默标志,默认会向标准输出打印编码摘要。
  • ! 过低的 -s 速度值(0–2)在大分辨率图像上可能导致长时间 CPU 阻塞。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI