Convert video to GIF
gif & images
// what it does
Single-pass video-to-GIF. The -vf filtergraph runs fps=10 to resample the stream down to 10 frames per second and scale=320:-1 to set width to 320px while -1 auto-computes height to preserve aspect ratio. ffmpeg's gif encoder then auto-quantizes the frames to 256 colors. Reach for this when you want a quick GIF and don't care much about color fidelity.
// shell
$ ffmpeg -i input.mp4 -vf "fps=10,scale=320:-1" output.gif// gotcha
Without a palettegen pass, ffmpeg picks a non-optimized 256-color palette automatically, which produces visible banding and dithering artifacts and usually a larger file than the two-pass palettegen/paletteuse method.