Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffmpeg animated gif is blotchy

Tags:

ffmpeg

gif

I am generating an animated gif from an mp4 ... but due (I think) to color reduction (gif requires -pix_fmt rgb24) the result is somewhat ... blotchy? like running an image through an oil paint (or maybe "posterize") special effect filter. I think that the quality could be better, but I don't know what to tweak.

Not sure about this ... but ooking at the color palette of the resulting gif in an image editor it does not even appear to have attempted to create a color palette specific to this clip, but instead is attempting to us a generic palette ... which wastes a lot of pixmap space. That is, if I am interpreting this correctly.

Any tips on preserving the original video image instead of getting a "posterized" animated gif?

like image 848
R. Hartman Avatar asked Aug 10 '13 05:08

R. Hartman


1 Answers

To get better looking gifs, you can use generated palettes. palettegen filter will generate a png palette to use with the paletteuse filter.

ffmpeg -i input.mkv -vf palettegen palette.png
ffmpeg -i input.mkv -i palette.png -lavfi paletteuse output.gif
like image 115
posit labs Avatar answered Sep 18 '22 03:09

posit labs