Or, you could just use FFMpeg.
I thought this thread would no longer be relevant, but I saw someone recommend it to someone today. No one suggested an ffmpeg-only approach, so here's what I do. These are excerpts of my batch file. I got most of this from Googling for results from stackoverflow and superuser.

  • Step 0: Download FFMpeg
    • Go here
    • Windows users: in case you're a noob to command line, you click ffprompt.bat to get started. You have to define all of the variables below. (google it)
  • Step 1: Generate palette from video range.
    • ffmpeg -v warning -ss %start% -t %duration% -i "%input%" -vf fps=%fps%,scale=-1:%height%,palettegen=max_colors=%colors% -y palette.png
  • Step 2: make gif using palette from step 1
    • ffmpeg -v warning -ss %start% -t %duration% -i "%input%" -i palette.png -filter_complex mpdecimate,fps=%fps%,scale=-1:%height%[x];[x][1:v]paletteuse -y %output%
To lower the file size you can change the values of height, fps, and colors (max is 256). I haven't fiddled with it much, but if you're still not satisfied with the file size you could also try changing the dithering settings. See this article for info on that. (What he says about scaling is no longer true. The default scaler is no longer bilinear, so you don't need to include the lanczos thingy.)

One more thing you could try in order to shave off a few 10ths of a MB is re-encode your video range as an MP4 before making the gif and remove the -ss and -t options from the two above commands. In my experience, starting with a smaller source video results in a slightly smaller gif, but with slightly more artifacts (banding and dither dots). Example:

ffmpeg -v warning -ss %start% -i "%input%" -t %duration% -c:v libx264 -crf 18 -preset veryslow -tune animation -an -sn -y infile.mp4

Then use infile.mp4 as %input%. I also find that the -t option is more accurate this way, but that could just be because I test my times by creating a low-quality MP4 using veryfast preset.