We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 605a1bd commit 65187f9Copy full SHA for 65187f9
1 file changed
opencv/play-video.py
@@ -4,6 +4,7 @@
4
import cv2
5
import os
6
import tempfile
7
+from subprocess import call
8
9
def screenshot(img):
10
dirname = tempfile._get_default_tempdir()
@@ -12,8 +13,14 @@ def screenshot(img):
12
13
print('Screenshot %s' % filename)
14
cv2.imwrite(filename, img)
15
-# URL: https://www.youtube.com/watch?v=qRLbzpy1y8Y
16
video = 'data/spain-vs-germany-2008.mp4'
17
+if not os.path.exists(video):
18
+ if not os.path.exists(os.path.dirname(video)):
19
+ os.mkdir(os.path.dirname(video))
20
+ url = "https://www.youtube.com/watch?v=qRLbzpy1y8Y"
21
+ print("Downloading video: %s" % url)
22
+ call(["youtube-dl", url, "-o", video])
23
+ print("Video saved: %s" % video)
24
cap = cv2.VideoCapture(video)
25
26
while (True):
0 commit comments