MediaMTX Server
Context: $ARGUMENTS
Quick start
- Install the binary: -> Step 1 (
install) - Write a starter config: -> Step 2 (
init-config) - Launch + reload + stop: -> Step 3 (
start/reload/stop) - Query the Control API: -> Step 4 (
paths-list/sessions-list/api) - Author auth rules (JWT): -> Step 5 (
mint-jwt)
When to use
- User wants a self-hosted server that accepts any of RTSP, RTMP, HLS, WebRTC (WHIP/WHEP), SRT, MPEG-TS and transmuxes between them.
- User needs on-demand publishing (spawn an ffmpeg publisher only when readers appear), recording to disk, or per-path hooks.
- User wants a Prometheus-scrapeable metrics endpoint for stream health.
- User wants to relay / forward / proxy between servers.
For documentation lookup (what does recordSegmentDuration default to? which /v3/* endpoint lists webrtc sessions?), use the mediamtx-docs skill first.
Step 1 — Install
Download the latest release binary for the current platform (detects
darwin_{arm64,amd64}, linux_{amd64,arm64v8,armv7,armv6}, windows_amd64):
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py install --dir ./MediaMTX-bin
Then the binary lives at ./MediaMTX-bin/mediamtx (or .exe on Windows).
Export MEDIAMTX_BIN once so subsequent commands can find it without --bin:
export MEDIAMTX_BIN=$PWD/MediaMTX-bin/mediamtx
Alternative installs (not covered by this script — all documented at mediamtx-docs):
- Docker:
docker run --rm -it --network host bluenviron/mediamtx:latest - Homebrew:
brew install mediamtx go install github.com/bluenviron/mediamtx@latest
Step 2 — Write a starter config
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py init-config --output ./mediamtx.yml
The generated mediamtx.yml has:
- API on
:9997, metrics on:9998, playback on:9996. - RTSP + RTMP + HLS (LL-HLS variant) + WebRTC + SRT all enabled.
- Internal auth with an
anyuser (no-auth publisher/reader) and a locked-downadminfor API/metrics. - Commented-out examples for on-demand-only paths, recording, and upstream RTSP camera proxy.
Edit before starting. At minimum:
- Change the admin password.
- Set
webrtcICEServers2to a real STUN/TURN for NAT traversal. - Add per-path recording if needed.