Skip to content

Cropdetect

Video Single output Transform

Auto-detect crop size.

FFmpeg filter: cropdetect — the official reference.

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

$node = $video->addFilter(new Cropdetect(…));
$result = $node->outputs()[0];

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

$result = $video->apply(new Cropdetect(…));

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
limitfloat0.0941176470588240–65535Threshold below which the pixel is considered black
roundint16≥ 0Value by which the width/height should be divisible
reset_countint0≥ 0Recalculate the crop area after this many frames
skipint2≥ 0Number of initial frames to skip
max_outliersint0≥ 0Threshold count of outliers
modeCropdetectModeblackblack, mvedgesset mode
highfloat0.0980392156862750–1Set high threshold for edge detection
lowfloat0.0588235294117650–1Set low threshold for edge detection
mv_thresholdint80–100motion vector threshold when estimating video window size

FFmpeg also names these options (use the parameter shown above): reset → reset_count.


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