Skip to content

Instantly share code, notes, and snippets.

@Benitoite
Forked from alexellis/timelapse.md
Last active June 13, 2021 23:14
Show Gist options
  • Save Benitoite/f469434fc6706dd05bf89d2da5a6622e to your computer and use it in GitHub Desktop.
Save Benitoite/f469434fc6706dd05bf89d2da5a6622e to your computer and use it in GitHub Desktop.
ffmpeg time-lapse

Convert sequence of JPEG images to MP4 video

ffmpeg -r 24 -pattern_type glob -i '*.JPG' DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse.mp4

  • -r 24 - output frame rate
  • -pattern_type glob -i '*.JPG' - all JPG files in the current directory
  • -i DSC_%04d.JPG - e.g. DSC_0397.JPG
  • -s hd1080 - 1920x1080 resolution

Slower, better quality

Add the following after -vcodec libx264 to achieve better quality output

-crf 18 -preset slow

Bulk convert JPGs to 1920x1080, centered

convert input.jpg -resize '1920x1080^' -gravity center -crop '1920x1080+0+0' output.jpg

@Benitoite
Copy link
Author

-s 3840x2160 (4K resolution)

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