0

I have a proVisionISR IP camera which I am trying to connect through openCV.videoCapture(). I have inserted RTSP URL like this: "rtsp://user:password@IP:port/", I also tried to add different ending after the port in the URL, such as profile2 which indicate on the sub stream (pic below), H264?ch=1&subtype=0 and more results I found while searching. The code uses cv2.CAP_FFMPEG, but tried also with GSTREAMER pipeline.

I changed some values in the camera dashboard configuration, such as resolution that fit the code, the encoding also was changed to h264, and disabling the audio as well. (The bitrate type is: CBR)

I open the stream in VLC, and it is work just fine. And 2 more IP cameras with RTSP streaming was able to connect with: cv2.videocapture(RTSP URL, cv2.CAP_FFMPEG)

Python version: 3.8 OpenCV version : 4.6.0-dev (installed from source) ffmpeg version 4.2.7 ubuntu version (If necessary) 20.04

enter image description here

1
  • In case you are giving up OpenCV, you may try using FFmpeg sub-process, or ffmpeg-python (binding for FFmpeg). Here is an example. cv2.VideoCapture was not working, so I suggested a workaround using ffmpeg-python (ignore the StreamLink part, and set the URL to the RTSP URL). Your OpenCV is installed from source and your URL is private, so it's hard guessing the problem... Commented Sep 18, 2022 at 17:02

1 Answer 1

0

HI

Here u have a working example to connect to a rtsp stream via pyav and show it on a opencv window.

Example

The code is testet with an axis camera and hikvision camera. If the not work send the error for deeper investigation.

Sign up to request clarification or add additional context in comments.

1 Comment

Since it's an answer, and not a comment, I recommend you to add the code sample to the answer. Good answers supposed to be "complete" (not just a link).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.