
This means that the areas without motion will remain the transparent from one frame to the next.įor our longer gifs, this method cut our file size down by about 40%. In our case, since the images were synthetic (i.e., not photographic), dithering using the Bayer algorithm worked quite nicely.ĭiff_mode=rectangle restricts area to only the regions where there is motion. Have a look a the different options for dithering as they’ll each have a different effect depending on your content.

I found that without this, some static pixels would still change colours ever so slightly between frames.ĭithering with a bayer_scale=5. This will generate a smaller palette because FFMPEG will only look at the pixels that do not change from one frame to the next. Using stats_mode=diff when generating the palette. I won’t go into each option we’re passing to FFMPEG here, but there are a couple things that differ from the original blog post. You can find a more detailed explanation of this in FFMPEG’s Filtergraph Docs Explanation of Options
