GstRtspSink - Multicast+Authentication

From RidgeRun Developer Wiki

Follow Us On Twitter LinkedIn Email Share this page



Previous: Transport_Stream_RTSP_Streaming Index Next: Live_File_Streaming



This example combines multicast delivery with access control. It is useful in controlled networks where many receivers need the same content but the session should not be open to everyone.

Why combine multicast and authentication

Multicast optimizes network use, while authentication limits who can request the session metadata and access the stream path.


Server-side Pipeline

The following pipelines take audio from the microphone, encode it to AC3, and serve it to a multicast group found between 239.255.255.253 and 239.255.255.255 and a port between 5000 and 6000. Additionally, it requires an anonymous user without a password.

PORT=12345
MAPPING=/stream
IP_MIN=239.255.255.253
IP_MAX=239.255.255.255
PORT_MIN=5000
PORT_MAX=6000
TTL=128
# By leaving the password empty, users can access with a username but without a password
USER=anonymous
PASSWORD=

gst-launch-1.0 alsasrc ! avenc_ac3 ! capsfilter caps="audio/x-ac3, mapping=${MAPPING}" ! rtspsink name=sink \
service=$PORT auth=${USER}:${PASSWORD} multicast=true multicast-ip-min=${IP_MIN} multicast-ip-max=${IP_MAX} \
multicast-port-min=${PORT_MIN} multicast-port-max=${PORT_MAX}  multicast-ttl=${TTL}

Client-side

VLC

IP_ADDRESS=127.0.0.1
PORT=12345
MAPPING=stream
USER=anonymous
PASSWORD=

vlc rtsp://${USER}:${PASSWORD}@${IP_ADDRESS}:${PORT}/${MAPPING}

GStreamer

IP_ADDRESS=127.0.0.1
PORT=12345
MAPPING=stream
USER=anonymous
PASSWORD=

gst-launch-1.0 rtspsrc location=rtsp://${USER}:${PASSWORD}@${IP_ADDRESS}:${PORT}/${MAPPING} ! rtpac3depay ! ac3parse ! avdec_ac3 ! queue ! autoaudiosink

MPlayer

IP_ADDRESS=192.0.0.1
PORT=12345
MAPPING=stream
USER=anonymous
PASSWORD=

mplayer rtsp://${USER}:${PASSWORD}@${IP_ADDRESS}:${PORT}/${MAPPING}

Totem

IP_ADDRESS=192.0.0.1
PORT=12345
MAPPING=stream
USER=anonymous
PASSWORD=

totem rtsp://${USER}:${PASSWORD}@${IP_ADDRESS}:${PORT}/${MAPPING}

Summary

This pattern is best for controlled LAN environments that need efficient one-to-many delivery and restricted access.


Problems running the pipelines shown on this page? Please see our GStreamer Debugging guide for help.


Related pages


Previous: Transport_Stream_RTSP_Streaming Index Next: Live_File_Streaming