Last active
August 28, 2017 15:46
-
-
Save ailinykh/2bf10922a7aa2f48f208a491f9c3ff1c to your computer and use it in GitHub Desktop.
Bash script converts your videos into gif
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 | |
# | |
# Usage: ./video_to_gif.sh video.mp4 | |
# | |
TARGET_FILE=$1 | |
if [[ -z $TARGET_FILE ]]; then | |
echo "usage: video_to_gif.sh <target_file>" | |
echo "\ttarget_file - video file to convert into gif" | |
exit 1 | |
fi | |
ffmpeg -y -i "${TARGET_FILE}" -vf fps=10,scale=480:-1:flags=lanczos,palettegen palette.png | |
ffmpeg -i "${TARGET_FILE}" -i palette.png -filter_complex "fps=10,scale=480:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif | |
rm palette.png | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment