Converting Video Files
Converting mp4 to animated gif[edit]
Using ffmpeg without any options will create a gif file that looks very close to the source, but can be 300+ Mb for a 2+ Mb mp4 source file.
$ ffmpeg -i source.mp4 -o output.gif
This StackOverflow thread contains some useful options for reducing the size:
$ ffmpeg -y -i source.mp4 -filter_complex "fps=5,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=32[p];[s1][p]paletteuse=dither=bayer" output.gif
With the options above the gif still comes out maybe 4 times the size of the source mp4.
Reducing the palette to 32 colors is extreme, but it does reduce the file size significantly. Also 5 frames per second is pretty jerky if the source video contains smooth motion at 24 or 30 fps.