Skip to content

Instantly share code, notes, and snippets.

@Macrofig
Last active September 4, 2017 20:02
Show Gist options
  • Select an option

  • Save Macrofig/f66c9793870b080fc4a5e6b442fcc7fc to your computer and use it in GitHub Desktop.

Select an option

Save Macrofig/f66c9793870b080fc4a5e6b442fcc7fc to your computer and use it in GitHub Desktop.
Convert GoPro time lapse photos to GIF. Bonus MP4 output, too.
# I find that the delay is pretty good at 10 if there are a lot of shots.
# A delay of 5 gives it a more speedy look.
# Finds all jpg files in current folder and creates a file called animated.gif.
# Also resizes images to 800 by 600 size so output gif will be same.
gm convert -size 800x600 *.jpg -delay 5 -resize 800x600 animated.gif
# Create an mp4 version while we are at it
ffmpeg -i animated.gif -c:v libx264 -crf 12 -b:v 500K animated.mp4
# Skip the graphicsmagick stuff and just use ffmpeg to concatenate images into a video
ffmpeg -framerate 1 -r 30 -pattern_type glob -i '*.jpg' -c:v libx264 -vf "scale=1440:1080,fps=25,format=yuv420p" out.mp4
# Add the following using `&&` to each command. Since the above commands can take
# some time, you can continue to work on something else and recieve a notification
# when the process is complete.
# Used this SE question for reference: http://apple.stackexchange.com/a/115373
osascript -e 'display notification "Process complete!" with title "Conversion" sound name "Glass"'
@Macrofig
Copy link
Author

I have Graphics Magick and ffmpeg installed through Homebrew which makes running these commands super easy.

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