Skip to content

Instantly share code, notes, and snippets.

@paulfermoreyes
Created May 3, 2025 07:35
Show Gist options
  • Save paulfermoreyes/dd089273440d53558375a696bb74f446 to your computer and use it in GitHub Desktop.
Save paulfermoreyes/dd089273440d53558375a696bb74f446 to your computer and use it in GitHub Desktop.

Commands to create timelapse from image file

Pre-requisites:

  1. File list preparation
    # Make sure to change to the directory
    # where your image files are located
    ls -1v *.jpg > input.txt
    awk '{print "file '\''" $0 "'\''"}' input.txt > files.txt
    ffmpeg -f concat -safe 0 -r 30 -i files.txt -c:v libx264 -pix_fmt yuv420p timelapse.mp4

To create an .mp4 file from the files.txt with minimum of 1920x1080 resolution

ffmpeg -f concat -safe 0 -r 30 -i files.txt \
-vf "scale='min(1920,iw)':'min(1080,ih)':force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2" \
-c:v libx264 -pix_fmt yuv420p milkyway1_1080p.mp4

For high bitrate

ffmpeg -f concat -safe 0 -r 30 -i files.txt \
-vf "scale='min(1920,iw)':'min(1080,ih)':force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2" \
-c:v libx264 -crf 18 -preset slow -pix_fmt yuv420p milkyway1_1080p_high.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment