MediaMTX: Free Open-Source Media Server for Real-Time Video Streaming and RTSP Cameras - Take your Surveillance to Next Level

MediaMTX: Free Open-Source Media Server for Real-Time Video Streaming and RTSP Cameras - Take your Surveillance to Next Level
Photo by Coline Haslé / Unsplash

MediaMTX is a free, open-source media server supporting real-time video streaming, RTSP, RTMP, HLS, and WebRTC. It enables the management and streaming of video from various sources, including RTSP cameras, with low-latency performance.

It is a lightweight solution that is written using Go language.

Features

  • Publish live streams to the server
  • Read live streams from the server
  • Streams are automatically converted from a protocol to another
  • Serve multiple streams at once in separate paths
  • Record streams to disk
  • Playback recorded streams
  • Authenticate users
  • Redirect readers to other RTSP servers (load balancing)
  • Control the server through the Control API
  • Reload the configuration without disconnecting existing clients (hot reloading)
  • Read Prometheus-compatible metrics
  • Run hooks (external commands) when clients connect, disconnect, read or publish streams
  • Compatible with Linux, Windows and macOS, does not require any dependency or interpreter, it's a single executable
  • Works on Raspberry Pi
  • Simple installation using Docker
  • Works with OSB

Supported systems

  • Windows
  • macOS
  • Linux

Supported Protocols

Here’s a standard table format:

Protocol Variants Video Codecs Audio Codecs
SRT clients H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3
SRT cameras and servers H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3
WebRTC clients WHIP AV1, VP9, VP8, H265, H264 Opus, G722, G711 (PCMA, PCMU)
WebRTC servers WHEP AV1, VP9, VP8, H265, H264 Opus, G722, G711 (PCMA, PCMU)
RTSP clients UDP, TCP, RTSPS AV1, VP9, VP8, H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video, M-JPEG, RTP-compatible codecs Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3, G726, G722, G711 (PCMA, PCMU), LPCM, RTP-compatible codecs
RTSP cameras and servers UDP, UDP-Multicast, TCP, RTSPS AV1, VP9, VP8, H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video, M-JPEG, RTP-compatible codecs Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3, G726, G722, G711 (PCMA, PCMU), LPCM, RTP-compatible codecs
RTMP clients RTMP, RTMPS, Enhanced RTMP AV1, VP9, H265, H264 MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), G711 (PCMA, PCMU), LPCM
RTMP cameras and servers RTMP, RTMPS, Enhanced RTMP AV1, VP9, H265, H264 MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), G711 (PCMA, PCMU), LPCM
HLS cameras and servers Low-Latency HLS, MP4-based HLS, legacy HLS AV1, VP9, H265, H264 Opus, MPEG-4 Audio (AAC)
UDP/MPEG-TS Unicast, broadcast, multicast H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3
Raspberry Pi Cameras H264

Supported Live Streams

Protocol Variants Video Codecs Audio Codecs
SRT H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3
WebRTC WHEP AV1, VP9, VP8, H264 Opus, G722, G711 (PCMA, PCMU)
RTSP UDP, UDP-Multicast, TCP, RTSPS AV1, VP9, VP8, H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video, M-JPEG, and any RTP-compatible codec Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3, G726, G722, G711 (PCMA, PCMU), LPCM, and any RTP-compatible codec
RTMP RTMP, RTMPS, Enhanced RTMP H264 MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3)
HLS Low-Latency HLS, MP4-based HLS, legacy HLS AV1, VP9, H265, H264 Opus, MPEG-4 Audio (AAC)

Install

You can install the server as a standalone binary that will work on almost all platform, or you can download and run the Docker image:

docker run --rm -it --network=host bluenviron/mediamtx:latest

There are several official Docker images that you can download and use:

Available images:

nameFFmpeg includedRPI Camera support
bluenviron/mediamtx:latest
bluenviron/mediamtx:latest-ffmpeg✔️
bluenviron/mediamtx:latest-rpi✔️
bluenviron/mediamtx:latest-ffmpeg-rpi✔️✔️

The --network=host flag is mandatory for RTSP to work, since Docker can change the source port of UDP packets for routing reasons, and this doesn't allow the server to identify the senders of the packets. This issue can be avoided by disabling the RTSP UDP transport protocol:

docker run --rm -it \
-e MTX_PROTOCOLS=tcp \
-e MTX_WEBRTCADDITIONALHOSTS=192.168.x.x \
-p 8554:8554 \
-p 1935:1935 \
-p 8888:8888 \
-p 8889:8889 \
-p 8890:8890/udp \
-p 8189:8189/udp \
bluenviron/mediamtx

set MTX_WEBRTCADDITIONALHOSTS to your local IP address.

License

MIT License

Resources & Downloads

GitHub - bluenviron/mediamtx: Ready-to-use SRT / WebRTC / RTSP / RTMP / LL-HLS media server and media proxy that allows to read, publish, proxy, record and playback video and audio streams.
Ready-to-use SRT / WebRTC / RTSP / RTMP / LL-HLS media server and media proxy that allows to read, publish, proxy, record and playback video and audio streams. - bluenviron/mediamtx







Open-source Apps

9,500+

Medical Apps

500+

Lists

450+

Dev. Resources

900+