Video Lag in Jetson AGX Orin

There is Video Lag of Approx 2 Seconds in Jetson Orin when the video is captured using OpenCV Videocapture()
But when the video is streamed directly in the gstreamer path, there is no lag in video.
Also, the same scenario when tried in Jetson Xavier, there is no issue. There is no video ;ag in Xavier.
kindly help us find a solution.

We have tried to use various methods available in different forums like changing the pipeline.

Hi,
Do you use nvarguscamerasrc or v4l2src in your use-case? Would like to know the type of your source.

1 Like

import cv2

rtsp_url = “rtsp://192.168.168.119:554”

vs = VideoCapture(rtsp_url)

while True:
frame = vs.read()

if frame is None:
    continue

cv2.imshow('frame', frame)

key = cv2.waitKey(1) & 0xFF

if key == ord('q'):
    break

cv2.destroyAllWindows()
cv2.release()

We are getting a video lag for the above scenario itself. We have just used the opencv for the videocapture and viewing.

Hi,
Please try this sample and see if the issue is still present:
Doesn't work nvv4l2decoder for decoding RTSP in gstreamer + opencv - #3 by DaneLLL

1 Like

We are getting the following error when the above pipeline is run.

nvbufsurftransform: Could not get EGL display connection
nvbuf_utils: Could not get EGL display connection
nvbuf_utils: Could not get EGL display connection
Opening in BLOCKING MODE
[ WARN:0] global …/modules/videoio/src/cap_gstreamer.cpp (1758) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module rtspsrc0 reported: Internal data stream error.
[ WARN:0] global …/modules/videoio/src/cap_gstreamer.cpp (888) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global …/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
[ERROR:0] global …/modules/videoio/src/cap.cpp (116) open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.2.0) …/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can’t find starting number (in the name of file): rtspsrc location= rtsp://192.168.168.119:554! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw,format=BGR ! appsink in function ‘icvExtractPattern’

rtsp open failed

Hi,
Looks like gstreamer is not enabled in the OpenCV. Do you use default OpenCV package installed through SDKManager?

1 Like

Hi,
still there is lag…
But, the gstreamer is enabled

Video I/O:
DC1394: YES (2.2.5)
FFMPEG: YES
avcodec: YES (58.54.100)
avformat: YES (58.29.100)
avutil: YES (56.31.100)
swscale: YES (5.5.100)
avresample: YES (4.0.0)
GStreamer: YES (1.16.2)
PvAPI: NO
v4l/v4l2: YES (linux/videodev2.h)

Parallel framework: TBB (ver 2020.1 interface 11101)

Trace: YES (built-in)

Hi,
Please try gst-launch-1.0 command for comparison:

$ gst-launch-1.0 rtspsrc location=rtsp://192.168.168.119:554 ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! 'video/x-raw(memory:NVMM)' ! nv3dsink

see if the RTSP source can be decoded well in gst-launch-1.0 command and the issue is specific to OpenCV code.

1 Like

Hi,
it hits this error
gst-launch-1.0 rtspsrc location=rtsp://192.168.168.119:554 ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! ‘video/x-raw(memory:NVMM)’ ! nv3dsink
Setting pipeline to PAUSED …
Opening in BLOCKING MODE
Pipeline is live and does not need PREROLL …
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://192.168.168.119:554
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not open resource for reading and writing.
Additional debug info:
gstrtspsrc.c(7893): gst_rtspsrc_retrieve_sdp (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Failed to connect. (Generic error)
ERROR: pipeline doesn’t want to preroll.
Setting pipeline to NULL …
Freeing pipeline …

Hi,

Please check if this URI is correct. Probably your RTSP source is changed.

1 Like

HI,
we are getting the stream in gst launch but not in opencv, it shows the warning
[ WARN:0] global …/modules/videoio/src/cap_gstreamer.cpp (713) open OpenCV | GStreamer warning: Error opening bin: syntax error
[ WARN:0] global …/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

What JetPack or L4T release are you running:

cat /etc/nv_tegra_release

because

GStreamer: YES (1.16.2)

may not be expected with current JP-5.0.2 (L4T R35.1.0)

1 Like

Hi the release version is,
R34 (release), REVISION: 0.1, GCID: 29955323, BOARD: t186ref, EABI: aarch64, DATE: Tue Mar 15 08:13:50 UTC 2022
But there is still 2 seconds delay…
strong text

Hi,
Looks like you are using developer release. Please upgrade to Jetpack 5.0.2(r35.1) and try again.

1 Like

Also, be aware that default latency of rtspsrc would be 2 s (2000 ms). Try to decrease it such as:

gst-launch-1.0 rtspsrc location=rtsp://192.168.168.119:554 latency=500 ! rtph264depay latency=300 ! h264parse ! nvv4l2decoder ! nvvidconv ! ‘video/x-raw(memory:NVMM)’ ! nv3dsink
1 Like

Hi,
After i gave sudo apt update,sudo sudo apt dist upgrade, sudoreboot,in terminal the jetson orin does not display anything
The screen went blank
And the fan is running continuously what to do
please give some solution…

sudo ./flash.sh jetson-agx-orin-devkit mmcblk0p1
###############################################################################

L4T BSP Information:

R35 , REVISION: 1.0

###############################################################################
Unsupported ioctl: cmd=0xffffffff8004550f
Error: probing the target board failed.
Make sure the target board is connected through
USB port and is in recovery mode.

But the USB is connected through Type-C cable

Be sure to use the USB-C connector on GPIO connector side.
Also if possible try another cable… Some cables from smartphone power supply may have low quality signal.
Be sure to set your Jetson in recovery mode.

See:

1 Like

Hi,
Please also try to flash through SDKManager. You can install system image and SDK Components by following the steps.

1 Like

sudo apt install ./sdkmanager_1.9.0-10816_amd64.deb
Reading package lists… Done
Building dependency tree
Reading state information… Done
Note, selecting ‘sdkmanager:amd64’ instead of ‘./sdkmanager_1.9.0-10816_amd64.deb’
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
sdkmanager:amd64 : Depends: libgconf-2-4:amd64 but it is not installable
Depends: libcanberra-gtk-module:amd64 but it is not installable
Depends: locales:amd64 but it is not installable
E: Unable to correct problems, you have held broken packages