a year ago
Hello. I have a problem. When I use FFmpeg to stream to YouTube, approximately 5 to 6 minutes into the stream, the video transmission stops. On YouTube, the stream turns into a black screen. However, with the exact same configuration on a local environment, everything works without any interruptions. Could you advise if there are any hidden settings or restrictions on outbound connections or direct connections to external services on Railway, and how this issue can be resolved? There are absolutely no logs or errors. The connection to YouTube simply drops after 5 minutes. FFmpeg doesn’t throw an error, it just stops transmitting the video, but the connection itself remains active.
cmd := exec.Command(
"ffmpeg",
"-stream_loop", "-1",
"-re",
"-i", streamMessage.Video.FilePath,
"-r", "25", // Set frame rate to match input video
"-c:v", "libx264",
"-preset", "veryfast",
"-b:v", "3000k", // Set average video bitrate
"-maxrate", "3000k", // Set max video bitrate
"-bufsize", "6000k", // Set buffer size (usually twice the maxrate)
"-pix_fmt", "yuv420p",
"-g", "50",
"-c:a", "aac",
"-b:a", "128k",
"-ar", "44100",
"-f", "flv",
"-rw_timeout", "5000000", // 5-second timeout for network operations
streamMessage.Settings.StreamUrl+"/"+streamMessage.Settings.StreamKey,
)
2 Replies
a year ago
also here a dockerfile
# Dockerfile
# Use an official Go image as the base
FROM golang:1.22
# Set the working directory
WORKDIR /app
# Copy the Go module files
COPY go.mod ./
COPY go.sum ./
# Download the dependencies
RUN go mod download
# Copy the rest of the application code
COPY . .
# Build the Go application
RUN go build -o /app/main
# Copy the start script
COPY entrypoint.sh /entrypoint.sh
# Make the start script executable
RUN chmod +x /entrypoint.sh
# Set the entrypoint to the start script
ENTRYPOINT ["/entrypoint.sh"]
a year ago
We do not have any restrictions on outbound traffic, nor do we have any way to set any restrictions even if we wanted to.
This could be either YouTube cutting off the stream, or an application level issue.
Unfortunately either issue would be out of our hands, I'm sorry but we aren't going to be able to offer assistance here.