- 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
12 KiB
Streamd + agent on a Linux server (for dummies)
This guide is only for streamd (drm serve) and the agent (drm agent run)
on a Linux box. Copy-paste the commands. Change the bits in CAPS or
<angle brackets>.
You do not need Go, git, or a full repo checkout. One binary is enough.
For the deep reference (every flag, every API route), see streamd.md.
What each piece does
| Piece | Command | Job |
|---|---|---|
| streamd | drm serve |
Dashboard + API + pulls the MPD and serves HLS |
| agent | drm agent run |
Optional. Uses a phone to refresh MPD/keys when they expire |
If you already have a working MPD URL and Widevine keys (KID:KEY), you can run
streamd alone. Start the agent later when you want automatic refresh.
0. What you need
- A Linux server (x86_64 or ARM64)
- SSH access
curl(almost every distro has it)- Outbound HTTPS (streamd downloads ffmpeg / N_m3u8DL-RE on first start)
Check your CPU type:
uname -m
x86_64→ downloaddrm-linux-amd64aarch64→ downloaddrm-linux-arm64
1. Make a folder and download the binary
mkdir -p ~/null-drm
cd ~/null-drm
Pick the matching line (replace v0.1.4 if a newer v* release exists — check
releases):
# Intel / AMD 64-bit
curl -fL -o drm \
"https://git.nulldrm.com/nulldrm/Null-DRM-Official/releases/download/v0.1.4/drm-linux-amd64"
# OR ARM 64-bit (Raspberry Pi 4+, many cloud ARM VMs)
# curl -fL -o drm \
# "https://git.nulldrm.com/nulldrm/Null-DRM-Official/releases/download/v0.1.4/drm-linux-arm64"
Make it executable and check it works:
chmod +x drm
./drm help
You should see a list of commands including serve and agent.
Optional layout after first run:
~/null-drm/
drm # the binary
.cache/streamd/ # created by serve (database, HLS, logs)
.cache/agent/ # created by agent
agent.yaml # you create this for the agent
data/ # optional .wvd for key fetch
modules/ # optional provider zips (agent / capture)
bin/ # auto-downloaded ffmpeg, N_m3u8DL-RE, mp4decrypt
2. Start streamd (first time)
Pick a password. Create the first admin account on the command line so you are not stuck hunting a setup token in the logs:
cd ~/null-drm
./drm serve \
--bind 0.0.0.0:8083 \
--data .cache/streamd \
--admin-user admin \
--admin-pass 'CHANGE_ME_NOW'
What those flags mean:
| Flag | Meaning |
|---|---|
--bind 0.0.0.0:8083 |
Listen on all interfaces so you can open it from your PC |
--data .cache/streamd |
Where the DB, HLS files, and logs live |
--admin-user / --admin-pass |
First admin account (only used when the DB is empty) |
You will see a startup warning about binding non-loopback. That is expected on a server. Prefer putting a reverse proxy (Caddy / nginx) with TLS in front later.
On first start, streamd downloads ffmpeg, N_m3u8DL-RE, and mp4decrypt into
bin/. Wait until the log says it is listening.
Open in your browser (use the server IP):
http://YOUR_SERVER_IP:8083
Sign in with admin / the password you set.
Firewall tip: if the page does not load, open TCP 8083:
# Ubuntu ufw example
sudo ufw allow 8083/tcp
sudo ufw reload
3. Create an API key for the agent (and for curl)
In the dashboard:
- Open Settings → API keys (or People & keys)
- New API key
- Role: operator
- Copy the secret once (
ndk_…) — it is shown only then
You will paste that into agent.yaml and into curl examples below. Call it
YOUR_API_KEY in the rest of this guide.
4. Add an MPD stream and start it
Option A — dashboard (easiest)
- Go to Streams → Add stream (or Create)
- Basics: name like
city-news, leave Enabled checked - Source: paste the MPD URL (
https://…/manifest.mpd) - Paste keys if the stream is encrypted — one
KID:KEYper line. Leave empty for clear streams (e.g. some BBC) - Optional proxy:
socks5://127.0.0.1:1080if origin needs a UK/IE SOCKS hop - Create the stream
- Open the stream → Start (or it may already be running if Enabled + MPD are set)
When it is healthy, copy the play URL from the dashboard (Copy button), or use:
http://YOUR_SERVER_IP:8083/hls/city-news/index.m3u8
HD / SD variants (if you enabled them) are:
http://YOUR_SERVER_IP:8083/hls/city-news-hd/index.m3u8
http://YOUR_SERVER_IP:8083/hls/city-news-sd/index.m3u8
Option B — curl (no browser)
Create:
export STREAMD_API_KEY='YOUR_API_KEY'
curl -sS -X POST "http://127.0.0.1:8083/api/streams" \
-H "Authorization: Bearer $STREAMD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "city-news",
"title": "City News",
"mpd": "https://example.com/path/manifest.mpd",
"key": "KIDHEX:KEYHEX",
"enabled": true,
"drm_mode": "auto"
}'
Start (use the numeric id from the create response, or from GET /api/streams):
curl -sS -X POST "http://127.0.0.1:8083/api/streams/1/start" \
-H "Authorization: Bearer $STREAMD_API_KEY"
List streams:
curl -sS "http://127.0.0.1:8083/api/streams" \
-H "Authorization: Bearer $STREAMD_API_KEY"
Push fresh credentials later (what the agent does after a phone capture):
curl -sS -X POST "http://127.0.0.1:8083/api/streams/1/credentials" \
-H "Authorization: Bearer $STREAMD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"mpd": "https://example.com/path/manifest.mpd",
"key": "KIDHEX:KEYHEX\nKIDHEX2:KEYHEX2"
}'
Health check (no auth):
curl -sS "http://127.0.0.1:8083/api/health"
5. Agent (optional — auto refresh with a phone)
Skip this section if you will paste MPD/keys yourself forever.
What the agent needs
- streamd already running and reachable
- An operator API key
adbon the serverPATH- A rooted phone with the streaming app already installed (agent never installs apps)
- USB debugging authorised (
adb devicesshowsdevice) - Provider modules under
modules/if you use phone capture for that app - A
.wvdatdata/device.wvd(or setwvd:in the config) for key fetch
Config file
cd ~/null-drm
nano agent.yaml
Paste (edit the URL and key):
streamd_url: http://127.0.0.1:8083
api_key: "YOUR_API_KEY"
poll_interval_sec: 30
data_dir: .cache/agent
workers: 1
max_attempts: 5
capture_wait_sec: 180
devices: []
# wvd: data/device.wvd
# agent_id: my-server
Save, then run:
cd ~/null-drm
./drm agent run --config agent.yaml
Useful checks:
./drm agent devices
./drm agent status
./drm agent enqueue --stream city-news --reason manual
In the dashboard, Refresh keys on a stream asks connected agents to capture now.
6. Keep it running when you close the terminal
If you close SSH while drm serve is in the foreground, it dies. Pick one method.
Method A — screen (simplest)
sudo apt-get update && sudo apt-get install -y screen # Debian/Ubuntu
# Fedora: sudo dnf install screen
Start streamd inside a named screen:
cd ~/null-drm
screen -S streamd
./drm serve --bind 0.0.0.0:8083 --data .cache/streamd
Detach without killing it: press Ctrl+A, then D.
Come back later:
screen -r streamd
Second screen for the agent:
screen -S agent
cd ~/null-drm
./drm agent run --config agent.yaml
# Ctrl+A then D
List sessions: screen -ls
Method B — tmux (same idea)
sudo apt-get install -y tmux
cd ~/null-drm
tmux new -s streamd
./drm serve --bind 0.0.0.0:8083 --data .cache/streamd
# Detach: Ctrl+B then D
# Reattach: tmux attach -t streamd
Method C — nohup (one-liner, no session to reattach)
cd ~/null-drm
nohup ./drm serve --bind 0.0.0.0:8083 --data .cache/streamd > streamd.log 2>&1 &
echo $! > streamd.pid
# optional agent
nohup ./drm agent run --config agent.yaml > agent.log 2>&1 &
echo $! > agent.pid
Stop later:
kill "$(cat streamd.pid)"
kill "$(cat agent.pid)"
Method D — systemd (survives reboot — recommended for a real server)
Create a user unit (no root binary needed). Paths assume install in /home/ubuntu/null-drm
— change User=, paths, and password as needed.
sudo tee /etc/systemd/system/streamd.service >/dev/null <<'EOF'
[Unit]
Description=Null-DRM streamd (drm serve)
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu/null-drm
ExecStart=/home/ubuntu/null-drm/drm serve --bind 0.0.0.0:8083 --data /home/ubuntu/null-drm/.cache/streamd
Restart=on-failure
RestartSec=5
# Optional first-boot admin (ignored once users exist):
# Environment=STREAMD_ADMIN_PASS=CHANGE_ME
[Install]
WantedBy=multi-user.target
EOF
sudo tee /etc/systemd/system/drm-agent.service >/dev/null <<'EOF'
[Unit]
Description=Null-DRM credentials agent
After=network-online.target streamd.service
Wants=network-online.target
Requires=streamd.service
[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu/null-drm
ExecStart=/home/ubuntu/null-drm/drm agent run --config /home/ubuntu/null-drm/agent.yaml
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now streamd.service
# when ready for the agent:
# sudo systemctl enable --now drm-agent.service
Useful commands:
sudo systemctl status streamd
sudo journalctl -u streamd -f
sudo systemctl restart streamd
sudo systemctl stop streamd
Same pattern with drm-agent for the agent unit.
7. Quick “am I done?” checklist
cd ~/null-drm
# binary runs
./drm help
# streamd answers
curl -sS http://127.0.0.1:8083/api/health
# at least one stream exists and is enabled
curl -sS http://127.0.0.1:8083/api/streams \
-H "Authorization: Bearer YOUR_API_KEY"
# HLS playlist exists after start (name = stream name)
curl -sI "http://127.0.0.1:8083/hls/city-news/index.m3u8"
Play the m3u8 in VLC / ffplay / any HLS player using the server IP URL.
8. Common problems
| Symptom | Fix |
|---|---|
Permission denied running ./drm |
chmod +x drm |
| Browser cannot open the page | Use --bind 0.0.0.0:8083, open firewall port 8083, check curl from the server itself |
| Stream will not start | MPD must be http:// or https://. Encrypted streams need KID:KEY lines |
| Agent does nothing | Operator API key wrong; stream Enabled; phone in adb devices as device; app installed |
| Dies when SSH closes | Use screen/tmux/nohup/systemd from §6 |
| Deps download fails | Server needs outbound HTTPS; or place ffmpeg / N_m3u8DL-RE / mp4decrypt on PATH / in bin/ and use --skip-deps only if you already have them |
| Want loopback only + proxy | Bind 127.0.0.1:8083 and put Caddy/nginx in front with TLS |
9. Stopping / upgrading
Stop a foreground or screen session with Ctrl+C inside that session.
Upgrade:
cd ~/null-drm
# stop streamd first (systemctl stop streamd / kill / Ctrl+C)
curl -fL -o drm.new \
"https://git.nulldrm.com/nulldrm/Null-DRM-Official/releases/download/v0.1.4/drm-linux-amd64"
chmod +x drm.new
mv drm drm.bak
mv drm.new drm
# start again
Back up .cache/streamd/streamd.db before big upgrades.
See also
- streamd.md — full control-plane + agent reference
- release.md — all binary names / build notes
- quickstart.md — capture + modules from a full checkout