Skip to content

Instantly share code, notes, and snippets.

@joepindar
Created December 20, 2015 00:02
Show Gist options
  • Save joepindar/ff63443e2eeb6bb67bf0 to your computer and use it in GitHub Desktop.
Save joepindar/ff63443e2eeb6bb67bf0 to your computer and use it in GitHub Desktop.
  1. Download the youtube video using http://www.savido.net

  2. Create a palette from the video:

  • skip the first 13 seconds of the input
  • create a 6 second output
  • 5 frames per second to minimize size
  • scale the output to be 320 pixels wide and automatic height, preserve aspect ratio

ffmpeg -y -ss 13 -t 6 -i videoplayback.mp4 -vf fps=5,scale=320:-1:flags=lanczos,palettegen palette.png

  1. Create the animated gif based using the above parameters and palette.

ffmpeg -ss 13 -t 6 -i videoplayback.mp4 -i palette.png -filter_complex "fps=5,scale=320:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif

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