Skip to content

Instantly share code, notes, and snippets.

@snehankekre
Created May 11, 2022 18:13
Show Gist options
  • Select an option

  • Save snehankekre/1a17ef3a1759f1992faf553249440960 to your computer and use it in GitHub Desktop.

Select an option

Save snehankekre/1a17ef3a1759f1992faf553249440960 to your computer and use it in GitHub Desktop.
Video to GIF
#!/bin/sh
# http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
palette="/tmp/palette.png"
filters="fps=15,scale=1000:-1:flags=lanczos"
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
@snehankekre
Copy link
Author

snehankekre commented May 11, 2022

Installation

$ curl https://gist.githubusercontent.com/snehankekre/1a17ef3a1759f1992faf553249440960/raw/87ebd80481664cd9a4a6333b88968f937f54a8b0/vid2gif.sh --output vid2gif.sh
$ brew install ffmpeg

Usage

Only the first time:

$ chmod +x ./vid2gif

Then:

$ ./vid2gif foo.MOV bar.gif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment