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

FFmpeg

$ ffmpeg 基金会 中风险
FFmpeg Project · AI 能力与音视频 · LGPL-2.1-or-later / GPL-2.0-or-later · macos / linux / windows

ffmpeg 支持几乎所有音视频格式的转码、裁剪、缩放、抽帧/抽音频与无损重封装。Agent 调用时务必传入 -y(或 -n)与 -loglevel error(或 -nostats),防止交互式覆盖询问或进度日志阻塞与刷屏。

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

确定性的本地媒体预处理工具(ffmpeg -nostdin -loglevel error),适合在调用 Whisper 或视觉大模型前完成切片、重采样与关键帧抽取。

Agent 友好度体检单

本地探针实测证据
— 原生 JSON 输出
— 字段裁剪
✓ 无头非交互
— 支持 Dry-Run
— 只读模式开关
✓ 支持 NO_COLOR
— 自省/Schema 发现
— 官方 SKILL.md
实测版本
ffmpeg version 8.1 Copyright (c) 2000-2026 the FFmpeg developers
冷启动耗时
20 ms
退出码 (help / 非法参数)
0 / 8
NO_COLOR 无色码污染 / 无 TTY 不挂起
Yes / Safe
抓取的 --help 摘要
Universal media converter
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Getting help:
    -h      -- print basic options
    -h long -- print more options
    -h full -- print all options (including all format and codec specific options, very long)
    -h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsf/protocol
    See man ffmpeg for detailed description of the options.

Per-stream options can be followed by :<stream_spec> to apply that option to specific streams only. <stream_spec> can be a stream index, or v/a/s for video/audio/subtitle (see manual for full syntax).

Print help / information / capabilities:
-L                  show license
-license            show license
-h <topic>          show help
-version            show version
-muxers             show available muxers
-demuxers           show available demuxers
-devices            show available devices
-decoders           show available decoders
-encoders           show available encoders
-filters            show available filters
-pix_fmts           show available pixel formats
-layouts            show standard channel layouts
-sample_fmts        show available audio sample formats

Global options (affect whole program instead of just one file):
-v <loglevel>       set logging level
-y                  overwrite output files
-n                  never overwrite output files
-print_graphs       print execution graph data to stderr
-print_graphs_file <filename>  write execution graph data to the specified file
-print_graphs_format <format>  set the output printing format (available formats are: default, compact, csv, flat, ini, json, xml, mermaid, mermaidhtml)
-stats              print progress report during encoding

Per-file options (input and output):
-f <fmt>            force container format (auto-detected otherwise)
-t <duration>       stop transcoding after specified duration
-to <time_stop>     stop transcoding after specified time is reached
-ss <time_off>      start transcoding at specified time


Per-file options (output-only):
-metadata[:<spec>] <key=value>  add metadata

Per-stream options:
-c[:<stream_spec>] <codec>  select encoder/decoder ('copy' to copy stream without reencoding)
-filter[:<stream_spec>] <filter_graph>  apply specified filters to audio/video

Video options:
-r[:<stream_spec>] <rate>  override input framerate/convert to given output framerate (Hz value, fraction or abbreviation)
-aspect[:<

FCRS-1.0 六维评分拆解

Agent 友好度 18 / 25

配合 -nostdin、-y/-n 与 -loglevel error 可干净脚本化运行,但默认运行会打印冗长构建横幅与进度 stderr,且目标存在时会交互阻塞。

  • Needs -nostdin -y/-n -loglevel error to avoid prompts and noisy stderr
安全与权限边界 21 / 25

纯本地处理为主;-y 会静默覆盖已有文件,传入远程流 URL 时则会拉取外部媒体。

  • Local transcoding; -y overwrites destination files without confirmation
安装与运行摩擦 14 / 15

覆盖 macOS(brew)、Linux 软件源与静态编译包。

  • Universally packaged on macOS, Linux, Windows
能力覆盖与边际价值 15 / 15

音视频编解码、滤镜处理与多模态预处理的无可替代工具。

  • Handles virtually every codec, container, and filtergraph
维护与来源背书 8 / 10

基础开源项目 FFmpeg(LGPL/GPL 协议)。

  • Official FFmpeg Project
文档与可验证性 7 / 10

官方文档极其庞大,但复杂滤镜语法与 -i 前后参数顺序容易出错。

  • Official documentation at ffmpeg.org/ffmpeg.html

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

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

无需凭据;处理本地媒体文件或显式传入的流地址。

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

免费开源(LGPL-2.1+ / GPL-2.0+ 协议)C 二进制。

可复制到 CLAUDE.md / AGENTS.md 的安全护栏
# FFmpeg Agent Rules
- Always pass `-nostdin`, `-loglevel error` (or `-nostats`), and either `-n` (never overwrite) or explicit `-y` so `ffmpeg` never blocks waiting on `Overwrite? [y/N]` or stdin `q`.
- Use `ffprobe` for JSON metadata inspection rather than parsing `ffmpeg -i` stderr.

Agent 高频安全命令配方

只读查询(安全推荐)

不写文件直接检测音频静音片段
ffmpeg -nostdin -hide_banner -i input.mp4 -af silencedetect=noise=-30dB:d=0.5 -f null -

通过 -f null - 分析静音区间而不生成任何输出媒体文件。

受控写入与预演

提取 16 kHz 单声道 WAV 供语音识别使用
ffmpeg -nostdin -y -loglevel error -i input.mp4 -vn -ac 1 -ar 16000 audio.wav

剥离视频流(-vn)导出 16 kHz 单声道音频,跳过覆盖确认(-y)并抑制统计噪音。

核心优势

  • + 几乎覆盖全部音视频编解码器、滤镜与容器格式。
  • + 为 Whisper 或视觉大模型预处理音频重采样、视频降采样与抽帧的核心工具。

注意事项与踩坑点

  • ! 未加 -y 或 -n 时遇到同名输出会交互询问 [y/N],未加 -nostdin 会监听标准输入。
  • ! 未设置 -hide_banner -loglevel error 时 stderr 日志非常嘈杂。

已验证兼容的 Agent 宿主

Claude Code Codex CLI Gemini CLI