Guest User

Untitled

a guest
Nov 22nd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import numpy as np
  2. import cv2
  3.  
  4. cap = cv2.VideoCapture('https://www.youtube.com/watch?v=oCUqsPLvYBQ')
  5.  
  6. while(True):
  7. # Capture frame-by-frame
  8. ret, frame = cap.read()
  9.  
  10. # Display the resulting frame
  11. cv2.imshow('frame',frame)
  12. if cv2.waitKey(1) & 0xFF == ord('q'):
  13. break
  14.  
  15. WARNING: Couldn't read movie file https://www.youtube.com/watch?v=oCUqsPLvYBQ
  16. 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
  17.  
  18. import cv2, pafy
  19.  
  20. url = "https://www.youtube.com/watch?v=aKX8uaoy9c8"
  21. videoPafy = pafy.new(url)
  22. best = videoPafy.getbest(preftype="webm")
  23.  
  24. video=cv2.VideoCapture(best.url)
Add Comment
Please, Sign In to add comment