Skip to content

Instantly share code, notes, and snippets.

@Makio64
Last active February 21, 2022 17:03
Show Gist options
  • Save Makio64/eed4e52ef3217ff4d3d68fe3d16b44c1 to your computer and use it in GitHub Desktop.
Save Makio64/eed4e52ef3217ff4d3d68fe3d16b44c1 to your computer and use it in GitHub Desktop.
ffmpeg commands to convert images folder to video or gif
//---------------------------------------------------------------------------- EXPORT VIDEO
// convert a serie of images to high quality video
ffmpeg -f image2 -framerate 2 -i %d.png -vcodec libx264 -b 800k video.avi
// re-scale option to 1080x1080 ( for example )
ffmpeg -f image2 -framerate 2 -i %d.png -vf scale=1080x1080 video.avi
// convert for iphone format
ffmpeg -i video.avi -c:v libx264 -pix_fmt yuv420p -profile:v main -crf 1 -preset medium -c:a aac -movflags +faststart output.mp4
//---------------------------------------------------------------------------- EXPORT GIF
// convert a serie of images to a gif respecting the colorimetry
ffmpeg -f image2 -framerate 2 -i %d.png -vf "fps=16,scale=1080:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=32:reserve_transparent=0[p];[s1][p]paletteuse" -loop 0 out.gif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment