Created
December 22, 2021 20:31
-
-
Save porty/9d6c78295cdec81e48e3b6d7a8a21ba1 to your computer and use it in GitHub Desktop.
FFMpeg mov to gif
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 | |
set -euo pipefail | |
# https://engineering.giphy.com/how-to-make-gifs-with-ffmpeg/ | |
# convert *.mov to *.gif | |
for f in *.mov; do | |
out=${f//.mov/.gif} | |
rm -rf "$out" | |
# -i: the input filename | |
# -r 5: bump the framerate down to 5 fps (save space) | |
# palettegen stuff: better quality for hopefully similar space | |
ffmpeg \ | |
-i "$f" \ | |
-r 5 \ | |
-filter_complex "[0:v] fps=12,split [a][b];[a] palettegen [p];[b][p] paletteuse" \ | |
"$out" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment