Skip to content

timelapse project #26

Description

@flfphotography

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)

for file in sorted_images:
    ImageToVideoFrames = cv2.imread(file)
    out.write(ImageToVideoFrames)
return (0)

images_to_video(out, timelapse_img_dir)
out.release()
cv2.destroyAllWindows()
print ('complete')`

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions