Problem with ffmpeg execution installed in docker

Hi guys! I am trying to use ffmpeg for oga to wav conversion and having a trouble. My n8n is installed in a docker and ffmpeg is installed in a different docker. I cant execute it.
What I have tried:

  1. Direct exection via Execute command note. n8n doesnt see the ffmpeg docker and this didnt work
  2. HTTP request node didnt work as well
    Code "{
    “Image”: “jrottenberg/ffmpeg:5.1-alpine”,
    “Cmd”: [“ffmpeg”, “-i”, “/data/input_audio.oga”, “/data/output_audio.wav”],
    “HostConfig”: {
    “NetworkMode”: “n8n_n8n-network”,
    “Binds”: [“n8n_file_storage:/data”]
    }
    }
    the output mistake is “The service refused the connection - perhaps it is offline”

Please help.

Information on your n8n setup

  • n8n version: 1.80.1
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Maybe I’m missing something about how you are running n8n or what you are executing, but it sounds like you are trying to run docker-in-docker.

In item #1, you said “n8n is installed in a docker” which I assume means you are running n8n in a docker container. If that’s correct, the Execute Command node would be running commands within the same container as n8n, not on the docker host. The only commands you could execute in a workflow would have to be installed in the n8n docker image.

  • For instance, wget is installed in the published n8n container image, so this command works wget -O - https://httpbin.org/get
  • ffmpeg is not installed in the n8n docker image.

In your item #2 you mentioned the HTTP Request node but the jrottenberg ffmpeg image only wraps the ffmpeg command-line to run with docker run... I don’t quite follow how you are expecting these two things to work together.

So to get this working, you could do one of these things…

Option 1

Create a modified n8n docker image, layered on top of the base (published) n8n image, with the ffmpeg command line package installed in the image.

  1. Create a Dockerfile like this:
ARG tag=latest
FROM n8nio/n8n:$tag
USER root
RUN apk update
RUN apk add ffmpeg
USER node
  1. Rig docker-compose.yml to build the customized image like this:
services:
  n8n:
    image: n8n_built_by_docker_compose
    build:
      context: .
      dockerfile: Dockerfile
      args:
        - "tag=1.90.2"
  ...
  • Then you could use an Execute Command node to run the ffmpeg command
    • Check with command ffmpeg -version

Option 2

Start a container using something like the docker-ffmpeg-service that wraps ffmpeg features and exposes some of them as http service endpoints.

  • Then you could probably use the HTTP Request node to do the conversion.
  • You will have to customize the endpoints file to add/enable the ogawav support though.
1 Like