I'm trying to use FFmpeg to convert a bunch of Png's into a gif, while setting the duration of each frame and while using an optimal palette (and other parameters, such as dither) on a single command.

I was reading FFmpeg's page, but the examples are using two commands and a temporary palette.png file.

Here's what I got, without using palettegen and paletteuse:

-vsync 2 -safe 0 -f concat -i "concat.txt" -y "example.gif"

The concat.txt file contains each frame path and duration, like:

file 'C:\0.png'  
duration 0.066 

It outputs a gif with a default palette as expected.

So, my question is how can I use palettegen and paletteuse on the same command, without a temporary file?

marked as duplicate by llogan ffmpeg Dec 9 '17 at 19:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Oh c'mon. How is this question a duplicate of the other two questions? – Nicke Manarin Dec 10 '17 at 15:05

Okay, It's working now with this command from another SuperUser answer:

-vsync 2 -safe 0 -f concat -i "concat.txt" 
-lavfi palettegen=stats_mode=single[pal],[0:v][pal]paletteuse=new=1 -y "example.gif"

Not the answer you're looking for? Browse other questions tagged or ask your own question.