3

I am accessing a RTSP video stream from a VIRB 360 camera. I am able to play the stream using the following gstreamer command:

gst-launch-1.0 -v playbin uri=rtsp://192.168.0.1/livePreviewStream?maxResolutionVertical=720\&liveStreamActive=1

However, there is a 3 second delay in the streaming, which needs to be eliminated. The output of the above command (due to -v) has been uploaded here. I also created a few .svg files for the pipeline following the method described in this question/ answer. Those files has been uploaded here. I believe mypipeline4.svg and mypipeline5.svg represent the complete pipeline (Multiple dot files were generated by a single pipeline and that's reason for multiple .svg file). In the .svg files, can see a latency=2000 under rtpjitterbuffer.

The plan is to build the same pipeline by adding components manually instead of using playbin, and then set latency property for rtpjitterbuffer. I have tried the following commands:

1) gst-launch-1.0 rtspsrc location=rtsp://192.168.0.1/livePreviewStream?maxResolutionVertical=720\&liveStreamActive=1 ! udpsrc ! rtpsession ! rtpssrcdemux ! rtpjitterbuffer ! rtpptdemux ! queue ! udpsink ! queue ! rtph264depay ! h264parse ! omxh264dec ! playsink

2) gst-launch-1.0 rtspsrc location=rtsp://192.168.0.1/livePreviewStream?maxResolutionVertical=720\&liveStreamActive=1 ! udpsrc ! rtpsession ! rtpssrcdemux ! rtpjitterbuffer ! rtpptdemux ! queue ! udpsink ! queue ! rtph264depay ! h264parse ! omxh264dec ! nvoverlaysink

However, in both cases, I received an error: WARNING: erroneous pipeline: could not link udpsink0 to queue1. How can I fix this? Also, from my experiments I pretty sure that the rest of the pipeline also has errors. How can I optimize this pipeline?

skr
  • 914
  • 3
  • 18
  • 35
  • Instead of rebuilding from scratch - how about connecting the `deep-element-added` signal from the pipeline aka `GstBin`? Whenever an element gets added by `playbin/rtpbin` you should get the signal called with that element. If its an `rtpjitterbuffer` you can set your desired properties. – Florian Zwoch Mar 14 '18 at 19:34
  • @FlorianZwoch I am relatively new to gstreamer and didn't quite understand your comment. I did try adding `latency=0` and `latency=10000` at the end of my `playbin` command. But in both these cases, the verbose output showed a latency of 2000. – skr Mar 14 '18 at 19:39
  • Well you would have to write a real GStreamer application. `gst-launch-1.0` is quick start but quickly comes to its limits. – Florian Zwoch Mar 14 '18 at 20:37
  • @FlorianZwoch okay. I will follow the tutorial and see how that goes. – skr Mar 14 '18 at 20:39
  • 1
    Its a complex framework.. with some learning curve. There are a lot of things to read and learn. So maybe first make things work. Fine tuning can be done anytime.. – Florian Zwoch Mar 14 '18 at 20:42
  • 3
    you can try to set the latency using the following: gst-launch-1.0 -v playbin uri=rtsp://192.168.0.1/livePreviewStream?maxResolutionVertical=720\&liveStreamActive=1 uridecodebin0::source::latency=0 – Prabhakar Lad Mar 16 '18 at 09:49
  • @PrabhakarLad I had already tried something similar. I also tried your exact command. But in both cases, the video is very choppy. I was able to obtain better results using `ffplay`. So, now I am trying to get it into `OpenCV` using ffmpeg. `OpenCV` / C/ C++ is the ultimate destination. – skr Mar 16 '18 at 13:11

1 Answers1

5

First, you are not supposed to connect anything to a sink in GStreamer. The sink is the end of the line and should just receive data. Especially the udpsink is to send UDP packets to the network. See more at documentation:

https://gstreamer.freedesktop.org/documentation/udp/udpsink.html?gi-language=c

I am also trying to reduce my latency, and the best that I got until now is:

gst-launch-1.0 rtspsrc location=rtsp://10.20.0.188:554 latency=0 buffer-mode=auto ! decodebin ! vaapisink sync=false

I'm getting 400ms delay through it while in the camera app I have 150ms, I wanna to reduce it.

I hope this helps you ;)