0

I'm trying to connect to a RTSP camera via OpenCV using VideoCapture from opencv-python and i get the following error ONLY IN PYTHON3, IT WORKS NORMALLY IN PYTHON2:

[tcp @ 0x1d0a4ac0] Port missing in uri
Unable to open

The code:

import cv2

endpoint = "rtsp://<user>:<password>@192.168.<ip>.<ip>:554/cam/realmonitor?channel=1&subtype=0"

cap = cv2.VideoCapture(endpoint)

if not cap.isOpened():
        print("Unable to open")
else:
        print("Open")

What I've tried:

I'm running this in a NVidia Jetson Xavier AGX running Ubuntu.

Any suggestion to fix this will be welcome

(And, YES, I NEED it to run on Python3)

Guilherme Poleto
  • 327
  • 1
  • 2
  • 13

1 Answers1

0

I'm getting this error only in a newer version of opencv.

It worked for me in python3 with an older version, so I pinned the older version to my requirements.

opencv-python==4.1.1.26
bubbassauro
  • 3,969
  • 2
  • 45
  • 45
  • ERROR: Could not find a version that satisfies the requirement opencv-python==4.1.1.26 (from versions: 3.4.0.14, 3.4.10.37, 3.4.11.39, 3.4.11.41, 3.4.11.43, 3.4.11.45, 3.4.13.47, 3.4.15.55, 3.4.16.57, 3.4.16.59, 3.4.17.61, 3.4.17.63, 4.3.0.38, 4.4.0.40, 4.4.0.42, 4.4.0.44, 4.4.0.46, 4.5.1.48, 4.5.3.56, 4.5.4.58, 4.5.4.60, 4.5.5.62, 4.5.5.64) ERROR: No matching distribution found for opencv-python==4.1.1.26 – Maizied Hasan Majumder Apr 22 '22 at 09:54
  • 1
    yeah these are chaos... depending on the platform/architecture that you're deploying to, there may be different versions available to install with pip. I would try going with one of the near versions that are listed in that error message – bubbassauro Apr 25 '22 at 19:03