6 ms·
Gifski: Optimized GIF Encoder
- niutech 2y agoGIF Optimizer at https://ezgif.com/optimize https://ezgif.com/optimize could further optimize a demo GIF image https://gif.ski/jazz-chromecast-ultra.gif https://gif.ski/jazz-chromecast-ultra.gif by 23% using Lossy GIF Compression and by 27% using Optimize Transparency. So there is still much to improve in Gifski.
- pornel 2y agoezgif uses a lossy GIF compressor written by me — author of gif.ski. I can run: gifski -Q50 jazz-chromecast-ultra.gif -o even-smaller.gif and it reduces the same file by 65%. With -Q20 it can be 78% smaller: https://gif.ski/jazz-ultra-small.gif https://gif.ski/jazz-ultra-small.gif By that measure, gif.ski is 78% better than itself! With lossy compression it's always possible to make files smaller, and smaller, and smaller. Comparisons of lossy encoders without controlling for quality lead to such absurd results. See https://kornel.ski/en/faircomparison https://kornel.ski/en/faircomparison
- skadamat 2y agoI've used the GUI version before (Mac App) and it's my favorite, favorite little tool for quickly whipping up GIF's. I'm a big fan
- afavour 2y agoSame. It annoys me that I can’t easily place a video in a Google Doc so converting to GIF is my usual go-to. Gifski has been great for that.
- NayamAmarshe 2y agoWhile Gifski is fantastic, I'd really like to know what kind of tech https://gifs.com https://gifs.com uses. Their GIFs are really high quality and small in size. I thought they were using Gifski but I'm not sure about it.
- wildrhythms 2y agoWish these services could be run locally. I'd even pay for it. For people at companies uploading a clip of something internal for a slide deck to a 3rd party is a non-starter.
- cornstalks 2y agoAre they actually GIFs? Some websites use looping videos and call them GIFs, even though they’re H.264 in MP4 or something like that.
- cl3misch 2y agowebm seems to be the modern replacement for GIFs in browsers. I would suspect gifs.com supports them. Somehow their site is buggy for me atm so I could not test it.
- HeatrayEnjoyer 2y agoWhere are WebM files used? Safari browsers/Apple don't even support it.
- cornstalks 2y agoThey do now. At least on desktop. But it is a more recent feature (within the last few years, I can’t remember when exactly). MP4 with H.264 is still king for compatibility, but WebM with VP9 isn’t as bespoke as it once was.
- edflsafoiewq 2y agoAccording to https://caniuse.com/webm https://caniuse.com/webm, desktop Safari is green since 2022, while iOS Safari is green since two months ago.
- NayamAmarshe 2y agoI wish WebM could be the standard. GIFs shouldn't even be used in 2024. It's a format of the past, with no upsides. I usually only need GIFs for GitHub readmes. GitHub doesn't support WebM autoplay videos. In texting, Telegram has introduced WebM stickers so there's at least a choice there.
- Rperry2174 2y agoI've tried an absurd amount of video-to-gif tools and Gifski somehow is orders of magnitude better quality than all of them
- armada651 2y agoGifski does two things that most video-to-gif tools generally don't do: 1. It uses a unique color palette for each frame rather than using one global color palette for all frames. 2. It takes advantage of the fact that pixels from previous frames can be retained and used as part of the next frame even if the colors from those pixels are no longer part of the color palette. This is the main trick gifski uses to get more than 256 colors in a frame. On top of that gifski uses pngquant for color quantization (converting to 256 colors) which is extremely good at its job in its own right.
- pornel 2y agogifski is also maintaining consistent Floyd-Steinberg dithering across frames (basically dithering in 3 dimensions). This allows more reuse of the background colors, and keeps file sizes lower by avoiding adding unnecessary temporal noise. Other converters that remap and dither each frame independently will needlessly create unique noise patterns in each frame.
- duffyjp 2y agoI just ran a test on a ~4 second hires screen recording in Gifski and GIF Brewery 3 (which is what I've been using for years). Gifski took 11 seconds, and GIF Brewery took 59. Both apps set to maximum quality, 50fps, no resizing. The Gifski version is a little bigger at 5.5mb vs 4.2mb but also looks a bit better. I embed short screen recording GIFs into GitLab/GitHub several times a week as it's just a better user experience vs real video files on those platforms. I'm definitely switching tools! I wish I had known about this sooner.
- aikinai 2y agoI've used this for years and it's the best out there. Definitely use it for converting videos for Google Slides and such. But it's such a travesty that we're in 2024 and still using GIFs in place of videos. I guess it's not necessary on the web directly anymore, but so many other platforms, like Google, support GIFs but not videos. So we're all stuck encoding into an insanely space/cpu inefficient format just to get something animating.
- niutech 2y agoInstead of GIF, use APNG or animated WebP, supported in almost all web browsers.
- cl3misch 2y agoCreating GIFs for Google Slides is also exactly my main usecase for gifski. Today I played around with different formats for animated images (GIFs, apng, svg) and videos (webm, mp4, ...) in Google Slides. Only GIFs can be directly embedded. Other animated images are not supported, and videos have to be files in Google Drive. Ironically, GIFs are way larger than e.g. a webm video but are the only format which can be directly embedded in a presentation.
- ea016 2y agoI think Google Slides supports video, the downside is that you need to upload them to Google Drive first
- jonplackett 2y agoIt does - or YouTube. But they will not auto play like a gif and take over the screen when playing. feature requests for Google: - inline video that auto plays and loops. This is like 1 line of html. Please do this! - let me drag a video into the slide and just upload it for me and embed it - or just convert videos to gifs for me when I drag in!!
- Deukhoofd 2y agoMany platforms already stopped using gifs, for precisely those reasons. Tumblr silently converts to animated webp when uploading a gif, imgur converts it to mp4, etc.
- sorenjan 2y agoWhile on the subject of gifs, I'd like to recommend ScreenToGif. As the name suggests it supports screen recording, but the editor is nice for other gifs as well. It's easy to remove duplicate frames, change timing for all or some frames, etc. It can use ffmpeg and gifski for the gif encoding. https://www.screentogif.com/ https://www.screentogif.com/ Also, I just learnt this, gifski has integrated gifsicle for lossy gif compression.
- jdthedisciple 2y agoDef has my vouch too, been using it for years.
- c-linkage 2y agoAs others have mentioned below, a lot of sites and applications don't support embedded video, so GIF is the only way to go. I love using ScreenToGif to embed little videos into my email responses when I'm doing technical support. It's so much easier to show someone the process than describe everything in click by click detail. I've been doing this for years, and people are always amazed at the videos.
- underlines 2y agoI use it for Documentation (when interactive), for Teams with integrated short clips, for Powerpoint Presentations when I'm doing a live demo (having a second slide with the gif as a backup, when the live demo doesn't work). The editor is minimal and has a non existent learning curve. AFAIK screentogif even has the gifsky encoder plus a few others.
- itslennysfault 2y agoAfter clicking your link I had instant nostalgia. I used this tool years ago and completely forgot about it. I went to download it, but it appears to be windows only which explains why I stopped using it as I haven't used windows in about a decade. That said, I'd highly recommend Giphy Capture for recording gifs on mac. It has a very sleek/light UI.
- mrbluecoat 2y agoLike Ethernet, as long as the two commandments of "Does it work?" and "Is it secure?" pass, people will keep the default. P.S. The example gif on their site is gorgeous.
- jimfx 2y agoPretty sure the gif is from the short movie Cosmo Laundromat by Blender Studios, would definitely recommend giving it a watch: https://gooseberry.blender.org https://gooseberry.blender.org
- DeathArrow 2y agoI kind of dislike the Gif-ification of the internet. I rather watch video or look at static pictures.
- kierenj 2y ago"It produces animated GIFs that use thousands of colors per frame." - caught my interest. I googled, and saw that one technique for this is layering multiple frames with different palettes and a delay of 0.
- joaomoreno 2y agogifcap.dev compiles it into WebAssembly to get you an in-browser GIF screen recorder. https://gifcap.dev/ https://gifcap.dev/
- stef25 2y agoImageOptim is a really good desktop tool. Whatever scripts I write to optimise images on the server, nothing gets to the level of optimisation that ImageOptim does, even though it uses the same tools under the hood.
- alin23 2y agoLove this thing! It enabled me to add a “Convert to GIF” for videos in my Clop app (https://lowtechguys.com/clop https://lowtechguys.com/clop) in just a few lines of code. The GIF gets encoded at its optimal size by default so I didn’t have to do a second optimization step. I also like that the author spent time to add an easy way to build a static binary, which I need in order to ship gifski inside the app. Compressing all these static binaries so I can ship them in Clop with a <100MB download was not so easy though. I’ve been using the included xz in macOS but I’m switching to lrzip [1] for better compression size and especially speed [1] https://github.com/ckolivas/lrzip https://github.com/ckolivas/lrzip
- jjcm 2y agoIf you don't want to use something more composed like this, the main trick gifski is doing is using a two-pass approach to generate a palette for the gif. You can do this pretty easily with just ffmpeg / ffprobe. Here's my personal script I use for generation: #!/bin/sh SCALE=500 FPS=15 SCALEPROVIDED=false for arg in "$@" do case $arg in -s=*|--size=*) SCALE="${arg#*=}" SCALEPROVIDED=true shift ;; -f=*|--fps=*) FPS="${arg#*=}" shift ;; esac done palette="/tmp/palette.png" # Look at the width/height of the video width=`ffprobe -v error -select_streams v:0 -show_entries stream=width -of csv=s=x:p=0 $1` height=`ffprobe -v error -select_streams v:0 -show_entries stream=height -of csv=s=x:p=0 $1` # Get the max max=$(( width > height ? width : height)) # If we havent provided a scale, and the max size is lower than the default, set it to the lower value if [ "$SCALEPROVIDED" == true ] then minScale=$SCALE else minScale=$(( SCALE < max ? SCALE : max)) fi # Set our flags filters="fps=$FPS,scale=$minScale:-1:flags=lanczos" # If there's no name provided, output the same name as the input with gif as the extension output=$2 if [ -z "$output" ] then output=${1%.*}.gif fi # Output our gif ffmpeg -v error -i $1 -vf "$filters,palettegen=max_colors=256" -y $palette ffmpeg -v error -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $output echo created $output at ${minScale}px Example usage is something like: gif input.mov But you can also optionally specify framerate, size, and output name: gif -s=800 -f=22 input.mov my-800px-22fps-gif.gif
- pornel 2y agogifski works in a single pass, and streams its output. ffmpeg -i input.mov -f yuv4mpegpipe | gifski --width=500 -o out.gif -
- tbillington 2y agoaside: find it funny (genuinely), you describe this as "pretty easy" xD. ffmpeg is so impressive but so daunting from a cli perspective to me. how do you even know whats possible! I would never have imagined it could generate palettes
- ronjouch 2y agoMy image optimization trio as of now: - GIF: gifski (squeeze out the best possible out of the ancient format) - PNG: pngquant (lossy but respectful of what many PNGs are: lots of flat surfaces + limited color palette, transparency) - JPG: jpegli (writing this post mostly to share the news about this one, it's new from libjxl learnings, approximately as good qualitatively as Guetzli, but 1000x faster -actual number, not an exaggeration-. It's amazing! https://github.com/libjxl/libjxl/tree/main/lib/jpegli https://github.com/libjxl/libjxl/tree/main/lib/jpegli ) Below's my lil' `image-opt` helper making for a nice workflow to optimize any gif/jpg/png file(s) :) #!/usr/bin/env bash set -euo pipefail dbg() { if [ "${DEBUG:=false}" = 'true' ]; then echo "$@"; fi } die() { echo "Error: $*" 1>&2; zenity --error --text="$*"; exit 1; } if ! command -v pngquant > /dev/null; then die 'You must install pngquant'; fi if ! command -v cjpegli > /dev/null; then die 'You must install cjpegli'; fi if ! command -v gifsicle > /dev/null; then die 'You must install gifsicle'; fi for filename in "${@:1}"; do if [ -d "$filename" ]; then echo && echo "ℹ File '$filename' is a directory. Skipping." continue fi if [ ! -f "$filename" ]; then echo && echo "ℹ File '$filename' does not exist. Skipping." continue fi extension_raw="${filename##*.}" extension="${extension_raw,,}" # Convert to lowercase if [[ "$extension" != 'jpg' && "$extension" != 'png' && "$extension" != 'gif' ]]; then echo && echo "ℹ Skipping file $filename due to unsupported extension: .$extension" continue fi filename_noext="${filename%.*}" filename_original="${filename_noext}_beforeOpt.${extension_raw}" filename_final="${filename_noext}.${extension}" dbg "filename($filename), filename_noext($filename_noext), extension($extension), filename_original($filename_original)" echo && echo " Compressing $filename ..." mv "$filename" "$filename_original" if [ "$extension" == 'jpg' ]; then cjpegli "$filename_original" "${filename_noext}_q50.${extension}" -q 50 cjpegli "$filename_original" "${filename_noext}_q60.${extension}" -q 60 cjpegli "$filename_original" "${filename_noext}_q70.${extension}" -q 70 cjpegli "$filename_original" "${filename_noext}_q80.${extension}" -q 80 cjpegli "$filename_original" "${filename_noext}_q90.${extension}" -q 90 elif [ "$extension" == 'png' ]; then pngquant --strip --force --verbose --output "$filename_final" "$filename_original" elif [ "$extension" == 'gif' ]; then # https://kornel.ski/lossygif , set --lossy to 20 for light compression, 200 for heavy gifsicle -O3 --lossy=50 --verbose --output "$filename_final" "$filename_original" fi gio trash "$filename_original" done sync
- peacemoon 2y agoThis is an awesome cli to convert video to gifs. If you need GUI, you can use Gifski app on macOS or my app Quick Drop I wrote about the integration here https://quickdrop.antran.app/blogs/video_to_gif_conversion https://quickdrop.antran.app/blogs/video_to_gif_conversion