|
| 1 | +# OBS Setup — WFR Streaming Overlay |
| 2 | + |
| 3 | +This recipe captures your local overlay page in OBS and pushes it to YouTube or Twitch as a finished broadcast. |
| 4 | + |
| 5 | +``` |
| 6 | +[Car Pi] ─ WS :9080 ─┐ |
| 7 | + │ |
| 8 | + ▼ |
| 9 | +[Laptop] localhost:8000/Streaming Overlay.html ← telemetry + video composite |
| 10 | + │ |
| 11 | + ▼ |
| 12 | + OBS (Browser Source, 1920×1080) |
| 13 | + │ |
| 14 | + ▼ |
| 15 | + rtmp://a.rtmp.youtube.com/live2/<key> |
| 16 | + rtmp://live.twitch.tv/app/<key> |
| 17 | +``` |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +## 1. Serve the overlay page locally |
| 22 | + |
| 23 | +From the project folder: |
| 24 | + |
| 25 | +```bash |
| 26 | +python3 -m http.server 8000 |
| 27 | +# or: npx serve . |
| 28 | +# or: npx http-server -p 8000 |
| 29 | +``` |
| 30 | + |
| 31 | +Open `http://localhost:8000/Streaming%20Overlay.html` in a browser to sanity-check it's running. |
| 32 | + |
| 33 | +--- |
| 34 | + |
| 35 | +## 2. Add the Browser Source in OBS |
| 36 | + |
| 37 | +1. **Sources** → **+** → **Browser** |
| 38 | +2. Name it `WFR Overlay` |
| 39 | +3. **URL**: `http://localhost:8000/Streaming%20Overlay.html?variant=B&solo=1` |
| 40 | + - Change `variant=B` to `variant=A` if you want the broadcast-bar variant |
| 41 | + - `solo=1` hides the side-by-side comparison and shows one variant full-bleed |
| 42 | +4. **Width**: `1920` |
| 43 | +5. **Height**: `1080` |
| 44 | +6. **Custom FPS**: ✅ **60** |
| 45 | +7. **Custom CSS** (makes the page background transparent so your video shows through the gaps): |
| 46 | + ```css |
| 47 | + html, body, #root { background: transparent !important; } |
| 48 | + ``` |
| 49 | +8. **Shutdown source when not visible**: ❌ (leave off — keeps telemetry alive) |
| 50 | +9. **Refresh browser when scene becomes active**: ✅ |
| 51 | + |
| 52 | +Click **OK**. The overlay should now render in OBS at full 1920×1080. |
| 53 | + |
| 54 | +> **Want a pure overlay with no baked video?** Leave the MediaMTX host blank in the Settings panel. The page renders just the overlay chrome on transparent pixels, and you stack a separate OBS Media Source (or Video Capture Device) *underneath* the browser source. This is the recommended setup if your video source is already reliable via OBS directly. |
| 55 | +
|
| 56 | +--- |
| 57 | + |
| 58 | +## 3. Configure OBS output |
| 59 | + |
| 60 | +**Settings → Output** (Advanced mode): |
| 61 | + |
| 62 | +| Field | Value | |
| 63 | +|----------------|-------------------------------| |
| 64 | +| Encoder | NVENC HEVC / H.264 (or x264) | |
| 65 | +| Rate Control | CBR | |
| 66 | +| Bitrate | 6000–9000 kbps (YouTube 1080p60) · 6000 kbps max (Twitch) | |
| 67 | +| Keyframe | 2 s | |
| 68 | +| Preset | Quality / P5 | |
| 69 | +| Profile | high | |
| 70 | + |
| 71 | +**Settings → Video**: |
| 72 | + |
| 73 | +| Field | Value | |
| 74 | +|----------------------|------------| |
| 75 | +| Base (Canvas) Res | 1920×1080 | |
| 76 | +| Output (Scaled) Res | 1920×1080 | |
| 77 | +| FPS | 60 | |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +## 4. Stream key |
| 82 | + |
| 83 | +**Settings → Stream**: |
| 84 | + |
| 85 | +### YouTube |
| 86 | +1. Go to **YouTube Studio → Create → Go Live**. |
| 87 | +2. Copy the **Stream key**. |
| 88 | +3. OBS → **Settings → Stream** → Service: **YouTube - RTMPS** → paste key. |
| 89 | + |
| 90 | +### Twitch |
| 91 | +1. Go to **dashboard.twitch.tv → Settings → Stream**. |
| 92 | +2. Copy your **Primary Stream Key**. |
| 93 | +3. OBS → **Settings → Stream** → Service: **Twitch** → paste key. |
| 94 | + |
| 95 | +Click **Start Streaming**. |
| 96 | + |
| 97 | +--- |
| 98 | + |
| 99 | +## 5. Public viewer page |
| 100 | + |
| 101 | +Open `Public.html` and set your channel IDs at the top of the `<script>` block: |
| 102 | + |
| 103 | +```js |
| 104 | +const CONFIG = { |
| 105 | + youtube: { |
| 106 | + channelId: 'UCxxxxxxxxxxxxxxxxxxxxxx', // your channel ID |
| 107 | + }, |
| 108 | + twitch: { |
| 109 | + channel: 'wfrracing', |
| 110 | + parents: ['wfr.example.com'], // your deployed domain |
| 111 | + }, |
| 112 | +}; |
| 113 | +``` |
| 114 | + |
| 115 | +- **YouTube channel ID** → [youtube.com/account_advanced](https://www.youtube.com/account_advanced) |
| 116 | +- **Twitch parents** → the Twitch player iframe requires a `parent=` param listing the domain(s) hosting the page. For local testing use `['localhost']`; for prod list every domain the page is served from. |
| 117 | + |
| 118 | +Deploy `Public.html` anywhere — it's a single file with no build step. Netlify drop, GitHub Pages, S3, Cloudflare Pages, whatever you like. |
| 119 | + |
| 120 | +--- |
| 121 | + |
| 122 | +## Troubleshooting |
| 123 | + |
| 124 | +| Symptom | Fix | |
| 125 | +|---|---| |
| 126 | +| OBS browser source is black | Make sure `python3 -m http.server` is still running. Right-click source → **Refresh**. | |
| 127 | +| Overlay looks blurry | Check canvas + output res are both 1920×1080 and FPS is 60. | |
| 128 | +| Telemetry stuck on SIM | In the overlay's Settings panel (bottom-right), paste your WS URL and hit **Connect**. Close the panel before capture. | |
| 129 | +| Twitch embed shows "refused to connect" | Your domain isn't in `parents`. Add it to `CONFIG.twitch.parents`. | |
| 130 | +| YouTube embed shows "video unavailable" | You're not live yet, or the `channelId` is wrong. Once you Start Streaming, it auto-loads. | |
| 131 | +| Want to hide the settings panel before capture | Click **HIDE SETTINGS** in the top-right. The panel is OFF by default in `?solo=1` view. | |
| 132 | + |
| 133 | +--- |
| 134 | + |
| 135 | +## File map |
| 136 | + |
| 137 | +- `Streaming Overlay.html` — the local page OBS captures |
| 138 | +- `Public.html` — the lightweight page your audience visits |
| 139 | +- `OBS-SETUP.md` — this file |
0 commit comments