Created
May 22, 2025 19:06
-
-
Save cassiozen/0470a5cf0e56ab676de46f8e64242dc4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Creates an animated gif from video using an explicit color pallete with space handling | |
# usage: mov2gif input.mov [output.gif] | |
in="$1" | |
out="${2:-${in%.*}.gif}" | |
# tweak fps / scale here | |
fps=12 | |
width=600 | |
ffmpeg -loglevel error -hide_banner -i "$in" \ | |
-filter_complex " | |
colorspace=all=bt709:iall=bt709:fast=0,format=rgb24, | |
fps=${fps},scale=${width}:-1:flags=lanczos, | |
split [main][pal]; | |
[pal] palettegen=stats_mode=full [p]; | |
[main][p] paletteuse=dither=sierra2_4a | |
" \ | |
-y "$out" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment