Git Product home page Git Product logo

gifski's Introduction

gif.ski

Highest-quality GIF encoder based on pngquant.

gifski converts video frames to GIF animations using pngquant's fancy features for efficient cross-frame palettes and temporal dithering. It produces animated GIFs that use thousands of colors per frame.

(CC) Blender Foundation | gooseberry.blender.org

It's a CLI tool, but it can also be compiled as a C library for seamless use in other apps.

Download and install

See releases page for executables.

If you have Rust, you can also get it with cargo install gifski. Run cargo build --release --features=openmp to build from source.

If you have Homebrew, you can also get it with brew install gifski. Add the --with-openmp to make it run faster.

Usage

You can use ffmpeg command to convert any video to PNG frames:

ffmpeg -i video.webm frame%04d.png

and then make the GIF from the frames:

gifski -o anim.gif frame*.png

You can also resize frames (with -W <width in pixels> option). If the input was ever encoded using a lossy video codec it's recommended to at least halve size of the frames to hide compression artefacts and counter chroma subsampling that was done by the video codec.

See gifski -h for more options.

Building

  1. Install Rust
  2. Clone the repository: git clone https://github.com/ImageOptim/gifski
  3. In the cloned directory, run: cargo build --release

Enable OpenMP by adding --features=openmp to Cargo build flags (supported on macOS and Linux with GCC). It makes encoding more than twice as fast.

Using from C

See gifski.h for the API. To build the library, run:

cargo build --release

and link with target/release/libgifski.a. Please observe the LICENSE.

License

AGPL 3 or later. Let me know if you'd like to use it in a product incompatible with this license. I can offer alternative licensing options, including commercial licenses.

With built-in video support

The tool optionally supports decoding video directly, but unfortunately it relies on ffmpeg 3.x, which may be very hard to get working, so it's not enabled by default.

You must have ffmpeg and libclang installed, both with their C headers intalled in default system include paths. Details depend on the platform and version, but you usually need to install packages such as libavformat-dev, libavfilter-dev, libavdevice-dev, libclang-dev, clang. Please note that installation of these dependencies may be quite difficult. Especially on macOS and Windows it takes expert knowledge to just get them installed without wasting several hours on endless stupid installation and compilation errors, which I can't help with.

Once you have dependencies installed, compile with cargo build --release --features=video,openmp.

When compiled with video support ffmpeg licenses apply. You may need to have a patent license to use H.264/H.265 video (I recommend using VP9/WebM instead).

gifski -o out.gif video.mp4

gifski's People

Contributors

kornelski avatar vitorgalvao avatar timvisee avatar liamross avatar badlogic avatar scribblemaniac avatar

Watchers

James Cloos avatar Jithin Raj avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.