Skip to content

likeatruehero/newwave-webrtc-wsl2-stream-bridge

Repository files navigation

NewWave Project Structure

newwave/
├── docker-compose.yml              # Docker RTMP server configuration
├── nginx.conf                      # NGINX RTMP module config
├── obs-profile-newwave.json        # OBS streaming profile settings
├── launch-newwave.ps1              # Main Windows PowerShell launcher
├── start.bat                       # Quick-start batch file for Windows
├── SETUP.md                        # Comprehensive setup guide (READ THIS FIRST)
├── README.md                       # This file
│
└── scripts/
    ├── setup-wsl2-devices.sh       # One-time WSL2 setup (v4l2loopback + PulseAudio)
    ├── rtmp-to-vdevices.sh         # FFmpeg RTMP bridge (continuous)
    ├── run-full-setup.sh           # Complete WSL2 setup in one command
    ├── health-check.sh             # System health diagnostic tool
    └── test-components.sh          # Interactive component tester

Quick Start

First Time Only (Setup)

Windows:

cd C:\path\to\newwave
start.bat

WSL2:

bash scripts/setup-wsl2-devices.sh  # One-time setup

Every Streaming Session (Runtime)

Windows:

# Terminal 1
cd C:\path\to\newwave
PowerShell -ExecutionPolicy Bypass -File launch-newwave.ps1

WSL2:

# Terminal 2
bash scripts/rtmp-to-vdevices.sh

Firefox:

Configure camera/mic in about:preferences and start screenshare.


File Purposes

Docker Files

  • docker-compose.yml: Defines RTMP server container, ports, networking
  • nginx.conf: RTMP module configuration, stream apps, HTTP stats page

OBS Configuration

  • obs-profile-newwave.json: Preconfigured OBS settings for:
    • 1920x1080 @ 60 FPS
    • 6000 Kbps bitrate
    • H.264 encoder
    • RTMP streaming to localhost:1935

Windows Automation

  • launch-newwave.ps1:
    • Starts Docker RTMP server
    • Launches OBS minimized
    • Shows status and next steps
    • Cleans up on exit (Ctrl+C)
  • start.bat: Wrapper batch file for easy double-click launch

WSL2 Scripts

  • setup-wsl2-devices.sh:

    • Installs packages (ffmpeg, v4l2loopback, pulseaudio)
    • Creates virtual camera at /dev/video10
    • Creates PulseAudio sink
    • Sets up auto-load systemd service
    • Run once after WSL2 setup
  • rtmp-to-vdevices.sh:

    • Pulls RTMP stream from Docker
    • Splits video → /dev/video10
    • Splits audio → PulseAudio sink
    • Run every streaming session
  • run-full-setup.sh: Combines setup + bridge in one script

Diagnostics

  • health-check.sh: Verifies all components are ready
  • test-components.sh: Interactive testing menu for each component

Configuration

Change RTMP Stream Key

Edit nginx.conf or OBS settings:

rtmp://127.0.0.1:1935/live/YOUR_KEY_HERE

Change Video Quality

Edit OBS or launch-newwave.ps1:

# Bitrate (higher = better quality, more bandwidth)
Bitrate: 6000  # Change to 8000-12000 if network allows

# Resolution (default 1920x1080)
OutputCX: 1920
OutputCY: 1080

# Frame rate (default 60)
FPSCommon: 60

Change Virtual Device Location

Edit scripts/rtmp-to-vdevices.sh:

VIDEO_DEVICE="${2:-/dev/video10}"  # Change video10 to another number if needed

Environment Variables

FFmpeg Bridge

# Call with custom parameters:
bash scripts/rtmp-to-vdevices.sh \
  "rtmp://127.0.0.1:1935/live/mystream" \
  "/dev/video11" \
  "myaudio_sink"

PowerShell Launcher

# Edit in launch-newwave.ps1:
$OBSPath = "C:\Program Files\obs-studio\bin\64bit\obs64.exe"
$OBSProfile = "NewWave"
$DockerComposePath = $PSScriptRoot

Troubleshooting Checklist

OBS Can't Connect

  1. ✓ Is Docker running? (docker compose ps)
  2. ✓ Is RTMP port open? (docker logs newwave-rtmp)
  3. ✓ Is OBS profile using correct RTMP URL? (rtmp://127.0.0.1:1935/live/newwave)

No Virtual Camera

  1. ✓ Did you run setup script? (bash scripts/setup-wsl2-devices.sh)
  2. ✓ Is v4l2loopback loaded? (lsmod | grep v4l2loopback)
  3. ✓ Does /dev/video10 exist? (ls /dev/video10)

No Audio

  1. ✓ Is PulseAudio running? (pactl stat)
  2. ✓ Is sink created? (pactl list sinks | grep newwave_sink)
  3. ✓ Is Firefox configured? (about:preferences → Permissions)

Firefox Can't Find Device

  1. ✓ Restart Firefox: killall firefox
  2. ✓ Check about:preferences again
  3. ✓ Verify FFmpeg is running: ps aux | grep ffmpeg

Docker Won't Start

  1. ✓ Is Docker Desktop running?
  2. ✓ Check memory/resources available
  3. ✓ Try: docker system prune

Performance Tips

  • CPU: Reduce bitrate to 4000 Kbps if CPU usage > 50%
  • Memory: Close other apps, Docker base uses ~100MB
  • Network: Test with iperf3 to verify bandwidth (6 Mbps minimum for 1080p/60fps)
  • Latency: Should be <1s (acceptable for streaming)

Use about:processes in Firefox to monitor resource usage.


Security

Secure by default:

  • All connections are localhost-only (127.0.0.1)
  • Docker runs isolated in WSL2
  • No internet connectivity required
  • No accounts or authentication needed
  • Firewall unaffected

Low-Profile Runtime:

  • OBS minimized (may flash in taskbar during startup)
  • Docker runs silently in background
  • Only Firefox is visible
  • No system tray icons besides Firefox
  • Clean exit with no residual processes

Advanced Features

Record Stream to File

While streaming, in OBS:

  • Settings → Output → Recording → MKV format
  • Click "Start Recording"

Monitor Stream Status

Browser: http://localhost:8080/stat

Custom FFmpeg Options

Edit rtmp-to-vdevices.sh lines with your parameters:

ffmpeg -threads 4 -preset fast ...  # More CPU efficiency

Multiple Virtual Cameras

Create multiple v4l2loopback devices:

sudo modprobe v4l2loopback devices=2 video_nr=10,11
# Then route different RTMP streams to /dev/video11, etc.

Still Having Issues?

  1. Run health check: bash scripts/health-check.sh
  2. Run component tests: bash scripts/test-components.sh
  3. Check logs:
    • Docker: docker logs newwave-rtmp
    • FFmpeg: cat ~/.newwave/ffmpeg.log
    • OBS: Check Help → Log Files
  4. See SETUP.md for detailed troubleshooting

Ready? Start with: start.bat on Windows, then bash scripts/setup-wsl2-devices.sh in WSL2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors