scripts:ffmpeg:dither_video_reduce_colors

Dither Video and Reduce Colors

Sometimes you need to reduce the number of colors you can use.

Typically for gif, but sometimes other reasons.

Example to batch process a bunch of Mp4 files for reducing to 14 colors

parallel --ungroup -j16 -q ffmpeg -i "{}" -vf palettegen=max_colors=16  -y "{.}.png" ::: *.mp4

Here is my sample command

parallel --ungroup -j24 -q ffmpeg -i "{}" -i "{.}.png" -filter_complex "paletteuse=dither=sierra3" -c:v libx264 -an -s 640x450 -crf 26 -pix_fmt yuv420p -y "{.}.MP4" ::: *.mp4

NOTE: this will give you the APPEARANCE of a dithered video, but the output is still full 8 bit color.

This matters for images like gif or if you're turning to raw vidoe, but otherwise, it's simply for aesthetics

  • scripts/ffmpeg/dither_video_reduce_colors.txt
  • Last modified: 2025-04-08 08:39
  • by Tony