Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import cv2
- cap = cv2.VideoCapture('https://www.youtube.com/watch?v=oCUqsPLvYBQ')
- while(True):
- # Capture frame-by-frame
- ret, frame = cap.read()
- # Display the resulting frame
- cv2.imshow('frame',frame)
- if cv2.waitKey(1) & 0xFF == ord('q'):
- break
- WARNING: Couldn't read movie file https://www.youtube.com/watch?v=oCUqsPLvYBQ
- OpenCV Error: Assertion failed (size.width>0 && size.height>0) in imshow, file /tmp/opencv20160107-29960-t5glvv/opencv-2.4.12/modules/highgui/src/window.cpp, line 261
- import cv2, pafy
- url = "https://www.youtube.com/watch?v=aKX8uaoy9c8"
- videoPafy = pafy.new(url)
- best = videoPafy.getbest(preftype="webm")
- video=cv2.VideoCapture(best.url)
Add Comment
Please, Sign In to add comment