Publish and read streams
Live streams can be published or read by using a client (software) that connects to MediaMTX and communicates through a protocol.
Many protocols are available for publishing and reading real-time streams because different industries developed streaming technology at different times and for different purposes (security, web streaming, TV broadcasting). In MediaMTX, streams are not tied to a specific protocol: they can be published with one protocol and read with another. Conversion is effortless and automatic.
Streams can also be ingested as Static sources, in which MediaMTX acts as the client and pulls streams from other servers.
These are the protocols that are currently supported and their capabilities (publish / static source / read):
Media-over-QUIC (publish, static source, read): a new generation streaming protocol based on QUIC, HTTP/3 and browser APIs. MediaMTX listens for incoming clients on ports
8892/TCPand8893/UDPand is capable of pulling streams from other servers.WebRTC (publish, static source, read): a streaming protocol based on a set of ready-to-use browser APIs. MediaMTX listens for incoming clients on ports
8889/TCP,8189/UDPand is capable of pulling streams from other servers.RTSP (publish, static source, read): the streaming protocol used by most IP cameras. MediaMTX listens for incoming clients on port
:8554/TCP(and uses:8000/UDPand:8001/UDPunder the hood) and is capable of pulling streams from other servers.RTMP (publish, static source, read): streaming protocol used mostly for publishing live streams to broadcast websites. MediaMTX listens for incoming clients on port
:1935/TCPand is capable of pulling streams from other servers.SRT (publish, static source, read): a streaming protocol developed for robustness and precise timing for the enterprise broadcasting industry. MediaMTX listens for incoming clients on port
8890/UDPand is capable of pulling streams from other servers.HLS (static source, read): a streaming protocol based on files (segments) served through an HTTP server, suitable for reading streams on websites. MediaMTX listens for incoming clients on port
8888/TCP.MPEG-TS (static source): a packet format used for TV broadcasting. MediaMTX is capable of pulling MPEG-TS packets from an IP address.
RTP (static source): a packet format used for IP streaming. MediaMTX is capable of pulling RTP streams from an IP address.
We also provide instructions for ingesting streams from some devices:
We also provide instructions for publishing streams with specific software:
We also provide instructions for reading streams with specific software:
Which protocol(s) should i use?
There isn’t a single answer to this question; it depends on the specific use case. Think about the overall system you want to implement, from the source to the final destination.
If the source is an IP camera, you probably want to use the protocol offered by the camera (RTSP, RTMP). If the source is broadcasting software, you might want to use its native protocol (RTMP, WebRTC, SRT). If the source is a user connected to your website through a browser, you might want to use a browser-native protocol (Media-over-QUIC, WebRTC).
The protocols used by readers are often different from the one used to publish the stream, and the choice depends on the intended audience. If readers are users connected through a website, you might want to use a browser-native protocol (Media-over-QUIC, WebRTC). If you need to serve a large number of readers, you might want to consider HLS.
In any case, the protocol is not a constraint and can be changed at any time by switching the client and target port.