Skip to content

Paletteuse

Video Single output Transform

Use a palette to downsample an input video stream.

FFmpeg filter: paletteuse — the official reference.

Add it to a graph. The explicit form works for every filter — bind it to its inputs and read the result from outputs():

$node = $video->addFilter(new Paletteuse(), [$other]);
$result = $node->outputs()[0];

Shorthand. Single-output filters can skip the node — apply() returns the result stream directly:

$result = $video->apply(new Paletteuse(), $other);

TODO — when this filter shines: what it’s the right tool for, what to reach for instead when it isn’t, and how it composes with neighbouring filters.

TODO — prose: how the filter actually works and what its key parameters mean (the explanation FFmpeg’s terse option help omits).

TODO — runnable PHP, with the equivalent ffmpeg CLI alongside.

TODO

TODO

ParameterTypeDefaultRange / valuesDescription
ditherPaletteuseDitheringModesierra2_4abayer, heckbert, floyd_steinberg, sierra2, sierra2_4a, sierra3, burkes, atkinsonselect dithering mode
bayer_scaleint205set scale for bayer dithering
diff_modePaletteuseDiffMode0rectangleset frame difference mode
newboolfalsetake new palette for each output frame
alpha_thresholdint1280255set the alpha threshold for transparency
debug_kdtreestringsave Graphviz graph of the kdtree in specified file

Maps to FFmpeg’s paletteuse filter. Verified against ffmpeg n7.1.1.

An Artisan Build project.

Built on FFmpeg — an independent binding, not affiliated with or endorsed by the FFmpeg project. Support FFmpeg.