GstRtspSink - Multicast
This page describes how to use GstRtspSink multicast capabilities.
RTSP and Multicast
In unicast RTSP, the server sends a copy of the stream packets to each client, each one to a different IP address and port negotiated during the initial handshaking. As the number of clients increases, the server would require to send more and more duplicates of the same stream.
In multicast RTSP, the server sends a single stream to a multicast IP address and port and points the clients to that address. The handshaking process and keepalive messages are still exchanged between the server and each client, however, the media streaming will be multicast.
Multicast Properties
The multicast streaming can be configured using some element properties. The following table summarizes the properties related to multicast.
Name | Property | Default value |
---|---|---|
Multicast | multicast | false |
Minimum address | multicast-ip-min | 254.2.0.1 |
Maximum address | multicast-ip-max | 254.2.0.10 |
Minimum port | multicast-port-min | 5000 |
Maximum port | multicast-port-max | 5010 |
TTL | multicast-ttl | 16 |
The multicast property enables or disables the overall multicast operation. If disabled, none of the multicast-related properties have an effect.
The minimum and maximum addresses are the multicast addresses range available that the RTSP server may use to start streaming. If the first address is already in use, it will connect to the next available address. The same behavior applies to the ports. To enforce a single address and port, the same value may be applied to the max and min.
Example
gst-launch-1.0 videotestsrc is-live=true ! x264enc tune=zerolatency ! video/x-h264, mapping=/stream1 ! rtspsink \ service=5000 multicast=true multicast-ip-min=239.255.255.253 multicast-ip-max=239.255.255.255 \ multicast-port-min=5000 multicast-port-max=6000 multicast-ttl=128