FFmpeg for AI agents
FFmpeg for AI agents: inspect media with ffprobe, convert, trim, resize, and extract audio, with flags that stop silent overwrites and stuck prompts.
What FFmpeg does for an agent
FFmpeg is the standard open-source toolkit for recording, converting, and streaming audio and video. The ffmpeg command transcodes and edits media, and ffprobe reports a file's streams, codecs, and duration.
Agents can drive it entirely from flags, but two defaults matter: ffmpeg asks before overwriting files and reads from standard input, either of which can stall a non-interactive run.
Official site: ffmpeg.org
Install FFmpeg
The install commands from the official docs. Check it worked with ffmpeg -version.
brew install ffmpeg
sudo apt-get install ffmpeg
Signing in FFmpeg for an agent
No sign-in. FFmpeg works on local files and URLs it is given.
What agents use FFmpeg for
Example commands with placeholder names. Swap in your own project, app, or file names.
Inspect a file as JSON
ffprobe -v error -show_format -show_streams -of json input.mp4
Convert to H.264 MP4
ffmpeg -nostdin -n -i input.mov -c:v libx264 -crf 23 -c:a aac output.mp4
Cut a 30-second clip without re-encoding
ffmpeg -nostdin -n -ss 00:00:10 -i input.mp4 -t 30 -c copy clip.mp4
Extract the audio as MP3
ffmpeg -nostdin -n -i input.mp4 -vn -c:a libmp3lame -q:a 2 audio.mp3
Grab one frame as a thumbnail
ffmpeg -nostdin -n -ss 5 -i input.mp4 -frames:v 1 thumb.jpg
Safety rules for agents
Safe to run without asking
ffprobe ...ffmpeg ... writing to a new file name with -n
Ask a human first
ffmpeg -y (overwrites without asking)batch jobs that replace originalsstreaming to a remote URL
- Pass -n so ffmpeg never overwrites an existing file, and write to new file names.
- Pass -nostdin so ffmpeg does not wait on standard input in a non-interactive shell.
- Run ffprobe first to check codecs and duration before choosing settings.
- Never delete or replace source files unless asked.
AGENTS.md or CLAUDE.md snippet
Paste this into the instruction file your agent reads at the start of every session, then adjust the rules to your setup.
## FFmpeg (ffmpeg) Use `ffmpeg` for inspecting, converting, trimming, and resizing video and audio files. - Check it is installed with `ffmpeg -version`. If it is missing, ask before installing it. - Auth: none needed. - Run without asking (read-only): `ffprobe ...`, `ffmpeg ... writing to a new file name with -n`. - Ask a human first (changes or deletes things): `ffmpeg -y (overwrites without asking)`, `batch jobs that replace originals`, `streaming to a remote URL`. - Pass -n so ffmpeg never overwrites an existing file, and write to new file names. - Pass -nostdin so ffmpeg does not wait on standard input in a non-interactive shell. - Run ffprobe first to check codecs and duration before choosing settings. - Never delete or replace source files unless asked. - Prefer JSON output where the command supports it, and keep output short.
FFmpeg or an MCP server?
No official MCP server. FFmpeg has no official MCP server; community servers wrap common operations. A shell-based agent can run ffmpeg directly with more control.
Rule of thumb: in a terminal agent that a human has signed in, the CLI is usually faster and cheaper in context. In a chat client without a shell, or when you want a fixed set of typed tools, use an MCP server.
Other Media tools
FFmpeg questions
How do I install FFmpeg?
Homebrew: brew install ffmpeg. Other official options: Debian or Ubuntu. Check the install with ffmpeg -version, and see the FFmpeg project docs for other platforms.
How does an AI agent authenticate FFmpeg?
No sign-in. FFmpeg works on local files and URLs it is given. There is nothing to set up: an agent can use it as soon as ffmpeg -version succeeds.
Which FFmpeg commands are safe for an agent to run?
Commands that only read state are safe to run without asking: ffprobe ...; ffmpeg ... writing to a new file name with -n. Ask a human before anything that changes or deletes something: ffmpeg -y (overwrites without asking); batch jobs that replace originals; streaming to a remote URL.
Is there an MCP server for FFmpeg?
FFmpeg has no official MCP server; community servers wrap common operations. A shell-based agent can run ffmpeg directly with more control.