GstRtspSink - Dual Multicast

From RidgeRun Developer Wiki


Previous: Live_File_Streaming Index Next: Multicast_Audio_Video






This wiki provides an example to H264 streams through two different multicast groups.

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

GstRtspSink Pipeline

This example generates two test patterns and encodes to H264. Then it creates two independent RTSP streams, each one in a different multicast group.

PORT=12345
MAPPING1=/stream1
MAPPING2=/stream2
IP_MIN=224.2.0.3
IP_MAX=224.2.0.10
PORT_MIN=7000
PORT_MAX=7010
TTL=128

gst-launch-1.0 rtspsink name=sink service=${PORT} multicast-ip-min=${IP_MIN} multicast-ip-max=${IP_MAX} \
multicast-port-min=${PORT_MIN} multicast-port-max=${PORT_MAX} multicast=true \
videotestsrc pattern=snow ! queue ! x264enc key-int-max=30 ! video/x-h264,mapping=${MAPPING1} ! sink. \
videotestsrc pattern=ball ! queue ! x264enc key-int-max=30 ! video/x-h264,mapping=${MAPPING2} ! sink.

RTSP Clients

VLC

IP_ADDRESS=<IP ADDRESS OF HOST>
PORT=12345
MAPPING1=stream1
MAPPING2=stream2

# Stream 1
vlc rtsp://${IP_ADDRESS}:${PORT}/${MAPPING1}

# Stream 2
vlc rtsp://${IP_ADDRESS}:${PORT}/${MAPPING2}

GStreamer

IP_ADDRESS=<IP ADDRESS OF HOST>
PORT=12345
MAPPING1=stream1
MAPPING2=stream2

# Stream 1
gst-launch-1.0 rtspsrc location=rtsp://${IP_ADDRESS}:${PORT}/${MAPPING1} ! rtph264depay ! avdec_h264 ! autovideosink

# Stream 2
gst-launch-1.0 rtspsrc location=rtsp://${IP_ADDRESS}:${PORT}/${MAPPING2} ! rtph264depay ! avdec_h264 ! autovideosink

MPlayer

IP_ADDRESS=<IP ADDRESS OF HOST>
PORT=12345
MAPPING1=stream1
MAPPING2=stream2

# Stream 1
mplayer rtsp://${IP_ADDRESS}:${PORT}/${MAPPING1}

# Stream 2
mplayer rtsp://${IP_ADDRESS}:${PORT}/${MAPPING2}

Totem

IP_ADDRESS=<IP ADDRESS OF HOST>
PORT=12345
MAPPING1=stream1
MAPPING2=stream2

# Stream 1
totem rtsp://${IP_ADDRESS}:${PORT}/${MAPPING1}

# Stream 2
totem rtsp://${IP_ADDRESS}:${PORT}/${MAPPING2}

Multicast Group Validation

Using

iftop

the use of the two multicast groups can be validated, as the following:

sudo iftop -p

which effectively shows the use of two independent groups 224.2.0.3 and 224.2.0.4 as shown in Figure 1.

Figure 1 - Iftop output validating two independent multicast groups
Figure 1 - Iftop output validating two independent multicast groups


Previous: Live_File_Streaming Index Next: Multicast_Audio_Video