Skip to content

Instantly share code, notes, and snippets.

@displaynone
Last active August 13, 2021 15:19
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 displaynone/c906780db2bb34117290f6d2beb11936 to your computer and use it in GitHub Desktop.
Save displaynone/c906780db2bb34117290f6d2beb11936 to your computer and use it in GitHub Desktop.
Convert video to GIF
$ more /usr/local/bin/video2gif.sh
#!/bin/bash
# https://engineering.giphy.com/how-to-make-gifs-with-ffmpeg/
echo "Video file: "
read video_file
echo "Video start position (HH:MM:SS): "
read start_seek
echo "GIF duration (ss.sss): "
read duration
echo "GIF name: "
read output_file
ffmpeg -ss $start_seek -t $duration -i $video_file -filter_complex "[0:v] fps=12,scale=w=480:h=-1,split [a][b];[a] palettegen=[p];[b][p] palet
teuse=new=1" $output_file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment