Files
Media-Server-Setup/mediamtx.example.yml

70 lines
2.2 KiB
YAML

# MediaMTX — ingest only. No playback endpoints exposed.
logLevel: info
rtsp: no
moq: 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: [media.example.com] # public hostname browsers can reach for ICE (configure.py fills this)
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-%f # hidden while recording; microseconds = server arrival time (timecode fallback)
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_.-]+$: {}