我正在尝试使用OpenCV和Python使用RTSP URI连接IP摄像机(Dahua)。我在下面添加了一个示例代码(使用单独的变量提供用户名,密码和IP),结果为
[rtsp @ 0x55cc3715c600] method OPTIONS failed: 401 Unauthorized
。使用VLC,我能够连接,但是只有在单独的对话框中输入密码后才能连接,即使密码已经在URI中提供了。我应该如何继续?address = f'rtsp://{username}:{password}@{ip}'
cap = cv2.VideoCapture(address)
cv2.VideoCapture()
中。我也在使用大华摄像头,但是RTSP链接会因摄像头而异。这是我的一个例子rtsp://username:password@192.168.1.25/axis-media/media.amp
。如果链接在VLC中有效,那么在OpenCV中也应该有效。 - nathancyvc = cv2.VideoCapture('rtspsrc location=rtsp://user:password@192.168.1.25:8554/play1.sdp ! decodebin ! videoconvert ! appsink')
。您应该能够在opencv之外使用gst-launch测试此管道是否正常工作,命令如下:gst-launch-1.0 rtspsrc location=rtsp://user:password@192.168.1.25:8554/play1.sdp ! decodebin ! videoconvert ! autovideosink
。 - shortcipher3rtsp://username:password@192.168.1.25
是我使用的格式,但它会导致在VLC中出现提示,需要再次输入密码。也许这与密码中的特殊字符%
有关? - sPY4CNgst-launch-1.0
εëΫδΜΛδΙüδΦöε·Φη΅¥φ€ΣφéàφùÉ (401)
ιîôη··ψIJ - sPY4CN