#!/bin/bash # Start OBS with noise virtual camera for testing camera-trng # # Usage: ./start-obs-noise.sh [--password=YOUR_OBS_WEBSOCKET_PASSWORD] # # Prerequisites: # 1. OBS Studio 28+ installed # 2. WebSocket Server enabled in OBS: Tools -> WebSocket Server Settings # 3. Node.js installed # 4. Run 'npm install' in this directory first set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$SCRIPT_DIR" # Check for node_modules if [ ! -d "node_modules" ]; then echo "Installing dependencies..." npm install fi # Check if OBS is running if ! pgrep -x "OBS" > /dev/null 2>&1; then echo "Starting OBS..." open -a "OBS" --args --minimize-to-tray echo "Waiting for OBS to start..." sleep 5 # Wait for websocket to be available for i in {1..10}; do if nc -z 127.0.0.1 4455 2>/dev/null; then echo "OBS WebSocket ready" break fi echo "Waiting for OBS WebSocket... ($i/10)" sleep 2 done fi # Pass through any arguments (like --password=xxx) echo "Configuring noise source and starting virtual camera..." node obs-noise-camera.mjs start "$@" echo "" echo "========================================" echo "OBS Virtual Camera is now active!" echo "========================================" echo "" echo "The virtual camera should appear as 'OBS Virtual Camera'" echo "in your camera selection. You can now run camera-trng:" echo "" echo " cargo run --release" echo "" echo "To stop the virtual camera:" echo " ./start-obs-noise.sh stop" echo ""