I have problem with writing video to file. This small program:
import numpy as np
import cv2
import time
cap = cv2.VideoCapture(0)
time.sleep(0.1)
# Define the codec and create VideoWriter object
fourcc = cv2.VideoWriter_fourcc('X','2','6','4')
out = cv2.VideoWriter('output.avi',fourcc, 25, (640,480))
while(cap.isOpened()):
ret, frame = cap.read()
if ret==True:
out.write(frame)
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
# Release everything if job is finished
cap.release()
out.release()
cv2.destroyAllWindows()
I see the frames in the window but no outputfile are generated. Nor any errors shown. What am I doing wrong?