R. Hartman
R. Hartman

Reputation: 129

ffmpeg animated gif is blotchy

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?

Upvotes: 9

Views: 6959

Answers (2)

posit labs
posit labs

Reputation: 9431

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

Upvotes: 21

Jimmy Rustles
Jimmy Rustles

Reputation: 1

You can try using -vf format=rgb8,format=rgb24.

Upvotes: -1

Related Questions