streamd: preview quality picker, dashboard polish, C4 wrap keys
All checks were successful
release / build-and-upload (push) Successful in 6m18s
modules-release / build-and-upload (push) Successful in 5m18s

- Preview player can select FHD/HD/SD (or ABR master) from publish links
- Embed dashboard screenshots in README; Linux streamd+agent setup guide
- C4 Widevine wrap license mode + require --wvd; prefer Widevine PSSH
- Channel 4 and My5 modules; streamd auth, variants, schedules, HLS gate
This commit is contained in:
404errordeveloper 2026-10-09 20:57:43 +02:00
parent b3955bd81e
commit 066e018749
113 changed files with 19002 additions and 1541 deletions

View file

@ -3,17 +3,22 @@
Two long-running pieces: `drm serve` holds the state and the dashboard, `drm agent
run` keeps credentials fresh using real phones.
**New to Linux servers?** Start with the copy-paste guide:
[streamd-server-setup.md](streamd-server-setup.md) (download, chmod, add MPD
streams, screen/systemd so it survives closing the terminal).
## drm serve
```bash
./bin/drm serve --bind 127.0.0.1:8083 --data .cache/streamd --token SECRET
./bin/drm serve --bind 127.0.0.1:8083 --data .cache/streamd
```
| Flag | Default | Purpose |
|---|---|---|
| `--bind` | `0.0.0.0:8083` | listen address |
| `--bind` | `127.0.0.1:8083` | listen address (loopback). Non-loopback logs a warning |
| `--data` | `.cache/streamd` | SQLite, work dirs, HLS output, logs |
| `--token` | `$STREAMD_TOKEN` | bearer token for mutating routes |
| `--token` | `$STREAMD_TOKEN` | legacy admin API key (prefer dashboard API keys) |
| `--admin-user` / `--admin-pass` | — | create first admin on empty install |
| `--nre` | `$NRE_PATH`, `bin/`, `PATH`, auto-download | N_m3u8DL-RE |
| `--ffmpeg` | `$FFMPEG_PATH`, `bin/`, `PATH`, auto-download | ffmpeg |
| `--mp4decrypt` | `$MP4DECRYPT_PATH`, `bin/`, `PATH`, auto-download | Bento4 mp4decrypt |
@ -24,9 +29,12 @@ On start, `serve` resolves media tools and **downloads** ffmpeg (BtbN static),
N_m3u8DL-RE (v0.6.0-beta), and mp4decrypt (Bento4) into `bin/` when missing.
macOS ffmpeg is not auto-fetched — install with `brew install ffmpeg`.
Open <http://127.0.0.1:8083>. GET routes are unauthenticated; anything mutating
needs `Authorization: Bearer <token>`. The header shows ffmpeg / NRE / mp4decrypt
status from `/api/health` → `deps`.
Open <http://127.0.0.1:8083> and sign in (or complete first-run setup). Auth is
session cookies for the dashboard and **API keys** (Settings → API keys) for
agents/scripts. Roles: `admin`, `operator`, `viewer`. `GET /api/health` stays
anonymous for liveness; stream list and mutations need a principal. Legacy
`--token` / `STREAMD_TOKEN` still works as an admin key and prints a migration
warning.
### Keys and proxy
@ -53,6 +61,7 @@ status from `/api/health` → `deps`.
| `PATCH /api/streams/:id` | update |
| `DELETE /api/streams/:id` | remove |
| `POST /api/streams/:id/start\|stop\|restart` | desired state |
| `POST /api/streams/:id/capture` | ask connected agents to refresh credentials now |
| `POST /api/streams/:id/credentials` | push a fresh manifest + keys |
| `POST /api/streams/:id/claim` | agent claims the stream |
@ -107,7 +116,9 @@ at init time.
## drm agent run
```bash
export STREAMD_TOKEN=SECRET
# Prefer an operator API key from the streamd dashboard (Settings → API keys).
export STREAMD_API_KEY=ndk_…
# or: export STREAMD_TOKEN=… (legacy alias)
./bin/drm agent run --config apps/agent/agent.yaml
```
@ -121,7 +132,9 @@ What it does, in a loop:
6. force-stop the app and release the device
It never installs apps and never runs a downloader. A websocket heartbeat keeps its
claims alive, so claims expire automatically if the agent dies.
claims alive, so claims expire automatically if the agent dies. Streamd can also
push a capture immediately (`POST /api/streams/:id/capture` or the dashboard
**Refresh keys** button).
### Subcommands
@ -138,7 +151,10 @@ claims alive, so claims expire automatically if the agent dies.
```yaml
streamd_url: http://127.0.0.1:8083
# token: taken from $STREAMD_TOKEN when unset
# Prefer an API key created in the streamd dashboard (operator role):
# api_key: ndk_…
# token: … # alias for api_key (legacy name)
# Or set STREAMD_API_KEY / STREAMD_TOKEN in the environment.
poll_interval_sec: 30
data_dir: .cache/agent
workers: 1
@ -160,14 +176,15 @@ run by the host; not linked into `drm.exe`).
```bash
# terminal 1
./bin/drm serve --bind 127.0.0.1:8083 --data .cache/streamd --token SECRET
./bin/drm serve --bind 127.0.0.1:8083 --data .cache/streamd
# terminal 2
export STREAMD_TOKEN=SECRET
# terminal 2 — after creating an operator API key in the dashboard
export STREAMD_API_KEY=ndk_…
./bin/drm agent run --config apps/agent/agent.yaml
```
Then create a stream, enable it, and watch the agent pick it up:
Then create a stream, leave **Enabled** checked (required for on-demand wake),
and watch the agent pick it up:
```bash
./bin/drm agent status