Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: Andrew Wood on July 27, 2021, 08:40:45 PM

Title: Crop filter in scripts ignored in 2.7.8
Post by: Andrew Wood on July 27, 2021, 08:40:45 PM
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.

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

2.7.8
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.
Title: Re: Crop filter in scripts ignored in 2.7.8
Post by: eumagga0x2a on July 27, 2021, 11:28:27 PM
Yes, incompatible interface changes between versions happen all over the place, much more to come in the next release. I'm sorry for inconvenience.
Title: Re: Crop filter in scripts ignored in 2.7.8
Post by: butterw on July 28, 2021, 08:59:52 AM
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.
Title: Re: Crop filter in scripts ignored in 2.7.8
Post by: eumagga0x2a on July 28, 2021, 09:35:16 AM
This is exactly what was done here (https://github.com/mean00/avidemux2/commit/78c3ef4f9066818e43ad0fe038b546b30ede3738) 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.
Title: Re: Crop filter in scripts ignored in 2.7.8
Post by: eumagga0x2a on July 28, 2021, 09:45:48 AM
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.
Title: Re: Crop filter in scripts ignored in 2.7.8
Post by: eumagga0x2a on July 28, 2021, 10:13:01 AM
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.
Title: Re: Crop filter in scripts ignored in 2.7.8
Post by: Andrew Wood on July 28, 2021, 06:09:07 PM
Thanks for the responses, they are appreciated.
Title: Re: Crop filter in scripts ignored in 2.7.8
Post by: eumagga0x2a on July 29, 2021, 01:19:14 AM
The handling of only partially matching configuration should be now fixed for the crop filter by [1] (https://github.com/mean00/avidemux2/commit/cfe1f1fd53cfe6164b470ff83350d434ae792e94) and [2] (https://github.com/mean00/avidemux2/commit/e978d281da8c2cfa2f67daf3e55bffc6bcf52311). Other filters may need a similar treatment.

Thank you for raising the topic.