Skip to content

Commit 1b01727

Browse files
committed
docs: update
1 parent ef087a6 commit 1b01727

File tree

8 files changed

+195
-147
lines changed

8 files changed

+195
-147
lines changed

README.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,19 @@ _MediaMTX_ is a ready-to-use and zero-dependency real-time media server and medi
2727

2828
<h3>Features</h3>
2929

30-
* [Publish](https://mediamtx.org/docs/usage/publish) live streams to the server with SRT, WebRTC, RTSP, RTMP, HLS, MPEG-TS, RTP
31-
* [Read](https://mediamtx.org/docs/usage/read) live streams from the server with SRT, WebRTC, RTSP, RTMP, HLS
32-
* Streams are automatically converted from a protocol to another
33-
* Serve several streams at once in separate paths
34-
* [Record](https://mediamtx.org/docs/usage/record) streams to disk in fMP4 or MPEG-TS format
35-
* [Playback](https://mediamtx.org/docs/usage/playback) recorded streams
36-
* [Authenticate](https://mediamtx.org/docs/usage/authentication) users with internal, HTTP or JWT authentication
37-
* [Forward](https://mediamtx.org/docs/usage/forward) streams to other servers
38-
* [Proxy](https://mediamtx.org/docs/usage/proxy) requests to other servers
39-
* [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
42-
* [Run hooks](https://mediamtx.org/docs/usage/hooks) (external commands) when clients connect, disconnect, read or publish streams
43-
* Compatible with Linux, Windows and macOS, does not require any dependency or interpreter, it's a single executable
44-
* ...and many [others](https://mediamtx.org/docs/kickoff/introduction).
30+
- [Publish](https://mediamtx.org/docs/usage/publish) live streams to the server with SRT, WebRTC, RTSP, RTMP, HLS, MPEG-TS, RTP
31+
- [Read](https://mediamtx.org/docs/usage/read) live streams from the server with SRT, WebRTC, RTSP, RTMP, HLS
32+
- Streams are automatically converted from a protocol to another
33+
- Serve several streams at once in separate paths
34+
- Reload the configuration without disconnecting existing clients (hot reloading)
35+
- [Record](https://mediamtx.org/docs/usage/record) streams to disk in fMP4 or MPEG-TS format
36+
- [Playback](https://mediamtx.org/docs/usage/playback) recorded streams
37+
- [Authenticate](https://mediamtx.org/docs/usage/authentication) users with internal, HTTP or JWT authentication
38+
- [Forward](https://mediamtx.org/docs/usage/forward) streams to other servers
39+
- [Proxy](https://mediamtx.org/docs/usage/proxy) requests to other servers
40+
- [Control](https://mediamtx.org/docs/usage/control-api) the server through the Control API
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
43+
- [Run hooks](https://mediamtx.org/docs/usage/hooks) (external commands) when clients connect, disconnect, read or publish streams
44+
- Compatible with Linux, Windows and macOS, does not require any dependency or interpreter, it's a single executable
45+
- ...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: 104 additions & 82 deletions
Large diffs are not rendered by default.

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

docs/2-usage/23-rtsp-specific-features.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,32 @@ The RTSP protocol supports several underlying transport protocols, that are chos
1010
- UDP-multicast: allows to save bandwidth when clients are all in the same LAN, by sending packets once to a fixed multicast IP.
1111
- TCP: the most versatile.
1212

13-
The default transport protocol is UDP. To change the transport protocol, you have to tune the configuration of your client of choice.
13+
To change the transport protocol, you have to tune the configuration of the client you are using to publish or read streams. In most clients, the default transport protocol is UDP.
14+
15+
For instance, FFmpeg allows to change the transport protocol with the `-rtsp_transport` flag:
16+
17+
```sh
18+
ffmpeg -rtsp_transport tcp -i rtsp://localhost:8554/mystream -c copy output.mp4
19+
```
20+
21+
GStreamer allows to change the transport protocol with the `protocols` property of `rtspsrc` and `rtspclientsink`:
22+
23+
```sh
24+
gst-launch-1.0 filesrc location=file.mp4 ! qtdemux name=d \
25+
d.video_0 ! rtspclientsink location=rtsp://localhost:8554/mystream protocols=tcp
26+
```
27+
28+
VLC allows to use the TCP transport protocol, use the `--rtsp_tcp` flag:
29+
30+
```sh
31+
vlc --network-caching=50 --rtsp-tcp rtsp://localhost:8554/mystream
32+
```
33+
34+
VLC allows to use the UDP-multicast transport protocol by appending `?vlcmulticast` to the URL:
35+
36+
```sh
37+
vlc --network-caching=50 rtsp://localhost:8554/mystream?vlcmulticast
38+
```
1439

1540
## Encryption
1641

@@ -35,7 +60,22 @@ Streams can be published and read with the `rtsps` scheme and the `8322` port:
3560
rtsps://localhost:8322/mystream
3661
```
3762
38-
## Corrupted frames
63+
Some clients require additional flags for encryption to work properly.
64+
65+
When reading with GStreamer, set set `tls-validation-flags` to `0`:
66+
67+
```sh
68+
gst-launch-1.0 rtspsrc tls-validation-flags=0 location=rtsps://ip:8322/...
69+
```
70+
71+
When publishing with GStreamer, set `tls-validation-flags` to `0` and `profiles` to `GST_RTSP_PROFILE_SAVP`:
72+
73+
```sh
74+
gst-launch-1.0 filesrc location=file.mp4 ! qtdemux name=d \
75+
d.video_0 ! rtspclientsink location=rtsp://localhost:8554/mystream tls-validation-flags=0 profiles=GST_RTSP_PROFILE_SAVP
76+
```
77+
78+
## Decreasing corrupted frames
3979

4080
In some scenarios, when publishing or reading from the server with RTSP, frames can get corrupted. This can be caused by several reasons:
4181

docs/2-usage/3-read.md

Lines changed: 26 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Replace `mystream` with the path name.
3535

3636
If you need to use the standard stream ID syntax instead of the custom one in use by this server, see [Standard stream ID syntax](srt-specific-features#standard-stream-id-syntax).
3737

38-
Known clients that can read with SRT are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer) and [VLC](#vlc).
38+
Some clients that can read with SRT are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer) and [VLC](#vlc).
3939

4040
### WebRTC
4141

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

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

58-
Known clients that can read with WebRTC and WHEP are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer), [Unity](#unity) and [web browsers](#web-browsers).
58+
Some clients that can read with WebRTC and WHEP are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer), [Unity](#unity) and [web browsers](#web-browsers).
5959

6060
### RTSP
6161

@@ -65,7 +65,7 @@ RTSP is a protocol that allows to publish and read streams. It supports differen
6565
rtsp://localhost:8554/mystream
6666
```
6767

68-
Known clients that can read with RTSP are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer) and [VLC](#vlc).
68+
Some clients that can read with RTSP are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer) and [VLC](#vlc).
6969

7070
#### Latency
7171

@@ -83,7 +83,7 @@ RTMP is a protocol that allows to read and publish streams, but is less versatil
8383
rtmp://localhost/mystream
8484
```
8585

86-
Known clients that can read with RTMP are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer) and [VLC](#vlc).
86+
Some clients that can read with RTMP are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer) and [VLC](#vlc).
8787

8888
### HLS
8989

@@ -99,7 +99,7 @@ and can also be accessed without using the browsers, by software that supports t
9999
http://localhost:8888/mystream/index.m3u8
100100
```
101101

102-
Known clients that can read with HLS are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer), [VLC](#vlc) and [web browsers](#web-browsers).
102+
Some clients that can read with HLS are [FFmpeg](#ffmpeg), [GStreamer](#gstreamer), [VLC](#vlc) and [web browsers](#web-browsers).
103103

104104
#### LL-HLS
105105

@@ -109,7 +109,7 @@ Low-Latency HLS is a recently standardized variant of the protocol that allows t
109109
hlsPartDuration: 500ms
110110
```
111111
112-
#### Supported browsers
112+
#### Codec support in browsers
113113
114114
The server can produce HLS streams with a variety of video and audio codecs (that are listed at the beginning of the README), but not all browsers can read all codecs due to internal limitations that cannot be overcome by this or any other server.
115115
@@ -170,19 +170,15 @@ To decrease the latency, you can:
170170

171171
### FFmpeg
172172

173-
FFmpeg can read a stream from the server in several ways (RTSP, RTMP, HLS, WebRTC with WHEP, SRT). The recommended one consists in reading with [RTSP](#rtsp):
173+
FFmpeg can read a stream from the server in several ways. The recommended one consists in reading with RTSP.
174174

175-
```sh
176-
ffmpeg -i rtsp://localhost:8554/mystream -c copy output.mp4
177-
```
178-
179-
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:
175+
#### FFmpeg and RTSP
180176

181177
```sh
182-
ffmpeg -rtsp_transport tcp -i rtsp://localhost:8554/mystream -c copy output.mp4
178+
ffmpeg -i rtsp://localhost:8554/mystream -c copy output.mp4
183179
```
184180

185-
FFmpeg can also read a stream with RTMP:
181+
#### FFmpeg and RTMP
186182

187183
```sh
188184
ffmpeg -i rtmp://localhost/mystream -c copy output.mp4
@@ -194,26 +190,24 @@ In order to read AV1, VP9, H265, Opus, AC3 tracks and in order to read multiple
194190
ffmpeg -rtmp_enhanced_codecs ac-3,av01,avc1,ec-3,fLaC,hvc1,.mp3,mp4a,Opus,vp09 -i rtmp://localhost/mystream -c copy output.mp4
195191
```
196192

197-
### GStreamer
198-
199-
GStreamer can read a stream from the server in several ways (RTSP, RTMP, HLS, WebRTC with WHEP, SRT). The recommended one consists in reading with [RTSP](#rtsp):
193+
#### FFmpeg and SRT
200194

201195
```sh
202-
gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:8554/mystream latency=0 ! decodebin ! autovideosink
196+
ffmpeg -i 'srt://localhost:8890?streamid=read:test' -f null -
203197
```
204198

205-
The RTSP protocol supports several underlying transport protocols, each with its own characteristics (see [RTSP-specific features](rtsp-specific-features)). You can change the transport protocol by using the `protocols` flag:
199+
### GStreamer
206200

207-
```sh
208-
gst-launch-1.0 rtspsrc protocols=tcp location=rtsp://127.0.0.1:8554/mystream latency=0 ! decodebin ! autovideosink
209-
```
201+
GStreamer can read a stream from the server in several way. The recommended one consists in reading with RTSP.
210202

211-
If encryption is enabled, set `tls-validation-flags` to `0`:
203+
#### GStreamer and RTSP
212204

213205
```sh
214-
gst-launch-1.0 rtspsrc tls-validation-flags=0 location=rtsps://ip:8322/...
206+
gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:8554/mystream latency=0 ! decodebin ! autovideosink
215207
```
216208

209+
#### GStreamer and WebRTC
210+
217211
GStreamer also supports reading streams with WebRTC/WHEP, although track codecs must be specified in advance through the `video-caps` and `audio-caps` parameters. Furthermore, if audio is not present, `audio-caps` must be set anyway and must point to a PCMU codec. For instance, the command for reading a video-only H264 stream is:
218212

219213
```sh
@@ -242,27 +236,13 @@ audio-caps="application/x-rtp,media=audio,encoding-name=OPUS,payload=111,clock-r
242236

243237
### VLC
244238

245-
VLC can read a stream from the server in several ways (RTSP, RTMP, HLS, SRT). The recommended one consists in reading with [RTSP](#rtsp):
239+
VLC can read a stream from the server in several way. The recommended one consists in reading with RTSP:
246240

247241
```sh
248242
vlc --network-caching=50 rtsp://localhost:8554/mystream
249243
```
250244

251-
The RTSP protocol supports several underlying transport protocols, each with its own characteristics (see [RTSP-specific features](rtsp-specific-features)).
252-
253-
In order to use the TCP transport protocol, use the `--rtsp_tcp` flag:
254-
255-
```sh
256-
vlc --network-caching=50 --rtsp-tcp rtsp://localhost:8554/mystream
257-
```
258-
259-
In order to use the UDP-multicast transport protocol, append `?vlcmulticast` to the URL:
260-
261-
```sh
262-
vlc --network-caching=50 rtsp://localhost:8554/mystream?vlcmulticast
263-
```
264-
265-
#### Ubuntu compatibility
245+
#### RTSP and Ubuntu compatibility
266246

267247
The VLC shipped with Ubuntu 21.10 doesn't support playing RTSP due to a license issue (see [here](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=982299) and [here](https://stackoverflow.com/questions/69766748/cvlc-cannot-play-rtsp-omxplayer-instead-can)). To fix the issue, remove the default VLC instance and install the snap version:
268248

@@ -271,7 +251,7 @@ sudo apt purge -y vlc
271251
snap install vlc
272252
```
273253

274-
#### Encrypted streams compatibility
254+
#### Encrypted RTSP compatibility
275255

276256
At the moment VLC doesn't support reading encrypted RTSP streams. However, you can use a proxy like [stunnel](https://www.stunnel.org) or [nginx](https://nginx.org/) or a local _MediaMTX_ instance to decrypt streams before reading them.
277257

@@ -421,7 +401,9 @@ In the _Hierarchy_ window, find or create a scene. Inside the scene, add a _Canv
421401

422402
### Web browsers
423403

424-
Web browsers can read a stream from the server in several ways (WebRTC or HLS).
404+
Web browsers can read a stream from the server in several ways.
405+
406+
#### Web browsers and WebRTC
425407

426408
You can read a stream by using the [WebRTC protocol](#webrtc) by visiting the web page:
427409

@@ -437,6 +419,8 @@ This web page can be embedded into another web page by using an iframe:
437419

438420
For more advanced setups, you can create and serve a custom web page by starting from the [source code of the WebRTC read page](https://github.com/bluenviron/mediamtx/blob/{version_tag}/internal/servers/webrtc/read_index.html). In particular, there's a ready-to-use, standalone JavaScript class for reading streams with WebRTC, available in [reader.js](https://github.com/bluenviron/mediamtx/blob/{version_tag}/internal/servers/webrtc/reader.js).
439421

422+
#### Web browsers and HLS
423+
440424
Web browsers can also read a stream with the [HLS protocol](#hls). Latency is higher but there are less problems related to connectivity between server and clients, furthermore the server load can be balanced by using a common HTTP CDN (like Cloudflare or CloudFront), and this allows to handle an unlimited amount of readers. Visit the web page:
441425

442426
```

docs/2-usage/5-authentication.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ MediaMTX can be configured to ask clients for credentials, either in the form of
88

99
Credentials can be validated through one of these methods:
1010

11-
- Internal database: users are stored in the configuration file
11+
- Internal database: credentials are stored in the configuration file
1212
- External HTTP server: an external HTTP URL is contacted to perform authentication
1313
- External JWT provider: an external identity server provides signed tokens that are then verified by the server
1414

@@ -252,7 +252,7 @@ Authorization: Basic base64(user:pass)
252252

253253
When using a web browser, a dialog is first shown to users, asking for credentials, and then the header is automatically inserted into every request.
254254

255-
If the `Authorization: Basic` header cannot be used (for instance, in software like OBS Studio, which only allows to provide a "Bearer Token"), credentials can be passed through the `Authorization: Bearer` header (i.e. the "Bearer Token" in OBS), where value is the concatenation of username and password, separated by a colon:
255+
If the `Authorization: Basic` header cannot be used (for instance, in software like OBS Studio, which only allows to provide a "Bearer Token"), credentials can be passed through the `Authorization: Bearer` header (i.e. the "Bearer Token" in OBS), where the value is the concatenation of username and password, separated by a colon:
256256

257257
```
258258
Authorization: Bearer username:password

mediamtx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ runOnDisconnect:
4343
# Global settings -> Authentication
4444

4545
# Authentication method. Available values are:
46-
# * internal: users are stored in the configuration file
46+
# * internal: credentials are stored in the configuration file
4747
# * http: an external HTTP URL is contacted to perform authentication
4848
# * jwt: an external identity server provides authentication through JWTs
4949
authMethod: internal

0 commit comments

Comments
 (0)