Skip to content

Instantly share code, notes, and snippets.

@porjo
Last active May 25, 2023 16:14
Show Gist options
  • Save porjo/3e4b182089c430a54a64 to your computer and use it in GitHub Desktop.
Save porjo/3e4b182089c430a54a64 to your computer and use it in GitHub Desktop.
ffmpeg time-lapse

Convert sequence of JPEG images to MP4 video

Simple glob:

ffmpeg -r 24 -i '*.JPG' -s hd1080 -vcodec libx264 timelapse.mp4

Start from DSC_0079.JPG

ffmpeg -r 24 -f image2 -start_number 79 -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse2.mp4
  • -r 24 - output frame rate
  • -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

@tomav
Copy link

tomav commented Jun 10, 2017

The last one is not bulk but unique image.

@abixalmon
Copy link

Pattern type 'glob' was selected but globbing is not supported by this libavformat build
*.JPG: Function not implemented

@Pierstoval
Copy link

Saved my life 👍

@billmei
Copy link

billmei commented Jan 3, 2019

I made a fork of this using the crop option in ffmpeg so that you no longer need to run convert: https://gist.github.com/billmei/9b2ebeceb879c53de00e297f471b0719

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