If you're looking to perform media processing tasks like trimming, converting, or compressing video and audio files inside your automated workflows, FFmpeg is your best friend. But what if you want to combine that with the power of n8n, the open-source workflow automation tool? In this guide, we’ll walk you through how to install FFmpeg inside n8n—whether you're running it via Docker, on a server, or locally—so you can finally automate your multimedia processing with ease.
Why Use FFmpeg in n8n Workflows?
FFmpeg is a powerful open-source command-line utility that can handle just about any audio or video format out there. By integrating FFmpeg into your n8n workflows, you unlock the ability to:
- Automatically compress video uploads
- Convert audio files before sending them to transcription tools
- Generate video previews or thumbnails
- Prepare media content for different platforms
Here's a quick example:
Use Case: A user submits a video via a form. Your n8n workflow:
- Receives the video using a webhook trigger
- Runs an FFmpeg command to compress it
- Uploads the result to Google Drive or S3
- Notifies the user on Telegram or Slack
To make all that possible, you need FFmpeg running in your environment—let’s explore how to do that.
Determine How You Run n8n
Before installing FFmpeg inside n8n, identify how you're currently hosting n8n. The approach varies depending on whether you're using:
- Docker (self-hosted or Docker-based platforms like DigitalOcean, AWS, etc.)
- Local Machine (Windows, macOS, or Linux)
- Cloud App Platforms (like Render, Heroku, etc.)
We'll break down the instructions for the two most common setups: Docker-based hosting and local installations.
How to Install FFmpeg in Docker-Based n8n Setup
Step 1: Modify Your Dockerfile
If you're hosting n8n with a custom Dockerfile, you'll need to add FFmpeg by extending the base image. Here's an example:
FROM n8nio/n8n
# Install FFmpeg
RUN apt-get update &&
apt-get install -y ffmpeg &&
apt-get clean &&
rm -rf /var/lib/apt/lists/*
Step 2: Build and Run Your Image
After modifying your Dockerfile:
docker build -t n8n-custom-ffmpeg .
docker run -it --rm -p 5678:5678 n8n-custom-ffmpeg
Want persistence and auto-restart? Here’s a better Docker setup with volumes and restart policies.
Step 3: Use FFmpeg in a Workflow
Inside an Execute Command node, you can now call FFmpeg like this:
ffmpeg -i input.mp4 -b:v 1M output.mp4
You can pull in media files from previous nodes using n8n’s data pipes and write FFmpeg outputs to the filesystem or external cloud locations.
How to Install FFmpeg on a Local n8n Instance
If you are running n8n on your local machine, installation depends on your OS.
macOS
Use Homebrew:
brew install ffmpeg
Ubuntu/Debian
sudo apt update
sudo apt install ffmpeg
Windows
- Go to ffmpeg.org and download the Windows build
- Extract and copy to a directory like
C:ffmpeg - Add
C:ffmpegbinto your system PATH - Restart your terminal or services
After installation, run ffmpeg -version in your terminal to confirm it’s accessible globally.
Once installed, your local n8n instance will be able to use FFmpeg via the Execute Command node using the same command syntax as in Docker.
Example Workflow: Video to Audio Converter
Let’s build a simple workflow that takes a video file and extracts its audio in MP3 format:
Workflow Steps:
- Webhook Node
Accepts a POST request with a video file - Write Binary File Node
Saves the uploaded video to a temporary location - Execute Command Node
Uses FFmpeg to extract audio:ffmpeg -i input.mp4 -vn -ar 44100 -ac 2 -b:a 192k output.mp3 - Upload Node
Could be FTP, S3, or Google Drive
This is a typical use case that could tie into other automation like automated YouTube subtitle extraction or podcast content processing.
FFmpeg Command Reference Table (for n8n Use Cases)
Here’s a quick table of FFmpeg commands you might commonly use in n8n:
| Task | FFmpeg Command Example |
|---|---|
| Compress Video | ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4 |
| Extract Audio | ffmpeg -i input.mp4 -q:a 0 -map a output.mp3 |
| Create Video Thumbnail | ffmpeg -i input.mp4 -ss 00:00:01.000 -vframes 1 thumbnail.jpg |
| Convert Format (e.g. AVI) | ffmpeg -i input.mp4 output.avi |
| Resize Video | ffmpeg -i input.mp4 -vf scale=1280:720 resized.mp4 |
You can integrate these into your n8n Execute Command nodes by piping input/output as needed.
Tips for Using FFmpeg in n8n
- Use environment-specific paths: Make sure input/output paths work inside Docker volume mounts or temp folders
- Avoid blocking operations: For large media, FFmpeg can be CPU-intensive. Optimize your Docker settings accordingly
- Handle errors gracefully: Use a Try-Catch or Error Handling workflow structure in n8n
When You Should Not Use FFmpeg in n8n
While running FFmpeg inside n8n is powerful, it’s not always the best fit:
- Avoid in low-resource environments like Raspberry Pi or shared VPS
- Batch-processing 100s of videos is better suited in a dedicated FFmpeg processing queue or microservice
Still, for one-off tasks and light use, it's terrific for prototyping fast automations.
Related Resources
If you’re deep into media-based automations, you might also want to explore:
- Step-by-step guide to Creatomate integration with n8n
- Automate YouTube summaries using n8n and LLMs
- Build a full YouTube automation pipeline with n8n
FAQ
Can I install FFmpeg directly in the n8n UI?
No, FFmpeg must be installed in the same environment where n8n is running—this usually means updating your Dockerfile or machine setup.
Is FFmpeg supported on all Docker deployments of n8n?
Only if you explicitly add it. The official n8nio/n8n image does not come with FFmpeg pre-installed.
Where should FFmpeg output files be saved?
You can save them in Docker-mounted volumes, temporary directories, or upload them directly to external services like Drive, S3, or FTP.
Can I use FFmpeg in n8n's Function or JavaScript nodes?
Not directly. FFmpeg needs to run as a system command, so use the Execute Command node instead.
How do I diagnose FFmpeg not found errors?
Try running ffmpeg -version inside the same environment (Docker container or terminal) that hosts n8n. If it fails, FFmpeg is not installed or not in PATH.
Installing FFmpeg inside n8n gives you a powerful edge in automating anything media-related. Whether you're enhancing user experience or streamlining your content pipelines, combining the two opens up major possibilities.
Copy-paste templates.
Beginner friendly.