Convert your gif to a highres Video (mp4)
#!/bin/bash
# Check if input file is provided
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <input.gif>"
exit 1
fi
input="$1"
output="${input%.*}.mp4"
# Loop the GIF 5 times, scale up by 10x (using nearest neighbor for hard edges), and convert to MP4
ffmpeg -i "$input" -filter_complex "[0:v]split[a][b];[a]palettegen[p];[b][p]paletteuse,scale=10*iw:10*ih:flags=neighbor" -loop 5 -c:v libx264 -preset slow -crf 18 -pix_fmt yuv420p "$output"
echo "Output: $output"