Skip to content

Instantly share code, notes, and snippets.

@dlcmh
Last active April 22, 2021 03:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlcmh/74e0400c469f79b96635ae65d06e6057 to your computer and use it in GitHub Desktop.
Save dlcmh/74e0400c469f79b96635ae65d06e6057 to your computer and use it in GitHub Desktop.
Convert a macOS QuickTime Player .mp4 screen recording to GIF
brew install ffmpeg
brew install gifsicle

ffmpeg -i myVideo.mp4 -vf "scale='min(1280,iw)':-1" -r 5 -f gif - | gifsicle --optimize=3 > myGif.gif

Credits

Notes

-r 5 - reduce frame rate to 5 per second

scale='min(1280,iw)':-1 - width of the GIF is the smaller of 1280px or the input video; height should be whatever value is needed to maintain the aspect ratio

--optimize=3 tells gifsicle to use the most aggressive compression

@dlcmh
Copy link
Author

dlcmh commented Apr 22, 2021

Input

Screen Shot 2021-04-22 at 10 48 26 AM

Output

3.2MB, 1280x1343

out

@dlcmh
Copy link
Author

dlcmh commented Apr 22, 2021

If 5 fps is too jerky, try a conversion with -r 24 (although the output balloons to 9.5MB):

ffmpeg -i myVideo.mp4 -vf "scale='min(1280,iw)':-1" -r 24 -f gif - | gifsicle --optimize=3 > myGif.gif

out

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