GstRtspSink - Audio+Video Streaming Plus H264 Single Streaming

From RidgeRun Developer Wiki

Follow Us On Twitter LinkedIn Email Share this page



Previous: Audio+Video_Streaming Index Next: Transport_Stream_RTSP_Streaming



This example mixes one combined audio and video mapping with a second independent H264 mapping. It is useful when one client needs the full program while another needs video only.


Example use case

A product can publish:

  • one full audio and video stream for normal playback
  • one video-only stream for analytics, monitoring, or lower-complexity clients

Server-side Pipeline

The following pipeline sends two different streams: a H264+AAC in-sync stream and a H264 only stream, through two different mappings: av_stream and v_stream respectively. Any of them can be accessed independently.

PORT=12345
MAPPING1=/av_stream
MAPPING2=/v_stream

gst-launch-1.0 rtspsink name=sink service=${PORT} \
v4l2src ! queue ! videoconvert ! x264enc tune=zerolatency ! h264parse ! capsfilter caps="video/x-h264, mapping=${MAPPING1}" ! sink. \
alsasrc ! voaacenc ! aacparse ! capsfilter caps="audio/mpeg, mapping=${MAPPING1}" ! sink. \
videotestsrc ! x264enc tune=zerolatency ! h264parse ! capsfilter caps="video/x-h264, mapping=${MAPPING2}" ! sink.

Client-side

VLC

IP_ADDRESS=127.0.0.1
PORT=12345
MAPPING1=av_stream
MAPPING2=v_stream

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

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

GStreamer

IP_ADDRESS=127.0.0.1
PORT=12345
MAPPING1=av_stream
MAPPING2=v_stream

# Stream 1
gst-launch-1.0 rtspsrc location=rtsp://${IP_ADDRESS}:${PORT}/${MAPPING1} name=src \
src. ! rtph264depay ! h264parse ! avdec_h264 ! queue ! autovideosink \
src. ! rtpmp4adepay ! aacparse ! avdec_aac ! queue ! autoaudiosink

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

MPlayer

IP_ADDRESS=127.0.0.1
PORT=12345
MAPPING1=av_stream
MAPPING2=v_stream

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

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

Totem

IP_ADDRESS=127.0.0.1
PORT=12345
MAPPING1=av_stream
MAPPING2=v_stream

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

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

Summary

This mixed layout is useful when different client classes need different media compositions from the same pipeline.


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


Related pages


Previous: Audio+Video_Streaming Index Next: Transport_Stream_RTSP_Streaming