2

I'm playing with gstreamer rtsp.

I created a rtsp sink as this:

gst-launch-1.0 videotestsrc ! x264enc ! rtph264pay config-interval=10 pt=96 ! udpsink host=127.0.0.1 port=5000

I can't open it directly by VLC (with rtsp://127.0.0.1:5000) but with a vlc.sdp file, it can be displayed. the vlc.sdp file is like:

v=0
m=video 5000 RTP/AVP 96
c=IN IP4 127.0.0.1
a=rtpmap:96 H264/90000
vlc vlc.sdp

The file above is copied from somewhere, I don't understand it well but I think the rtsp sink is and working. I think it's rtsp over udp since I see rtph264pay and udpsink in the cmd line above.

Then I'd like to use rtspsrc to display it.

gst-launch-1.0 rtspsrc location=rtsp://127.0.0.1:5000 ! rtph264depay ! avdec_h264 ! autovideosink sync=false

But I have errors like this:

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://127.0.0.1:5000
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not open resource for reading and writing.
Additional debug info:
gstrtspsrc.c(7469): gst_rtspsrc_retrieve_sdp (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Failed to connect. (Generic error)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

So what's wrong with my rtspsrc command?

1 Answers1

1

You are not using RTSP on the sending side. You are sending just RTP. I recommend some reading on RTP, RTSP and SDP so you understand how these interact with each other.

TL;DR RTSP is used to initiate a RTP session. Basically it transfers a SDP file to the client with required information on how to receive the RTP stream.

These are 3 different protocols you have to follow if you want a complete RTSP spec required transmission.

Note that GStreamer project has some RTSP libraries too for handling such situations.

Florian Zwoch
  • 6,764
  • 2
  • 12
  • 21