/media-os:mediamtx-server [action]from media-os
Hosts an all-protocol media server with MediaMTX, transmuxing RTSP, RTMP, HLS, WebRTC, SRT, and MPEG-TS. Covers install, config, Control API, auth, recording, and Docker deployment.
Ships in media-os. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Context: $ARGUMENTS
install)init-config)start / reload / stop)paths-list / sessions-list / api)mint-jwt)For documentation lookup (what does recordSegmentDuration default to? which /v3/* endpoint lists webrtc sessions?), use the mediamtx-docs skill first.
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 run --rm -it --network host bluenviron/mediamtx:latestbrew install mediamtxgo install github.com/bluenviron/mediamtx@latestuv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py init-config --output ./mediamtx.yml
The generated mediamtx.yml has:
:9997, metrics on :9998, playback on :9996.any user (no-auth publisher/reader) and a locked-down admin for API/metrics.Edit before starting. At minimum:
webrtcICEServers2 to a real STUN/TURN for NAT traversal.Full reference: references/config.md has the
annotated YAML + every knob.
Start (forked, pidfile-tracked):
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py start \
--bin ./MediaMTX-bin/mediamtx \
--config ./mediamtx.yml \
--log ./mediamtx.log
The pidfile defaults to /tmp/mediamtx.pid (override with --pidfile or
MEDIAMTX_PID). Starting twice fails fast if the pidfile's process is still
alive.
Hot-reload the config (SIGHUP — most keys reload without restart; a few listener changes need a full restart):
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py reload
Stop:
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py stop # SIGTERM
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py stop --kill # SIGKILL if stuck
For systemd / launchd / Windows service, point your unit/plist at the
mediamtx binary directly — the docs page features/start-on-boot has
templates.
Default API base: http://127.0.0.1:9997 (override with --base or
$MEDIAMTX_API). Tags that pass --user / --password use HTTP Basic.
List all paths (live + configured):
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py paths-list
Aggregate every session + connection endpoint into one JSON blob:
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py sessions-list
(Covers /v3/rtspconns/list, /v3/rtspsessions/list, /v3/rtspsconns/list,
/v3/rtspssessions/list, /v3/rtmpconns/list, /v3/rtmpsconns/list,
/v3/hlsmuxers/list, /v3/webrtcsessions/list, /v3/srtconns/list.)
List recordings:
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py recordings-list
Generic GET / POST / PATCH / DELETE:
# Read global config
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py api --path /v3/config/global/get
# Patch a path at runtime
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py api \
--path /v3/config/paths/patch/camera1 \
--method PATCH \
--json-body '{"record":true,"recordFormat":"fmp4"}'
# Delete a path
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py api \
--path /v3/config/paths/delete/camera1 \
--method DELETE
# Kick a WebRTC session
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py api \
--path /v3/webrtcsessions/kick/<id> \
--method POST
Full endpoint list: references/api.md or
mediamtx-docs -> references/control-api.
MediaMTX supports three auth backends, selected by authMethod:
internal — users listed under authInternalUsers in mediamtx.yml.http — MediaMTX POSTs {action, path, protocol, user, pass, ip, query} to
your external endpoint; your endpoint replies 200 (allow) or anything else
(deny).jwt — bearer token verified against a JWK URL (jwtJWKSURL) OR a shared
HMAC secret. The token's mediamtx_permissions claim is a list of
{action, path} entries.For testing the JWT flow, mint a short-lived HS256 token:
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py mint-jwt \
--secret "$MY_SHARED_SECRET" \
--sub user42 \
--ttl 900 \
--permission publish:live/cam1 \
--permission read:live/cam1
Pass the token as either ?jwt=<token> on the publish URL or the
Authorization: Bearer <token> header.
Full auth flow details: references/api.md and
mediamtx-docs -> features/authentication.
features/remuxing-reencoding-compression has the recipe.bluenviron/mediamtx (was aler9/rtsp-simple-server). Old install scripts, Docker image tags (aler9/rtsp-simple-server:latest), and StackOverflow answers still reference the old name — ignore them. Current image: bluenviron/mediamtx:latest.mediamtx.yml (set rtsp: no, rtmp: no, etc.) — exposing them all in production is unnecessary attack surface./v3/*, NOT /v2/* or /v1/*. Any tutorial referencing /v2 is obsolete.127.0.0.1 is dangerous — anyone with access can add paths, rewrite config, or kick sessions. Lock it down with authInternalUsers that requires the api action, and firewall the port.authMethod is global, not per-path. You can't use internal for RTSP but jwt for WebRTC. Per-path granularity comes from the permissions list inside each user entry.sourceOnDemand: true fires runOnDemand only when a reader connects. sourceOnDemandStartTimeout (default 10s) is the grace period for the publisher to appear; sourceOnDemandCloseAfter (default 10s) is how long the source stays alive after the last reader disconnects.runOnInit, runOnDemand, runOnReady, runOnRead, runOnUnread, runOnConnect, runOnDisconnect all fork/exec a shell. MediaMTX substitutes $MTX_PATH, $MTX_QUERY, $MTX_SOURCE_TYPE, etc. into the command.mpegts (legacy, .ts segments, ~6-10s latency, widest compat), fmp4 (fragmented MP4, ~4-6s), lowLatency (LL-HLS with partial segments, ~1-2s, Safari + hls.js >=1.5 only). Default is lowLatency.:8889/<path>/whip and .../whep. Not a signalling-server model — direct HTTP POST of SDP offers. OBS's built-in WebRTC service targets this.srt://host:8890?streamid=publish:<path>:<user>:<pass> to publish, srt://host:8890?streamid=read:<path>:<user>:<pass> to read. Most SRT clients default to streamid=live — you must set it.recordFormat: fmp4 default, recordSegmentDuration: 1h default. fMP4 supports seek via the Playback API (/playback). MPEG-TS recordings do not.mediamtx.yml hot-reloads on SIGHUP for almost every key. Exceptions: listening addresses, TLS certs, API address. Restart for those.FROM scratch works if you also ship the CA bundle your upstreams need.raw.githubusercontent.com/.../main/mediamtx.yml is always the ground truth for defaults. mediamtx-docs github-mediamtx.yml page gives it to you directly.# 1. install + init-config + start
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py install
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py init-config
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py start --config ./mediamtx.yml
# 2. publish via ffmpeg (separate shell)
ffmpeg -re -stream_loop -1 -i sample.mp4 -c copy -f rtsp \
rtsp://127.0.0.1:8554/live/demo
# 3. read via ffplay / VLC
ffplay rtsp://127.0.0.1:8554/live/demo
Edit mediamtx.yml:
pathDefaults:
record: yes
recordPath: ./recordings/%path/%Y-%m-%d_%H-%M-%S-%f
recordFormat: fmp4
recordSegmentDuration: 1h
recordDeleteAfter: 24h
Hot-reload:
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py reload
Later, inspect disk:
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py recordings-list
mediamtx.yml, ensure hls: yes and hlsVariant: lowLatency.http://127.0.0.1:8889/live/obs/whip, Bearer Token blank (unless auth on).http://127.0.0.1:8888/live/obs/index.m3u8 (LL-HLS) or http://127.0.0.1:8889/live/obs/ (WHEP viewer page).In mediamtx.yml:
authMethod: internal
authInternalUsers:
- user: admin
pass: SECURE_PW
ips: [127.0.0.1/32]
permissions:
- action: api
- action: metrics
- action: pprof
- user: publisher
pass: PUB_PW
permissions:
- action: publish
- user: any
pass:
permissions:
- action: read
Reload. API calls now need --user admin --password SECURE_PW.
ids=$(uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py api --path /v3/webrtcsessions/list \
| jq -r '.items[].id')
for id in $ids; do
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxctl.py api \
--path "/v3/webrtcsessions/kick/$id" --method POST
done
docker run -d --name mediamtx --network host \
-v "$PWD/mediamtx.yml:/mediamtx.yml" \
-v "$PWD/recordings:/recordings" \
bluenviron/mediamtx:latest
The install / start / stop / reload script subcommands are not
needed in this mode — Docker manages the process lifecycle. mtxctl.py paths-list / api / mint-jwt still work against the API at
http://127.0.0.1:9997.
mediamtx binary not foundCause: MEDIAMTX_BIN isn't set and ./MediaMTX-bin/mediamtx doesn't exist.
Solution: Run mtxctl.py install first, or export MEDIAMTX_BIN=$(which mediamtx), or pass --bin /path/to/mediamtx.
Cause: Pidfile is stale (non-graceful shutdown).
Solution: Remove the pidfile (rm /tmp/mediamtx.pid) and start again.
Cause: MediaMTX can't transcode; browsers don't support HEVC in WebRTC. Solution: Re-encode upstream: run an ffmpeg process that reads HEVC from one path and publishes H.264 into a second path, then point the WebRTC reader at the second path.
Cause: authMethod is internal and your API user doesn't have the api action.
Solution: Add - action: api to the user's permissions list, reload, and include --user/--password on every API call.
/v2/paths/listCause: The v2 namespace was removed.
Solution: Use /v3/paths/list.
Cause: No public STUN/TURN — browser can't get a reachable ICE candidate.
Solution: In mediamtx.yml set webrtcICEServers2 with real STUN + TURN (coturn, Cloudflare Realtime, Twilio STUN).
Cause: recordDeleteAfter not set.
Solution: Set recordDeleteAfter: 24h (or similar) in pathDefaults so old segments are pruned.
Cause: The key you changed is in the "requires restart" set (listener addresses, TLS, API address).
Solution: Full restart: mtxctl.py stop && mtxctl.py start ....
/v3/* API endpoint catalog with request/response shapes -> references/api.mdmediamtx.yml with every knob + its default -> references/config.mdCompanion skills:
mediamtx-docs for official doc search / section fetch.ffmpeg-streaming for publishing via ffmpeg (-f rtsp, -f rtmp, -f srt).ffmpeg-whip for WHIP publish from ffmpeg.gstreamer-pipeline for publishing via GStreamer (rtspclientsink, whipclientsink, srtsink).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub damionrashford/media-os --plugin media-os110 skills in this plugin
/audio-coreaudioManipulate macOS audio at the Core Audio HAL layer: afinfo (audio file metadata), afplay (play), afconvert (convert format/rate/bit-depth/channel layout), say (TTS), SwitchAudioSource (change default input/output/system device — brew install switchaudio-osx), audiodevice CLIs (npm/Go variants), AppleScript via osascript to drive System Preferences Sound. HAL plugins at /Library/Audio/Plug-Ins/HAL/ load virtual drivers (BlackHole 2ch/16ch/64ch, Loopback, Background Music). Aggregate Device (drift-corrected multi-in) and Multi-Output Device via Audio MIDI Setup.app or AudioHardwareCreateAggregateDevice. Use when the user asks to change default macOS audio device, route audio between apps on Mac, install BlackHole, build an Aggregate Device, convert audio files with afconvert, or script Mac audio from the terminal.
/audio-jackRoute professional low-latency audio with JACK Audio Connection Kit (jackaudio.org): jackd server (ALSA/CoreAudio/PortAudio/ASIO backends), jack_control (D-Bus JACK2 config), jack_lsp (list ports/connections), jack_connect/jack_disconnect (manage links), jack_cpu_load, jack_samplerate, jack_bufsize (runtime period size), jack_transport, jack_rec (multi-channel WAV recording), jack_iodelay (round-trip latency), jack_wait, jack_midi_dump. JACK1 C maintenance vs JACK2 C++ multicore. Modern Linux swaps jackd for PipeWire's libjack shim — same client API. JackTrip for uncompressed multichannel UDP over the Internet. Use when the user asks to run a JACK server, connect audio clients, measure roundtrip latency, record from JACK ports, set JACK period size, or bridge JACK over the network with JackTrip.
Other plugins' skills for the same job