文档
- 作者仓库星标 0
- 作者仓库 skills-registry
- 领域
- 文档
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @tomevault-io · 未声明许可证
- 上下文用量评级
- 中等消耗
- 接入复杂程度
- 需手动接入
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- macOS · Docker
- 运行环境要求
- Python · Docker
- 检测到的文件与系统行为
-
- 只读
- 允许写入 / 修改
- 命令执行
- 网络行为
- 允许外网请求
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
第 1 步 - 了解页面目录
顶级家族:家族 · 何时选择`kickoff/*` · 安装、升级、首次运行。 `features/*` · 核心概念(发布、读取、记录、回放、身份验证、挂钩、指标)。 `features/<proto>-specific-features` · 每个协议选项(`rtsp-specific-features`、`rtmp-specific-features`、`webrtc-specific-features`、`srt-specific-features`)。
第 2 步 — 首先搜索
使用`--regex`作为锚定图案。每次点击都会打印 page:line、最近的标题、规范 URL 和 ±3 行上下文。
第 3 步 — 阅读一节
当命中出现时 `[§anchor]`: `--id` 也接受标题关键字作为后备。
第 4 步 — 获取整个页面
谨慎使用 — howto 页面足够紧凑,当您真正需要完整的配方时可以获取整个内容:`--format json` 用于结构化切换。
第 5 步 — 主缓存
以每个 0.3 秒的速度获取每个已知页面(约 70 个 URL)。通过`MEDIAMTX_DOCS_CACHE`覆盖缓存目录。用`clear-cache`清除。
# MediaMTX Docs
**Context:** $ARGUMENTS
## Quick start
- **Find a config key / API endpoint / feature:** -> Step 2 (`search --query <term>`)
- **Read a how-to in full:** -> Step 4 (`fetch --page <publish/X or read/X>`)
- **Read one section:** -> Step 3 (`section --page <page> --id <anchor>`)
- **Prime cache for offline:** -> Step 5 (`index`)
## When to use
- User asks "how do I push RTSP to MediaMTX?" or "how do I configure JWT auth?" or "what control-api endpoints exist?"
- Need to verify a MediaMTX config key or CLI flag before recommending it.
- Need the canonical mediamtx.org URL to cite.
- Before wiring up a publisher/reader, confirm the protocol endpoint and default port (RTSP 8554, RTMP 1935, HLS 8888, WebRTC 8889, SRT 8890, API 9997, Metrics 9998, pprof 9999).
- For the running-server wrapper + API calls, see the `mediamtx-server` skill.
---
## Step 1 — Know the page catalog
```bash
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py list-pages
```
Top-level families:
| Family | When to pick |
|---|---|
| `kickoff/*` | Install, upgrade, first-run. |
| `features/*` | Core concepts (publish, read, record, playback, auth, hooks, metrics). |
| `features/<proto>-specific-features` | Per-protocol options (`rtsp-specific-features`, `rtmp-specific-features`, `webrtc-specific-features`, `srt-specific-features`). |
| `features/configuration` + `features/control-api` + `features/logging` + `features/metrics` | Operational — the knobs you actually turn in production. |
| `references/configuration-file` | Authoritative list of every YAML option. Start here for config questions. |
| `references/control-api` | Authoritative list of every `/v3/*` endpoint. |
| `publish/<client>` | How to SEND a stream in via ffmpeg / gstreamer / OBS / Python / Go / Unity / etc. |
| `read/<client>` | How to PLAY a stream out via ffmpeg / gstreamer / VLC / OBS / browsers / etc. |
| `github-readme`, `github-mediamtx.yml`, `github-apidocs` | Raw upstream files — the ground truth when mediamtx.org is behind. |
Read [`references/pages.md`](references/pages.md) for the full catalog.
---
## Step 2 — Search first
```bash
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py search --query "recordFormat" --limit 5
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py search --query "jwt" --page features/authentication
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py search --query "/v3/paths" --page references/control-api
```
Use `--regex` for anchored patterns. Each hit prints page:line, nearest heading, canonical URL, and ±3 lines of context.
---
## Step 3 — Read one section
When a hit surfaces `[§anchor]`:
```bash
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py section --page features/authentication --id internal-users
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py section --page references/configuration-file --id paths
```
`--id` also accepts a heading keyword as fallback.
---
## Step 4 — Fetch a whole page
Use sparingly — howto pages are compact enough to fetch whole when you actually need the full recipe:
```bash
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py fetch --page publish/ffmpeg
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py fetch --page read/web-browsers
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py fetch --page github-mediamtx.yml # raw upstream YAML
```
`--format json` for structured handoff.
---
## Step 5 — Prime cache
```bash
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py index
```
Fetches every known page (~70 URLs) at 0.3s each. Override cache dir via `MEDIAMTX_DOCS_CACHE`. Clear with `clear-cache`.
---
## Gotchas
- **MediaMTX does NOT transcode — it remuxes only.** If a publisher pushes HEVC into a path and a reader asks for WebRTC in the browser, the reader will FAIL (browsers don't universally support HEVC in WebRTC). The docs page `features/remuxing-reencoding-compression` is explicit: for transcoding, chain an external `ffmpeg` publisher. When in doubt, publish as H.264 + Opus.
- **The binary is now `mediamtx` (was `rtsp-simple-server`).** Repo moved from `aler9/rtsp-simple-server` -> `bluenviron/mediamtx`. Old Docker tags and install scripts still float around the internet; ignore them.
- **Default ports you'll see quoted in docs:** RTSP 8554, RTSPS 8322, RTMP 1935, RTMPS 1936, HLS 8888, WebRTC 8889, SRT 8890, Control API 9997, Metrics 9998, pprof 9999, Playback 9996. Each is a separate listener; disable any you don't need in `mediamtx.yml`.
- **Three auth backends, exclusive.** `internal` (users in YAML under `authInternalUsers`), `http` (POST to an external endpoint), `jwt` (verify a bearer token via JWK URL or static secret). You can't mix them globally — but per-path `permissions` still apply. See `features/authentication`.
- **Auth actions**: `publish`, `read`, `playback`, `api`, `metrics`, `pprof`. Default allowed users have `all` which is shorthand for the union. Lock down production before exposing port 9997.
- **Hooks fire on path events**, not on connection events. `runOnInit` runs when the path is first registered, not when a client connects. `runOnDemand` is what you want for lazy pipelines. Read `features/hooks`.
- **`always-available` vs `on-demand-publishing`.** Set `sourceOnDemand: true` to start `source:` only when readers appear (saves bandwidth). `sourceOnDemandStartTimeout` + `sourceOnDemandCloseAfter` control how long MediaMTX waits / keeps source alive after the last reader.
- **Control API lives at `/v3/*`**, NOT `/v2/*` or `/v1/*`. Older tutorials reference v2; the v3 namespace is the current stable. Full endpoint list is on `references/control-api`.
- **HLS has two variants**: "HLS" (standard, `.ts` segments, ~6s latency) and "Low-Latency HLS" (LL-HLS, fMP4 partial segments, ~2s latency). Configurable per path via `hlsVariant`.
- **WebRTC signalling is WHIP/WHEP** over HTTP at `http://<host>:8889/<path>/whip` (publish) and `.../whep` (read). Default ICE servers + STUN config live at the global level; per-path overrides are NOT supported.
- **SRT uses the "stream ID" trick for path routing.** `srt://host:8890?streamid=publish:<path>:<user>:<pass>` to publish; `srt://host:8890?streamid=read:<path>:<user>:<pass>` to read. Quotes required in most shells.
- **`recordFormat: fmp4` is the default and what you want.** MPEG-TS recording is deprecated for most cases because it can't seek.
- **Config file hot-reloads on SIGHUP**, but some settings (listening ports, TLS certs) require a full restart. If a change "doesn't seem to take", restart the process.
- **Docs site pagination is Next.js SSR**; anchors are Markdown-slugified headings (`#internal-users`, `#authentication-methods`). The `section --id` command accepts either the raw slug or a heading keyword.
- **Raw upstream YAML is the final authority.** `github-mediamtx.yml` page returns the exact `mediamtx.yml` shipped in `main` with every default documented inline. When mediamtx.org lags a release, this is the ground truth.
---
## Examples
### Example 1 — "What do I put in mediamtx.yml to enable JWT auth?"
```bash
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py search --query "jwt" --page features/authentication --limit 5
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py section --page features/authentication --id jwt
```
### Example 2 — "How do I publish with ffmpeg?"
```bash
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py fetch --page publish/ffmpeg
```
### Example 3 — "What's the full list of control-api endpoints?"
```bash
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py fetch --page references/control-api
```
### Example 4 — "What does `runOnDemandCloseAfter` default to?"
```bash
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py search --query "runOnDemandCloseAfter" --page github-mediamtx.yml --limit 3
```
(Upstream YAML has inline defaults — faster than the HTML docs here.)
### Example 5 — "Record to disk, rotate every 15 min, keep 4 hours"
```bash
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py search --query "recordSegmentDuration" --page features/record
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py search --query "recordDeleteAfter" --page features/record
```
### Example 6 — "WebRTC publish from a browser — what's the WHIP URL?"
```bash
uv run ${CLAUDE_SKILL_DIR}/scripts/mtxdocs.py fetch --page publish/web-browsers
```
---
## Troubleshooting
### Error: `unknown page: foo`
**Cause:** The name isn't in the catalog.
**Solution:** Run `list-pages`. Common mistakes: using `record` instead of `features/record`; `api` instead of `references/control-api`.
### Error: `urlopen error [SSL: CERTIFICATE_VERIFY_FAILED]`
**Cause:** System certificate store is out of date (usually macOS Python).
**Solution:** Run `/Applications/Python\ 3.x/Install\ Certificates.command` or set `SSL_CERT_FILE`. Don't patch SSL verification off.
### Search returns zero hits for a config key
**Cause:** Key might be new in `main` but not yet in the published docs.
**Solution:** Search against the upstream YAML — `search --query "<key>" --page github-mediamtx.yml`. The upstream file is the source of truth.
### Results look like broken-up tables
**Cause:** The HTML extractor flattens cell borders into pipes but can't reconstruct multi-line cells.
**Solution:** The search-hit header prints the canonical URL. Open it directly in a browser for the authoritative view.
### Cache stale after MediaMTX release
**Solution:** `clear-cache` then `index`. The GitHub fallback pages already track `main` — if you want a specific release tag, edit the `github-*` URLs in the script's `PAGES` dict (or fetch directly with `urllib`).
---
## Reference docs
- Full page catalog with protocol-to-page cross reference -> [`references/pages.md`](references/pages.md)
---
> Source: [damionrashford/media-os](https://github.com/damionrashford/media-os) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-05-23 -->
章节与文件索引
按说明文件中的顺序排列。
快速启动
何时使用
第 1 步 - 了解页面目录
第 2 步 — 首先搜索
第 3 步 — 阅读一节
文件/命令 -> search --query <term> · fetch --page <publish/X or read/X> · section --page <page> --id <anchor> · index · mediamtx-server · kickoff/* · features/* · features/<proto>-specific-features
内容校验值 -> 7cd96387a35e
当前原文的自动摘译,尚未人工审校。
快速启动
查找配置密钥/API端点/功能: -> 步骤 2 (
search --query <term>) 完整阅读操作方法: -> 步骤 4 (fetch --page <publish/X or read/X>) 阅读一节: -> 步骤 3 (section --page <page> --id <anchor>) 为离线准备缓存: -> 步骤 5 (index)何时使用
用户询问“如何将 RTSP 推送到 MediaMTX?”或“如何配置 JWT 身份验证?”或“存在哪些 control-api 端点?”在推荐之前需要验证 MediaMTX 配置密钥或 CLI 标志。需要规范的 mediamtx.org URL 来引用。连接发布器/读取器之前,请确认协议端点和默认端口(RTSP 8554、RTMP 1935、HLS 8888、WebRTC 8889、SRT 8890、API 9997、Metrics 9998、pprof 9999)。
第 2 步 — 首先搜索
使用
--regex作为锚定模式。每次点击都会打印 page:line、最近的标题、规范 URL 和 ±3 行上下文。