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.
These are the protocols that are currently supported and their capabilities (publish from a client / publish from a server / read):
Media-over-QUIC (publish from a client, publish from a server, 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 from a client, publish from a server, 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 from a client, publish from a server, 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 from a client, publish from a server, 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 from a client, publish from a server, 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 (publish from a server, 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 (publish from a server): a packet format used for TV broadcasting. MediaMTX is capable of pulling MPEG-TS packets from an IP address.
RTP (publish from a server): 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. Usually some protocol is used for the publishing/ingestion operation, and a different one is used by clients to read streams.
Regarding publishing/ingestion, 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).
Regarding reading, the protocol 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. On a local network, multicast-capable protocols (RTSP, RTP) allow to save bandwidth since packets are sent once per stream and not per user.
In any case, the protocol is not a constraint and can be changed at any time by switching the client and target port.