import cv2
def main():
cap = cv2.VideoCapture('test.mp4')
if cap.isOpened():
ret, frame = cap.read()
else:
return
while (True and ret):
cv2.imshow('video', frame)
if cv2.waitKey(40) & 0xff == ord('q'):
break
ret, frame = cap.read()
cap.release()
cv2.destroyAllWindows()
if __name__ == "__main__":
main()
网友评论