Last active
November 16, 2024 10:19
-
-
Save tassoman/d6305276914632c9eab52e8ba7f171d6 to your computer and use it in GitHub Desktop.
Generate a GIF header for your Misskey profile
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 | |
| # 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