[FFmpeg-devel] Color quantization for GIF

Clément Bœsch u at pkh.me
Sun Jan 25 20:38:36 CET 2015


On Sun, Jan 25, 2015 at 07:55:17PM +0100, Clément Bœsch wrote:
> Hi folks,
> 
> I've been trying to improve GIF support even more recently. This is the result:
> http://lucy.pkh.me/gone-nutty-current.gifhttp://lucy.pkh.me/gone-nutty.gif
> 

I added more here: http://lucy.pkh.me/gif-experiment/ with other dithering
(in what is available currently):

gif-experiment/bbb:
total 119M
-rw-r--r-- 1 ux ux 13M Jan 25 20:28 out-current-ad.gif
-rw-r--r-- 1 ux ux 41M Jan 25 20:28 out-current-ed.gif
-rw-r--r-- 1 ux ux 13M Jan 25 20:28 out-current.gif
-rw-r--r-- 1 ux ux 14M Jan 25 20:28 out-current-xd.gif
-rw-r--r-- 1 ux ux 40M Jan 25 20:28 out-dither.gif

gif-experiment/gone-nutty:
total 77M
-rw-r--r-- 1 ux ux 6.5M Jan 25 20:19 out-current-ad.gif
-rw-r--r-- 1 ux ux  29M Jan 25 20:19 out-current-ed.gif
-rw-r--r-- 1 ux ux 6.1M Jan 25 20:18 out-current.gif
-rw-r--r-- 1 ux ux 7.3M Jan 25 20:19 out-current-xd.gif
-rw-r--r-- 1 ux ux  29M Jan 25 20:19 out-dither.gif

gif-experiment/matrix:
total 111M
-rw-r--r-- 1 ux ux 12M Jan 25 20:22 out-current-ad.gif
-rw-r--r-- 1 ux ux 36M Jan 25 20:22 out-current-ed.gif
-rw-r--r-- 1 ux ux 14M Jan 25 20:22 out-current.gif
-rw-r--r-- 1 ux ux 14M Jan 25 20:22 out-current-xd.gif
-rw-r--r-- 1 ux ux 38M Jan 25 20:22 out-dither.gif

So indeed, with the heckbert/floyd-steinburg dithering I implemented in
paletteuse, the results are very similar in size with error diffusion
dithering.

The quality is IMO better with the palette though, except for a bug in BBB
where it seems the palette has no black (so the opening fade in looks like
shit).

I used the following for testing:

#!/bin/sh

./ffmpeg -i $1 -vf trim=start=$2:end=$3,palettegen -y palette.png

filt="trim=start=$2:end=$3,scale=480:-1"

./ffmpeg -i $1                -lavfi $filt                     -y out-current.gif
./ffmpeg -i $1                -lavfi $filt:sws_dither=ed       -y out-current-ed.gif
./ffmpeg -i $1                -lavfi $filt:sws_dither=a_dither -y out-current-ad.gif
./ffmpeg -i $1                -lavfi $filt:sws_dither=x_dither -y out-current-xd.gif
./ffmpeg -i $1 -i palette.png -lavfi $filt,paletteuse          -y out-dither.gif

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150125/33196d98/attachment.asc>


More information about the ffmpeg-devel mailing list