ffmpeg -i input.mp4 -vf "palettegen" palette.png
if one doesnt work or loads indefinetly, which is the case by bigger videos
ffmpeg -i input.mp4 -vf "select=eq(n\,1206)" -vframes 1 out.png
then
ffmpeg -i out.png -vf "palettegen" palette.png
ffmpeg -i input.mp4 -i palette.png -filter_complex "paletteuse" out.gif
if your wanna limit framerate add a -r and fps number
-
ffmpeg -i input.mp4 -i palette.png -r 12 -filter_complex "paletteuse" out.gif
-
Voila