ffmpeg-mcp
An MCP server that exposes FFmpeg as structured tools for AI-agent-driven video editing, enabling operations like trimming, subtitling, and transcoding via natural language.
README
ffmpeg-mcp
An MCP (Model Context Protocol) server for AI-agent-driven video editing, powered by FFmpeg.
It exposes FFmpeg as a set of safe, structured tools that an AI agent (Claude Desktop, Claude Code, or any MCP client) can call in natural language — "trim the first 10 seconds", "burn these subtitles in", "transcribe the speech to an SRT", "cut the silent parts".
The server shells out to the installed ffmpeg/ffprobe binaries; there is no FFmpeg source build required.
Requirements
- Node.js ≥ 18
- FFmpeg + ffprobe on your
PATH(or setFFMPEG_PATH/FFPROBE_PATH). A full build is recommended (libass, NVENC, whisper). Tested with FFmpeg 8.1.
Install & build
npm install
npm run build
Tools
| Tool | What it does |
|---|---|
probe |
Inspect a file: duration, format, bitrate, streams (codec/resolution/fps/channels). |
trim |
Cut a segment by start + end/duration. Stream-copy (fast) or re-encode (frame-accurate). |
concat |
Join clips. copy (same codecs) or reencode (normalize). |
convert |
Transcode: format/codec/resolution/fps/bitrate. Supports NVENC (h264-nvenc, …). |
extract_audio |
Pull the audio track out (mp3/aac/wav/flac/opus). |
thumbnail |
Single frame at a time, or frames every N seconds. |
burn_subtitles |
Hard-burn an .srt/.ass file onto the video. |
overlay |
Watermark image / picture-in-picture, with position, scale, opacity. |
auto_subtitle |
Speech → subtitles via FFmpeg's whisper filter (needs a model — see below). |
cut_silence |
Detect silent spans and remove them. |
All tools resolve relative paths against the working directory (or FFMPEG_MCP_WORKDIR), validate that inputs exist, and refuse to overwrite outputs unless you pass overwrite: true.
Configuration (environment variables)
| Var | Purpose |
|---|---|
FFMPEG_PATH / FFPROBE_PATH |
Full path to the binaries if not on PATH. |
FFMPEG_MCP_WORKDIR |
Base directory for resolving relative paths. |
WHISPER_MODEL_PATH |
Default whisper.cpp model file for auto_subtitle. |
Whisper model (for auto_subtitle)
The whisper filter needs a ggml-*.bin model (not bundled — it's large). Fetch one with the helper script:
npm run download-model # downloads ggml-base.bin into ./models
npm run download-model -- small # or another size: tiny | base | small | medium | large
Then point the server at it via WHISPER_MODEL_PATH (see registration below), or pass model per call.
You can also download manually from
huggingface.co/ggerganov/whisper.cpp.
Register with Claude
Claude Code
claude mcp add ffmpeg -- node /absolute/path/to/ffmpeg-mcp/dist/index.js
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"ffmpeg": {
"command": "node",
"args": ["C:\\absolute\\path\\to\\ffmpeg-mcp\\dist\\index.js"],
"env": {
"WHISPER_MODEL_PATH": "C:\\models\\ggml-base.bin"
}
}
}
}
Develop & verify
npm test # unit + real-ffmpeg E2E tests (fixtures generated by ffmpeg)
npm run inspect # launch the MCP Inspector against the server
The Inspector lets you call each tool interactively and see the JSON results.
Project structure
src/
index.ts # MCP server bootstrap (stdio), tool registration
ffmpeg/
locate.ts # resolve ffmpeg/ffprobe (PATH or env override)
runner.ts # spawn wrapper: args-array (no shell), progress, errors
probe.ts # ffprobe -> structured metadata
lib/
paths.ts # input/output path validation & overwrite policy
schema.ts # shared zod fragments (timecode, resolution)
tools/ # one file per MCP tool + registry (index.ts)
test/ # unit tests + real-ffmpeg E2E (fixtures via lavfi)
scripts/
download-model.mjs # fetch a whisper ggml model into ./models
Design notes
- No shell interpolation — ffmpeg is always invoked with an argument array, so user-supplied paths cannot inject commands.
- Path safety — inputs must exist; outputs never overwrite unless
overwrite: true. - No FFmpeg build — the server calls the installed binaries; nothing is compiled.
Contributing
Issues and PRs are welcome. Please run npm run build and npm test before opening a PR.
License
MIT © Sohn EuiJin
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。