13

I am pretty new to Gstreamer.

I need to write a video client able to stream data from an RTSP source using GStreamer. I configured VLC to stream a video I have on my laptop using RTSP and I want to create a pipeline to get that stream and show it. I tried using playbin and everything works fine. The point is that I need to fine tune the latency used to stream the video but it seems I cannot do that with playbin.

I tried rtspsrc because it allows to work on the latency but I don't know how to show the video on any window. That's the pipeline I created:

gst-launch-1.0 rtspsrc location=rtsp://localhost:8554/test latency=300 ! decodebin ! autovideosink

I get the error "streaming task paused, reason not-negotiated (-4)".

I tried different pipelines after deeply looking on the internet but I definitely miss something. How can I write a gstreamer pipeline to show a video from RTSP?

The final goal is to have a pipeline which can be adjustable at least in terms of latency, so I have two choices:

  • set the latency of playbin element, if possible. (This element correctly shows the video)
  • Show the video with the correct pipeline since rtspsrc allows me to set the latency.

I use Xubuntu 16.04, gstreamer-tools-1.0 (used 0.10 as well) and the video I stream with VLC has mp4 extension.

5 Answers 5

10

you can adjust the latency by setting the right property and using playbin component:

gst-launch-1.0 -v playbin uri=rtsp://localhost:8554/test uridecodebin0::source::latency=300

Hope you find this useful :)

10

Assume the rtsp stream is h264 format, use explicit h264 decoder and encoder to parse the stream. Use videoconvert and videoscale to change the frame shape.

gst-launch-1.0 rtspsrc location=rtsp://localhost:8554/test latency=100 ! queue ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! videoscale ! video/x-raw,width=640,height=480 ! autovideosink
1

playbin does have a latency option last time I have checked. Note that its scale is different from the one of rtspsrc. rtspsrc is in milliseconds while playbin is in nanoseconds. It may still not go below a certain threshold - depending on the input video requirements (vbv buffer limitations).

For your rtspsrc pipeline you probably miss a videoconvert or autovideosonvert element right before the autovideosink.

2
  • 1
    Thanks for your help! I think I got the solution with the answer above. But I am still interested in the second solution with rtsp. I tried with both videoconvert and autovideoconvert but I don't see anything. The pipeline seems to be correct tough. I don't get any error message. Do I need other elements in my pipeline? Thanks! May 25, 2017 at 10:46
  • 1
    export GST_DEBUG=3 and see the logs whats happening. May 25, 2017 at 14:06
0

I've been trying to get this work and was successful on a raspberry pi 3 so I thought "Well since that was so easy I'll try it on the rpi4" Followed the same steps to get gstream installed but when running the command:

gst-launch-1.0 rtspsrc location=rtsp://localhost:8554/test latency=100 ! queue ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! videoscale ! video/x-raw,width=640,height=480 ! autovideosink

It looks like a thermal camera. Still works on the rpi3 just fine though. Not sure what would be making the difference here.

0

In my case I was receiving a video stream with impressive latency from an android smartphone(server) to an nvidia jetson nano(client) for later inference processing and the following string worked:

pipeline = "rtspsrc location=rtsp://admin:[email protected]:xxxx latency=0 ! queue ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! videoscale ! video/x-raw,width=640,height=480 ! appsink"

After replacing the "omxh264dec" decoder with "avdec_h264" in the pipeline they disappeared the following deprecations:

(

python3:10659): GStreamer-CRITICAL **: 22:47:22.966: gst_caps_is_empty: assertion 'GST_IS_CAPS (caps)' failed

(python3:10659): GStreamer-CRITICAL **: 22:47:22.966: gst_caps_truncate: assertion 'GST_IS_CAPS (caps)' failed

(python3:10659): GStreamer-CRITICAL **: 22:47:22.966: gst_caps_fixate: assertion 'GST_IS_CAPS (caps)' failed

(python3:10659): GStreamer-CRITICAL **: 22:47:22.966: gst_caps_get_structure: assertion 'GST_IS_CAPS (caps)' failed

(python3:10659): GStreamer-CRITICAL **: 22:47:22.966: gst_structure_get_string: assertion 'structure != NULL' failed

(python3:10659): GStreamer-CRITICAL **: 22:47:22.966: gst_mini_object_unref: assertion 'mini_object != NULL' failed

I hope i was helpful

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jan 2, 2023 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.