Streaming Configuration Reference
Complete reference for Hyperscape’s RTMP streaming system with WebGPU rendering.Overview
Hyperscape’s streaming pipeline captures gameplay via Chrome DevTools Protocol (CDP) and streams to multiple platforms simultaneously (Twitch, Kick, X/Twitter). The system requires WebGPU for rendering and uses NVIDIA GPU acceleration via Vulkan.Critical Requirements
WebGPU is REQUIRED
- NO WebGL fallback - All shaders use TSL (Three Shading Language)
- Chrome must have WebGPU enabled and working
- NVIDIA GPU with Vulkan support required for server/streaming
- Headless Chrome modes that don’t support WebGPU will NOT work
GPU Rendering Modes
The deployment script (scripts/deploy-vast.sh) tries multiple approaches in order:
-
Xorg with NVIDIA (preferred):
- Full hardware acceleration
- Best performance and quality
- Requires DRI/DRM device access
- Config:
/etc/X11/xorg-nvidia-headless.conf
-
Xvfb with NVIDIA Vulkan (fallback):
- Virtual framebuffer for X11 protocol
- Chrome uses NVIDIA GPU via ANGLE/Vulkan
- CDP captures from Chrome’s internal GPU rendering
- Works in containers without DRM access
-
Deployment FAILS if neither works:
- No soft fallback to headless mode
- WebGPU is non-negotiable
Environment Variables
GPU & Display Configuration
Chrome Configuration
Audio Configuration
RTMP Destinations
Streaming Behavior
Audio Capture Setup
PulseAudio Configuration
The deployment script sets up PulseAudio in user mode with a virtual sink:-
Create runtime directory:
-
Create PulseAudio config (
~/.config/pulse/default.pa): -
Start PulseAudio:
-
Verify sink exists:
FFmpeg Audio Capture
FFmpeg captures from the PulseAudio monitor device:thread_queue_size=1024- Prevents buffer underrunsuse_wallclock_as_timestamps=1- Real-time timingaresample=async=1000:first_pts=0- Recovers from audio drift (22ms threshold)
FFmpeg Encoding Configuration
Video Encoding
Audio Encoding
Output Flags
Capture Modes
CDP Mode (Default)
Chrome DevTools Protocol screencast capture:- 2-3x faster than MediaRecorder
- No browser-side encoding overhead
- Single encode step: JPEG → H.264
- Works in headful and headless modes
- Hardware accelerated on supported platforms
- CDP
Page.startScreencastcaptures compositor frames - Frames sent as base64 JPEG to Node.js
- Decoded and piped to FFmpeg stdin
- FFmpeg encodes to H.264 and sends to RTMP
MediaRecorder Mode (Legacy)
Browser MediaRecorder API with WebSocket:WebCodecs Mode (Experimental)
Native VideoEncoder API with stream copy:Troubleshooting
WebGPU Not Available
Symptoms:- Black screen in stream
- “WebGPU not supported” errors
- Chrome falls back to software rendering
- Verify NVIDIA GPU is accessible:
nvidia-smi - Check Vulkan support:
vulkaninfo --summary - Verify X server is running:
xdpyinfo -display :99 - Check Chrome WebGPU: Navigate to
chrome://gpuin browser - Verify
VK_ICD_FILENAMESpoints to NVIDIA ICD
Audio Not Captured
Symptoms:- Stream has video but no audio
- FFmpeg shows audio input errors
- Verify PulseAudio is running:
pulseaudio --check - Check chrome_audio sink exists:
pactl list short sinks - Verify monitor device:
pactl list short sources | grep monitor - Check FFmpeg can access PulseAudio:
ffmpeg -f pulse -list_devices true -i dummy - Verify
PULSE_SERVERenvironment variable is set
Stream Buffering/Stuttering
Symptoms:- Viewers see buffering
- Inconsistent frame rate
- Audio/video desync
- Increase buffer size:
STREAM_BUFFER_MULTIPLIER=4(or higher) - Use film tune for better compression:
STREAM_LOW_LATENCY=false - Check network bandwidth to RTMP servers
- Verify CDP FPS matches target: Check logs for “CDP FPS: X”
- Monitor dropped frames: Check logs for “Dropped: X”
Xorg/Xvfb Failures
Symptoms:- Deployment fails with “Cannot establish WebGPU-capable rendering mode”
- Xorg falls back to swrast (software rendering)
- Verify NVIDIA drivers are installed:
nvidia-smi - Check DRI devices exist:
ls -la /dev/dri/ - Review Xorg logs:
cat /var/log/Xorg.99.log - Verify GPU BusID is correct in xorg config
- Check for conflicting X servers:
pkill -9 Xorg; pkill -9 Xvfb - Clean up lock files:
rm -f /tmp/.X99-lock
Performance Tuning
Low Latency Mode
For minimal latency (at cost of compression efficiency):High Quality Mode
For better compression and smoother playback:Resource Optimization
For lower CPU/memory usage:Monitoring & Diagnostics
Health Checks
The streaming system exposes health endpoints:Log Monitoring
Diagnostic Commands
See Also
- docs/vast-deployment.md - Vast.ai deployment guide
- docs/streaming-audio-capture.md - Audio capture setup
- CLAUDE.md - Development guide
- ecosystem.config.cjs - PM2 configuration