How to Run FFmpeg Commands in n8n Workflows
Compress, trim and make thumbnails in n8n without installing FFmpeg on your server: one HTTP Request node, a webhook for the result, or an AI Agent with MCP.
n8n is good at moving media between services, but it is not a good place to encode video. To run FFmpeg from n8n without installing it, send the FFmpeg arguments to the Xora API from an HTTP Request node, and receive the result in a Webhook node. The encode runs in the cloud, not on the machine that runs your workflows.
This guide shows the node settings, three ready-to-paste payloads, the webhook step, and how an n8n AI Agent can use Xora through MCP. For the general approach, see how to run FFmpeg in the cloud.
1. Why not run FFmpeg on the n8n host
- Shared CPU. A video encode uses all the CPU it can get. On the same host, other workflows become slow while it runs.
- No FFmpeg in the image. The standard n8n Docker image does not include
ffmpeg. You must build and maintain a custom image, and n8n Cloud does not let you install it at all. - Disk. Large inputs and their outputs must fit on the n8n volume. A full disk makes workflows fail.
With an HTTP Request node, n8n only sends a small JSON body. The download, the encode and the upload happen on Xora.
2. Set up the HTTP Request node
Add an HTTP Request node with these settings:
- Method:
POST - URL:
https://api.xora.sh/v1/jobs - Authentication: Generic credential type, Header Auth
- Name:
Authorization - Value:
Bearer YOUR_XORA_API_KEY
- Name:
- Send Body: on
- Body Content Type:
JSON
The request body
This body compresses a video with your own FFmpeg arguments:
{ "mode": "ffmpeg", "input_files": { "in_1": "https://example.com/raw_input.mov" }, "output_files": { "out_1": "compressed_output.mp4" }, "ffmpeg": { "args": [ "-i", "{{in_1}}", "-c:v", "libx264", "-crf", "23", "-c:a", "aac", "-b:a", "128k", "-movflags", "+faststart", "{{out_1}}" ] }}The response is { id, state }. Output file names can contain only letters, numbers and underscores, plus an extension.
n8n also uses double curly braces, for expressions. Keep the JSON body in Fixed mode, so {{in_1}} and {{out_1}} are sent as written. If you need values from earlier nodes, build the body in a Code node and pass it to the HTTP Request node.
3. Practical payloads
Thumbnail from a URL
Take one frame at the 5-second mark. -ss before -i makes FFmpeg seek before it decodes:
{ "mode": "ffmpeg", "input_files": { "in_1": "https://example.com/raw_input.mov" }, "output_files": { "out_1": "thumbnail.jpg" }, "ffmpeg": { "args": ["-ss", "5", "-i", "{{in_1}}", "-frames:v", "1", "-q:v", "2", "{{out_1}}"] }}The thumbnail recipe does the same with less JSON. See generate video thumbnails from a URL.
Keep the first 10 seconds and compress
{ "mode": "ffmpeg", "input_files": { "in_1": "https://example.com/raw_input.mov" }, "output_files": { "out_1": "trimmed_clip.mp4" }, "ffmpeg": { "args": [ "-i", "{{in_1}}", "-t", "10", "-c:v", "libx264", "-crf", "24", "-c:a", "aac", "{{out_1}}" ] }}Use a recipe
For common jobs, a recipe is shorter. This one uses the compress recipe:
{ "mode": "recipe", "input": { "url": "https://example.com/raw_input.mov" }, "output": { "format": "mp4" }, "recipe": { "name": "compress", "crf": 28 }}More commands: FFmpeg cheat sheet and how to compress video with FFmpeg.
4. Get the result with a webhook
Encodes can take minutes. Do not keep the workflow waiting on the HTTP Request node. Add webhookUrl to the body and point it at an n8n Webhook node:
{ "mode": "recipe", "input": { "url": "https://example.com/raw_input.mov" }, "output": { "format": "mp4" }, "recipe": { "name": "compress", "crf": 28 }, "webhookUrl": "https://your-n8n-instance.com/webhook/xora-callback"}Then:
- Add a Webhook node that listens for
POSTrequests on that path. - When the job ends, Xora sends a
POSTwithdata.jobId,data.stateanddata.progress. For a completed job,data.output.signedUrlis the download link; for a failed job,data.errorsays why. - Add an IF node on
data.state, then send the link to email, Slack, Airtable or your storage.
The webhook request has no signature. Use a long, random path for the Webhook node, and get the job with GET /v1/jobs/{id} before you act on it if you must be sure it is real. See the webhooks guide.
If you cannot receive webhooks, use a Wait node and an HTTP Request node with GET https://api.xora.sh/v1/jobs/{id} in a loop until the state is completed, failed, rejected or cancelled.
5. Let an n8n AI Agent run FFmpeg with MCP
If your workflow uses an AI Agent node, the agent can write and send the FFmpeg job itself. Add an MCP Client Tool node to the agent:
- Endpoint:
https://api.xora.sh/v1/mcp - Authentication: Header Auth with
Authorization: Bearer YOUR_XORA_API_KEY
The agent then has the Xora tools, such as create_job, get_job and list_recipes. The Xora server uses the Streamable HTTP transport, so check that the transport options in your n8n version include it. See the MCP guide and FFmpeg for AI agents.
6. What it costs
Xora bills credits for machine time and output size, not for the time n8n waits. Failed, rejected and cancelled jobs cost nothing. The Free plan includes 25 credits every month with no card, and Build is $15 a month for 400 credits. See pricing.
Related
- How to run FFmpeg in Make.com scenarios.
- How to process video with FFmpeg in Zapier.
- FFmpeg cheat sheet: the common commands, each as an API call.
Frequently asked questions
Does n8n include FFmpeg?
The standard n8n Docker image does not include FFmpeg, so the Execute Command node cannot run it unless you build a custom image. A simpler way is to call a cloud FFmpeg API from an HTTP Request node.
How do I run FFmpeg in n8n Cloud?
n8n Cloud does not let you install binaries. Use an HTTP Request node to send the FFmpeg arguments to an API such as Xora, and receive the result with a Webhook node or by polling the job.
How do I get the result of an FFmpeg job back into n8n?
Add webhookUrl to the job and point it at an n8n Webhook node. When the job ends, Xora sends a POST with the job ID, the state and, for a completed job, a signed URL for the output file.
Can an n8n AI Agent run FFmpeg jobs?
Yes. Connect an MCP Client Tool node to the Xora MCP server at https://api.xora.sh/v1/mcp with an API key in the Authorization header. The agent then gets the create_job and get_job tools. Check that your n8n version supports the Streamable HTTP transport.