20 lines
475 B
Python
20 lines
475 B
Python
import cv2 as cv
|
|
|
|
minute = 60
|
|
video_start = 9 * minute + 30
|
|
video_end = 12 * minute + 56
|
|
|
|
cap = cv.VideoCapture('out.mp4')
|
|
while cap.isOpened():
|
|
ret, frame = cap.read()
|
|
# if frame is read correctly ret is True
|
|
if not ret:
|
|
print("Can't receive frame (stream end?). Exiting ...")
|
|
break
|
|
gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)
|
|
cv.imshow('frame', gray)
|
|
if cv.waitKey(1) == ord('q'):
|
|
break
|
|
cap.release()
|
|
cv.destroyAllWindows()
|