GstRtspSink - Simple Examples
GstRtspSink - Simple Examples
This page collects minimal GstRtspSink pipelines for common media formats. It is the fastest place to start when you want to verify basic streaming before moving to multi-stream, multicast, or secured deployments.
|
|
Server-side Pipelines
Below are the most commonly used video streaming pipelines with rtspsink.
Video - MPEG4
gst-launch-1.0 videotestsrc ! avenc_mpeg4 ! video/mpeg, mapping=/stream1 ! rtspsink service=5000
Video - H264
gst-launch-1.0 videotestsrc ! x264enc ! video/x-h264, mapping=/stream1 ! rtspsink service=5000
Video - H265
gst-launch-1.0 videotestsrc ! x265enc option-string="keyint=30:min-keyint=30:repeat-headers=1" ! video/x-h265, mapping=/stream1 ! rtspsink service=5000
Video - VP8
gst-launch-1.0 videotestsrc ! vp8enc ! video/x-vp8, mapping=/stream1 ! rtspsink service=5000
Video - VP9
gst-launch-1.0 videotestsrc ! vp9enc ! video/x-vp9, mapping=/stream1 ! rtspsink service=5000
Video - JPEG
gst-launch-1.0 videotestsrc ! jpegenc ! image/jpeg, mapping=/stream1 ! rtspsink service=5000
Video - AV1
gst-launch-1.0 videotestsrc is-live=true ! av1enc ! av1parse ! video/x-av1, mapping=/stream1 ! rtspsink service=5000
Audio - AAC
gst-launch-1.0 audiotestsrc ! voaacenc ! audio/mpeg, mapping=/stream1 ! rtspsink service=5000
Audio - AC3
gst-launch-1.0 audiotestsrc ! avenc_ac3 ! audio/x-ac3, mapping=stream1 ! rtspsink service=5000
Audio - PCMU
gst-launch-1.0 audiotestsrc ! mulawenc ! audio/x-mulaw, mapping=stream1 ! rtspsink service=5000
Audio - PCMA
gst-launch-1.0 audiotestsrc ! alawenc ! audio/x-alaw, mapping=stream1 ! rtspsink service=5000
Audio - OPUS
gst-launch-1.0 audiotestsrc ! opusenc ! audio/x-opus, mapping=stream1 ! rtspsink service=5000
Test observation :
You may not be able to play OPUS audio streaming at the client using VLC. Patching of the VLC source file live555.cpp is needed to resolve this issue. Reference.
It works fine with GStreamer playbin and Totem player.
Client-side
Different clients can connect to the rtspsink stream, this section provides examples for the most common methods. Note that in these examples, the IP used is 127.0.0.1; this means that the examples will work only if you launch the server and the client on the same device. Make sure to set the server IP address accordingly when the client is on a different device than the server.
GStreamer
IP_ADDRESS=127.0.0.1
PORT=5000
MAPPING=/stream1
gst-launch-1.0 playbin uri=rtsp://${IP_ADDRESS}:${PORT}/${MAPPING}
VLC
IP_ADDRESS=127.0.0.1
PORT=5000
MAPPING=/stream1
vlc rtsp://${IP_ADDRESS}:${PORT}/${MAPPING}
VLC Observation
If you experience delay when using the VLC player, it might be because of the ~1sec buffering. Follow the instructions in the Modify Streaming Buffer wiki to decrease the streaming buffer.
MPlayer
IP_ADDRESS=127.0.0.1
PORT=5000
MAPPING=/stream1
mplayer rtsp://${IP_ADDRESS}:${PORT}/${MAPPING}
Totem
IP_ADDRESS=127.0.0.1
PORT=5000
MAPPING=/stream1
totem rtsp://${IP_ADDRESS}:${PORT}/${MAPPING}
Related pages
- GstRtspSink
- GstRtspSink - Basic usage
- GstRtspSink - Simple Examples
- GstRtspSink - Advanced examples
- GStreamer Debugging
FAQ
- Which example should I try first?
- A single H264 test stream is usually the fastest first validation.
- When should I move to advanced examples?
- Move on after you confirm that a simple server and client pipeline work end-to-end.