Introduction
MediaMTX (formerly rtsp-simple-server) is a zero-dependency real-time media server written in Go. It acts as both a standalone server and a proxy, allowing you to publish, read, and relay live audio and video streams using multiple protocols from a single binary.
What MediaMTX Does
- Accepts and serves streams via RTSP, RTMP, HLS, Low-Latency HLS, WebRTC, and SRT
- Proxies and relays streams between different protocols automatically
- Records live streams to disk in segmented or continuous formats
- Runs external commands on stream events like connect, read, and publish
- Provides a built-in API for runtime stream and path management
Architecture Overview
MediaMTX is a single Go binary with no external dependencies. It manages named paths, where each path can have one publisher and multiple readers across any supported protocol. Internal stream data flows through a shared in-memory pipeline that handles protocol translation, so an RTMP publisher can be read by WebRTC clients without transcoding.
Self-Hosting & Configuration
- Deploy via Docker, a standalone binary, or package managers (Homebrew, APT)
- Configure paths, authentication, and recording in a single YAML file
- Set per-path credentials or integrate external authentication via HTTP hooks
- Enable TLS for RTSP, HTTPS for HLS and WebRTC, and encryption for SRT
- Use the REST API on port 9997 for dynamic path and session management
Key Features
- Single binary, zero external dependencies, minimal resource footprint
- Supports seven major streaming protocols with automatic cross-protocol bridging
- Built-in stream recording with configurable segment duration and path templates
- External command hooks for authentication, transcoding, and event-driven workflows
- Hot-reloadable YAML configuration without restarting the server
Comparison with Similar Tools
- Nginx-RTMP — requires compiling an Nginx module; limited to RTMP/HLS without WebRTC or SRT support
- Janus Gateway — full WebRTC media server with plugin architecture; more complex to configure
- LiveKit — focused on WebRTC rooms and real-time communication; heavier for simple relay scenarios
- GStreamer — powerful multimedia framework but requires building custom pipelines for server use cases
FAQ
Q: Does MediaMTX transcode streams? A: No, it relays streams without transcoding. Use FFmpeg in an external command hook if transcoding is needed.
Q: Can I run multiple streams simultaneously? A: Yes, each named path operates independently and you can run hundreds of concurrent streams.
Q: Is authentication supported? A: Yes, via static credentials in YAML, external HTTP-based authentication hooks, or JWT-based auth.
Q: What is the latency for WebRTC playback? A: Sub-second latency is typical for WebRTC readers when the publisher uses RTSP or RTMP.