Skip to content

Instantly share code, notes, and snippets.

View monogenea's full-sized avatar

Francisco Lima monogenea

View GitHub Profile
@Mxhmovd
Mxhmovd / cap.py
Created October 22, 2018 20:36
Read Youtube videos with OpenCV without downloading it locally.
#pip install pafy
#sudo pip install --upgrade youtube_dl
import cv2, pafy
url = "https://www.youtube.com/watch______"
video = pafy.new(url)
best = video.getbest(preftype="webm")
#documentation: https://pypi.org/project/pafy/
capture = cv2.VideoCapture(best.url)