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
-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
If 5 fps is too jerky, try a conversion with
-r 24
(although the output balloons to 9.5MB):