Created
July 15, 2022 12:23
-
-
Save scientificRat/155044b1eace31a0bfcddd1f49e401bc to your computer and use it in GitHub Desktop.
make time lapse from images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import glob | |
import moviepy.editor as mpe | |
IMAGE_ROOT = '/Users/huangzhengyue/work_data/jiaolou3' | |
OUT_FILE_NAME = 'test3.mp4' | |
FPS = 12 | |
def main(): | |
image_list = glob.glob(os.path.join(IMAGE_ROOT, '*.jpg')) | |
image_list += glob.glob(os.path.join(IMAGE_ROOT, '*.JPG')) | |
image_list += glob.glob(os.path.join(IMAGE_ROOT, '*.jpeg')) | |
image_list += glob.glob(os.path.join(IMAGE_ROOT, '*.JPEG')) | |
image_list = sorted(image_list) | |
print("total image cnt:", len(image_list)) | |
video = mpe.ImageSequenceClip(image_list, fps=FPS) | |
video.write_videofile(OUT_FILE_NAME) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment