A lightweight, headless streaming daemon designed to broadcast continuous video loops 24/7/365 from low-spec VPS servers (1 vCPU, 1 GB RAM, 7 GB SSD) with near-zero CPU overhead and zero stream cuts.
- Direct Stream Copy (
-c copy): No on-the-fly transcoding. Uses less than 5% CPU and under 200 MB RAM on a $4/mo VPS. - Auto-Healing Watchdog: Instantly detects RTMP socket disconnections or network drops and reconnects automatically in 3 seconds without terminating your YouTube stream session.
- Two-Stage Media Pipeline:
- Stage 1 (Normalizer): Converts any raw video to standard 720p/1080p, H.264 High Profile, AAC 48kHz, and a strict 2.0-second GOP (keyframe interval).
- Stage 2 (Broadcaster): Loops pre-normalized videos seamlessly via the FFmpeg
concatdemuxer with 0ms transition delay.
- Zero-Maintenance Stream Key Mode: Broadcast using YouTube's persistent RTMP stream key (no OAuth expiration, no API quota limits).
- Google OAuth2 & Channel Discovery: Authenticate via terminal URL flow on a headless VPS to query your owned channels and active ingestion streams.
- Diagnostic Doctor (
npm run doctor): One-command health check inspecting FFmpeg, RAM, disk space, and configurations. - Production
systemdDaemon: Runs in the background and auto-starts on VPS reboot.
youtube247/
├── config/ # Profiles (720p, 1080p) & central config
├── src/
│ ├── auth/ # OAuth2 & channel manager
│ ├── converter/ # Media normalizer & ffprobe inspector
│ ├── streamer/ # FFmpeg engine & auto-recovery watchdog
│ ├── utils/ # Logger & system doctor
│ └── index.js # Unified CLI entrypoint
├── media/
│ ├── raw/ # Drop incoming raw video files here
│ ├── processed/ # Stream-ready standardized MP4s
│ └── playlists/ # Generated FFmpeg concat files
├── system/ # systemd daemon & swap setup scripts
├── overview.md # Hardware & spec evaluation
├── architecture.md # System architecture & design notes
└── package.json
Simply double-click setup.bat! It will:
- Verify Node.js and FFmpeg
- Install npm dependencies automatically
- Prompt for your YouTube Stream Key and write
.env - Run diagnostics and launch the stream!
(To restart the stream anytime later, just double-click start.bat).
- Node.js: v18.0.0 or higher
- FFmpeg & FFprobe: Installed and available in your system
PATH
On Ubuntu/Debian:
sudo apt update && sudo apt install -y nodejs npm ffmpeggit clone https://github.com/expgg/youtube247.git
cd youtube247
npm installCopy the template and fill in your YouTube Stream Key:
cp .env.example .env
nano .envSet your persistent stream key from YouTube Studio (studio.youtube.com -> Go Live -> Stream):
YOUTUBE_STREAM_URL=rtmp://a.rtmp.youtube.com/live2
YOUTUBE_STREAM_KEY=xxxx-xxxx-xxxx-xxxx-xxxx
STREAM_PROFILE=720pnpm run doctorPlace any .mp4, .mkv, .mov, or .webm files into media/raw/:
cp /path/to/my-video.mp4 media/raw/Run the batch normalizer to convert raw videos into stream-ready 720p (or 1080p) files with fixed 2-second keyframes:
npm run normalizeStandardized files will be output to media/processed/.
npm startThe engine will initialize the playlist, launch FFmpeg, and display real-time live telemetry:
● LIVE [Uptime: 04:12:30] [Stream Time: 00:05:42.10] [Speed: 1.00x] [Bitrate: 2200kbits/s] [Reconnects: 0]
Run the included swap setup script to add 2GB of virtual memory:
sudo bash system/install-swap.shEdit system/youtube-live.service to match your directory if needed, then install it:
sudo cp system/youtube-live.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable youtube-live
sudo systemctl start youtube-live# Check service status
sudo systemctl status youtube-live
# View live broadcast logs
tail -f logs/engine.log| Command | Description |
|---|---|
npm start or node src/index.js stream |
Starts the 24/7 live stream watchdog engine. |
npm run normalize |
Batch converts videos in media/raw/ to standardized stream profiles. |
npm run doctor |
Performs a system health check (FFmpeg, RAM, disk, keys). |
npm run auth |
Initiates Google OAuth2 login via terminal URL. |
npm run channels |
Lists all YouTube channels and live stream ingestion endpoints. |
MIT © expgg
