Skip to content

Instantly share code, notes, and snippets.

@HerXayah
Last active March 25, 2022 08:53
Show Gist options
  • Save HerXayah/02a91207961fab5c0051933b78cb5359 to your computer and use it in GitHub Desktop.
Save HerXayah/02a91207961fab5c0051933b78cb5359 to your computer and use it in GitHub Desktop.
Mp4 to Gif high quality
  1. ffmpeg -i input.mp4 -vf "palettegen" palette.png

if one doesnt work or loads indefinetly, which is the case by bigger videos

  1. ffmpeg -i input.mp4 -vf "select=eq(n\,1206)" -vframes 1 out.png

then

  1. ffmpeg -i out.png -vf "palettegen" palette.png
  2. ffmpeg -i input.mp4 -i palette.png -filter_complex "paletteuse" out.gif

if your wanna limit framerate add a -r and fps number

  1. ffmpeg -i input.mp4 -i palette.png -r 12 -filter_complex "paletteuse" out.gif

  2. Voila

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