视频捕获冻结在这个特定的视频上

2024-04-24 22:02:34 发布

您现在位置:Python中文网/ 问答频道 /正文

出于某种原因,它挂在this video

这是密码

import cv2
import time

cap = cv2.VideoCapture("http://192.65.213.243/mjpg/video.mjpg")

while(cap.isOpened()):
    ret, img = cap.read()
    current_time_in_milliseconds = "%.5f" % time.time()
    filename="{}.jpg".format(current_time_in_milliseconds)
    cv2.imwrite(filename, img)

有什么想法为什么?是不是跟这个视频格式有关? 这段代码可以在其他mjpg上运行,但是关于这个提要的一些内容使python冻结在cv2.VideoCapture()上

我也有这个有趣的错误:

warning: Error opening file (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:792) warning: http://192.65.213.243/mjpg/video.mjpg (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:793)


Tags: inimportbuildhttpimgtimevideocurrent