[FFmpeg-devel] [PATCH 5/5] lavfi: addroi filter

Mark Thompson sw at jkqxz.net
Thu Feb 28 03:18:06 EET 2019


On 27/02/2019 23:42, Moritz Barsnick wrote:
> On Wed, Feb 27, 2019 at 22:00:23 +0000, Mark Thompson wrote:
>> +static const AVOption addroi_options[] = {
>> +    { "top",    "Region distance from top edge of frame",
>> +      OFFSET(region_str[TOP]),    AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
>> +    { "bottom", "Region distance from bottom edge of frame",
>> +      OFFSET(region_str[BOTTOM]), AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
>> +    { "left",   "Region distance from left edge of frame",
>> +      OFFSET(region_str[LEFT]),   AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
>> +    { "right",  "Region distance from right edge of frame",
>> +      OFFSET(region_str[RIGHT]),  AV_OPT_TYPE_STRING, { .str = "0" }, .flags = FLAGS },
> 
> My comment may not apply here, but I sometimes wish all rectangle
> defining filters had compatible options.
> 
> I.e. drawbox and crop and delogo (which I use interchangably - e.g.
> first the one to visually determine the other's dimensions) aren't
> compatible with respect to order of unnamed options, and to names of
> variables in their expression (w, iw, ow, ...).
> 
> Can ROIs not also be defined as x, y, w, h?

Sure, it would be easy to change if people prefer that.  This was chosen pretty much entirely because it matches the structure definition (where I think the symmetric style is indeed cleanest?  I guess you could have the same debate there if you like...).  I certainly was making use of the order of options when using it, though - e.g. "addroi=h/4:h/4:w/4:w/4:-1/5" to highlight the central quarter of the frame.

Wrt variables, I don't have 'i'/'o' prefixed names because the input and output are the same frame.  Would "iw"/"ih" be better, or would that just be more confusing?

Thanks,

- Mark


More information about the ffmpeg-devel mailing list