Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cv2
- cap = cv2.VideoCapture("BBunny_360x240_1mb.mp4")
- print cap.isOpened() # True = read video successfully. False - fail to read video.
- fourcc = cv2.VideoWriter_fourcc(*'XVID')
- out = cv2.VideoWriter("output_video.avi", fourcc, 30.0, (320, 240))
- print out.isOpened() # True = write out video successfully. False - fail to write out video.
- while True:
- ret, frame = cap.read()
- out.write(frame)
- cv2.imshow('frame',frame)
- if cv2.waitKey(1) & 0xFF ==ord('q'):
- break
- cap.release()
- out.release()
- cv2.destroyAllWindows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement