Download ffmpeg
ffmpeg -i clip.mp4 -vf palettegen palette.png ffmpeg -y -i clip.mp4 -i palette.png -lavfi paletteuse output.gif
DONE!
ref http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
You can also use giflossy to reduce the size https://github.com/pornel/giflossy