xxxxxxxxxx
Use
https://ezgif.com/video-to-gif
Other converter sites gives a weird annoying effect on the gif sometimes for some reason
xxxxxxxxxx
#!/bin/bash
##
# •––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––•
# + vars +
# •––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––•
##
media="$(echo -n $1 | sed 's/\.....$//g')"
##
# •––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––•
# + main script +
# •––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––•
##
rm -rf /tmp/*.png /tmp/*.gif
ffmpeg -i "$1" \
-filter_complex "[0:v] palettegen" /tmp/palette.png
sleep 1
ffmpeg -i "$1" \
-i /tmp/palette.png -filter_complex "[0:v][1:v] paletteuse" /tmp/temp.gif
# below was the original script; commented out in favor of above
#ffmpeg -i "$1" \
# -vf "setpts=0.35* PTS $1.gif" \
# "users/$USER/desktop/converted.gif"
cp /tmp/temp.gif/users/$USER/desktop/"$media".gif
exit 0