52

I suppose ffmpeg is the weapon of choice but I didn't find out how to reach my goal.

brubaker
  • 659
  • 1
  • 7
  • 17
  • 2
    See [How do I convert a video to GIF using ffmpeg, with reasonable quality?](http://superuser.com/a/556031/110524) for some additional information. – llogan Aug 04 '14 at 16:20

3 Answers3

71

From here:

ffmpeg -i input.webm -pix_fmt rgb24 output.gif
Barafu Albino
  • 6,401
  • 1
  • 34
  • 42
43

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:

Covert MP4/Webm - ubuntubuzz.com

Raynal Gobel
  • 587
  • 5
  • 7
9

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.

SMoenig
  • 103
  • 3
Max Ghenis
  • 191
  • 1
  • 4