cropdetect ignores a value of 1 as the round parameter
In its current implementation, the cropdetect
filter does not accept a value of 1 for the round
parameter and falls back to the default value, which currently is 16.
While not explicitly documented in the online help, I assume that this is due to 2 being the minimum value for the round
parameter. This unfortunately forces us to remove information even when this is not necessary: If I am rescaling the cropped image to output dimensions that satisfy all divisibility requirements enforced by the codec and sample format before encoding, the output of cropdetect
does not even have to satisfy any divisibility requirements. (I do understand that one might have to specify exact=1
when using the crop
filter in such a scenario.)
So I would appreciate it, if the lowest accepted value for round
is changed to 1. (In the hopes that the code then does not modify the detected crop any further since all integer numbers are already divisible by 1.) Note that one should also properly document the minimum value for the round
param.
I just took a look at the source code and realized that there are even more restrictions in place that are not documented: In addition to the
round
parameter needing to be greater than 1, it will also automatically get multiplied by 2 if the input value is odd and the offsets for the crop rectangle are also modified such that they are divisible by 2.While a comment in the code suggests that this has something to do with the YUV color model, the code more likely was added to ensure that one will obtain an output that works with chroma subsampled video.
However, again, such requirements would not have to be met in my use case (or when you are working with non-subsampled formats) and you can already tell the
crop
filter that you want it to be exact. But instead of a simple relaxation of the minimum value forround
, it seems that I would need you to introduce a setting that would drop the aforementioned restrictions of theround
parameter and modification ofcropdetect
's output altogether, just likeexact=1
does forcrop
. Such a setting could be off by default to keep things backwards compatible.