Skip to content

Instantly share code, notes, and snippets.

@xeoncross
Last active December 15, 2023 13:06
Show Gist options
  • Save xeoncross/d0c93429fc0d62642a1b to your computer and use it in GitHub Desktop.
Save xeoncross/d0c93429fc0d62642a1b to your computer and use it in GitHub Desktop.
Converting a folder of .CR2 (Canon Raw Images) into a timelapse video on mac or linux
# Assuming your have installed the following:
#
# brew install ufraw imagick ffmpeg
# apt-get install ufraw imagick ffmpeg
# Convert to JPG's
for img in *.CR2; do convert -resize 1920 "$img" "$img.jpg"; print "$img"; done
# Make a video
ffmpeg -framerate 8 -i IMG_%04d.CR2.jpg -c:v libx264 -r 30 -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" out.mp4
# -framerate 8 means 8 images a second while 1/5 means each image lasts 5 seconds
# -fv scale http://stackoverflow.com/a/20848224/99923
@neilghosh
Copy link

With this command it was asking me to delete the JPEG file one by one . . This one worked

ffmpeg -pattern_type glob -r 5 -i '*.JPG' -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -pix_fmt yuv420p -vcodec libx264 timelapse.mp4

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