您好我正在学习opencv并通过rtsp:http阅读ip camera
videoStream = "rtsp://admin:[email protected]:554/Streaming/Channels/1"
capture = cv2.VideoCapture(videoStream)
我正在阅读这个流,我正在opencv
进行面部检测,但在1或2分钟后,我的脚本崩溃了一个h264
消息,我的opencv
代码给了我一个错误:
[h264 @ 0x27e49570] error while decoding MB 55 12, bytestream -12
no video
如果我使用网络摄像头没有发生
有人可以帮助我如何获得ip camera流媒体进行面部检测的最佳方法?
在处理任何帧之前,您可以确保相机处于打开状态且获得的帧有效。
videoStream = "rtsp://admin:[email protected]:554/Streaming/Channels/1"
capture = cv2.VideoCapture(videoStream)
while True:
if capture.isOpened():
status, frame = capture.read()
if status:
# Process frames here
...
如果您无法访问相机或损坏的帧,您可以使用cv2.error
来捕获它。
try:
...
except cv2.error as e:
...