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:
Added a Linux ffmpeg binary to my repo and used a build step:
[build]
command = "chmod +x ffmpeg"Tried Railway nixpacks, but ffmpeg was still not detected at runtime.
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"]Added
ffmpeg-pythontorequirements.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
3 Replies
7 days ago
Could be UDP related if it's Discord voice.
7 days ago
Not sure if/how Railway NATs that for outgoing connections.
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:
I use the Docker image mwader/static-ffmpeg to retrieve FFmpeg and FFprobe binaries
I copy them to /usr/bin/ to have them available in my Linux image
Bot's Dockerfile gets built and uploaded to DockerHub via a GitHub Workflow https://github.com/Stickerifier/Stickerify/blob/main/.github/workflows/docker-image.yml
Railway is then configured to build the project from a different Dockerfile https://github.com/Stickerifier/Stickerify/blob/main/Railway.dockerfile