Skip to content

Instantly share code, notes, and snippets.

@tomasdev
Created February 9, 2018 17:11
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 tomasdev/7ad92addfa839f3936e1a0df4c15601a to your computer and use it in GitHub Desktop.
Save tomasdev/7ad92addfa839f3936e1a0df4c15601a to your computer and use it in GitHub Desktop.
MP4 to GIF using FFMPEG
# Step 1: define video
export VIDEO=name.mp4
# Step 2: create palette to have a better image quality result
ffmpeg -i $VIDEO -vf fps=15,scale=320:-1:flags=lanczos,palettegen palette.png
# Step 3: use the palette to convert the mp4 to gif
ffmpeg -i $VIDEO -i palette.png -filter_complex "fps=15,scale=400:-1:flags=lanczos[x];[x][1:v]paletteuse" $VIDEO.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment