GstRtspSink - Audio+Video Streaming Plus H264 Single Streaming
This wiki provides an audio+video stream plus and independent H264 streaming example using GstRtspSink.
|
GstRtspSink 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.
RTSP Clients
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}