Following this tutorial I managed to create high quality gifs in reasonable memory size.

Using piping, what I'm currently doing is this

# Generate palette
ffmpeg -y -i - -vf fps=15,scale=600:-1:flags=lanczos,palettegen some_dir/palette.png

# Generate gif using palette
ffmpeg -y -i - -i some_dir/palette.png -filter_complex fps=15,scale=600:-1:flags=lanczos[x];[x][1:v]paletteuse output.gif 

This is working great, but I read in the tutorial above that it is possible to generate a different palette for EVERY frame, how can I do that ? (Generate and use different palette for every frame)


It is possible. Tutorial is outdated.

ffmpeg.exe -i Wildlife.wmv -lavfi palettegen=stats_mode=single[pal],[0:v][pal]paletteuse=new=1 out.mp4

  • Did you mean out.gif? Because running this command with out.gif resulted me in the following error Error initializing filter 'palettegen' with args 'stats_mode=single' Error initializing complex filters. Invalid argument – bluesummers Aug 9 '17 at 10:53
  • Your ffmpeg is prahistoric. – Paul B. Mahol Aug 10 '17 at 11:36
  • ffmpeg version 2.8.11 not good enough? – bluesummers Aug 10 '17 at 11:40
  • This actually works in ffmpeg 3.3.3 - accepted. How would you run it on a series of pictures instead of a video? – bluesummers Aug 10 '17 at 12:07
  • 1
    By using image2 muxer? ffmpeg.exe -i Wildlife.wmv -lavfi palettegen=stats_mode=single[pal],[0:v][pal]paletteuse=new=1 out%04d.png ? – Paul B. Mahol Aug 10 '17 at 15:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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