https://github.com/imvickykumar999/Efficient-24x7-Image
1.1K
Optimized YouTube 24/7 streaming script that reduces costs from ~$2 to ~$0.20 by eliminating unnecessary video processing.
Cost Effective:
Optimized to run within the Railway free trial limit. You can stream 24/7 for up to a week before needing to upgrade your plan or switch accounts.
This guide explains how to pull and run the pre-built Docker image from Docker Hub.
docker pull imvickykumar999/youtube-stream:latest
docker run -d --name youtube-stream \
-e STREAM_KEY=your_youtube_stream_key_here \
-e YouTube_ID=your_youtube_video_id_here \
imvickykumar999/youtube-stream:latest
Create a .env file in your current directory:
STREAM_KEY=your_youtube_stream_key_here
YouTube_ID=your_youtube_video_id_here
Then run:
docker run -d --name youtube-stream \
--env-file .env \
imvickykumar999/youtube-stream:latest
docker pull imvickykumar999/youtube-stream:latest
This will download the pre-built image from Docker Hub. You only need to do this once, or when you want to update to the latest version.
YouTube Stream Key:
YouTube Video ID:
https://www.youtube.com/watch?v=oY7SfTpyRco, the ID is oY7SfTpyRcoOption A: Using Environment Variables (Direct)
docker run -d \
--name youtube-stream \
-e STREAM_KEY=qvfy-u9ar-1900-63qx-625y \
-e YouTube_ID=oY7SfTpyRco \
imvickykumar999/youtube-stream:latest
Option B: Using .env File (Recommended)
Create a .env file:
echo "STREAM_KEY=your_stream_key_here" > .env
echo "YouTube_ID=your_video_id_here" >> .env
Run the container:
docker run -d \
--name youtube-stream \
--env-file .env \
imvickykumar999/youtube-stream:latest
View the container logs:
docker logs -f youtube-stream
Press Ctrl+C to exit the log view (this won't stop the container).
docker ps
You should see youtube-stream in the list if it's running.
docker stop youtube-stream
docker start youtube-stream
docker stop youtube-stream
docker rm youtube-stream
Or force remove (stops and removes in one command):
docker rm -f youtube-stream
docker restart youtube-stream
Check the logs to see what went wrong:
docker logs youtube-stream
Common issues:
STREAM_KEYYouTube_IDdocker pull imvickykumar999/youtube-stream:latest
docker stop youtube-stream
docker rm youtube-stream
docker run -d --name youtube-stream --env-file .env imvickykumar999/youtube-stream:latest
docker stats youtube-stream
This shows real-time CPU, memory, and network usage.
Create a docker-compose.yml file:
version: '3.8'
services:
youtube-stream:
image: imvickykumar999/youtube-stream:latest
container_name: youtube-stream
env_file:
- .env
restart: unless-stopped
Then run:
docker-compose up -d
View logs:
docker-compose logs -f
Stop:
docker-compose down
imvickykumar999/youtube-stream:latestFor issues or questions:
docker logs youtube-streamContent type
Image
Digest
sha256:494820e56…
Size
217 MB
Last updated
9 months ago
docker pull imvickykumar999/youtube-stream