简体   繁体   中英

Get images of a streaming video url with Python

I have this url https://www.earthcam.com/js/video/embed.php?type=h264&vid=AbbeyRoadHD1.flv

And I want get frames from the streaming and save them in Python. Is this possible? I looked into the streamlink library, but I'm not sure if it will work. Sorry for my bad English, thanks.

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

Copied from this question: Python - Extracting and Saving Video Frames

Try this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM