Open-source, self-hosted RTMP(S) ingest router and splitter for Media over QUIC (MoQ) and RTMP(S) failover.
Run moq-ingest on your own edge (AWS, bare metal, Kubernetes) to own your contribution ingress, route broadcasters per stream, convert RTMP → MoQ right at your edge (so the WAN hop to your MoQ CDN runs over QUIC with congestion-aware group dropping instead of head-of-line-blocked TCP), and keep a zero-disconnect break-glass path to any RTMP(S) provider (AWS IVS, Mux, Cloudflare Stream, custom RTMP).
Broadcaster (OBS / Mobile / Hardware Encoder)
│ RTMPS / RTMP
▼
┌──────────────────────────────────────────────────────────┐
│ moq-ingest (your edge) │
│ │
│ RTMP(S) Listener ──► Router (HTTP Webhook / Static) │
│ │ │
│ ├──► HeaderCache (onMetaData + seq headers) │
│ │ │
│ ├──► MoQ Sink (isolated bounded queue) │
│ │ RTMP -> MoQ (FLV demux + QUIC publish) │
│ │ ──► https://cdn.moq.pro/... (or any relay) │
│ │ │
│ └──► RTMP(S) Sink (isolated bounded queue) │
│ Verbatim RTMP forward (metadata, captions, │
│ E-RTMP multitrack, key queries preserved) │
│ ──► rtmps://ingest.provider.example/app/… │
│ │
│ Admin / Break-Glass HTTP API (:8080) │
│ /healthz /metrics /v1/streams /v1/break-glass │
└──────────────────────────────────────────────────────────┘
- Edge RTMP → MoQ conversion: converts legacy RTMP (H.264 + AAC) and Enhanced-RTMP (HEVC, AV1, VP9, Opus, multitrack) into MoQ right on your edge using
moq-rtmp, sending QUIC over the WAN instead of TCP. - Verbatim RTMP(S) forwarding: relays audio, video,
onMetaData, captions (onCaptionInfo), cue points, E-RTMP multitrack, and stream key queries (e.g.?priority=1) untouched — no remuxing or transcoding. - Per-broadcaster routing: choose which broadcasters go to MoQ, RTMP, or both via an HTTP routing webhook or static TOML config.
- Failure isolation: every destination runs on its own task with a bounded queue. If MoQ degrades or goes down, the broadcaster's RTMP connection and any RTMP leg keep streaming uninterrupted while MoQ reconnects with jittered exponential backoff.
- Zero-disconnect break-glass & active-standby failover:
moq-ingestcaches each stream's latestonMetaDataand video/audio sequence headers. Standby targets stay dormant (zero duplicate ingest cost) and can be hot-attached mid-stream on the next video keyframe (~1–2 s) — either automatically afterfailover_after_msor instantaneously viaPOST /v1/break-glass— without dropping a single broadcaster.
cp config.example.toml config.toml
# Edit config.toml with your MoQ relay URL and optional RTMP(S) backup URL
cargo run --release -- --config config.tomlStream from OBS or FFmpeg to rtmp://127.0.0.1:1935/live/<stream-key>:
ffmpeg -re -f lavfi -i testsrc2=size=1280x720:rate=30 -f lavfi -i sine=frequency=440 \
-c:v libx264 -preset ultrafast -tune zerolatency -g 60 -c:a aac \
-f flv rtmp://127.0.0.1:1935/live/testSet [webhook].route_url to authenticate stream keys and pick per-broadcaster destinations dynamically.
Request (POST <route_url>):
{
"app": "live",
"stream_key": "sk_live_...",
"tc_url": "rtmps://ingest.example.com/live",
"peer": "203.0.113.10:54321"
}Response (200 OK):
{
"allow": true,
"stream_id": "channel-42",
"targets": [
{
"id": "moq-primary",
"group": "moq",
"role": "active",
"kind": "moq",
"url": "https://cdn.moq.pro/my-project?jwt=...",
"broadcast": "live/channel-42.hang"
},
{
"id": "rtmp-backup",
"group": "rtmp",
"role": "standby",
"kind": "rtmp",
"url": "rtmps://ingest.backup.example.com/app/sk_backup_..."
}
]
}Return {"allow": false, "reason": "invalid key"} (or HTTP 401/403) to reject the publish.
All /v1/* and /metrics endpoints require Authorization: Bearer <admin.token> when configured. /healthz stays open for load balancer health probes. Stream keys and ?jwt= query strings are redacted from every response and log line.
| Endpoint | Description |
|---|---|
GET /healthz |
Health check (status, active_streams, break_glass_active) |
GET /metrics |
Prometheus metrics (active streams, bytes/messages per kind, drops, reconnects, failovers) |
GET /v1/streams |
List active streams and per-target health/counters |
PUT /v1/streams/{id}/targets |
Hot-replace targets on one live stream without disconnecting the encoder |
DELETE /v1/streams/{id} |
Disconnect one live stream |
GET /v1/break-glass |
Inspect active global break-glass override |
POST /v1/break-glass |
Disable/promote target groups across all live and new streams immediately |
DELETE /v1/break-glass |
Clear global break-glass override |
Example: immediately fail all live and new streams from MoQ to standby RTMP:
curl -X POST http://127.0.0.1:8080/v1/break-glass \
-H "Authorization: Bearer $ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"disabled_groups": ["moq"],
"promoted_groups": ["rtmp"],
"reason": "upstream incident"
}'Restore normal routing:
curl -X DELETE http://127.0.0.1:8080/v1/break-glass \
-H "Authorization: Bearer $ADMIN_TOKEN"deploy/aws/cloudformation.yaml deploys a complete self-hosted ingest stack:
- Network Load Balancer (
:1935TCP RTMP + optional:443ACM-terminated TLS RTMPS) with HTTP health checks on:8080/healthz - EC2 Graviton (
c7g.medium) Auto Scaling Group tuned for QUIC UDP egress and TCP BBR ingest, with IMDSv2 enforced and SSM Session Manager access (no SSH port needed) - Optional AWS Global Accelerator (
EnableGlobalAccelerator=true) for anycast static IPs and AWS backbone last-mile RTMP contribution
aws cloudformation deploy \
--stack-name moq-ingest \
--template-file deploy/aws/cloudformation.yaml \
--capabilities CAPABILITY_IAM \
--parameter-overrides \
InstanceType=c7g.medium \
AdminToken="$ADMIN_TOKEN" \
MoqTargetUrl="https://cdn.moq.pro/my-project?jwt=$PUBLISH_JWT" \
RtmpBackupUrl="rtmps://ingest.backup.example.com/app/{stream_key}" \
RtmpBackupRole=standby \
EnableGlobalAccelerator=falseDual-licensed under MIT or Apache-2.0.