简体   繁体   中英

connecting with IP camera using opencv

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM