Skip to content

Gradients

Video Single output Source

Draw a gradients.

FFmpeg filter: gradients — the official reference.

Generate a stream. Gradients is a source — it has no input, so you create a stream from it rather than applying it to one:

$video = \FFmpeg\VideoStream::generate(new Gradients(…));

apply() and addFilter() do not apply to source filters (there is nothing to attach them to).

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
sizestring640x480—set frame size
ratestring25—set frame rate
c0stringrandom—set 1st color
c1stringrandom—set 2nd color
c2stringrandom—set 3rd color
c3stringrandom—set 4th color
c4stringrandom—set 5th color
c5stringrandom—set 6th color
c6stringrandom—set 7th color
c7stringrandom—set 8th color
x0int-1≥ -1set gradient line source x0
y0int-1≥ -1set gradient line source y0
x1int-1≥ -1set gradient line destination x1
y1int-1≥ -1set gradient line destination y1
nb_colorsint22–8set the number of colors
seedint-1≥ -1set the seed
durationint-1≥ -1set video duration
speedfloat0.010–1set gradients rotation speed
typeGradientsTypelinearlinear, radial, circular, spiral, squareset gradient type

FFmpeg also names these options (use the parameter shown above): s → size, r → rate, n → nb_colors, d → duration, t → type.


Maps to FFmpeg’s gradients 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.