friendlygiraffe
friendlygiraffe

Reputation: 1021

Force FFMPEG to reuse gif frames

I am exporting a gif from a mov file using ffmpeg with the following code:

 ffmpeg -i movie.mov -i mypalette.png -lavfi "paletteuse,scale=600:-1" -r "25" -loop "0" movie.gif

The movie has a lot of pauses where the frame does not change. I noticed when opening the gif in Photoshop it is using duplicates of the same frame rather than pausing at that frame for say, 2 seconds. Is there a method for forcing FFMEG to re-use identical frames?

Upvotes: 2

Views: 1140

Answers (1)

Gyan
Gyan

Reputation: 93261

Use

ffmpeg -i movie.mov -i mypalette.png -lavfi "mpdecimate,paletteuse,scale=600:-1" -vsync 0 -r 25 -loop 0 movie.gif

The mpdecimate will remove duplicate frames from the input. The -vsync 0 will prevent ffmpeg from populating the gaps created by mpdecimate with duplicate frames.

Upvotes: 4

Related Questions