【问题标题】:Coonnect to IP camera Dahua连接网络摄像机大华
【发布时间】:2020-03-04 12:18:28
【问题描述】:

我需要使用 Python 连接到网络摄像机。 我正在尝试这样做:

import cv2

if __name__ == "__main__":
    cv2.namedWindow("original")
    cap = cv2.VideoCapture("<URL>")
    while True:
        flag, img = cap.read()
        try:
            cv2.imshow("original", img)
        except:
            cap.release()
            raise

        ch = cv2.waitKey(5)
        if ch == 27:
            break

    cap.release()
    cv2.destroyAllWindows()

我无法直接使用相机。
我有IP、端口、用户名、密码。
型号为大华DH-XVR4116HS-X.
我找不到正确的网址。
我尝试了rtsp://&lt;username&gt;:&lt;password&gt;@&lt;ip&gt;:&lt;port&gt;/cam/realmonitor?channel=&lt;channelNo&gt;&amp;subtype=&lt;typeNo&gt; 格式,但没有得到结果。
我需要启用多播吗?

【问题讨论】:

标签: python python-3.x opencv connection ip-camera


【解决方案1】:

很可能当前摄像头端口已关闭,因此需要打开rtsp端口,然后尝试连接。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-05-10
    • 2016-09-23
    • 1970-01-01
    • 2012-12-20
    • 1970-01-01
    • 1970-01-01
    • 2015-04-25
    • 2022-06-29
    相关资源
    最近更新 更多