简体   繁体   English

Python OpenCV IP camera..error:(-5:Bad argument) CAP_IMAGES: 无法找到视频捕获问题

[英]Python OpenCV VideoCapturing problem from IP camera..error:(-5:Bad argument) CAP_IMAGES: can't find starting number

I am trying to enable this IP cam that I have access to its feed by the browser.我正在尝试启用这个 IP cam,我可以通过浏览器访问它的提要。 but can't access it through a python project to do some object detection stuff.但无法通过 python 项目访问它来做一些 object 检测工作。 but I can't seem to get the feed to be cv2.videocapture() ed without an error.但我似乎无法让提要被cv2.videocapture()编辑而没有错误。 the link to the camera feed is live and working.指向摄像机源的链接是实时的并且可以工作。 the capturing code in the main pythin file: pythin 主文件中的捕获代码:

vs = cv2.VideoCapture('http://<user>:<pass>@<IP>:8080/video.cgi?.mjpg')

I have tried to put rtsp also but no use and I get this error in the cmd when I run the program by command: anything not in <> is exactly how I entered it我也尝试输入 rtsp 但没有用,当我通过命令运行程序时,我在 cmd 中收到此错误:<> 中没有的任何内容正是我输入的方式

[tcp @ 000001f40de13980] Connection to tcp://<IP>:8080 failed: Error number -138 occurred
[ERROR:0] global C:\projects\opencv-python\opencv\modules\videoio\src\cap.cpp (116) cv::VideoCapture::open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.2.0) C:\projects\opencv-python\opencv\modules\videoio\src\cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): http://<user>:<pass>@<IP>:8080/video.cgi?.mjpg in function 'cv::icvExtractPattern'
  1. Streaming laptop camera works Videocapture(0)流式笔记本电脑摄像头工作Videocapture(0)
  2. when searching for the port no.搜索端口号时。 in cmd there where 6 internal links so 6 ports I tried all在 cmd 那里有 6 个内部链接所以 6 个端口我都试过了
  3. I installed FFMPEG in laptop and added path but not sure if active in the project because I don't know-how我在笔记本电脑中安装了 FFMPEG 并添加了路径,但不确定是否在项目中处于活动状态,因为我不知道如何

please explain your answer since I'm new and thanks.请解释你的答案,因为我是新手,谢谢。

import cv2
cam = cv2.VideoCapture('rtsp://admin:admin@10.10.1.38/H264?ch=1&subtype=0')
ret, im =cam.read()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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