YTPVSLS - VPS 24/7 YouTube Livestream System

Overview

A headless, production-ready system for running continuous 24/7 YouTube livestreams from a VPS using FFmpeg. Features a web-based multi-channel manager for controlling streams from any browser. No GUI, OBS, or browser required on the server side.

Repo: /mnt/c/Users/hanse/ytvpsls/
License: MIT


Core Features

  • Headless Operation — Runs entirely on a VPS via FFmpeg, no desktop environment needed
  • Web-Based Manager — Node.js control panel on port 3000 for managing channels, media, and streams
  • Multi-Channel Support — Run multiple simultaneous YouTube streams from one VPS
  • Hot-Swap Media — Switch images, videos, and audio on-the-fly without stopping streams
  • Auto-Restart — Streams recover automatically from disconnections via systemd
  • Low Resource Usage — ~5-15% CPU per stream (static images), ~15% for video loops

Architecture

System Layout (/opt/stream/)

/opt/stream/
├── manager/        # Web control panel (Node.js, port 3000)
├── scripts/        # install.sh, stream-runner.sh, health-check.sh
├── config/         # channels.json (channel configuration)
├── audio/          # MP3/WAV files organized by channel
├── images/         # JPG/PNG/WebP backgrounds
├── videos/         # MP4/MOV/MKV loops
└── logs/           # Stream logs

Tech Stack

  • Streaming Engine: FFmpeg (H.264 + AAC, RTMP to YouTube Live)
  • Web Manager: Node.js (Express-based API + frontend)
  • Process Management: systemd template units (yt-stream@channel-name)
  • Deployment: Ubuntu 22.04 VPS (Hetzner recommended)

API Endpoints

EndpointMethodDescription
/api/channelsGETList all channels
/api/channelsPOSTCreate channel
/api/channels/:idPUTUpdate channel
/api/channels/:idDELETEDelete channel
/api/channels/:id/startPOSTStart stream
/api/channels/:id/stopPOSTStop stream
/api/channels/:id/swapPOSTSwap media
/api/media/:typeGETList media files
/api/media/:type/uploadPOSTUpload files
/api/system/statsGETSystem statistics
/api/healthGETHealth check

Encoding Profiles

ProfileCPU UsageDescription
Static Image + Audio5-10%Lowest — wallpaper + looping audio
Playlist Streaming5-10%Concat playlist with static image
Video LoopHigherLooping MP4 background + audio

Quality Reference

ResolutionVideo BitrateAudioTotal Bandwidth
720p2500k160k~2.7 Mbps
1080p4500k192k~4.7 Mbps

Visual Effects Available

  • Ken Burns — Slow zoom/pan on static images
  • Text Overlay — Channel name, labels
  • Clock Overlay — Live clock on stream
  • Color Adjustments — Night mode, warm/sunset filters

Audio Processing

  • Volume normalization (loudnorm)
  • Fade in/out
  • Bass boost
  • Dynamic compression

System Requirements

StreamsvCPURAMUpload
111 GB5 Mbps
2-324 GB10 Mbps

Recommended VPS: Hetzner CX21 (~$4.50/mo), DigitalOcean/Vultr/Linode (~$5-6/mo)


Deployment Workflow

  1. Provision VPS — Ubuntu 22.04, configure firewall (UFW), install FFmpeg
  2. Install System — Clone repo, run install.sh, run quick-setup.sh
  3. Upload Content — SCP audio/images to /opt/stream/audio/ and /opt/stream/images/
  4. Configure YouTube — Get stream key from YouTube Studio
  5. Start Streaming — Via web UI at http://YOUR_IP:3000 or systemctl start yt-stream@channel-1
  6. Production Setup — Enable auto-start, configure log rotation, add health-check cron (every 5 min)

Channel Configuration Format

{
  "channels": [{
    "id": "channel-1",
    "name": "Lofi Jazz Radio",
    "enabled": true,
    "streamKey": "xxxx-xxxx-xxxx-xxxx",
    "rtmpUrl": "rtmp://a.rtmp.youtube.com/live2",
    "audio": { "type": "playlist", "source": "/opt/stream/audio/jazz/playlist.txt" },
    "video": { "type": "image", "source": "/opt/stream/images/cafe.jpg", "resolution": "1920x1080", "fps": 30 },
    "encoding": { "videoBitrate": "2500k", "audioBitrate": "160k", "preset": "veryfast", "tune": "stillimage" }
  }]
}

Common Operations

# Stream management
systemctl start|stop|restart yt-stream@channel-1
journalctl -u yt-stream@channel-1 -f
 
# Web manager
systemctl start|restart stream-manager
journalctl -u stream-manager -f
 
# Health check
/opt/stream/scripts/health-check.sh

Troubleshooting

IssueSolution
Stream won’t startVerify stream key, check files exist, review logs with journalctl
High CPUUse -preset ultrafast, static images instead of video, reduce to 720p
Stream disconnectsCheck network, add reconnect flags, use backup RTMP server
A/V desyncAdd -async 1 -vsync cfr -fflags +genpts
Pixelated videoIncrease bitrate to 4500k, use -preset medium
Web UI inaccessibleCheck firewall (port 3000), verify stream-manager service, check netstat

Documentation Files

  • README.md — Quick start, features overview, directory structure
  • docs.md — FFmpeg reference, encoding profiles, API endpoints, troubleshooting
  • setup.md — Complete VPS provisioning and deployment guide

Summary created: 2026-04-16

0 items under this folder.