GstRtspSink - Live File Streaming

From RidgeRun Developer Wiki

Follow Us On Twitter LinkedIn Email Share this page



Previous: Multicast+Authentication Index Next: Dual_Multicast



This example uses a file-based source while still exposing it as an RTSP stream. It is useful for demos, replay workflows, validation, and systems that need to publish pre-recorded content through the same RTSP interface used for live feeds.

Typical uses

  • Demo environments
  • Regression testing
  • File replay through the same RTSP workflow used in production
  • Simulating a live source when hardware is not available

Server-side Pipeline

The following pipeline takes a MP4 file containing an H264 video and an AAC audio elementary stream and streams them through RTSP using GstRtspSink.

PORT=12345
MAPPING=/stream
FILE=/var/media/videos/recording.mp4

gst-launch-1.0 rtspsink name=sink service=${PORT} appsink0::sync=true appsink1::sync=true qtdemux name=demux \
filesrc location=${FILE} ! demux. \
demux. ! queue ! aacparse ! audio/mpeg,mapping=${MAPPING} ! sink. \
demux. ! queue ! h264parse ! video/x-h264,mapping=${MAPPING} ! sink.

Client-side

VLC

IP_ADDRESS=192.0.0.1
PORT=12345
MAPPING=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

Live file streaming is a practical way to test client interoperability and product behavior before a real camera or hardware source is available.


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


Related pages


Previous: Multicast+Authentication Index Next: Dual_Multicast