I am trying to create a TimeLapse creator in python using OpenCV, and have the following code:
import cv2
import os
import string
directory = (r"C:\Users\Josh\Desktop\20130216")
video = cv2.VideoWriter(r"C:\Users\Josh\Desktop\video.avi", cv2.cv.CV_FOURCC('F','M','P', '4'), 15, (1536, 1536), 1)
for filename in os.listdir(directory):
if filename.endswith(".jpg"):
video.write(cv2.imread(filename))
cv2.destroyAllWindows()
video.release()
The folder has 1,440 pictures in it, yet video.avi is only 5.54kb in size, and has an empty output when played. Can anyone see any flaws in my code, and give me any help?