Crop filter in scripts ignored in 2.7.8

Started by Andrew Wood, July 27, 2021, 08:40:45 PM

Previous topic - Next topic

Andrew Wood

Just a small frustration - going from 2.7.7 to 2.7.8, it seems that crop settings in my automation scripts are ignored as they don't have "ar_select" in the filter.

adm.addVideoFilter("crop", "top=4", "bottom=4", "left=4", "right=4", "rubber_is_hidden=False")

adm.addVideoFilter("crop", "top=4", "bottom=4", "left=4", "right=4", "rubber_is_hidden=False", "ar_select=0")

I have to manually add the ar_select in each script.

Not a biggie, but it caught me out.


Yes, incompatible interface changes between versions happen all over the place, much more to come in the next release. I'm sorry for inconvenience.


Silently breaking backwards compatibility on scripts is bad.
It's easy to manually write a wrapper function in python with default parameters for filters, ex:
addVideoFilter("crop", top, bottom, left, right, rubber_is_hidden=false, ar_select=0)

If script backwards compatibility is broken, adding such a layer could solve the issue going forward. Filter parameters need some documention also.


This is exactly what was done here as it is easily doable for methods where the argument list changes. But addVideoFilter() is different. IMVHO, the only way to move forward while remaining forward-compatible (accepting old scripts, but outputting new) would be renaming a filter on each API change ("crop" => "crop2" etc.) and creating a wrapper plugin to translate the parameter list. I hope that better solutions are possible.


The fun is about to intensify with 2.7.9 (or 2.8.0, whatever path will be chosen regarding incrementing version minor) as some users complained about the list of filters in the transform category growing too long, which has inspired szlldm to merge "Horizontal flip" and "Vertical flip" into a single filter with preview. Now all users with horizontal or vertical flip in their scripts will see Avidemux crash.


Just to be clear: I think that improving the application (like in case of the merged "Flip" filters) is more important than forward compatibility, despite the latter being a valuable goal on its own.

Andrew Wood

Thanks for the responses, they are appreciated.


The handling of only partially matching configuration should be now fixed for the crop filter by [1] and [2]. Other filters may need a similar treatment.

Thank you for raising the topic.