1

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)

bluesummers
  • 113
  • 1
  • 5

1 Answers1

12

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 09 '17 at 10:53
  • Your ffmpeg is prahistoric. –  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` ? –  Aug 10 '17 at 15:32
  • @PaulB.Mahol thanx for the solution! Is it possible to generate 1 palette per, let's say, 30 frames? Because it seems like the performance is terrible when generating palette for each frame. – Alexander Korzhykov Aug 18 '17 at 19:43
  • Currently not in code. –  Aug 20 '17 at 14:09
  • on ubuntu 16 lts the version in apt is `2.8.15` – chiliNUT Oct 15 '19 at 21:11