首先感谢您的关注。我正在尝试使用 opencv 和 ip 摄像头进行流式传输,但它只返回“[tcp @ 000001d5fce13580] uri 中缺少端口”。我已经在 VLC 上进行了测试,并且还使用 JavaCV 进行了测试,它适用于两者。我已经检查过 MPEG 了,没问题。有没有人经历过这个并且可以提供帮助?
我和:
代码:
import numpy as np
import cv2
def runCam():
print(cv2.getBuildInformation())
video_src = "rtsp://admin:myPWCam@192.168.1.223:554/Streaming/channels/1/"
cap = cv2.VideoCapture(video_src, cv2.CAP_FFMPEG)
while True:
ret, frame = cap.read()
try:
cv2.resizeWindow('Stream IP Camera OpenCV', 120300, 800)
cv2.imshow('Stream IP Camera OpenCV', frame)
except Exception as ex:
template = "An exception of type {0} occurred. Arguments:\n{1!r}"
message = template.format(type(ex).__name__, ex.args)
print(message)
break
if cv2.waitKey(1) & 0xFF == ord('q'):
break …Run Code Online (Sandbox Code Playgroud)