Question about the new Size and Posiition keyframed presets

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.

This is great! Using percentages, I believe I’ve basically recreated my favorites ones from Movie Maker:

  • Zoom In
  • Zoom In, Hold Top
  • Zoom In, Hold Bottom
  • Zoom In, Pan Left
  • Zoom In, Pan Right
  • Zoom Out
  • Zoom Out, Hold Top
  • Zoom Out, Hold Bottom
  • Zoom Out, Pan Left
  • Zoom Out, Pan Right

For example, here is Zoom Out, Hold Top-

transition.fill: 1
transition.distort: 0
transition.rect: “0=-10%/0%:120%x120%; -1=0%/0%:100%x100%”
transition.halign: center
transition.valign: middle
“shotcut:animIn”: “00:00:06.006”

I don’t know what shotcut:animIn is. What is that? Is that close to 6 seconds since that’s what I set as my duration on my photos? Is it weird that it has an extra 6 thousanths?

Now for panoramas that I want to pan while filling either height or width, I still need to do those custom since they are all different sizes. And I don’t think there is any way using percentages like this. Or is there some way to do that? For example, I have a 5909x2736 pano that I’d like to fill height and pan across the full width. I figured it out with a custom size/position filter. But can that be done in an adaptive preset somehow?

Thanks to @sauron for referring me to this thread.

The duration of a simple keyframe. animIn = simple keyframe at beginning, animOut = simple keyframe at the end

The duration of a simple keyframe. animIn = simple keyframe at beginning, animOut = simple keyframe at the end

Ok, sound good. But I wonder why I have an extra .006 seconds in there. Did I drag the black dot slightly past the end? :slight_smile: It doesn’t matter I guess, but my photos are all set initially to 6 seconds. Oh wait, even the stock presets are 6.006 seconds.

Since I may adjust the duration of individual photos in the timeline, I would also then have to adjust the keyframe to get the pan/zoom effect to match the duration. Sooo, you can see the next question coming… is there any way to set the keyframe duration of a preset to go the whole length of an item? I’m just using the beginning keyframe since I want the same pan/zoom throughout the duration.

Maybe it is due to your framerate. Frame counts are converted into time based on frame rate.
180 frames / (30000/1001 frames/sec) = 6.006 sec
(30000/1001) is the exact frame rate for what is commonly referred to as 29.97

not completely for simple keyframes. You already saw how " -1=…" accomplishes that. Simply remove the shotcut:animIn and shotcut:animOut lines from your preset to make the preset use regular keyframes.

Ok, but I’m looking at the Slow Zoom Out stock preset right now and it is-

transition.fill: 1
transition.distort: 0
transition.rect: “0=-5%/-5%:110%x110%; -1=0%/0%:100%x100%”
transition.halign: center
transition.valign: middle
“shotcut:animIn”: “00:00:06.006”

Does that file regenerate itself if the framerate changes?

Hmm regular keyframes instead of simple ones. I don’t know if I’m ready. Ok, I’ll experiment there.

Oh boy. I tried the stock Slow Zoom Out preset on a roughly 8 second image, and then it actually went the whole duration. How? Well I reopened the file in my text editor and now it said “shotcut:animIn”: “00:00:07.941”. So I guess that file is indeed actually changing every time I pick a different Timeline item.

However, my custom preset still doesn’t fill the duration. Ok then. Yeah Shotcut doesn’t know what I want with my presets.

So I tried removing that animIn line from my custom preset file like you said, and yes, it caused the keyframe to go the full duration of this longer item. Hah, great! Time to remove that from all my custom presets.

Hi @HikingMike - Just wondering if you were willing to share the code of your presets on here, and maybe post them as a .txt file? No worries if you’re not happy to do that!