Advertisement
Guest User

Untitled

a guest
Apr 6th, 2016
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. import cv2
  2.  
  3. cap = cv2.VideoCapture("BBunny_360x240_1mb.mp4")
  4. print cap.isOpened() # True = read video successfully. False - fail to read video.
  5.  
  6. fourcc = cv2.VideoWriter_fourcc(*'XVID')
  7. out = cv2.VideoWriter("output_video.avi", fourcc, 30.0, (320, 240))
  8. print out.isOpened() # True = write out video successfully. False - fail to write out video.
  9.  
  10. while True:
  11. ret, frame = cap.read()
  12. out.write(frame)
  13. cv2.imshow('frame',frame)
  14. if cv2.waitKey(1) & 0xFF ==ord('q'):
  15. break
  16.  
  17. cap.release()
  18. out.release()
  19. cv2.destroyAllWindows()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement