您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

是否可以使用OpenCV将https://(例如YouTube)的视频流传输到python中?

是否可以使用OpenCV将https://(例如YouTube)的视频流传输到python中?

您需要安装2件东西

安装完这两个软件包后,您可以使用youtube网址播放youtube上的流视频。请参考下面的代码

url = 'https://youtu.be/W1yKqFZ34y4'
vPafy = pafy.new(url)
play = vPafy.getbest(preftype="webm")

#start the video
cap = cv2.VideoCapture(play.url)
while (True):
    ret,frame = cap.read()
    """
    your code here
    """
    cv2.imshow('frame',frame)
    if cv2.waitKey(20) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()
python 2022/1/1 18:29:36 有178人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶