Skip to content

Instantly share code, notes, and snippets.

@tassoman
Last active November 16, 2024 10:19
Show Gist options
  • Select an option

  • Save tassoman/d6305276914632c9eab52e8ba7f171d6 to your computer and use it in GitHub Desktop.

Select an option

Save tassoman/d6305276914632c9eab52e8ba7f171d6 to your computer and use it in GitHub Desktop.
Generate a GIF header for your Misskey profile
#!/bin/sh
# License: AGPLv3
# Author: Tassoman
# URL: https://github.com/tassoman
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <input_video> <output_gif>"
exit 1
fi
if [ "${2##*.}" != "gif" ]; then
echo "Error: The output file must have a .gif extension."
exit 1
fi
palette="/tmp/palette.png"
file="${2%.*}"
ffmpeg -v error -i "$1" -vf "fps=15,scale=640:-1,palettegen" -y "$palette"
ffmpeg -v error -i "$1" -i "$palette" -lavfi "fps=15,scale=640:-1[p];[p][1:v]paletteuse=dither=bayer:bayer_scale=3" -fs 256K -y "$2"
file $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment