Created
April 19, 2017 06:53
-
-
Save chimerast/ca0c6b23bebb0cabfa60fd62031db8f9 to your computer and use it in GitHub Desktop.
Make gif animation file from movie
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 | |
set -eux | |
INPUT_FILE=${1} | |
OUTPUT_FPS=${2:-8} | |
OUTPUT_HEIGHT=${3:--1} | |
TEMPFILE_CUT=cut.mp4 | |
TEMPFILE_PALLETE=pallete.png | |
ffmpeg -v warning -y -i $INPUT_FILE -r $OUTPUT_FPS -f mp4 -vf scale=-1:$OUTPUT_HEIGHT -crf 0 $TEMPFILE_CUT | |
ffmpeg -v warning -y -i $TEMPFILE_CUT -vf palettegen $TEMPFILE_PALLETE | |
ffmpeg -v warning -y -i $TEMPFILE_CUT -i $TEMPFILE_PALLETE -filter_complex paletteuse out.gif | |
rm $TEMPFILE_CUT $TEMPFILE_PALLETE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment