Created
July 10, 2019 07:16
-
-
Save loopyd/584caae22cc9dba1a6d0429913d6249e to your computer and use it in GitHub Desktop.
Gifsicle wrapper, bash - Convert your stuff!
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/bash | |
# It has a funny name, but a valuable purpose. It will convert movies to optimized gif images of an extremely small size | |
# while preserving a decent amount of their quality. It uses the standard stream and DOES NOT create any junk on the | |
# filesystem, making it extremely fast! | |
# | |
# Dependencies required: gifsicle, ffmpeg | |
# By: HeavyPaws "Heavy H. Paws" <[email protected]> | |
# | |
# Example use: | |
# testicle.sh my_lewd_movie.webm my_lewd_animation.gif | |
filters="fps=45,scale=640:-1:flags=lanczos" | |
input=$1 | |
output=$2 | |
echo -ne "$input -> $output ... " | |
gifsicle -O3 --colors 256 <(capture /dev/stdout 2>/dev/null | ffmpeg -y -i $input -i <(ffmpeg -y -i $input -vf "$filters,palettegen" -f apng - 2>/dev/null) -lavfi "$filters [x]; [x][1:v] paletteuse" -f gif - 2>/dev/null) >$output 2>/dev/null & | |
pid=$! ; i=0 | |
while ps -a | awk '{print $1}' | grep -q "${pid}" | |
do | |
c=`expr ${i} % 4` | |
case ${c} in | |
0) echo -ne "/" ;; | |
1) echo -ne "-" ;; | |
2) echo -ne "\\" ;; | |
3) echo -ne "|" ;; | |
esac | |
i=`expr ${i} + 1` | |
sleep 1 | |
echo -ne "\b\c" | |
done | |
echo -ne "\r\n" | |
wait ${pid} | |
ret=$? | |
exit ${ret} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment