Operating reside streams via Twitch or YouTube is okay till you want management they don’t offer you — customized latency, a number of simultaneous streams, audience-specific routing, or a setup the place the platform takes no minimize of monetization. Self-hosted streaming on a devoted server solves all of those, however the {hardware} and configuration necessities are particular. Getting…
What Reside Streaming Really Calls for from a Server
A reside streaming server performs three distinct operations, every with completely different useful resource profiles:
Ingest: Receives the encoded stream out of your broadcasting software program (OBS, Restream, vMix) through RTMP (Actual-Time Messaging Protocol). CPU-light — the server is simply accepting a community connection and writing to disk or reminiscence.
Transcoding: Re-encodes the incoming stream to a number of high quality ranges (1080p, 720p, 480p, 360p) so viewers with completely different bandwidth can watch with out buffering. CPU-intensive. That is the place most servers encounter their limits.
Supply: Sends the HLS (HTTP Reside Streaming) or DASH segments to viewers through a CDN or instantly. Bandwidth-intensive. For 100 concurrent viewers at 4Mbps every, that’s 400Mbps of sustained outbound bandwidth.
Your server must deal with all three concurrently, doubtlessly for a number of concurrent streams.
{Hardware} Necessities by Use Case
Single Stream, As much as 500 Concurrent Viewers
Minimal viable configuration: InMotion Important ($99.99/month, 64GB DDR4, 2×1.92TB NVMe)
At 1080p30 with x264 medium preset transcoding to three high quality ranges, anticipate 4-6 CPU cores absolutely utilized throughout energetic streaming. The Important server’s processor handles this comfortably. At 500 concurrent viewers receiving 4Mbps streams, outbound bandwidth hits 2Gbps — inside the burstable 10Gbps envelope.
RAM will not be the constraint at this scale — 8-16GB is adequate for the streaming stack. 64GB gives headroom for the OS and another providers operating alongside the stream.
A number of Streams or 500-5,000 Concurrent Viewers
Really useful: InMotion Elite or Excessive ($199.99-349.99/month)
Multi-stream operations or excessive viewer counts want both extra CPU cores for concurrent transcoding or sufficient RAM to buffer stream segments aggressively. At 2,000 concurrent viewers receiving 4Mbps HLS supply, you’re at 8Gbps sustained — approaching the burstable restrict and a powerful argument for assured unmetered 10Gbps bandwidth.
The AMD EPYC 4545P’s 16 cores with 32 threads is well-suited to concurrent transcoding workloads. Software program transcoding utilizing libx264 or libvpx scales linearly with core rely — two concurrent 1080p streams eat roughly double the CPU of 1.
Supply at Scale (5,000+ Concurrent Viewers)
At this scale, the devoted server handles ingest and transcoding; a CDN handles supply. The mathematics is simple: 5,000 viewers at 4Mbps is 20Gbps of supply bandwidth, which exceeds any single server’s practical output. A correctly configured CDN pulls the HLS stream out of your server as soon as and distributes it to viewers — your server sees a small variety of CDN PoP connections fairly than 5,000 particular person viewer connections.
Setting Up Nginx-RTMP on Linux
Nginx with the RTMP module is the usual open supply streaming server. On AlmaLinux or Ubuntu:
# Ubuntu
apt-get set up nginx libnginx-mod-rtmp -y
# AlmaLinux/Rocky
dnf set up nginx -y
# Compile RTMP module or use neighborhood packages
Primary Nginx configuration for ingest and HLS supply:
# /and many others/nginx/nginx.conf
rtmp {
server {
hear 1935;
chunk_size 4096;
software reside {
reside on;
document off;
# HLS supply
hls on;
hls_path /var/www/html/hls;
hls_fragment 3s;
hls_playlist_length 60s;
# Transcode to a number of qualities
exec_push ffmpeg -i rtmp://localhost/$app/$title
-c:v libx264 -b:v 3000k -s 1920x1080 -r 30
-c:a aac -b:a 128k
-f flv rtmp://localhost/hls/$name_1080p
-c:v libx264 -b:v 1500k -s 1280x720 -r 30
-c:a aac -b:a 128k
-f flv rtmp://localhost/hls/$name_720p
-c:v libx264 -b:v 600k -s 854x480 -r 30
-c:a aac -b:a 96k
-f flv rtmp://localhost/hls/$name_480p;
}
software hls {
reside on;
hls on;
hls_path /var/www/html/hls;
hls_fragment 3s;
hls_nested on;
}
}
}
http {
server {
hear 80;
location /hls {
varieties {
software/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /var/www/html;
add_header Cache-Management no-cache;
add_header Entry-Management-Permit-Origin *;
}
}
}
This configuration accepts an RTMP stream from OBS on port 1935, transcodes to a few high quality ranges through FFmpeg, and serves HLS segments through HTTP on port 80.
OBS Stream Settings:
- Server: rtmp://your-server-ip/reside
- Stream Key: any string (turns into the stream title)
- Encoder: x264 or NVENC (if GPU obtainable)
- Bitrate: 6,000 Kbps for 1080p60 supply
Stream to Twitch and YouTube Concurrently through Devoted Server
A devoted RTMP server can restream to a number of platforms concurrently, eliminating the necessity for a paid restreaming service.
software reside {
reside on;
# Push to Twitch
push rtmp://reside.twitch.television/app/YOUR_TWITCH_STREAM_KEY;
# Push to YouTube
push rtmp://a.rtmp.youtube.com/live2/YOUR_YOUTUBE_STREAM_KEY;
# Maintain native HLS copy
hls on;
hls_path /var/www/html/hls;
}
Your broadcaster sends one stream to your devoted server; the server followers it out to Twitch, YouTube, and your individual HLS endpoint concurrently. This requires outbound bandwidth equal to the sum of all vacation spot bitrates — usually 6,000-18,000 Kbps relying on platform necessities.
FFmpeg Transcoding Optimization
FFmpeg’s default settings prioritize high quality over CPU effectivity. For reside streaming the place real-time efficiency is required, tune the preset and tune flags:
ffmpeg -i rtmp://localhost/$app/$title
-c:v libx264
-preset veryfast # Vital for actual-time: veryfast or ultrafast
-tune zerolatency # Reduces encoding delay
-b:v 3000k
-maxrate 3000k
-bufsize 6000k
-g 60 # Keyframe interval (2x framerate for 30fps)
-sc_threshold 0 # Disable scene change detection (provides latency)
-c:a aac
-b:a 128k
-f flv rtmp://localhost/hls/$name_1080p
The -preset veryfast setting reduces encoding high quality barely in comparison with gradual or medium, however reduces CPU utilization by 60-70% — important for real-time transcoding on a CPU that’s dealing with a number of streams or different workloads concurrently.
FFmpeg’s encoding information covers the tradeoffs between preset values intimately.
Firewall Configuration for Streaming
Open the ports your streaming stack requires:
# Permit RTMP ingest from broadcasters
nft add rule inet filter enter tcp dport 1935 settle for
# Permit HTTP supply of HLS segments
nft add rule inet filter enter tcp dport 80 settle for
nft add rule inet filter enter tcp dport 443 settle for
# Limit RTMP ingest to recognized broadcaster IPs if doable
# Exchange with precise broadcaster IP
nft add rule inet filter enter ip saddr 203.0.113.0/24 tcp dport 1935 settle for
nft add rule inet filter enter tcp dport 1935 drop
Leaving RTMP open to the web permits anybody to stream to your server. IP-restricting the ingest port prevents unauthorized use of your server’s bandwidth.
Storage for Stream Recording
Recorded streams at 1080p eat roughly 1GB per 10 minutes of recording at 12-15 Mbps. For normal streaming operations, plan storage accordingly:
- 2 hours of recording per day: ~12GB/day, ~360GB/month
- InMotion’s Important server contains 2×1.92TB NVMe — adequate for about 3,000 hours of recordings earlier than requiring archival
Configure Nginx-RTMP to document to a selected path:
software reside {
reside on;
document all;
record_path /var/recordings;
record_suffix -%d%m%Y-%H%M%S.flv;
record_max_size 1000M; # Cut up at 1GB to maintain recordsdata manageable
}
InMotion’s Premier Care backup storage (500GB) gives an off-server copy of vital recordings. For longer-term archival, configure rclone to sync the recordings listing to S3-compatible object storage on a scheduled foundation.
Associated studying: Community Latency Optimization for Devoted Servers | CDN Origin Server Optimization
