Jump to content

Streaming over RTSP

From RidgeRun Developer Wiki


Follow us on: YouTube Twitter LinkedIn Email Share this page

Share This Page




RTSP streaming is possible on the IQ-9075. This wiki shows two ways of streaming with RTSP: Using gst-rtsp-server and RidgeRun's GStreamer element rtspsink.


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


Using rtspsink

GstRtspSink is a RidgeRun GStreamer sink element that publishes one or more RTSP streams from a single pipeline. It is designed for embedded Linux systems that need video streaming, synchronized audio and video, multicast delivery, authentication, and easy integration into both gst-launch prototypes and production applications.

Setting up element

Follow the instructions on how to build the element.

H.264

Sender (Dragonwing EVK)

It is possible to capture from different sources:

Stream videotestsrc

Run server on board on localhost:

gst-launch-1.0 -v videotestsrc is-live=true ! v4l2h264enc qos=true ! video/x-h264,profile=high,stream-format=byte-stream,alignment=au ! h264parse config-interval=-1 ! video/x-h264,mapping=/test ! rtspsink service=8554
Stream from camera connected to JCAM0
gst-launch-1.0 -v qtiqmmfsrc camera=0 ! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 ! queue max-size-buffers=4 leaky=downstream ! v4l2h264enc qos=true ! video/x-h264,profile=high,stream-format=byte-stream,alignment=au ! h264parse config-interval=-1 ! video/x-h264,mapping=/test ! rtspsink service=8554
Stream from file
gst-launch-1.0 -v filesrc location=ngonzalez/camera-test2.mp4 ! qtdemux ! h264parse ! v4l2h264dec ! videoconvert ! v4l2h264enc qos=true ! video/x-h264,profile=high,stream-format=byte-stream,alignment=au ! h264parse config-interval=-1 ! video/x-h264,mapping=/test ! rtspsink service=8554

Receiver (host PC)

BOARD_IP=board_ip_address

Display video:

gst-launch-1.0 -v rtspsrc location=rtsp://$BOARD_IP:8554/test latency=100 ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! autovideosink

or save video to file:

gst-launch-1.0 -e -v rtspsrc location=rtsp://$BOARD_IP:8554/test latency=100 ! rtph264depay ! h264parse config-interval=-1 ! qtmux ! filesink location=output.mp4

H.265

Sender (Dragonwing EVK)

Options for capture:

Stream videotestsrc

Run server on board on localhost:

gst-launch-1.0 -v videotestsrc is-live=true ! v4l2h265enc qos=true ! video/x-h265,profile=main,stream-format=byte-stream,alignment=au ! h265parse config-interval=-1 ! video/x-h265,mapping=/test ! rtspsink service=8554
Stream from camera connected to JCAM0
gst-launch-1.0 -v qtiqmmfsrc camera=0 ! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 ! queue max-size-buffers=4 leaky=downstream ! v4l2h265enc qos=true ! video/x-h265,profile=main,stream-format=byte-stream,alignment=au ! h265parse config-interval=-1 ! video/x-h265,mapping=/test ! rtspsink service=8554
Stream from file
gst-launch-1.0 -v filesrc location=camera-test.mp4 ! qtdemux ! h265parse ! v4l2h265dec ! videoconvert ! v4l2h265enc qos=true ! video/x-h265,profile=main,stream-format=byte-stream,alignment=au ! h265parse config-interval=-1 ! video/x-h265,mapping=/test ! rtspsink service=8554

Receiver (host PC)

BOARD_IP=board_ip_address

Display video:

gst-launch-1.0 -v rtspsrc location=rtsp://$BOARD_IP:8554/test latency=100 ! rtph265depay ! h265parse ! avdec_h265 ! videoconvert ! autovideosink

or save video to file:

gst-launch-1.0 -e -v rtspsrc location=rtsp://$BOARD_IP:8554/test latency=100 ! rtph265depay ! h265parse config-interval=-1 ! qtmux ! filesink location=output.mp4

Using gst-rtsp-server

Setting up server

Get dependencies for rtsp server:

sudo apt-get update
sudo apt-get install -y git build-essential meson ninja-build libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstrtspserver-1.0-dev

Clone repository:

git clone https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server.git
cd gst-rtsp-server

Build:

meson build
ninja -C build

H.264

Sender (Dragonwing EVK)

Capture from:

Stream videotestsrc

Run server on board on localhost:

~/gst-rtsp-server/build/examples/test-launch "videotestsrc is-live=true ! v4l2h264enc qos=true ! video/x-h264,profile=high,stream-format=byte-stream,alignment=au ! h264parse ! rtph264pay name=pay0 pt=96"
Stream from camera connected to JCAM0
~/gst-rtsp-server/build/examples/test-launch "qtiqmmfsrc camera=0 ! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 ! queue max-size-buffers=4 leaky=downstream ! v4l2h264enc qos=true ! video/x-h264,profile=high,stream-format=byte-stream,alignment=au ! h264parse ! rtph264pay name=pay0 pt=96"
Stream from file
~/gst-rtsp-server/build/examples/test-launch "filesrc location=camera-test.mp4 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert ! v4l2h264enc qos=true ! video/x-h264,profile=high,stream-format=byte-stream,alignment=au ! h264parse ! rtph264pay name=pay0 pt=96"

Receiver (host PC)

BOARD_IP=board_ip_address

Display video:

gst-launch-1.0 -v   rtspsrc location=rtsp://$BOARD_IP:8554/test latency=100 ! rtph264depay ! h264parse ! avdec_h264 !   videoconvert ! autovideosink

or save video to file:

gst-launch-1.0 -e -v   rtspsrc location=rtsp://$BOARD_IP:8554/test latency=100 !   rtph264depay ! h264parse config-interval=-1 !   qtmux !   filesink location=output.mp4

H.265

Sender (Dragonwing EVK)

Stream videotestsrc

Run server on board on localhost:

~/gst-rtsp-server/build/examples/test-launch "videotestsrc is-live=true ! v4l2h265enc qos=true ! video/x-h265,profile=main,stream-format=byte-stream,alignment=au ! h265parse ! rtph265pay name=pay0 pt=96"
Stream from camera connected to JCAM0
~/gst-rtsp-server/build/examples/test-launch "qtiqmmfsrc camera=0 ! video/x-raw,format=NV12,width=1280,height=720,framerate=30/1 ! queue max-size-buffers=4 leaky=downstream ! v4l2h265enc qos=true ! video/x-h265,profile=main,stream-format=byte-stream,alignment=au ! h265parse ! rtph265pay name=pay0 pt=96"
Stream from file
~/gst-rtsp-server/build/examples/test-launch "filesrc location=camera-test.mp4 ! qtdemux ! h265parse ! avdec_h265 ! videoconvert ! v4l2h265enc qos=true ! video/x-h265,profile=main,stream-format=byte-stream,alignment=au ! h265parse ! rtph265pay name=pay0 pt=96"

Receiver (host PC)

BOARD_IP=board_ip_address

Display video:

gst-launch-1.0 -v   rtspsrc location=rtsp://$BOARD_IP:8554/test latency=100 ! rtph265depay ! h265parse ! avdec_h265 !   videoconvert ! autovideosink

or save video to file:

gst-launch-1.0 -e -v rtspsrc location=rtsp://$BOARD_IP:8554/test latency=100 ! rtph265depay ! h265parse config-interval=-1 ! qtmux ! filesink location=output.mp4

FAQ

Does RTSP carry the media itself?
RTSP controls the session; media is usually RTP over UDP or interleaved through the RTSP TCP connection.
Should a client use UDP or TCP?
Test both. UDP avoids TCP head-of-line behavior but needs media ports and loss handling; TCP can simplify traversal but add delay under loss.
Is an rtsp:// URL secure?
Not inherently. Define authentication and an approved encrypted transport, and validate certificates and credential handling.

Related pages


Cookies help us deliver our services. By using our services, you agree to our use of cookies.