This is just a quick remark about playing around with videos into gif conversion.
Sometimes I make some video from my smartphone, and I want to share it, but in reduced size and without any sound. Sometimes I do a desktop recording with Ubuntu Peek utility into gif directly, or with OBS into video format.
In all these cases I want to reduce the output size. Previously I have been using some web resources for a quick conversion, like this one – https://convertio.co/de/webm-gif/
But the last time I used it – it converted 7.9 MB webm file into 113 MB gif. o_O
Convert Video to Gif
So I decided to use some console utilities, as I sometimes do, to do a better job. For converting a video into gif I need
ffmpeg utility. Simply install it
sudo apt install ffmpeg
ffmpeg -i aD1gwwG_460svvp9.webm -r 5 aD1gwwG_460svvp9.gif
-r here is a frame rate. So I make it only 5 fps here. Can be 10 fps, results are a bit better. For my case 5 is enough.
After that, I have 31 MB gif file. Already much better than with this web conversion.
After that, I want to optimize it with
sudo apt install gifsicle and use
gifsicle --optimize=3 aD1gwwG_460svvp9.gif -k16 --color-method 'median-cut' > optimized2.gif
What I do here is a reduction of colors palette from 256 colors to 16. It still looks pretty good for a gif. Also, I use the 3rd level of optimization. Described in a man page – http://www.lcdf.org/gifsicle/man.html. Color reduction method I have picked up by trying all 3 of them.
The result is the 18 MB gif which is playing for 2 minutes and still good enough. :D