Linux

How to Install FFmpeg in n8n (Docker) So It NEVER Disappears

FFmpeg is a powerful multimedia processing tool used inside n8n for automating audio and video workflows. With FFmpeg, n8n can convert videos, extract audio, generate thumbnails, compress media files, merge clips, and perform advanced media transformations. FFmpeg is essential for automation scenarios involving video editing, podcast processing, social media content generation, and any workflow that manipulates media files programmatically.

Step-by-step: Correct Way to Install FFmpeg Permanently in n8n

1. Create a folder for your custom image

mkdir n8n-custom
cd n8n-custom

2. Create a Dockerfile

Inside the folder, create Dockerfile:

FROM n8nio/n8n:latest
USER root
# For Debian/Ubuntu-based n8n images
RUN apt-get update && apt-get install -y ffmpeg
# If your n8n image uses Alpine, use:
# RUN apk add --no-cache ffmpeg
USER node

This installs FFmpeg inside the image, not just in the running container.

3. Update docker-compose.yml to use the custom image

Replace

image: n8nio/n8n:latest

with:

build: ./n8n-custom
image: n8n-ffmpeg

Example:

services:
  n8n:
    build: ./n8n-custom
    image: n8n-ffmpeg
    restart: always
    ports:
      - "5678:5678"
    environment:
      - N8N_HOST=n8n.example.com
      - N8N_SECURE_COOKIE=false
      - GENERIC_TIMEZONE=Asia/Ho_Chi_Minh
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_PORT=5678
      - N8N_PROTOCOL=http
      - WEBHOOK_URL=https://n8n.example.com
      - N8N_BINARY_DATA_MODE=filesystem
    volumes:
      - ./n8n_data:/home/node/.n8n

4. Build and start n8n

docker compose build
docker compose up -d

5. Verify FFmpeg is installed

docker exec -it n8n ffmpeg -version

Thanks for visit my website