go-rtmp
Production-ready RTMP server in pure Go.
Zero external dependencies.
What Can go-rtmp Do?#
OBS / FFmpeg (Publisher)
│
▼ RTMP
┌─────────────────────────────────┐
│ go-rtmp server │
│ │
│ ┌───────────┐ ┌───────────┐ │
│ │ Record │ │ Relay │ │
│ │ to FLV │ │ to CDN │ │
│ └───────────┘ └───────────┘ │
│ │
│ ┌───────────┐ ┌───────────┐ │
│ │ Auth │ │ Hooks │ │
│ │ Tokens │ │ Webhooks │ │
│ └───────────┘ └───────────┘ │
└────────┬──────────┬─────────────┘
│ │
┌────▼───┐ ┌───▼────┐
│ ffplay │ │ VLC │ ... (unlimited subscribers)
└────────┘ └────────┘Stream from any RTMP client → go-rtmp → multiple viewers + recording + relay#
Feature Highlights#
| Feature | Description | |
|---|---|---|
| 📡 | Live Streaming | Accept streams from OBS, FFmpeg, or any RTMP client |
| 👥 | Multi-Subscriber | Unlimited concurrent viewers with independent connections |
| 🎬 | Enhanced RTMP | H.265, AV1, VP9 via E-RTMP v2 — works with FFmpeg 6.1+ and OBS 29.1+ |
| 💾 | FLV Recording | Automatic recording of all codecs to FLV |
| ⏩ | Late-Join | Sequence header caching — subscribers see video instantly |
| 🔄 | Multi-Relay | Forward to YouTube, Twitch, or any RTMP server |
| 🔐 | Authentication | Token-based auth with 4 pluggable backends |
| 🔔 | Event Hooks | Webhooks, shell scripts, stdio on every lifecycle event |
| 📊 | Metrics | Live expvar counters via HTTP endpoint |
| 🛡️ | Zombie Detection | TCP deadlines kill stale connections automatically |
| 📦 | Zero Dependencies | Standard library only — no vendor lock-in |
Quick Example#
# Build
go build -o rtmp-server ./cmd/rtmp-server
# Run with recording
./rtmp-server -listen :1935 -record-all true
# Publish (another terminal)
ffmpeg -re -i video.mp4 -c copy -f flv rtmp://localhost:1935/live/test
# Watch (another terminal)
ffplay rtmp://localhost:1935/live/testThat’s it. No config files, no databases, no containers. Just build and run.
Documentation#
| Section | Description |
|---|---|
| Quick Start | Up and running in 5 minutes |
| Installation | Download binaries or build from source |
| User Guide | Recording, relay, auth, hooks, metrics |
| CLI Reference | Every command-line flag explained |
| Developer Guide | Architecture, protocol, testing, contributing |
| Changelog | Release history |