talira

MediaMTX

Ready-to-use, open source, live media router

open sourceMITself-hostablefree

MediaMTX is a zero-dependency live media server and media proxy, a single Go binary that publishes, reads, proxies, forwards, records and plays back real-time video and audio streams. A stream published with one protocol (Media-over-QUIC, SRT, WebRTC with WHIP and WHEP, RTSP, RTMP, HLS, MPEG-TS or RTP) can be read with any other, converted automatically without re-encoding, from sources such as IP cameras, Raspberry Pi cameras, OBS Studio, FFmpeg, GStreamer and web browsers, and played in VLC or a browser. It records to fMP4 or MPEG-TS and serves recordings back over HTTP, keeps always-available streams running when the publisher drops, authenticates readers and publishers with users in its config file, an HTTP endpoint or JWTs (for example from Keycloak), runs hooks when clients connect, publish or read, and has a Control API and Prometheus metrics. It was called rtsp-simple-server before, is MIT licensed, and ships as binaries for Linux, Windows and macOS and as Docker images with optional FFmpeg and Raspberry Pi camera support.

Ways to install

Problems it solves

  • restream my IP camera's RTSP feed so people can watch it in a web browser without a plugin
  • turn an RTSP camera stream into WebRTC so viewers get sub-second latency in the browser
  • a self-hosted RTMP server so I can stream from OBS to my own machine instead of Twitch
  • receive SRT streams from remote encoders and serve them to our website as HLS
  • convert an RTMP live stream into HLS so it plays on iPhones
  • my camera allows only a couple of RTSP connections, so I need a proxy that lets many clients watch it
  • record our camera streams to disk and play back a chosen time range later over HTTP
  • publish a Raspberry Pi camera as a low-latency stream on my local network
  • keep a placeholder video playing when the live source drops so viewers don't get disconnected
  • send video from a browser tab to my own server with WHIP and play it back with WHEP
  • forward a live stream from my own server to YouTube and Twitch
  • a lightweight media server in a single binary with no dependencies for a small embedded device
  • control who can publish or watch each live stream using JWTs from our identity server
  • run a script whenever a camera starts publishing or a viewer connects to a stream
  • export live stream viewer and publisher counts to Prometheus

View all 21 problems

Features

  • publish streams with Media-over-QUIC, SRT, WebRTC (WHIP), RTSP, RTMP, HLS, MPEG-TS and RTP
  • read streams with Media-over-QUIC, SRT, WebRTC (WHEP), RTSP, RTMP and HLS (including Low-Latency HLS)
  • automatic conversion between protocols without re-encoding
  • several streams at once on separate paths
  • hot reloading of the configuration without disconnecting clients
  • always-available streams that keep playing when the publisher is offline
  • recording to disk in fMP4 or MPEG-TS, and playback of recordings over HTTP
  • authentication with users in the config file, an external HTTP server or JWTs with a JWKS endpoint
  • per-path permissions for publish, read, playback, API, metrics and pprof, with IP restrictions
  • forwarding streams to other servers, including YouTube and Twitch
View 9 more
  • proxying requests to other servers, and read replicas for horizontal scaling
  • hooks that run external commands when clients connect, disconnect, publish or read
  • on-demand publishing that starts a command only when a client requests the path
  • Control API to manage paths and see connections
  • Prometheus-compatible metrics and pprof performance monitoring
  • Raspberry Pi camera and generic webcam ingest
  • single executable for Linux (amd64, arm64, armv7, armv6), Windows and macOS with no dependencies
  • Docker images with or without FFmpeg and Raspberry Pi camera support
  • release binaries with SHA256 checksums attested on Sigstore through GitHub Attestations

Limitations

  • Doesn't transcode or re-encode streams itself: changing a stream's codec, format or bitrate needs FFmpeg or GStreamer run alongside it56
  • No user database or sign-up of its own: users and permissions are written in the configuration file, or checked by an external HTTP or JWT auth server7

Capabilities

Has an APIplan not known

Alternatives

The same job

These do what MediaMTX does.

  1. Owncast Open source software for running your own live stream
  2. OvenMediaEngine Self-hosted sub-second latency live streaming server
  3. Restreamer Self-hosted live streaming server with a web UI and FFmpeg API
  4. Janus WebRTC Server The general purpose WebRTC server
  5. go2rtc Ultimate camera streaming application with support for dozens formats and protocols
  6. SRS Simple, high-performance real-time video server: RTMP, WebRTC, HLS, HTTP-FLV, SRT

Compare MediaMTX with the top 3