fork download
  1. import numpy as np
  2. import cv2
  3.  
  4. cap = cv2.VideoCapture('input.MOV')
  5. fps = cap.get(cv2.CAP_PROP_FPS)
  6. height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)
  7. width = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
  8.  
  9. fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v')
  10. out = cv2.VideoWriter("output.mov", int(fourcc), fps, (int(width), int(height)))
  11.  
  12. while(cap.isOpened()):
  13. try:
  14. ret, frame = cap.read()
  15. frame = cv2.resize(frame, None, fx = 0.5, fy = 0.5)
  16. out.write(frame)
  17. cv2.imshow('Frame',frame)
  18. if cv2.waitKey(1) & 0xFF == ord('q'):
  19. break
  20. except:
  21. break
  22.  
  23. out.release()
  24. cap.release()
  25. cv2.destroyAllWindows()
Runtime error #stdin #stdout #stderr 0.3s 36028KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 2, in <module>
ModuleNotFoundError: No module named 'cv2'