Question about the new Size and Posiition keyframed presets

The new size and position keyframe presets are working very well.
My question is, how can I make my presets behave the way that the bundled presets work?

When I apply one of the included presets, for example slide in from left, the preset adapts to the video resolution. For instance if the video is 1280 x 720 the frame size for the size and position is 1280 x 720. If the video is a 1920 x 1080 video the frame size is 1920 x 1080.

My presets don’t work that way. If I create a preset for a 1080p clip the frame size will not adjust to a 720p clip and vice versa. Is there any way for a user to create “adaptive presets”?

1 Like

I’d be very interested to know if this is possible too.

1 Like
  1. Settings > App Data Directory > Show…
  2. presets > affineSizePosition (or movitSizePosition for GPU)
  3. open one of the stock presets in a text editor
  4. see how it uses percentages for the transition.rect property?
    Here is Slow Zoom In:
transition.rect: "0=0%/0%:100%x100%; -1=-5%/-5%:110%x110%"

The format of that value is:
time=X/Y:WxH; (repeat for other frame positions)
time -1 means the end
time “:1.0” means one second (a full time value woutld be
time “:-11.0” means one second from the end

  1. edit your preset in a text editor to use percentage values.
1 Like

Thank you. I’ll try it and report back if i can make it work.

That’s great. I’ll have a go tomorrow (UK time) and likewise report back.

I’ve just had a thought, to extend this question somewhat…

Would it be possible/straightforward enough for us to create combined effects in a similar manner, layering several together in one preset?

e.g. a single preset that could be selected that would set up a key-framed filter that combined a moving size&position filter with a graduated opacity effect, or a mask perhaps?

Got the X Y and Width and Height to work. Still can’t quite get the duration to work.

Think I finally figured it out (maybe).
This Zoom 2X preset works with all resolutions. Tried it with 720p 1080p and 2160p.

01 Zoom 2X.txt (215 Bytes)

1 Like

Yes, it has been discussed here. The idea is to build upon the Copy button in the Filters panel but to save the filter collection with a name.

Cheers Dan - It hadn’t even occurred to me that it might work that way. Nice one!

Didn’t have a chance to try this yesterday, so just had a go, and by Jiminy it works! Next thing is to do some combinations as per my last question.
@sauron I imported your preset into my SC and it works for me perfectly. A smooth zoom from 100% to 200% staying centred on the screen and it has worked in several resolutions.
This is the one I first tried which is an effect I use frequently - a point in the centre of the screen zooming in to a full picture.

Infinity Zoom In.txt (187 Bytes)

I have the same zoom preset except I call mine zoom 0 to full screen. Your infinity zoom worked perfectly except I had to change the “shotcut:animIn”: from 24 to 25 for the zoom to go all the way to full screen. I have no idea why it didn’t work with your original value.:confused:

Still having a some trouble with the time values. Here’s one that I’ve been trying to get to work but haven’t been able to. It’s a spin effect.

Spin H.txt (249 Bytes)

It’s supposed to spin the picture.

I had the same problem with an extreme zoom out effect just now - zooming out from 500% to 100%. It kept stopping at approx 160% size and didn’t go all the way to 100%. I changed “shotcut:animIn” from 24 to 30 and it worked. Something to do with the frame rate of the clip? (the clip I was using was 30fps as is most of what I use) I’ve now changed “shotcut:animIn” on both effects to a value of 60 (not many people work above 60fps AFAIK and it seems to be working OK. Maybe Dan will point us in the right direction later.
I was just about to have a go at a spin effect myself, so I’ll give it a spin* and we can compare notes :smiley:

*I’ll get me coat…

This spin filter seems to work. I’ve tried it on 3 different resolutions so far and seems OK. I tried to do it from scratch but was having trouble with the timing syntax (like yourself)
so I just created it manually in SC, saved it then edited all the pixel values into percentages.
It’s intended to create a 180 spin from side-on and back again over 3 seconds on a 30fps clip. I need to create some clips with different fps to test it further. If it’s applied to a clip longer than 3 seconds, there’s a proportionate pause on full screen in the middle, or you can pull on the key-frame tarballs to make a smooth spin of longer or shorter duration like with other presets.

Simple Spin In&Out.txt (251 Bytes)

I’ve just done the test on some 720p 15 fps footage using a custom video mode to match, and as I suspected, it stretches the transition to twice the length as when applied to 30fps footage. I can live with that myself, because I will be altering key-frame durations based on the length of the clips I’m using, or the pacing of the video anyway.
Dan - if there is a way of making the timing independent of the frame rate, it’d be handy to know, but if not, I’m not going to cry about it :wink:

Everytime a filter is newly added (not when reloaded), it recreates the stock presets setting shotcut:animIn and shotcut:animOut to the framerate of the current project. This is code in the filter’s UI (which is installed as Program Files\Shotcut\share\qml\filter\size_position\SizePositionUI.qml on Windows) There is currently no way to reproduce that behavior on custom presets. However, all the Slide… presets use shotcut:animIn = filter.duration. Why not simply adjust the simple animation as needed?

Thanks @QDSOV. Your file helped me figure out what the problem was with my spin effect. I was getting the spin out to work but the spin back to full screen was not working. Looking at your file I figured out the problem and now everything’s been fixed.

Vertical spin effect

01 Spin V.txt (243 Bytes)
Horizontal spin effect

Spin H.txt (243 Bytes)

Thanks @shotcut for providing all the information to make our presets work with all resolutions.

Hi Shotcut, sauron and QDSOV, great, this has inspired me to have a go at making some presets myself. But - I’m struggling with some aspects of the code, and how it works. For example in sauron’s code for 2X zoom:

1. transition.fill: 1
2. transition.distort: 0
3. transition.rect: "0=0%/0%:100%x100%; :1.0=-50%/-50%:200%x200%"
4. transition.halign: center
5. transition.valign: middle
6. "shotcut:animIn": 90
7. "shotcut:animOut": 0

I’m thinking I understand lines 1, 2, 4 and 5 but I’m struggling a lot with line 3 (ie what does “rect” mean, also not sure about all the numbers, especially the -50% bit…) and I’m stumped with lines 6 and 7 (no clue what it means!).

If anyone has a bit of spare time to explain lines 3, 6 and 7 in a bit more detail, I’d really appreciate it! Thanks!

I think it’s best if you create a preset manually in Shotcut. instead of trying to write the code from scratch.

I created all my presets in Shotcut then using the info that Dan provided in post # 3, edited the coordinate and pixel values, replacing the numbers with percentage values so the preset can be used with different resolutions.

Original preset created in Shotcut for a 2X zoom from 0 to 2X in 3 seconds.

transition.fill: 1
transition.distort: 0
transition.rect: 0=0 0 1920 1080 1;74=-960 -540 3840 2160 1
transition.halign: center
transition.valign: middle
“shotcut:animIn”: 75
“shotcut:animOut”: 0

Edited preset.

transition.fill: 1
transition.distort: 0
transition.rect: 0=0% 0% 100% 100% 1;74=-50% -50% 200% 200% 1
transition.halign: center
transition.valign: middle
“shotcut:animIn”: 75
“shotcut:animOut”: 0

The way I understand line 3, is that it defines the zoom parameters. In this case it’s starting at X 0 Y 0 at the upper left hand corner of the screen with a screen resolution of 1920 x 1080. Then the zoom ends at a screen position of X -960 by Y -540 and the screen size at that point is 3840 x 2160 which is double the original screen size of 1920 x 1080 yielding a 2X zoom.

Lines 6 and 7 I think have to do with the duration of the effect but I am not sure. I haven’t done much with any of the lines other than line 3. Once that line is edited the preset works with all resolutions and all you need to do is adjust the duration in Shotcut when you apply the preset. HTH and doesn’t create more confusion.

"rect’ is a common developer short form of “rectangle,” which has a position and size.
The shotcut:animIn and shotcut:animOut are the durations (in # frames) of the simple keyframes. They are shortened forms of “animate into” and “animate out from”. The reason they have a “shotcut:” prefix is because the others are understood by the engine MLT, but these are specific to and only used by the Shotcut UI.

@sauron and @shotcut, thanks guys for these very helpful explanations. It’s all making more sense to me now! I’ll look forward to playing around with these presets when I get a moment. I appreciate your responses.

You should be able to use “:1.0” for shotcut:animIn and shotcut:animOut to mean one second (vary the number for other seconds values, of course). The important thing to note is that the colon and decimal characters tell the engine this is a time value. Use appropriate decimal point character for your locale.