# ReStreamer Watchdog A lightweight watchdog for [datarhei Restreamer](https://hub.docker.com/r/datarhei/restreamer). It logs into your Restreamer Core, watches the ingest, and when the source stops transmitting it automatically pushes a **looping fallback video** to every active output (Twitch, YouTube, Facebook, Kick, etc.). When the real source comes back, it stops the fallback. It ships with a small web dashboard. ## Project layout ``` restreamer-watchdog/ ├── server.js # the watchdog + dashboard ├── package.json ├── Dockerfile # builds a self-contained image (node + ffmpeg + deps) ├── docker-compose.yml ├── .env.example # copy to .env and edit ├── .dockerignore ├── restreamer-watchdog.xml # Unraid Community Applications template └── data/ # you create this; holds config.json + fallback.mp4 ``` ## How configuration works Settings can come from **environment variables** (`RESTREAMER_URL`, `RESTREAMER_USER`, `RESTREAMER_PASS`, `FALLBACK_FILE`) or from the **Configure** button in the dashboard. Anything saved in the dashboard is written to `config.json` in the data folder and takes precedence on the next start. The fallback video must live in the data folder and be referenced by filename only (e.g. `fallback.mp4`). --- ## Install option A — docker-compose (recommended) ```bash cp .env.example .env # then edit .env mkdir -p data # put fallback.mp4 inside ./data docker compose up -d ``` Compose builds the image from the files in this folder — no registry account and nothing to pull. Dashboard: `http://SERVER_IP:1975/` ## Install option B — plain docker ```bash mkdir -p data # put your fallback.mp4 in ./data first docker build -t restreamer-watchdog . docker run -d \ --name restreamer-watchdog \ -p 1975:1975 \ -e RESTREAMER_URL="http://192.168.0.120:8080" \ -e RESTREAMER_USER="admin" \ -e RESTREAMER_PASS="yourpassword" \ -e FALLBACK_FILE="fallback.mp4" \ -v "$PWD/data:/data" \ --restart unless-stopped \ restreamer-watchdog ``` ## Install option C — Unraid `restreamer-watchdog.xml` is a Community Applications template. It does **not** need a Docker Hub account or a published image: it runs the official `node:18` image, installs ffmpeg, and downloads the app files from streamhelpers.com into your appdata folder on start. 1. Put the XML where Unraid can see it (e.g. `/boot/config/plugins/dockerMan/templates-user/`), or host it and add it via **Docker → Add Container → Template**. 2. Set the four env vars (URL, user, password, fallback filename), keep the WebUI port at `1975`, and leave the app data path at `/mnt/user/appdata/restreamer-watchdog`. 3. Copy your `fallback.mp4` into `/mnt/user/appdata/restreamer-watchdog` before starting. First boot takes a few minutes while ffmpeg installs; watch the container log. Restarting re-downloads the latest version. ## Install option D — one-line docker run (no compose, no build) Same approach as the Unraid template, for any Docker host: ```bash docker run -d \ --name restreamer-watchdog \ -w /app \ -p 1975:1975 \ --restart unless-stopped \ -v /mnt/user/appdata/restreamer-watchdog:/app \ node:18 \ bash -c "apt-get update && apt-get install -y ffmpeg curl && cd /app && curl -fsSL -O https://streamhelpers.com/restreamer-watchdog/server.js -O https://streamhelpers.com/restreamer-watchdog/package.json && npm install && node server.js" ``` --- ## Getting the settings right - **RESTREAMER_URL** is the Restreamer **web UI / API** address (e.g. `http://192.168.0.120:8080`) — *not* the SRT (`25553`) or RTMP (`1935`) port. If you can log into the Restreamer UI at that address, this is correct. - **User / password** are your normal Restreamer login. - **Fallback video**: any `.mp4` with video **and** audio works best. Match it roughly to your normal stream resolution; the watchdog will scale to the detected input size when it can. ## How it decides to fail over The watchdog polls `GET /api/v3/process` every few seconds. An output is considered "live" (and thus a fallback candidate) only when its process `exec === "running"`. The input is "healthy" when it's running **and** showing progress (fps/frames/bitrate). No healthy input + running outputs → fallbacks start. Healthy input returns, or the platform order is `stop` → fallbacks stop. ## Important caveats - **The switch is not seamless.** Because each output is a separate ffmpeg process, cutting to the fallback causes that platform's RTMP connection to reconnect — viewers may see a brief "stream interrupted" before the slate appears. For a truly gapless standby you'd need a single continuous encoder (e.g. OBS as the final mixer) in front of the platforms. - **No dashboard authentication.** The web UI and the stored `config.json` contain your Restreamer credentials in plain text. Keep this on your LAN / behind a reverse proxy with auth; do not expose port 1975 to the internet. - **This is separate from Restreamer's own processes.** The watchdog spawns its own ffmpeg; it does not create processes inside Restreamer, so it won't reintroduce the old crash-looping `failover-fallback` process. ## Updating ```bash docker compose up -d --build # options A and B: rebuild from updated source docker restart restreamer-watchdog # options C and D: re-downloads on start ``` Your `config.json` and fallback video persist in the mounted data folder across updates. --- ## License, support and donations Provided free and **as-is, with no warranty and no support of any kind**. There is no help desk, no ticket queue, and no obligation on anyone to answer a question, fix a bug, or keep this working as third-party APIs change. This tool decides when to cut your live broadcast over to a fallback video, and it can get that wrong. You are responsible for securing your installation, for the credentials you supply, and for testing before you rely on it. If it's useful and you want to chip in, donations are welcome: A donation is a **voluntary gift, not a purchase**. It buys no support, no warranty, no bug fixes, no features and no priority, and it is non-refundable. **Donating does not change any of the above.** Only give what you're happy to give away with nothing expected back. Full terms: Another fine product of [Blue Soup Enterprises](https://bluesoup.biz/) · [StreamHelpers.com](https://streamhelpers.com/)