-
Notifications
You must be signed in to change notification settings - Fork 57
RTSP Server, SDP
When using network protocol SDP or RTSP, UltraGrid uses RTP as normally but 2 things act differently:
- codecs are packed according to the RFCs (that however limits available codecs that can be used - H.264 for video and OPUS or PCMU for audio)
- descriptive SDP file is produced - depending on the protocol used it is provided either as a file (or with a HTTP server) or utilized within a RTSP session
Note 1: Current implementation is able to handle only one receiver at the same time. To process multiple receivers, check Use Cases.
Note 2: This setup doesn't provide neither NAT traversal nor firewall passthrough. Traffic from sender must pass to receiver UDP ports 5004 and 5006.
Note 3: Not to be confused with NAT traversal server mode.
RTSP server can be run with following commands:
uv -t <vcap> -c libavcodec:encoder=libx264 -x rtsp
# or with audio:
uv -t <vcap> -c libavcodec:encoder=libx264 -x rtsp -s <acap> -A u-law
# codec can be omitted for RTSP, in which case H.264 and Opus is used:
uv -t <vcap> -s <acap> -x rtsp
If you omit audio/video compression, some suitable will be chosen.
Client than can play the stream with either of:
ffplay rtsp://<ip>:8554/ultragrid
mpv --rtsp-transport=udp rtsp://<ip>:8554/ultragrid
The current list of supported codecs can be obtained by -x rtsp:help
.
uv -t <vcap> -s <acap> -x sdp <receiver>
In this case, default compression will be chosen (can be changed similarly to RTSP, eg. also A-law or OPUS for audio). SDP file ug.sdp will be created which can then be played by the receiver given on command-line. Alternatively, the receiver can use (play) the URL provided by sender on terminal, eg.:
mpv http://93.184.216.34:8554/ug.sdp
UltraGrid can also use a multicast address as a receiver. In that case all receivers that are able to receive multicast can join the multicast group:
sender$ uv -t <video_capture> -s <audio_capture> --protocol sdp 224.0.0.20 # send IPv4
# or
sender$ uv -t <video_capture> -s <audio_capture> --protocol sdp ff02::20 # send IPv6
receiver$ mpv http://93.184.216.34:8554/ug.sdp # receivers IPv4
The current list of supported codecs can be obtained by -x sdp:help
.
There is also an autorun option without receiver IP address, which is obtained automatically automatically, eg.:
sender$ uv -4 -t <video_capture> -s <audio_capture> --protocol sdp:autorun
receiver$ mpv http://93.184.216.34:8554/ug.sdp
It works as a very simple session management - UltraGrid will send data to the client that requests the SDP file over HTTP.
Note: Avoid sending the URL over services (eg. Facebook) that deliberately open the sent links.
- 1 channel PCMA/PCMU 8000 Hz (G.711) -
--audio-codec u-law:sample-rate=8000
- 1 channel PCMA/PCMU or OPUS 48000 Hz
- 2 channel PCMA/PCMU 48000 Hz (
--audio-codec u-law --audio-capture-format channels=2
)
not working:
- OPUS with 2 or more channels
may be working:
- 1 channel OPUS with supported sampling rates (8, 12, 16, 24 and 48 kHz)
- multi-channel PCMA/PCMU with various sample rates
H.264 and JPEG are currently supported for video. H.264 is set automatically if no compression is explicitly given.
For best compatibility it is recommended to turn of Intra Frame Refresh and possibly reduce the bitrate for H.264:
-c libavcodec:encoder=libx265:subsampling=420:disable_intra_refresh:bpp=0.15
JPEG encapsulation is quite rigid according to RFC 2435. Only interleaved, YUV 4:2:2 and 4:2:0 with default Huffman tables is supported. Therefore recommended settings for GPUJPEG and libavcodec are:
-c GPUJPEG:interleaved
# or
-c libavcodec:encoder=mpjpeg:subsampling=420 # libavcodec uses RFC-incompatible component order for 422, thus only 420 can be used
If you have any technical or non-technical question or suggestion please feel free to contact us at