Gstreamer rtsp TX2 opencv

Hi ,
on a TX2 with a MP1110 camera connected via an Oem1500 who have an Rtsp server I want optimise this gstreamer (who is working) to use it in opencv3.4:

gst-launch-1.0 rtspsrc location=rtsp://192.168.1.48latency=300 buffer-mode=auto ! queue max-size-buffers=1 ! decodebin ! nvvidconv ! video/xraw,format=BGRx,width=640,height=480! videoconvert nthreads=6 ! queue max-size-buffers=1 ! xvimagesink

my gtg with gst_launch is poor : #400ms
(using stopwatch to observe it like this:

sudo nice -n -20 stopwatch
and printscreen…
)

I have read and try this example who sem better but it not working with me:

[Top contributor - NVIDIA Developer Forums]

My configuration is :
# R32 (release), REVISION: 3.1

So thank’s to Honey_Patouceul if read this trying help me…

regard’s.
Laurent.

Don’t expect too much from me. More experienced users with low latency would better advise. Also note that I’ve found your post by curiousity. If you want me to be notified by the forum, you would use @ before the pseudo.

Be sure about the gstreamer syntax (you post has many typos that may lead to various problems), but I assume you got it working. I have no idea about your video source latency, expect a few frames, nor on your LAN traffic and how much UDP can get BW, so I’d just advise to try various latencies and see what gets best final latency measurements.
I’d suggest to select your H264 decoder and avoid to go thru BGRx format plus videoconvert for xvimagesink. This videosink may have more latency than nvoverlaysink, but the latter one wouldn’t allow to measure with printscreen.

You may also try various options of queue, but I cannot advise much more, you may try:

gst-launch-1.0 rtspsrc location=rtsp://192.168.1.48 latency=200 buffer-mode=auto ! queue max-size-buffers=0 max-size-bytes=0 max-size-time=10 ! queue max-size-time=1 min-threshold-time=5 ! rtph264depay ! h264parse ! nvv4l2decoder enable-max-performance=1 ! nvoverlaysink

Note that you may have to omit h264parse plugin before nvv4l2decoder depending on your L4T version. You may also try to set sync=false to your sink.

Thank’s for you reply @Honey_Patouceul
Je regarde tout cela de plus prés et je reviendrais vers toi.
Merci.

Hi @Honey_Patouceul,

Try it your solution :

gst-launch-1.0 rtspsrc location=rtsp://192.168.1.48 latency=200 buffer-mode=auto ! queue max-size-buffers=0 max-size-bytes=0 max-size-time=10 ! queue max-size-time=1 min-threshold-time=5 ! rtph264depay ! h264parse ! nvv4l2decoder enable-max-performance=1 ! nvoverlaysink

work but due to no printscreen I try this one :

gst-launch-1.0 rtspsrc location=rtsp://192.168.1.48 latency=200 buffer-mode=auto ! queue max-size-buffers=0 max-size-bytes=0 max-size-time=10 ! queue max-size-time=1 min-threshold-time=5 ! rtph264depay ! h264parse ! nvv4l2decoder enable-max-performance=1 ! xvimagesink

which not working…

AVERTISSEMENT : pipeline erroné : impossible de connecter nvv4l2decoder0 à xvimagesink0

I dont understand the reason… Can you explain why ?
thank’s.
Laurent.

nvv4l2decoder only outputs to NVMM memory, but xvimagesink can only read from standard CPU memory.
Using nvvidconv in between will do the job:

gst-launch-1.0 rtspsrc location=rtsp://192.168.1.48 latency=200 buffer-mode=auto ! queue max-size-buffers=0 max-size-bytes=0 max-size-time=10 ! queue max-size-time=1 min-threshold-time=5 ! rtph264depay ! h264parse ! nvv4l2decoder enable-max-performance=1 ! nvvidconv ! xvimagesink

Thanks for your reply @Honey_Patouceul .

This line works the latency is tl#400ms

This line :

gst-launch-1.0 rtspsrc location=rtsp://192.168.1.48 ! 'application/x-rtp, encoding-name=H264, payload=96' ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! nveglglessink sync=false

has a latency tl#180ms

But seem to me that your gstreamer line should be better that mine using appsink…
I have no physical way to avaluate this , but is my reflexion seem right by code comparaison ?

Laurent.

You are using a different displaysink (EGL) and sync=false. This might explain the difference.
You would try and keep what works best for your case.

Thank’s very muche for your advice.
Seem the line ,in my case , seem better :

gst-launch-1.0 rtspsrc location=rtsp://192.168.1.48 ! 'application/x-rtp, encoding-name=H264, payload=96' ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! nveglglessink sync=false

with a latency of 150ms wich should , i hoppe, decrease with appsink.

Laurent.