1 | initial version |
I solved problem. You are missing parameter in cv2.VideoWriter.
import cv2
import numpy as np
cap = cv2.VideoCapture('video.mp4')
frame_width = int(cap.get(3))
frame_height = int(cap.get(4))
out = cv2.VideoWriter('manipulated_video.avi',
cv2.VideoWriter_fourcc(*'MJPG'), 25,
(frame_width,frame_height), False)
while(cap.isOpened()):
ret, frame = cap.read()
if ret == True:
edges = cv2.Canny(frame, 100, 200)
out.write(edges)
cv2.imshow('Edges', edges)
if cv2.waitKey(25) & 0xFF == ord('q'):
break
else:
break
cap.release()
out.release()
cv2.destroyAllWindows()