MediaTofuFFmpeg for AI agents
FFmpeg for AI agents
Agents that cannot ship an FFmpeg binary can call MediaTofu over HTTPS: POST /v1/run with a JSON ffmpeg_command, or POST /v1/tools/<name> for compress, convert, trim, resize, thumbnail, extract-audio, gif, or probe. Each job gets a fresh container with no internet and no secrets. Agents that support MCP can connect to https://mcp.mediatofu.com/mcp instead.
Example
curl "https://api.mediatofu.com/v1/run?wait=25" \
-H "Authorization: Bearer $MEDIATOFU_KEY" \
-d '{
"input_files": { "in": "https://example.com/clip.mov" },
"output_files": { "out": "small.mp4" },
"ffmpeg_command": "-i {{in}} -vf scale=1280:-2 -crf 26 {{out}}"
}'Same contract for humans and agents. MCP clients can use the hosted server at https://mcp.mediatofu.com/mcp instead.
What to put in the agent prompt
Create a job with POST https://api.mediatofu.com/v1/run (or a tools URL), Authorization: Bearer YOUR_KEY, JSON body with input_files/output_files/ffmpeg_command or tool fields. For short work add ?wait=25 so the result can come back in the same request. Otherwise poll GET /v1/jobs/:id until status is terminal, then use the output URL.
Safety model agents can rely on
Args are not a free shell: there is never a shell, and a command can only touch the files you declared. URLs inside ffmpeg_command and options that read or write other files are rejected before anything runs.
Pricing
Free: $0, 5 minutes of compute a month, jobs up to 1 minute, inputs up to 50 MB, 1 job at a time. Pay per use: $0.024 per compute minute, billed by the second, no monthly fee. Jobs up to 5 minutes, inputs up to 2 GB, 3 jobs at once. Starter: $9/month includes 600 minutes, then $0.015 a minute. Jobs up to 1 minute, inputs up to 500 MB. Pro: $19/month includes 1,500 minutes, then $0.0127 a minute. Jobs up to 10 minutes, inputs up to 2 GB.
Questions
Is there an MCP server?
Yes. Connect to https://mcp.mediatofu.com/mcp with an API key as a Bearer token, or sign in with OAuth from a client that supports connectors. It can run raw FFmpeg commands and the eight simple tools, check jobs, and read your usage. Setup is at https://docs.mediatofu.com/mcp.
How do I get the result?
Add ?wait=25 and a short job can return its result in the same request. Short jobs typically take about 5–15 seconds including container start. 25 seconds is the longest wait. Otherwise you get a job id to check with GET /v1/jobs/:id, or on a paid plan you can pass webhook_url and we POST the result to you.
Do failed jobs cost anything?
A failure on our side is never charged, and neither is an input we couldn't download or one over your plan's size limit. If your command runs and FFmpeg exits with an error, or the job reaches your plan's length limit, the seconds it used count.
How is each job isolated?
Every job gets a fresh container with no internet access and no secrets. Your input files are copied in, FFmpeg runs, outputs are saved, and the container is destroyed when the job ends.
What does MediaTofu cost?
Free: $0, 5 minutes of compute a month, jobs up to 1 minute, inputs up to 50 MB, 1 job at a time. Pay per use: $0.024 per compute minute, billed by the second, no monthly fee. Jobs up to 5 minutes, inputs up to 2 GB, 3 jobs at once. Starter: $9/month includes 600 minutes, then $0.015 a minute. Jobs up to 1 minute, inputs up to 500 MB. Pro: $19/month includes 1,500 minutes, then $0.0127 a minute. Jobs up to 10 minutes, inputs up to 2 GB.