I suppose ffmpeg is the weapon of choice but I didn't find out how to reach my goal.
3 Answers
From here:
ffmpeg -i input.webm -pix_fmt rgb24 output.gif
-
7Wow! It works! AND.. 2.6 MB webm -> 48 MB gif ^^ -- any thought to reduce this?– brubakerAug 4, 2014 at 11:47
-
7gifsicle is a fantastic tool to reduce gif size
gifsicle -O2 input.gif -o output.gif
– kennAug 4, 2014 at 11:52 -
1@BarafuAlbino Thanks buddy, but I got an error: "Unknown pixel format requested: rgb16."– brubakerAug 4, 2014 at 12:01
-
3@brubaker I think I got you beat: 120K
.webm
→ 2.7G.gif
. Yes, that's with a G.– wcharginNov 1, 2015 at 23:19 -
6
rgb24
is not supported for gif, ffmpeg would usergb8
instead automatically. Jan 22, 2017 at 8:59
Barafu's answer is alright. But, the resulting gif may have color conversion issue as ffmpeg complains on Incompatible pixel format 'rgb24' for codec 'gif'
. Here is what I find works:
First, create PNG Palette:
ffmpeg -y -i input.webm -vf palettegen palette.png
Then, use the palette to produce gif:
ffmpeg -y -i input.webm -i palette.png -filter_complex paletteuse -r 10 output.gif
Source:
-
4
-
Extending Raynal's answer, here's a script one can add to .bashrc
to do the conversion:
function webm2gif() {
ffmpeg -y -i "$1" -vf palettegen _tmp_palette.png
ffmpeg -y -i "$1" -i _tmp_palette.png -filter_complex paletteuse -r 10 "${1%.webm}.gif"
rm _tmp_palette.png
}
e.g.
webm2gif recording.webm
will create recording.gif
.