docs: update (#6022)
This commit is contained in:
@@ -11,6 +11,5 @@ In order to ingest a SRT stream from a remote server, camera or client in listen
|
||||
```yml
|
||||
paths:
|
||||
proxied:
|
||||
# url of the source stream, in the format srt://host:port?streamid=streamid&other_parameters
|
||||
source: srt://original-url
|
||||
source: srt://host:port?streamid=streamid
|
||||
```
|
||||
|
||||
@@ -10,8 +10,10 @@ In order to ingest a WebRTC stream from a remote server, add the corresponding W
|
||||
```yml
|
||||
paths:
|
||||
proxied:
|
||||
# url of the source stream, in the format whep://host:port/path (HTTP) or wheps:// (HTTPS)
|
||||
source: wheps://host:port/path
|
||||
# url of the source stream. Use whep:// for HTTP and wheps:// for HTTPS
|
||||
source: whep://host:port/path
|
||||
# Token to insert in the Authorization: Bearer header.
|
||||
whepBearerToken: ""
|
||||
```
|
||||
|
||||
If the remote server is a _MediaMTX_ instance, remember to add a `/whep` suffix after the stream name, since in _MediaMTX_ [it's part of the WHEP URL](../4-read/03-webrtc.md):
|
||||
|
||||
@@ -11,43 +11,13 @@ Most IP cameras expose their video stream by using a RTSP server that is embedde
|
||||
```yml
|
||||
paths:
|
||||
proxied:
|
||||
# url of the source stream, in the format rtsp://user:pass@host:port/path
|
||||
source: rtsp://original-url
|
||||
source: rtsp://user:pass@host:port/path
|
||||
```
|
||||
|
||||
If username or password contain special characters (like ?, :, etc), they need to be [url-encoded](https://www.urlencoder.org/).
|
||||
|
||||
The resulting stream will be available on path `/proxied`.
|
||||
|
||||
It is possible to tune the connection by using some additional parameters:
|
||||
|
||||
```yml
|
||||
paths:
|
||||
proxied:
|
||||
# url of the source stream, in the format rtsp://user:pass@host:port/path
|
||||
source: rtsp://original-url
|
||||
# Transport protocol used to pull the stream. available values are "automatic", "udp", "multicast", "tcp".
|
||||
rtspTransport: automatic
|
||||
# Support sources that don't provide server ports or use random server ports. This is a security issue
|
||||
# and must be used only when interacting with sources that require it.
|
||||
rtspAnyPort: no
|
||||
# Range header to send to the source, in order to start streaming from the specified offset.
|
||||
# available values:
|
||||
# * clock: Absolute time
|
||||
# * npt: Normal Play Time
|
||||
# * smpte: SMPTE timestamps relative to the start of the recording
|
||||
rtspRangeType:
|
||||
# Available values:
|
||||
# * clock: UTC ISO 8601 combined date and time string, e.g. 20230812T120000Z
|
||||
# * npt: duration such as "300ms", "1.5m" or "2h45m", valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h"
|
||||
# * smpte: duration such as "300ms", "1.5m" or "2h45m", valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h"
|
||||
rtspRangeStart:
|
||||
# Size of the UDP buffer of the RTSP client.
|
||||
# This can be increased to mitigate packet losses.
|
||||
# It defaults to the default value of the operating system.
|
||||
rtspUDPReadBufferSize: 0
|
||||
# Range of ports used as source port in outgoing UDP packets.
|
||||
rtspUDPSourcePortRange: [32768, 60999]
|
||||
```
|
||||
|
||||
All available parameters are listed in the [configuration file](../5-references/1-configuration-file.md).
|
||||
It is possible to tune the connection by using several additional parameters, that are listed in the [configuration file](../5-references/1-configuration-file.md).
|
||||
|
||||
Advanced RTSP features and settings are described in [RTSP-specific features](../2-features/27-rtsp-specific-features.md).
|
||||
|
||||
@@ -10,8 +10,9 @@ You can use _MediaMTX_ to connect to one or several existing RTMP servers and re
|
||||
```yml
|
||||
paths:
|
||||
proxied:
|
||||
# url of the source stream, in the format rtmp://user:pass@host:port/path
|
||||
source: rtmp://original-url
|
||||
source: rtmp://user:pass@host:port/path#streamKey
|
||||
```
|
||||
|
||||
If username or password contain special characters (like ?, :, etc), they need to be [url-encoded](https://www.urlencoder.org/).
|
||||
|
||||
The resulting stream will be available on path `/proxied`.
|
||||
|
||||
@@ -11,8 +11,9 @@ HLS is a streaming protocol that works by splitting streams into segments, and b
|
||||
```yml
|
||||
paths:
|
||||
proxied:
|
||||
# url of the playlist of the stream, in the format http://user:pass@host:port/path
|
||||
source: http://original-url/stream/index.m3u8
|
||||
source: http://user:pass@host:port/path
|
||||
```
|
||||
|
||||
If username or password contain special characters (like ?, :, etc), they need to be [url-encoded](https://www.urlencoder.org/).
|
||||
|
||||
The resulting stream will be available on path `/proxied`.
|
||||
|
||||
@@ -13,10 +13,16 @@ In order to read a UDP MPEG-TS stream, edit `mediamtx.yml` and replace everythin
|
||||
```yml
|
||||
paths:
|
||||
mypath:
|
||||
source: udp+mpegts://238.0.0.1:1234
|
||||
source: udp+mpegts://ip:port
|
||||
```
|
||||
|
||||
Where `238.0.0.1` is the IP for listening packets, in this case a multicast IP.
|
||||
The IP is usually a multicast IP, for instance:
|
||||
|
||||
```yml
|
||||
paths:
|
||||
mypath:
|
||||
source: udp+mpegts://238.0.0.1:1234
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
|
||||
@@ -22,9 +22,40 @@ paths:
|
||||
t=0 0
|
||||
m=video 5004 RTP/AVP 96
|
||||
a=rtpmap:96 H264/90000
|
||||
a=fmtp:96 profile-level-id=42e01e;packetization-mode=1;sprop-parameter-sets=Z0LAHtkDxWhAAAADAEAAAAwDxYuS,aMuMsg==
|
||||
```
|
||||
|
||||
`rtpSDP` must contain a valid SDP, that is a description of the RTP session.
|
||||
|
||||
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:
|
||||
|
||||
```yml
|
||||
paths:
|
||||
mypath:
|
||||
source: udp+rtp://238.0.0.1:1234?interface=eth0
|
||||
rtpSDP: |
|
||||
v=0
|
||||
o=- 123456789 123456789 IN IP4 192.168.1.100
|
||||
s=H264 Video Stream
|
||||
c=IN IP4 192.168.1.100
|
||||
t=0 0
|
||||
m=video 5004 RTP/AVP 96
|
||||
a=rtpmap:96 H264/90000
|
||||
```
|
||||
|
||||
It is possible to restrict who can send packets by using the source parameter:
|
||||
|
||||
```yml
|
||||
paths:
|
||||
mypath:
|
||||
source: udp+rtp://238.0.0.1:1234?source=192.168.3.5
|
||||
rtpSDP: |
|
||||
v=0
|
||||
o=- 123456789 123456789 IN IP4 192.168.1.100
|
||||
s=H264 Video Stream
|
||||
c=IN IP4 192.168.1.100
|
||||
t=0 0
|
||||
m=video 5004 RTP/AVP 96
|
||||
a=rtpmap:96 H264/90000
|
||||
```
|
||||
|
||||
Some clients that can publish with UDP and MPEG-TS are [FFmpeg](17-ffmpeg.md) and [GStreamer](18-gstreamer.md).
|
||||
|
||||
@@ -123,3 +123,20 @@ paths:
|
||||
```
|
||||
|
||||
The secondary stream will be available on path `/secondary`.
|
||||
|
||||
## Multiple cameras
|
||||
|
||||
It is possible to stream several cameras at once by using `rpiCameraCamID`:
|
||||
|
||||
```yml
|
||||
paths:
|
||||
# first camera
|
||||
cam1:
|
||||
source: rpiCamera
|
||||
rpiCameraCamID: 0
|
||||
|
||||
# second camera
|
||||
cam2:
|
||||
source: rpiCamera
|
||||
rpiCameraCamID: 1
|
||||
```
|
||||
|
||||
+18
-20
@@ -8,14 +8,30 @@ FFmpeg can publish a stream to the server by acting as a [RTSP client](07-rtsp-c
|
||||
ffmpeg -re -stream_loop -1 -i file.mp4 -c copy -f rtsp rtsp://localhost:8554/mystream
|
||||
```
|
||||
|
||||
The resulting stream will be available on path `/mystream`.
|
||||
|
||||
## FFmpeg as a RTMP client
|
||||
|
||||
```sh
|
||||
ffmpeg -re -stream_loop -1 -i file.mp4 -c copy -f flv rtmp://localhost:1935/mystream
|
||||
```
|
||||
|
||||
## FFmpeg as a SRT client
|
||||
|
||||
```sh
|
||||
ffmpeg -re -stream_loop -1 -i file.mp4 -c copy -f mpegts 'srt://localhost:8890?streamid=publish:stream&pkt_size=1316'
|
||||
```
|
||||
|
||||
## FFmpeg as a WebRTC client
|
||||
|
||||
```sh
|
||||
ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 \
|
||||
-f lavfi -i "sine=frequency=1000:sample_rate=48000" \
|
||||
-c:v libx264 -pix_fmt yuv420p -preset ultrafast -b:v 600k \
|
||||
-c:a libopus -ar 48000 -ac 2 -b:a 128k \
|
||||
-f whip http://localhost:8889/stream/whip
|
||||
```
|
||||
|
||||
WARNING: in case of FFmpeg 8.0, a video track and an audio track must both be present.
|
||||
|
||||
## FFmpeg and MPEG-TS over UDP
|
||||
|
||||
In _MediaMTX_ configuration, add a path with `source: udp+mpegts://238.0.0.1:1234`. Then:
|
||||
@@ -43,21 +59,3 @@ ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 \
|
||||
-c:v libx264 -pix_fmt yuv420p -preset ultrafast -b:v 600k \
|
||||
-f rtp udp://238.0.0.1:1234?pkt_size=1316
|
||||
```
|
||||
|
||||
## FFmpeg as a SRT client
|
||||
|
||||
```sh
|
||||
ffmpeg -re -stream_loop -1 -i file.mp4 -c copy -f mpegts 'srt://localhost:8890?streamid=publish:stream&pkt_size=1316'
|
||||
```
|
||||
|
||||
## FFmpeg as a WebRTC client
|
||||
|
||||
```sh
|
||||
ffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 \
|
||||
-f lavfi -i "sine=frequency=1000:sample_rate=48000" \
|
||||
-c:v libx264 -pix_fmt yuv420p -preset ultrafast -b:v 600k \
|
||||
-c:a libopus -ar 48000 -ac 2 -b:a 128k \
|
||||
-f whip http://localhost:8889/stream/whip
|
||||
```
|
||||
|
||||
WARNING: in case of FFmpeg 8.0, a video track and an audio track must both be present.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# GStreamer
|
||||
|
||||
GStreamer can publish a stream to the server by acting as a [RTSP client](07-rtsp-clients.md), [RTMP client](09-rtmp-clients.md), [SRT client](02-srt-clients.md), [WebRTC client](05-webrtc-clients.md) or by sending [MPEG-TS packets](12-mpeg-ts.md). The recommended way is acting as a RTSP client.
|
||||
GStreamer can publish a stream to the server by acting as a [RTSP client](07-rtsp-clients.md), [RTMP client](09-rtmp-clients.md), [SRT client](02-srt-clients.md), [WebRTC client](05-webrtc-clients.md) or by sending [MPEG-TS packets](12-mpeg-ts.md) or [RTP packets](13-rtp.md). The recommended way is acting as a RTSP client.
|
||||
|
||||
## GStreamer as a RTSP client
|
||||
|
||||
@@ -18,8 +18,6 @@ gst-launch-1.0 filesrc location=file.mp4 ! qtdemux name=d \
|
||||
d.video_0 ! rtspclientsink location=rtsp://localhost:8554/mystream
|
||||
```
|
||||
|
||||
The resulting stream will be available on path `/mystream`.
|
||||
|
||||
## GStreamer as a RTMP client
|
||||
|
||||
```sh
|
||||
@@ -36,16 +34,6 @@ videotestsrc ! video/x-raw,width=1280,height=720,format=I420 ! x264enc speed-pre
|
||||
audiotestsrc ! audioconvert ! avenc_aac ! mux.
|
||||
```
|
||||
|
||||
The resulting stream will be available on path `/mystream`.
|
||||
|
||||
## GStreamer and MPEG-TS over UDP
|
||||
|
||||
```sh
|
||||
gst-launch-1.0 -v mpegtsmux name=mux alignment=1 ! udpsink host=238.0.0.1 port=1234 \
|
||||
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. \
|
||||
audiotestsrc ! audioconvert ! avenc_aac ! mux.
|
||||
```
|
||||
|
||||
## GStreamer as a WebRTC client
|
||||
|
||||
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:
|
||||
@@ -57,3 +45,23 @@ gst-launch-1.0 videotestsrc \
|
||||
! video/x-h264,profile=baseline \
|
||||
! whipclientsink signaller::whip-endpoint=http://localhost:8889/mystream/whip
|
||||
```
|
||||
|
||||
## GStreamer and MPEG-TS over UDP
|
||||
|
||||
In _MediaMTX_ configuration, add a path with `source: unix+mpegts:///tmp/socket.sock`. Then:
|
||||
|
||||
```sh
|
||||
gst-launch-1.0 -v mpegtsmux name=mux alignment=1 ! udpsink host=238.0.0.1 port=1234 \
|
||||
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. \
|
||||
audiotestsrc ! audioconvert ! avenc_aac ! mux.
|
||||
```
|
||||
|
||||
## GStreamer and RTP over UDP
|
||||
|
||||
In _MediaMTX_ configuration, add a path with `source: udp+rtp://238.0.0.1:1234` and a valid `rtpSDP` (read [RTP](13-rtp.md)). Then:
|
||||
|
||||
```sh
|
||||
gst-launch-1.0 -v \
|
||||
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 ! rtph264pay config-interval=1 ! udpsink host=238.0.0.1 port=1234 \
|
||||
audiotestsrc ! audioconvert ! avenc_aac ! rtpmp4gpay ! udpsink host=238.0.0.1 port=1236
|
||||
```
|
||||
|
||||
+14
-14
@@ -473,22 +473,22 @@ pathDefaults:
|
||||
|
||||
# Source of the stream. This can be:
|
||||
# * publisher -> the stream is provided by a RTSP, RTMP, WebRTC or SRT client
|
||||
# * rtsp://existing-url -> the stream is pulled from another RTSP server / camera
|
||||
# * rtsps://existing-url -> the stream is pulled from another RTSP server / camera with RTSPS
|
||||
# * rtsp+http://existing-url -> the stream is pulled from another RTSP server / camera, with HTTP tunneling
|
||||
# * rtsps+http://existing-url -> the stream is pulled from another RTSP server / camera, with HTTPS tunneling
|
||||
# * rtsp+ws://existing-url -> the stream is pulled from another RTSP server / camera, with WebSocket tunneling
|
||||
# * rtsps+ws://existing-url -> the stream is pulled from another RTSP server / camera, with secure WebSocket tunneling
|
||||
# * rtmp://existing-url -> the stream is pulled from another RTMP server / camera
|
||||
# * rtmps://existing-url -> the stream is pulled from another RTMP server / camera with RTMPS
|
||||
# * http://existing-url/stream.m3u8 -> the stream is pulled from another HLS server / camera
|
||||
# * https://existing-url/stream.m3u8 -> the stream is pulled from another HLS server / camera with HTTPS
|
||||
# * rtsp://user:pass@host:port/path -> the stream is pulled from another RTSP server / camera
|
||||
# * rtsps://user:pass@host:port/path -> the stream is pulled from another RTSP server / camera with RTSPS
|
||||
# * rtsp+http://user:pass@host:port/path -> the stream is pulled from another RTSP server / camera, with HTTP tunneling
|
||||
# * rtsps+http://user:pass@host:port/path -> the stream is pulled from another RTSP server / camera, with HTTPS tunneling
|
||||
# * rtsp+ws://user:pass@host:port/path -> the stream is pulled from another RTSP server / camera, with WebSocket tunneling
|
||||
# * rtsps+ws://user:pass@host:port/path -> the stream is pulled from another RTSP server / camera, with secure WebSocket tunneling
|
||||
# * rtmp://user:pass@host:port/path#streamKey -> the stream is pulled from another RTMP server / camera
|
||||
# * rtmps://user:pass@host:port/path#streamKey -> the stream is pulled from another RTMP server / camera with RTMPS
|
||||
# * http://user:pass@host:port/stream.m3u8 -> the stream is pulled from another HLS server / camera
|
||||
# * https://user:pass@host:port/stream.m3u8 -> the stream is pulled from another HLS server / camera with HTTPS
|
||||
# * udp+mpegts://ip:port -> the stream is pulled from MPEG-TS over UDP, by listening on the specified address
|
||||
# * unix+mpegts://socket -> the stream is pulled from MPEG-TS over Unix socket, by using the socket
|
||||
# * unix+mpegts://socketPath -> the stream is pulled from MPEG-TS over a Unix socket
|
||||
# * udp+rtp://ip:port -> the stream is pulled from RTP over UDP, by listening on the specified address
|
||||
# * srt://existing-url -> the stream is pulled from another SRT server / camera
|
||||
# * whep://existing-url -> the stream is pulled from another WebRTC server / camera with HTTP+WHEP
|
||||
# * wheps://existing-url -> the stream is pulled from another WebRTC server / camera with HTTPS+WHEP
|
||||
# * srt://host:port?streamid=streamid -> the stream is pulled from another SRT server / camera
|
||||
# * whep://host:port/path -> the stream is pulled from another WebRTC server / camera with HTTP+WHEP
|
||||
# * wheps://host:port/path -> the stream is pulled from another WebRTC server / camera with HTTPS+WHEP
|
||||
# * redirect -> the stream is provided by another path or server
|
||||
# * rpiCamera -> the stream is provided by a Raspberry Pi Camera
|
||||
# The following variables can be used in the source string:
|
||||
|
||||
Reference in New Issue
Block a user