使用this api我已經設法下載流數據,但我無法弄清楚如何解析它。我已經看過RMTP格式,但它似乎不匹配。下載twitch.tv流的第一幀
from livestreamer import Livestreamer
livestreamer = Livestreamer()
# set to a stream that is actually online
plugin = livestreamer.resolve_url("http://twitch.tv/froggen")
streams = plugin.get_streams()
stream = streams['mobile_High']
fd = stream.open()
data = fd.read()
我上傳的數據here的一個例子。
理想情況下,我不必將它解析爲視頻,我只需要第一個關鍵幀作爲圖像。任何幫助將不勝感激!
更新:好的,我得到OpenCV的工作,它的作品抓住我有一個隨機視頻文件的第一幀。但是,當我使用與流數據相同的代碼時,它生成了nonsense image。
我設法打開與OpenCV庫文件(Python代碼:'捕獲= cv2.VideoCapture( 「下載/(uploadMB.com)stream.bin」)')我設法脫身的圖像它(3頻道,1280x720),但它看起來像一個五彩的混亂。你確定有效的關鍵幀在文件中嗎? – Igonato
我剛剛嘗試下載[流數據的第一個1 MB](http://www.uploadmb.com/dw.php?id=1380209204),並使用'cv2.VideoCapture',然後'capture.read',但它返回False/None。你是如何得到一張圖片的? – doeke