I am trying to build timlapses off of the code used to capture and compile a timelapse. I wave deleted the code for capturing images as I simply want to use images take with my personal camera. I have also done my best (I'm very new to this) to remove references to other code files like the utils.py file. I wanted this to be a simple and stand alone code for my sake. As far as I can tell, it works. it pulls all the files I want and creates a video, the problem is that the video is extremely choppy and isn't much better running at lower resolution. this is what I've got.
`import os
import numpy as np
import cv2
import time
import datetime
I am trying to build timlapses off of the code used to capture and compile a timelapse. I wave deleted the code for capturing images as I simply want to use images take with my personal camera. I have also done my best (I'm very new to this) to remove references to other code files like the utils.py file. I wanted this to be a simple and stand alone code for my sake. As far as I can tell, it works. it pulls all the files I want and creates a video, the problem is that the video is extremely choppy and isn't much better running at lower resolution. this is what I've got.
`import os import numpy as np import cv2 import time import datetime
import glob
Vairables
frames_per_second = 24 save_path='saved-media/timelapse.mp4'
out = cv2.VideoWriter(save_path, cv2.VideoWriter_fourcc(*'mp4v'), frames_per_second, (1620, 1080)) timelapse_img_dir = r'E:\Nature\Sky captures\2021-10-19_Timelapse_PythonFJPG'
clear_images = False
def images_to_video(out, timelapse_image_dir, clear_images=False): image_list = glob.glob(f"{timelapse_image_dir}/*.JPG") sorted_images = sorted(image_list, key=os.path.getmtime)
images_to_video(out, timelapse_img_dir) out.release() cv2.destroyAllWindows() print ('complete')`