rust-sokoban icon indicating copy to clipboard operation
rust-sokoban copied to clipboard

Use gifski to encode gifs instead of stock ffmpeg options

Open msparkles opened this issue 11 months ago • 1 comments

Stumbled upon the repo and saw that there's a gif with Moiré pattern, and then we clicked on the file and.... 55.7MB :O

Unacceptable! Looked at the README to confirm our suspicion- ffmpeg!

ffmpeg is notoriously bad at encoding gifs, which isn't its fault, really, it's not designed to encode to such a primitive and horrible format- but we can do better.

Introducing gifski! (not sponsored whatsoever)

(unfortunately using this will mean you'll have to re-record every single one of the videos as encoding a gif into another gif with gifski is just a horrible idea, or just reencoding gifs in general, whoops.)


https://github.com/user-attachments/assets/77dea7e1-37e3-4eaf-aa93-9715faa9e2ac (original recording, 71.3 KiB, 60 fps)


ffmpeg, as the repo describes (created with ffmpeg -i recording.webm -r 60 -f gif - > ffmpeg.gif) (248.1 KiB)


gifski, medium quality (created with gifski recording.webm -r 60 -Q 60 --extra -o gifski.gif) (169.6 KiB)


gifski, really low quality (created with gifski recording.webm -r 30 -Q 15 --extra -o gifski.gif) (112.4 KiB)


(( we have 0 clues why the ffmpeg version has a clearly wrong FPS !! ))

As you can see, the gifski version is not only much cleaner, but also even smaller! And you can even squeeze it further if you really wanted to and if it doesn't impact the recording.

However gifski isn't perfect. ffmpeg is still better if you're encoding something high-motion, but since a videogame like this is anything BUT high-motion, it's the perfect job for gifski!

But! gifski clearly produces fantastic results here while making even smaller gifs, so we think it'd be good for the gifs to be using gifski instead :> 💯

msparkles avatar Jan 18 '25 21:01 msparkles

This is awesome, definitely up for doing this! I'll just have to see if I still have the original recordings or I need to go commit by commit to record them

iolivia avatar Jan 19 '25 09:01 iolivia