Unable to use ffmpeg on Railway (Discord bot)
popeye720
FREEOP

7 days ago

I am trying to use ffmpeg for Discord voice playback on Railway, but I am unable to make it work despite multiple approaches.

What I have tried so far:

  1. Added a Linux ffmpeg binary to my repo and used a build step:

[build]
command = "chmod +x ffmpeg"
  1. Tried Railway nixpacks, but ffmpeg was still not detected at runtime.

  2. Tried using a Dockerfile:

FROM python:3.11-slim

RUN apt-get update && apt-get install -y ffmpeg

WORKDIR /app
COPY . .

RUN pip install --no-cache-dir -r requirements.txt

CMD ["python", "-u", "main.py"]
  1. Added ffmpeg-python to requirements.txt, but this also did not help.

Behavior I am seeing:

  • Bot connects to the voice channel successfully

  • Audio playback does not work

  • No clear ffmpeg error is shown in logs

I am using [discord.py](discord.py) with FFmpegPCMAudio.

I would really appreciate help understanding:

  • The correct way to install and use ffmpeg on Railway

  • Whether Railway supports ffmpeg reliably for Discord voice bots

  • If there is a recommended Railway configuration for this use case

$10 Bounty

3 Replies

Could be UDP related if it's Discord voice.


Not sure if/how Railway NATs that for outgoing connections.


rob
HOBBY

7 days ago

Hello, I'm heavily relying on FFmpeg on my Telegram bot deployed on Railway.
To achieve this, I set it up in my Dockerfile (it's open source, you can have a look at it here https://github.com/Stickerifier/Stickerify/blob/main/Dockerfile).

The main points of attentions are the following:


Loading...