0

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

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
  • **`module source reported: Unauthorized`** what does that suggest? wrong username or password. -- please **reproduce without OpenCV**. just run gstreamer from a terminal. – Christoph Rackwitz Oct 27 '22 at 22:05
  • Hi @ChristophRackwitz, you were right. I thought that the correct way for rtsp uri was the following: rtsp://usr:psw@IP_address:88/videoMain however, i realized that, when using GStreamer, the user and password has to go with flags user-id, user-psw. I used the following ```gst-launch-1.0 rtspsrc location=rtsp://IP_address:88/videoMain user-id=admin user-pw=psw ! rtph264depay ! h264parse ! decodebin ! autovideosink``` and it initiated the connection although not sure if it is ok. This is what i get – Paloma Jimeno Oct 28 '22 at 07:39
  • `Setting pipeline to PAUSED ... nvbuf_utils: Could not get EGL display connection Pipeline is live and does not need PREROLL ... Progress: (request) SETUP stream 0 Progress: (request) SETUP stream 1 Progress: (open) Opened Stream Setting pipeline to PLAYING ... New clock: GstSystemClock Progress: (request) Sending PLAY request Progress: (request) Sending PLAY request Progress: (request) Sent PLAY request Opening in BLOCKING MODE NvMMLiteOpen : Block : BlockType = 261 NVMEDIA: Reading vendor.tegra.display-size : status: 6 NvMMLiteBlockCreate : Block : BlockType = 261` – Paloma Jimeno Oct 28 '22 at 07:46

0 Answers0