Created
October 15, 2020 14:38
-
-
Save maxrodrigo/f8a206d4a34c72475dc6acbed0bb8fe1 to your computer and use it in GitHub Desktop.
Creates gif for the given youtube video
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
#!/usr/bin/env bash | |
# example: ./yt-2-gif.sh dQw4w9WgXcQ 1 3 | |
VID=$1 | |
SKIP_SECONDS=$2 | |
TIME=$3 | |
youtube-dl --no-progress -o ${VID} ${VID} | |
ffmpeg -y -v error -ss ${SKIP_SECONDS} -t ${TIME} \ | |
-i "${VID}.mp4" \ | |
-vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \ | |
-loop 0 "${VID}.gif" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment