I'm using the following code to generate a gif using ffmpeg:


ffmpeg -i $src -vf palettegen -y $palette
ffmpeg -i $src -i $palette -lavfi paletteuse -y $dest

The gif that is produced is 'cumulative'. How can I change it so that the gif produced is 'replace' (where each image is independent of the previous)?

I realize this would result in a gif with a larger file size.

1 Answer 1


You have to disable picture offsetting.

ffmpeg -i $src -i $palette -lavfi paletteuse -gifflags 0 -y $dest
  • Thanks! How did you find out about gifflags? It's not mentioned in the docs...
    – Jet Blue
    Nov 15, 2017 at 21:22
  • Still gives the same cumulative result for me, even when using -gifflags 0. Is there another way? ffmpeg 4.1 on Windows 10.
    – Pyroglyph
    Dec 19, 2018 at 18:27
  • dude, this was a life saver, thank you so much Mar 8, 2022 at 16:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .