使用Python获取流式视频url的图像

2024-10-04 03:20:20 发布

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

我有这个网址 https://www.earthcam.com/js/video/embed.php?type=h264&vid=AbbeyRoadHD1.flv

我想从流媒体中获取帧并保存在Python中。这可能吗?我查看了streamlink库,但不确定它是否能工作。 对不起,我的英语不好,谢谢。在

streams = streamlink.streams("https://www.earthcam.com/js/video/embed.php?type=h264&vid=AbbeyRoadHD1.flv")

Tags: httpscomwwwvideotypejsembedstreams
1条回答
网友
1楼 · 发布于 2024-10-04 03:20:20

复制自此问题:Python - Extracting and Saving Video Frames

试试这个:

import cv2
vidcap = cv2.VideoCapture('https://www.earthcam.com/js/video/embed.php?type=h264&vid=AbbeyRoadHD1.flv')
success,image = vidcap.read()
count = 0
while success:
    cv2.imwrite("frame%d.jpg" % count, image) # save frame as JPEG file      
    success,image = vidcap.read()
    print('Read a new frame: ', success)
    count += 1

相关问题 更多 >