-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
36 lines (28 loc) · 951 Bytes
/
app.py
File metadata and controls
36 lines (28 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# importing libraries
import cv2
import numpy as np
# Create a VideoCapture object and read from input file
#NOTE - You must have the link to an actual video file hosted online for this to work.
#It can't be a normal link like a youtube link. The file type should be in the link like ".mp4" as shown below!
now = cv2.VideoCapture('example url - https://www.example.com/filename.mp4/file')
# Check if camera opened successfully
if (now.isOpened()== False):
print("Error opening video file")
# Read until video is completed
while(now.isOpened()):
# Capture frame-by-frame
ret, frame = now.read()
if ret == True:
# Display the resulting frame
cv2.imshow('Frame', frame)
# Press Q on keyboard to exit
if cv2.waitKey(25) & 0xFF == ord('q'):
break
# Break the loop
else:
break
# When everything done, release
# the video capture object
now.release()
# Closes all the frames
cv2.destroyAllWindows()