Skip to content

Instantly share code, notes, and snippets.

@ofgulban
Last active March 7, 2022 17:51
Show Gist options
  • Save ofgulban/f888bc3e4173fb5bdb0601b5f2bf434c to your computer and use it in GitHub Desktop.
Save ofgulban/f888bc3e4173fb5bdb0601b5f2bf434c to your computer and use it in GitHub Desktop.
Make MP4 and GIF files from multiple PNGs using ffmpeg.
# Compile an MP4 from a folder containing PNGs
ffmpeg -y -i /path/to/movie_frame-%03d.png -vb 20M -c:v libx264 -vf fps=24 -pix_fmt yuv420p path/to/movie.mp4
# Convert mp4 into a high quality gif
ffmpeg -y -i path/to/movie.mp4 -vf "fps=24, scale=768:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 path/to/movie.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment