Skip to content

Conversation

@balooii
Copy link

@balooii balooii commented Aug 6, 2025

Hi!

I think it would be a nice addition for the qtblend filter to be able to set the rotation anchor point so you can rotate around any point you want.

I (mis)used a rect type parameter for this as I didn't find a point-equivalent parameter type and just used x and y component out of it.

If you're interested in this change I'd be happy to change it to something more appropriate if you can guide me 🙂

Here are some examples how it could be used:

Rotate around bottom-right corner (1,1)

melt -profile hdv_720_25p color:red length=100 -filter qtblend rect="100 100 200 200 1" rotation=90 rotate_anchor="1 1 0 0 0" -consumer avformat:test_bottomright.mp4

Rotate around some point outside the rectangle (-0.5, 0.5)

melt -profile hdv_720_25p color:red length=100 -filter qtblend rect="100 100 200 200 1" rotation=45 rotate_anchor="-0.5 0.5 0 0 0" -consumer avformat:test_outside.mp4

Rotate around center (0.5, 0.5), equivalent to rotate_center set to 1

melt -profile hdv_720_25p color:red length=100 -filter qtblend rect="100 100 200 200 1" rotation=45 rotate_anchor="0.5 0.5 0 0 0" -consumer avformat:test_center.mp4

Rotate around top-left corner (0, 0), equivalent to rotate_center set to 0

melt -profile hdv_720_25p color:red length=100 -filter qtblend rect="100 100 200 200 1" rotation=45 rotate_anchor="0.5 0.5 0 0 0" -consumer avformat:test_topleft.mp4

In Inkscape this could be done like so:

inkscape_rotation_anchor.webm

@ddennedy
Copy link
Member

ddennedy commented Aug 6, 2025

I (mis)used a rect type parameter

That is fine. A lot of rect properties in MLT do not utilize the opacity field, and that is OK. However, an alternative is anchor_x and anchor_y. I do not have a preference. I want you to explore which is more convenient for Kdenlive and reply with your decision. Thank you

@balooii
Copy link
Author

balooii commented Aug 6, 2025

Thank you, I have reached out to JBM for another opinion.

Aesthetically I think I would prefer the two double params than using a rect for a point but don't really have a opinion.

I haven't looked at the Kdenlive keyframe/param model too deeply and don't know the one from Shotcut at all so maybe there is a preference based on how it will be used there at some point.

@ddennedy ddennedy requested review from j-b-m and jlskuz November 21, 2025 18:40
@ddennedy
Copy link
Member

Previously I wrote that Shotcut does not use qtblend. Well, it does use the transition now for track blending; so, I deleted it. But it does not use it as a transform filter. I recently had to do some work on the Shotcut Corner Pin UI, which is based on 4 points, and Shotcut does not have a point parameter type. The underlying frei0r plugin uses 2 distinct number parameters to represent the point. I used rect params in its UI, which has a visual control. It was quite a bit of ugly extra work to coordinate the rect-as-point with the discrete numbers--unrelated to rect having more fields than necessary. So, my vote is to use rect in case I adopt this into Shotcut or port it to another filter. However, priority goes to Kdenlive devs.

@j-b-m
Copy link
Contributor

j-b-m commented Nov 24, 2025

Thanks Dan for the input. I am also in favor of using a rect to handle position parameters. Reviewing this MR is on my todo list, hopefully I can move on with this in the coming weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants