Apple - How can I convert a .mov into a .gif (or a .apng)?

For Terminal lover

ffmpeg -i in.mov -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > out.gif
  • -r 10 tells ffmpeg to reduce the frame rate from 25 fps to 10
  • -s 600x400 tells ffmpeg the max-width and max-height
  • --delay=3 tells gifsicle to delay 30ms between each gif
  • --optimize=3 requests that gifsicle use the slowest/most file-size optimization

You need to install

  • ffmpeg to process the video file
  • gifsicle to create and optimize the an animated gif

brew install ffmpeg 

#if cask is not installed
brew install caskroom/cask/brew-cask

#dependency for gifsicle, only required for mountain-lion and above
brew cask install xquartz

brew install gifsicle

Above instructions taken from gist: dergachev/GIF-Screencast-OSX.md

The following error occurred while installing the ffmpeg

Error: The brew link step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink include/libyasm /usr/local/include is not writable.

For this follow this answer

sudo chown -R $USER /usr/local/include
sudo chown -R $USER /usr/local

Transparency

The code above don't keep transparent layers. In order to do that, use:

ffmpeg -i in.mov -f gif -lavfi split[v],palettegen,[v]paletteuse out.gif

I've used www.online-convert.com to convert Keynote-exported .mov files in to animated gifs. Quick and simple. And the results were good.

You can see the resulting GIF in the answer I gave to this question: How to partially uncover bullet points in Keynote


Gif Ninja is a great site for converting videos to gifs. I've used it several times and the gif always comes out great.