-
-
Save daikini/f74081ea85cf2951d0a710409e3453d8 to your computer and use it in GitHub Desktop.
Turn a movie into an animated webp.
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/zsh | |
movieInput=$1 | |
tmpFolder=$2 | |
outName=$3 | |
mkdir -p $tmpFolder | |
ffmpeg -i $movieInput $tmpFolder/%03d.png | |
for i in `ls $tmpFolder`; do | |
j=`echo $i | sed s/\.png/.webp/` | |
cwebp $tmpFolder/$i -o $tmpFolder/$j | |
done | |
webpmux `for i in \`ls $tmpFolder/*.webp\`; do echo -n "-frame $i +33+0+0+1+b "; done` `echo -n $4` -o $outName | |
# To cheat a none looping animation, add the last frame again with a really | |
# long timeout. A slightly higher value can be given then below but the below | |
# value is already more than 2 days. | |
# -frame last-frame.webp +9999999+0+0+1+b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment