Skip to content

Instantly share code, notes, and snippets.

@hancush
Created December 15, 2015 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hancush/27b3661c412100592687 to your computer and use it in GitHub Desktop.
Save hancush/27b3661c412100592687 to your computer and use it in GitHub Desktop.
#!/bin/sh
youtube-dl -o "_%(id)s.%(ext)s" $1
infile=$(ls | head -n1)
palette="/tmp/palette.png"
filters="fps=12,scale=500:-1:flags=lanczos"
ffmpeg -v warning -ss $2 -t $3 -i $infile -vf "$filters,palettegen=stats_mode=diff" -y $palette
ffmpeg -v warning -ss $2 -t $3 -i $infile -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse=dither=none" -y anim.gif
rm $infile
@hancush
Copy link
Author

hancush commented Dec 15, 2015

bash vidgif.sh $url $start_time_mm:ss $length

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment