Files
Media-Server-Setup/mediamtx.yml
Brandyn / Techy 463d9b2385 Live portal: React + dockview multi-stream viewer behind Authentik; MediaMTX HLS/WebRTC/API re-enabled; is-live Discord hook
live/: every active stream opens as a dockable window (WHEP, HLS fallback), audio follows the
focused window, per-window mute/volume, pinning. Caddy live.HOST block with forward-auth proxies
/api /webrtc /hls to MediaMTX on loopback and serves /srv/live. WebRTC media on 8189 (firewall).
configure.py asks the live hostname and an optional Discord webhook; MediaMTX -ffmpeg image runs
the runOnReady hook. deployLive.sh builds and ships dist/.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-30 23:01:11 -05:00

69 lines
2.2 KiB
YAML

# MediaMTX — ingest only. No playback endpoints exposed.
logLevel: info
rtsp: no
metrics: no
pprof: no
# live portal (served to the browser only via Caddy + Authentik on live.HOST; these ports are published on 127.0.0.1)
api: yes
apiAddress: :9997
hls: yes
hlsAddress: :8888
hlsVariant: lowLatency
hlsAlwaysRemux: no
webrtc: yes
webrtcAddress: :8889
webrtcLocalUDPAddress: :8189
webrtcLocalTCPAddress: :8189
webrtcIPsFromInterfaces: no
# webrtcAdditionalHosts is set via env MTX_WEBRTCADDITIONALHOSTS (= the public hostname) in docker-compose.yml
rtmp: yes
rtmpAddress: :1935
srt: yes
srtAddress: :8890
# ---- auth -------------------------------------------------------------
# Each streamer may publish only under their own prefix.
# RTMP key: techy/Title?user=techy&pass=CHANGEME
# SRT: srt://HOST:8890?streamid=publish:techy/Title:techy:CHANGEME
authMethod: internal
authInternalUsers:
- user: any
permissions:
- action: read
- action: playback
- action: api
- user: techy
pass: CHANGEME_TECHY
permissions:
- action: publish
path: ~^techy/[A-Za-z0-9_.-]+$
- user: diceofire
pass: CHANGEME_DICE
permissions:
- action: publish
path: ~^diceofire/[A-Za-z0-9_.-]+$
# ---- recording --------------------------------------------------------
pathDefaults:
record: yes
recordPath: /recordings/%path/.live/%Y-%m-%d_%H-%M-%S # hidden while recording; the sweep publishes the finished file one level up
recordFormat: fmp4
recordPartDuration: 1s
recordSegmentDuration: 12h # one file per stream unless it runs >12h
recordDeleteAfter: 0s # never auto-delete; the archive job handles it
# optional Discord "is live" notice (LIVE_WEBHOOK_URL set in .env). busybox wget in the -ffmpeg image.
runOnReady: >
sh -c '[ -n "$LIVE_WEBHOOK_URL" ] || exit 0;
u="${MTX_PATH%%/*}"; t="${MTX_PATH#*/}";
wget -q -O /dev/null --header="Content-Type: application/json"
--post-data="{\"content\":\"🔴 **$u** is live: $t — https://$LIVE_HOST/\"}" "$LIVE_WEBHOOK_URL"'
runOnReadyRestart: no
paths:
# any name under a streamer's prefix; inherits pathDefaults
~^(techy|diceofire)/[A-Za-z0-9_.-]+$: {}