Skip to content

Commit 5d401bd

Browse files
committed
docs: update
1 parent ef087a6 commit 5d401bd

File tree

8 files changed

+171
-123
lines changed

8 files changed

+171
-123
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ _MediaMTX_ is a ready-to-use and zero-dependency real-time media server and medi
3131
* [Read](https://mediamtx.org/docs/usage/read) live streams from the server with SRT, WebRTC, RTSP, RTMP, HLS
3232
* Streams are automatically converted from a protocol to another
3333
* Serve several streams at once in separate paths
34+
* Reload the configuration without disconnecting existing clients (hot reloading)
3435
* [Record](https://mediamtx.org/docs/usage/record) streams to disk in fMP4 or MPEG-TS format
3536
* [Playback](https://mediamtx.org/docs/usage/playback) recorded streams
3637
* [Authenticate](https://mediamtx.org/docs/usage/authentication) users with internal, HTTP or JWT authentication
3738
* [Forward](https://mediamtx.org/docs/usage/forward) streams to other servers
3839
* [Proxy](https://mediamtx.org/docs/usage/proxy) requests to other servers
3940
* [Control](https://mediamtx.org/docs/usage/control-api) the server through the Control API
40-
* Reload the configuration without disconnecting existing clients (hot reloading)
41-
* [Monitor](https://mediamtx.org/docs/usage/metrics) the server through Prometheus-compatible metrics
41+
- [Extract metrics](https://mediamtx.org/docs/usage/metrics) from the server in a Prometheus-compatible format
42+
- [Monitor performance](https://mediamtx.org/docs/usage/performance) to investigate CPU and RAM consumption
4243
* [Run hooks](https://mediamtx.org/docs/usage/hooks) (external commands) when clients connect, disconnect, read or publish streams
4344
* Compatible with Linux, Windows and macOS, does not require any dependency or interpreter, it's a single executable
4445
* ...and many [others](https://mediamtx.org/docs/kickoff/introduction).

docs/1-kickoff/1-introduction.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ Main features:
1010
- [Read](/docs/usage/read) live streams from the server with SRT, WebRTC, RTSP, RTMP, HLS
1111
- Streams are automatically converted from a protocol to another
1212
- Serve several streams at once in separate paths
13+
- Reload the configuration without disconnecting existing clients (hot reloading)
1314
- [Record](/docs/usage/record) streams to disk in fMP4 or MPEG-TS format
1415
- [Playback](/docs/usage/playback) recorded streams
1516
- [Authenticate](/docs/usage/authentication) users with internal, HTTP or JWT authentication
1617
- [Forward](/docs/usage/forward) streams to other servers
1718
- [Proxy](/docs/usage/proxy) requests to other servers
1819
- [Control](/docs/usage/control-api) the server through the Control API
19-
- Reload the configuration without disconnecting existing clients (hot reloading)
20-
- [Monitor](/docs/usage/metrics) the server through Prometheus-compatible metrics
20+
- [Extract metrics](/docs/usage/metrics) from the server in a Prometheus-compatible format
21+
- [Monitor performance](/docs/usage/performance) to investigate CPU and RAM consumption
2122
- [Run hooks](/docs/usage/hooks) (external commands) when clients connect, disconnect, read or publish streams
2223
- Compatible with Linux, Windows and macOS, does not require any dependency or interpreter, it's a single executable
2324

docs/2-usage/2-publish.md

Lines changed: 93 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Live streams can be published to the server with the following protocols and cod
1515
| [RTMP clients](#rtmp-clients) | RTMP, RTMPS, Enhanced RTMP | AV1, VP9, H265, H264 | Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3, G711 (PCMA, PCMU), LPCM |
1616
| [RTMP cameras and servers](#rtmp-cameras-and-servers) | RTMP, RTMPS, Enhanced RTMP | AV1, VP9, H265, H264 | Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3, G711 (PCMA, PCMU), LPCM |
1717
| [HLS cameras and servers](#hls-cameras-and-servers) | Low-Latency HLS, MP4-based HLS, legacy HLS | AV1, VP9, H265, H264 | Opus, MPEG-4 Audio (AAC) |
18-
| [MPEG-TS](#mpeg-ts) | MPEG-TS over UDP, MPEG-TS over Unix sockets | H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video | Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3 |
19-
| [RTP](#rtp) | RTP over UDP, RTP over Unix sockets | 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 |
18+
| [MPEG-TS](#mpeg-ts) | MPEG-TS over UDP, MPEG-TS over Unix socket | H265, H264, MPEG-4 Video (H263, Xvid), MPEG-1/2 Video | Opus, MPEG-4 Audio (AAC), MPEG-1/2 Audio (MP3), AC-3 |
19+
| [RTP](#rtp) | RTP over UDP, RTP over Unix socket | 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 |
2020

2121
We provide instructions for publishing with the following devices:
2222

@@ -48,7 +48,7 @@ If you need to use the standard stream ID syntax instead of the custom one in us
4848

4949
If you want to publish a stream by using a client in listening mode (i.e. with `mode=listener` appended to the URL), read the next section.
5050

51-
Known clients that can publish with SRT are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer), [OBS Studio](#obs-studio).
51+
Some clients that can publish with SRT are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer), [OBS Studio](#obs-studio).
5252

5353
### SRT cameras and servers
5454

@@ -81,7 +81,7 @@ Be aware that not all browsers can read any codec, check [Supported browsers](we
8181

8282
Depending on the network it might be difficult to establish a connection between server and clients, read [Solving WebRTC connectivity issues](webrtc-specific-features#solving-webrtc-connectivity-issues).
8383

84-
Known clients that can publish with WebRTC and WHIP are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer), [OBS Studio](#obs-studio), [Unity](#unity) and [Web browsers](#web-browsers).
84+
Some clients that can publish with WebRTC and WHIP are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer), [OBS Studio](#obs-studio), [Unity](#unity) and [Web browsers](#web-browsers).
8585

8686
### WebRTC servers
8787

@@ -104,11 +104,11 @@ rtsp://localhost:8554/mystream
104104

105105
The resulting stream is available in path `/mystream`.
106106

107-
Known clients that can publish with RTSP are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer), [OBS Studio](#obs-studio).
107+
Some clients that can publish with RTSP are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer), [OBS Studio](#obs-studio), [OpenCV](#opencv).
108108

109109
### RTSP cameras and servers
110110

111-
Most IP cameras expose their video stream by using a RTSP server that is embedded into the camera itself. In particular, cameras that are compliant with ONVIF profile S or T meet this requirement. You can use _MediaMTX_ to connect to one or several existing RTSP servers and read their video streams:
111+
Most IP cameras expose their video stream by using a RTSP server that is embedded into the camera itself. In particular, cameras that are compliant with ONVIF profile S or T meet this requirement. You can use _MediaMTX_ to connect to one or several existing RTSP servers and read their media streams:
112112

113113
```yml
114114
paths:
@@ -140,11 +140,11 @@ rtmp://localhost/mystream
140140

141141
The resulting stream is available in path `/mystream`.
142142

143-
Known clients that can publish with RTMP are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer), [OBS Studio](#obs-studio).
143+
Some clients that can publish with RTMP are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer), [OBS Studio](#obs-studio).
144144

145145
### RTMP cameras and servers
146146

147-
You can use _MediaMTX_ to connect to one or several existing RTMP servers and read their video streams:
147+
You can use _MediaMTX_ to connect to one or several existing RTMP servers and read their media streams:
148148

149149
```yml
150150
paths:
@@ -157,7 +157,7 @@ The resulting stream is available in path `/proxied`.
157157

158158
### HLS cameras and servers
159159

160-
HLS is a streaming protocol that works by splitting streams into segments, and by serving these segments and a playlist with the HTTP protocol. You can use _MediaMTX_ to connect to one or several existing HLS servers and read their video streams:
160+
HLS is a streaming protocol that works by splitting streams into segments, and by serving these segments and a playlist with the HTTP protocol. You can use _MediaMTX_ to connect to one or several existing HLS servers and read their media streams:
161161

162162
```yml
163163
paths:
@@ -182,24 +182,6 @@ paths:
182182

183183
Where `238.0.0.1` is the IP for listening packets, in this case a multicast IP.
184184

185-
You can generate a UDP multicast MPEG-TS stream with GStreamer:
186-
187-
```sh
188-
gst-launch-1.0 -v mpegtsmux name=mux alignment=1 ! udpsink host=238.0.0.1 port=1234 \
189-
videotestsrc ! video/x-raw,width=1280,height=720,format=I420 ! x264enc speed-preset=ultrafast bitrate=3000 key-int-max=60 ! video/x-h264,profile=high ! mux. \
190-
audiotestsrc ! audioconvert ! avenc_aac ! mux.
191-
```
192-
193-
or FFmpeg:
194-
195-
```sh
196-
ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 \
197-
-c:v libx264 -pix_fmt yuv420p -preset ultrafast -b:v 600k \
198-
-f mpegts udp://238.0.0.1:1234?pkt_size=1316
199-
```
200-
201-
The resulting stream is available in path `/mypath`.
202-
203185
If the listening IP is a multicast IP, _MediaMTX_ will listen for incoming packets on the default multicast interface, picked by the operating system. It is possible to specify the interface manually by using the `interface` parameter:
204186

205187
```yml
@@ -216,7 +198,7 @@ paths:
216198
source: udp+mpegts://0.0.0.0:1234?source=192.168.3.5
217199
```
218200

219-
Known clients that can publish with UDP and MPEG-TS are [FFmpeg](#ffmpeg) and [GStreamer](#gstreamer).
201+
Some clients that can publish with UDP and MPEG-TS are [FFmpeg](#ffmpeg) and [GStreamer](#gstreamer).
220202

221203
Unix sockets are more efficient than UDP packets and can be used as transport by specifying the `unix+mpegts` scheme:
222204

@@ -226,14 +208,6 @@ paths:
226208
source: unix+mpegts:///tmp/socket.sock
227209
```
228210

229-
FFmpeg can generate such streams:
230-
231-
```sh
232-
ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 \
233-
-c:v libx264 -pix_fmt yuv420p -preset ultrafast -b:v 600k \
234-
-f mpegts unix:/tmp/socket.sock
235-
```
236-
237211
### RTP
238212

239213
The server supports ingesting RTP streams, shipped in two different ways (UDP packets or Unix sockets).
@@ -257,17 +231,7 @@ paths:
257231

258232
`rtpSDP` must contain a valid SDP, that is a description of the RTP session.
259233

260-
FFmpeg can generate a RTP over UDP stream:
261-
262-
```sh
263-
ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 \
264-
-c:v libx264 -pix_fmt yuv420p -preset ultrafast -b:v 600k \
265-
-f rtp udp://238.0.0.1:1234?pkt_size=1316
266-
```
267-
268-
The stream is available on path `/mypath`.
269-
270-
Known clients that can publish with UDP and MPEG-TS are [FFmpeg](#ffmpeg) and [GStreamer](#gstreamer).
234+
Some clients that can publish with UDP and MPEG-TS are [FFmpeg](#ffmpeg) and [GStreamer](#gstreamer).
271235

272236
Unix sockets are more efficient than UDP packets and can be used as transport by specifying the `unix+rtp` scheme:
273237

@@ -286,14 +250,6 @@ paths:
286250
a=fmtp:96 profile-level-id=42e01e;packetization-mode=1;sprop-parameter-sets=Z0LAHtkDxWhAAAADAEAAAAwDxYuS,aMuMsg==
287251
```
288252

289-
FFmpeg can generate such streams:
290-
291-
```sh
292-
ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 \
293-
-c:v libx264 -pix_fmt yuv420p -preset ultrafast -b:v 600k \
294-
-f rtp unix:/tmp/socket.sock
295-
```
296-
297253
## Devices
298254

299255
### Raspberry Pi Cameras
@@ -458,23 +414,79 @@ The resulting stream is available in path `/cam`.
458414

459415
### FFmpeg
460416

461-
FFmpeg can publish a stream to the server in several ways (SRT client, SRT server, RTSP client, RTMP client, MPEG-TS over UDP, MPEG-TS over Unix sockets, WebRTC with WHIP, RTP over UDP, rtp over Unix sockets). The recommended one consists in publishing as a [RTSP client](#rtsp-clients):
417+
FFmpeg can publish a stream to the server in several ways. The recommended one consists in publishing with RTSP.
462418

463-
```
419+
#### FFmpeg and RTSP
420+
421+
```sh
464422
ffmpeg -re -stream_loop -1 -i file.ts -c copy -f rtsp rtsp://localhost:8554/mystream
465423
```
466424

467-
The RTSP protocol supports several underlying transport protocols, each with its own characteristics (see [RTSP-specific features](rtsp-specific-features)). You can set the transport protocol by using the `rtsp_transport` flag, for instance, in order to use TCP:
425+
The resulting stream is available in path `/mystream`.
426+
427+
#### FFmpeg and RTMP
468428

469429
```sh
470-
ffmpeg -re -stream_loop -1 -i file.ts -c copy -f rtsp -rtsp_transport tcp rtsp://localhost:8554/mystream
430+
ffmpeg -re -stream_loop -1 -i file.ts -c copy -f flv rtmp://localhost:1935/mystream
471431
```
472432

473-
The resulting stream is available in path `/mystream`.
433+
#### FFmpeg and MPEG-TS over UDP
434+
435+
In MediaMTX configuration, add a path with `source: udp+mpegts://238.0.0.1:1234`. Then:
436+
437+
```sh
438+
ffmpeg -re -stream_loop -1 -i file.ts -c copy -f mpegts 'udp://127.0.0.1:3356?pkt_size=1316'
439+
```
440+
441+
#### FFmpeg and MPEG-TS over Unix socket
442+
443+
```sh
444+
ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 \
445+
-c:v libx264 -pix_fmt yuv420p -preset ultrafast -b:v 600k \
446+
-f mpegts unix:/tmp/socket.sock
447+
```
448+
449+
#### FFmpeg and RTP over UDP
450+
451+
In MediaMTX configuration, add a path with `source: udp+rtp://238.0.0.1:1234` and a valid `rtpSDP` (see [RTP](#rtp)). Then:
452+
453+
```sh
454+
ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 \
455+
-c:v libx264 -pix_fmt yuv420p -preset ultrafast -b:v 600k \
456+
-f rtp udp://238.0.0.1:1234?pkt_size=1316
457+
```
458+
459+
#### FFmpeg and RTP over Unix socket
460+
461+
```sh
462+
ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 \
463+
-c:v libx264 -pix_fmt yuv420p -preset ultrafast -b:v 600k \
464+
-f rtp unix:/tmp/socket.sock
465+
```
466+
467+
#### FFmpeg and SRT
468+
469+
```sh
470+
ffmpeg -re -stream_loop -1 -i file.ts -c copy -f mpegts 'srt://localhost:8890?streamid=publish:stream&pkt_size=1316'
471+
```
472+
473+
#### FFmpeg and WebRTC
474+
475+
```sh
476+
ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 \
477+
-f lavfi -i "sine=frequency=1000:sample_rate=48000" \
478+
-c:v libx264 -pix_fmt yuv420p -preset ultrafast -b:v 600k \
479+
-c:a libopus -ar 48000 -ac 2 -b:a 128k \
480+
-f whip http://localhost:8889/stream/whip
481+
```
482+
483+
WARNING: in case of FFmpeg 8.0, both a video track and an audio track must be present.
474484

475485
### GStreamer
476486

477-
GStreamer can publish a stream to the server in several ways (SRT client, SRT server, RTSP client, RTMP client, MPEG-TS over UDP, WebRTC with WHIP, RTP over UDP). The recommended one consists in publishing as a [RTSP client](#rtsp-clients):
487+
FFmpeg can publish a stream to the server in several ways. The recommended one consists in publishing with RTSP.
488+
489+
#### GStreamer and RTSP
478490

479491
```sh
480492
gst-launch-1.0 rtspclientsink name=s location=rtsp://localhost:8554/mystream \
@@ -490,23 +502,27 @@ gst-launch-1.0 filesrc location=file.mp4 ! qtdemux name=d \
490502
d.video_0 ! rtspclientsink location=rtsp://localhost:8554/mystream
491503
```
492504

493-
The RTSP protocol supports several underlying transport protocols, each with its own characteristics (see [RTSP-specific features](rtsp-specific-features)). You can set the transport protocol by using the `protocols` flag:
505+
The resulting stream is available in path `/mystream`.
506+
507+
#### GStreamer and RTMP
494508

495509
```sh
496-
gst-launch-1.0 filesrc location=file.mp4 ! qtdemux name=d \
497-
d.video_0 ! rtspclientsink location=rtsp://localhost:8554/mystream protocols=tcp
510+
gst-launch-1.0 -v flvmux name=mux ! rtmpsink location=rtmp://localhost/stream \
511+
videotestsrc ! video/x-raw,width=1280,height=720,format=I420 ! x264enc speed-preset=ultrafast bitrate=3000 key-int-max=60 ! video/x-h264,profile=high ! mux. \
512+
audiotestsrc ! audioconvert ! avenc_aac ! mux.
498513
```
499514

500-
If encryption is enabled, the `tls-validation-flags` and `profiles` options must be specified too:
515+
#### GStreamer and MPEG-TS over UDP
501516

502517
```sh
503-
gst-launch-1.0 filesrc location=file.mp4 ! qtdemux name=d \
504-
d.video_0 ! rtspclientsink location=rtsp://localhost:8554/mystream tls-validation-flags=0 profiles=GST_RTSP_PROFILE_SAVP
518+
gst-launch-1.0 -v mpegtsmux name=mux alignment=1 ! udpsink host=238.0.0.1 port=1234 \
519+
videotestsrc ! video/x-raw,width=1280,height=720,format=I420 ! x264enc speed-preset=ultrafast bitrate=3000 key-int-max=60 ! video/x-h264,profile=high ! mux. \
520+
audiotestsrc ! audioconvert ! avenc_aac ! mux.
505521
```
506522

507-
The resulting stream is available in path `/mystream`.
523+
#### GStreamer and WebRTC
508524

509-
GStreamer can also publish a stream by using the [WebRTC / WHIP protocol](#webrtc-clients). Make sure that GStreamer version is at least 1.22, and that if the codec is H264, the profile is baseline. Use the `whipclientsink` element:
525+
Make sure that GStreamer version is at least 1.22, and that if the codec is H264, the profile is baseline. Use the `whipclientsink` element:
510526

511527
```
512528
gst-launch-1.0 videotestsrc \
@@ -518,7 +534,11 @@ gst-launch-1.0 videotestsrc \
518534

519535
### OBS Studio
520536

521-
OBS Studio can publish to the server in several ways (SRT client, RTMP client, WebRTC client). The recommended one consists in publishing as a [RTMP client](#rtmp-clients). In `Settings -> Stream` (or in the Auto-configuration Wizard), use the following parameters:
537+
OBS Studio can publish to the server in several ways. The recommended one consists in publishing with RTMP.
538+
539+
#### OBS Studio and RTMP
540+
541+
In `Settings -> Stream` (or in the Auto-configuration Wizard), use the following parameters:
522542

523543
- Service: `Custom...`
524544
- Server: `rtmp://localhost/mystream`
@@ -539,6 +559,8 @@ If you want to generate a stream that can be read with WebRTC, open `Settings ->
539559

540560
Then use the button `Start Recording` (instead of `Start Streaming`) to start streaming.
541561

562+
#### OBS Studio and WebRTC
563+
542564
Recent versions of OBS Studio can also publish to the server with the [WebRTC / WHIP protocol](#webrtc-clients) Use the following parameters:
543565

544566
- Service: `WHIP`
@@ -550,7 +572,7 @@ The resulting stream is available in path `/mystream`.
550572

551573
### OpenCV
552574

553-
Software which uses the OpenCV library can publish to the server through its GStreamer plugin, as a [RTSP client](#rtsp-clients). It must be compiled with GStreamer support, by following this procedure:
575+
Software which uses the OpenCV library can publish to the server through its GStreamer plugin, as a [RTSP client](#rtsp-clients). It must be compiled with support for GStreamer, by following this procedure:
554576

555577
```sh
556578
sudo apt install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-ugly gstreamer1.0-rtsp python3-dev python3-numpy

docs/2-usage/22-webrtc-specific-features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
WebRTC is a protocol that can be used for publishing and reading streams. Features in these page are shared among both tasks. Regarding specific tasks, see [Publish](publish) and [Read](read).
44

5-
## Supported browsers
5+
## Codec support in browsers
66

77
The server can ingest and broadcast with WebRTC a wide variety of video and audio codecs (that are listed at the beginning of the README), but not all browsers can publish and read all codecs due to internal limitations that cannot be overcome by this or any other server.
88

0 commit comments

Comments
 (0)