Created
March 28, 2018 04:07
-
-
Save aphyr/fc385a6d57fd31a0c951d192b475753c to your computer and use it in GitHub Desktop.
Video to gif script
This file contains 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 | |
# Args: input video file, start time in HH:MM:SS, duration in seconds, output | |
# gif file. | |
# Tmpdir | |
rm -rf /tmp/video2gif | |
mkdir /tmp/video2gif | |
mplayer -nosub -ao null -ss "$2" -endpos "$3" "$1" -vo jpeg:outdir=/tmp/video2gif:quality=100 | |
thunar /tmp/video2gif & | |
pid=$! | |
echo "Review frames and hit enter when ready." | |
read | |
kill -term $pid | |
echo "Converting to gifs" | |
ls /tmp/video2gif/*.jpg | parallel convert {} -resize 480x320 {}.gif | |
echo "Combining" | |
gifsicle -O3 --delay 6 --loop /tmp/video2gif/*.gif > "$4" | |
eog "$4" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment