python livestreamer stream to image

时间:2016-07-07 20:22:06

标签: python image screenshot frame

我目前的代码:

from livestreamer import Livestreamer
session = Livestreamer()
stream = session.streams('http://www.twitch.tv/esl_csgo')
stream = stream['source']
fd = stream.open()
with open("/tmp/stream.dat", 'wb') as f:
    while True:
        data = fd.read(1024)
        f.write(data)

我想从这个流中获取一个帧并在存储为png图像之前将其剪切

这段代码可以正常工作,可以在没有问题的情况下使用vlc播放器播放,但我希望在不保存文件的情况下获得一个帧,以减少硬盘上的IO。

我尝试过使用cv2,但在安装它之后我无法找到API https://github.com/BVLC/caffe/wiki/Ubuntu-16.04-or-15.10-OpenCV-3.1-Installation-Guide

0 个答案:

没有答案