GstRtspSink - Audio+Video Streaming
This example combines encoded audio and encoded video under the same mapping so a client can open one RTSP URL and receive a synchronized audio and video presentation.
When audio and video belong together, publish them under the same mapping so a standard RTSP client can discover and play both as one presentation.
Server-side Pipeline
The following pipeline combines a H264 video and an AAC audio stream into a single mapping. When viewing the stream, a synchronized A/V video should render.
PORT=12345
MAPPING=/stream
gst-launch-1.0 rtspsink name=sink service=$PORT \
v4l2src ! queue ! videoconvert ! x264enc tune=zerolatency ! h264parse ! capsfilter caps="video/x-h264, mapping=${MAPPING}" ! sink. \
alsasrc ! voaacenc ! aacparse ! capsfilter caps="audio/mpeg, mapping=${MAPPING}" ! sink.
Client-side
VLC
IP_ADDRESS=127.0.0.1
PORT=12345
MAPPING1=stream
vlc rtsp://${IP_ADDRESS}:${PORT}/${MAPPING}
GStreamer
IP_ADDRESS=127.0.0.1
PORT=12345
MAPPING=stream
gst-launch-1.0 rtspsrc location=rtsp://${IP_ADDRESS}:${PORT}/${MAPPING} name=src \
src. ! rtph264depay ! h264parse ! avdec_h264 ! queue ! autovideosink \
src. ! rtpmp4adepay ! aacparse ! avdec_aac ! queue ! autoaudiosink
MPlayer
IP_ADDRESS=127.0.0.1
PORT=12345
MAPPING=stream
mplayer rtsp://${IP_ADDRESS}:${PORT}/${MAPPING}
Totem
IP_ADDRESS=127.0.0.1
PORT=12345
MAPPING=stream
totem rtsp://${IP_ADDRESS}:${PORT}/${MAPPING}
Summary
Use one mapping for synchronized audio and video when the client should treat them as a single stream presentation.
Problems running the pipelines shown on this page? Please see our GStreamer Debugging guide for help.
Related pages
- GstRtspSink
- GstRtspSink - Basic usage
- GstRtspSink - Simple Examples
- GstRtspSink - Advanced examples
- GStreamer Debugging