Problem with Jetson Nano and OpenCV

Hello,
I am writing a code to read frames from an IP camera using OpenCV in a Jetson Nano Device with L4T R32.7.1 and JetPack 4.6.1. The version of OpenCV is 4.3.0 with Python3.6.9

The code of example that i am using is the following:

import cv2
input_URI = "rtsp://user:psw@IP_address:88/videoMain"
camera = cv2.VideoCapture(input_URI)
while camera.isOpened():
         ret, frame = camera.read()
         frame_rgba = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA)
         print(frame_rgba)

However, i get the following error.

[ WARN:0] global /tmp/pip-install-acvfpz_0/opencv-python_7732674b1cb7471d8a299216848188a1/opencv/modules/videoio/src/cap_gstreamer.cpp (1759) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module source reported: Unauthorized
[ WARN:0] global /tmp/pip-install-acvfpz_0/opencv-python_7732674b1cb7471d8a299216848188a1/opencv/modules/videoio/src/cap_gstreamer.cpp (888) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /tmp/pip-install-acvfpz_0/opencv-python_7732674b1cb7471d8a299216848188a1/opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
[ERROR:0] global /tmp/pip-install-acvfpz_0/opencv-python_7732674b1cb7471d8a299216848188a1/opencv/modules/videoio/src/cap.cpp (142) open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.3.0) /tmp/pip-install-acvfpz_0/opencv-python_7732674b1cb7471d8a299216848188a1/opencv/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): rtsp://usr:psw@IP_address:88/videoMain in function 'icvExtractPattern'

The code is inside a Docker container. Do you know how to fix it? It worked for a previous version of OpenCV but I updated the version and I started to receive this error. I tried to downgrade OpenCV but the error still appears for previous versions. Not sure what should i do.

Thank you

Hi,
By default there is OpenCV 4.1.1 installed and it enables WITH_GSTREAMER=ON. This sample works by default:
Doesn't work nvv4l2decoder for decoding RTSP in gstreamer + opencv - #3 by DaneLLL

Looks like yo re-build OpenCV. Please make sure you enables gstreamer. May try this script from a user:
GitHub - mdegans/nano_build_opencv: Build OpenCV on Nvidia Jetson Nano

Probably your previous opencv version had FFMPEG support able to use such URI, while the new version has not, so the IMAGES backend is tried but fails.
Gstreamer backend, as mentionned by @DaneLLL, would probably provide better performance leveraging HW decoding.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.