[Request] Extension to modify Event length

Marco. wrote on 8/8/2019, 5:20 PM

Maybe someone could code an extension that allows to type a value which then inverse modifies the given timeline Event length.

For example if you have a timeline Event of 1 second length and you use the extension you would type-in a value of 0.1 which then would automatically set the new Event length to 10 seconds. Or you would type-in a value of 2 and the resulting timeline Event length then is 0.5 seconds.

Such an Extension would help a lot to correctly prepare a slow motion (or time lapse) effect.

Comments

Marco. wrote on 8/8/2019, 6:38 PM

Thanks. I'm aware of the way Vegasaur offers it. But that's not what I'm after. In Vegasaur there's no calculation based on the value you'd use to set the slomo ratio. The extension should avoid you'd need to calculate the new event length on your own. See the example I mentioned in my first post. Vegasaur can't do that.
It needs a calculation like this:
 

Input value (x)
Output value (y)
clip length in frames (a)
new clip length in frames (b)

y = (1/x)
b = a · y

I'm really looking for a separate single extension which we could offer for everyone to use side by side with the new Slow Motion FX.

wwaag wrote on 8/8/2019, 9:48 PM

@Marco.

When you say extension, I presume that a compiled script is OK? For a single event? Multiple events? For just one event, it's almost trivial. For more than one, it's a bit more complicated in that the events have to be rippled.

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

wwaag wrote on 8/9/2019, 12:16 AM

Try this.

Here's the link. https://www.dropbox.com/s/q6ktji0wxcr7ive/SetEventLength.dll?dl=0

It only does the first selected event. Used an upDown box since it eliminates the problem of decimal separators.

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

Marco. wrote on 8/9/2019, 2:40 AM

@wwaag
Thank you very much. This is very close. Yes, it's for a single event because it should only affect that one on which you would apply a slow motion (or timelapse) after. The way you coded is perfect.

Only the math used should be different. In the current version, the script uses the input value (x) in the way x·1 to adjust the event length. So a value of 2 doubles the event length and a value of 0.5 halfes it.
But it should be vice versa so after you run the script the affected event would be ready to adopt to the same slomo ratio.
An input value of 2 should halfe the event, an input value of 0.5 should double the length, reziprocal to the given one. This is because if you use a slow motion value of 0.5 your event needs to be doubled in length to keep all original frames (or a slomo value of 0.1 needs the event length to be 10x).

I think he math would be:

Input value (x) 
Output value (y) 
clip length in frames (a) 
new clip length in frames (b) 


y = (1/x) 
b = a · y

 

altarvic wrote on 8/9/2019, 5:27 AM

Vegasaur Rocket Speed can be your calculator 😳
It can also change the length but you will need to return playback rate to 1 or remove velocity envelope.

Marco. wrote on 8/9/2019, 5:37 AM

Yes, Rocket Speed calculation does calculate and set the event length the way expected. But with the need to manually set back the playback rate it's getting to much action again. And as much as I appreciate Vegasaur, in this very case I'm looking for a separate tiny tool. This is only meant as a small addendum for those ones using the new Slow Motion FX which does not work correctly if not the event length is adopted before.
With the math corrected, the compiled script wwaag offered above would be perfekt.

Former user wrote on 8/9/2019, 8:39 AM

@Marco. @wwaag @altarvic @Harold-Linke

In slow motion / fast motion cases, Premiere adjusts the event length according to the defined parameters. In Vegas you need to creat a subclip, apply the envelope, set the parameters, and manually extend the event to the loop point to be the correct length.

Maybe it's something for the development team to consider, or maybe some outside developer might come up with an extension that does it in Vegas. It would be a great resource.

@altarvic

Vegasaur currently has the "Velocity 2 Twixtor" command that converts the speed envelopes to Twixtor keyframes. In a future update of the Vegasaur there could be the "Velocity 2 Vegas Slow Motion" that converts the speed envelopes to Vegas Slow Motion keyframes.

Harold-Linke wrote on 8/9/2019, 8:48 AM

Hi Marco,

I first needed to read the other thread reagdring Slo Motion to understand what you need.

Here is a VEGASPython script that sets the event length (including grouped events like audio) to the event length need for the specified slo mo rate.

You can download the script from here:

https://github.com/haroldlinke/VEGASPython_Scripts

It is named:

"SetEventLengthForSlowMo.py"

I hope it is helpfull.

Kind regards

Harold

 

Marco. wrote on 8/9/2019, 9:43 AM

Hi Harold,

thanks a lot. Though for some reason your script does not appear. I put it into the same folder as e.g. your VegasSceneDetect script is but Vegas Pro does not seam to read the SetEventLengthForSlowMo script.

If I try to run it manually by using the VegasPython Interactiv Window, this is what I get:

Harold-Linke wrote on 8/9/2019, 10:36 AM

Hi Marco,

it seems that Github adds html code to the link.

Here is the script in a zip file from my domain:

https://www.hlinke.de/dokuwiki/doku.php?id=en:vegas_python_users#additional_vegaspython_scripts

Harold

 

wwaag wrote on 8/9/2019, 10:40 AM

@Marco.

Try it now. Same link.

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

Marco. wrote on 8/9/2019, 10:52 AM

@Harold-Linke @wwaag
Thank you both! Both of your scripts work perfect now and with given two slightly different of it, users even would have the choice of either using the one which also affects the grouped audio event or the video event only. Dependend on the particular case both versions can be very useful.

Thanks again. The forum would need to be able to use the "Solution" tag for multiple posts …

Harold-Linke wrote on 8/9/2019, 11:06 AM

Hi Marco,

thank you for the idea and testing. unfortunately I have not found any description how the slow motion should be used. Is it correct that you also have to apply a speed envelope to the event as VEG mentions?

Maybe it would be good to add this to the script.

Marco. wrote on 8/9/2019, 11:21 AM

I use the Slow Motion FX as follows:

- Trim the timeline video event.
- Apply one of the SetEventhLength scripts and use the desired Slomo ratio (e.g. 0.5 for a 50 % slow motion).
- Apply the Slow Motion FX.
- Select a quality setting from the dropdown menu.
- Start "Analyze Motion".

Once the analyze process is done:

- Select a method ("Optical Flow" recommended).
- Set the playback rate (again e.g. 0.5 for a 50 % slow motion, same value used for the script).

Done. Now render the result.

The very critical point is that you need to set the new event length before you apply the Slow Motion FX!

No need for further actions. You may make a subclip once you trimmed the event and before you run the script but that's not mandatory (I think this reduces time to analyze). A speed envelope should not be set. That's just the way the Speed Rocket tool in Vegasaur works.

Harold-Linke wrote on 8/9/2019, 11:58 AM

Hi Marco,

 

thank you for the description. But this process does not make much sense for me.

If you want to apply a slow mo of 50% to a 10 event, your second step extends the event to 20 seconds. So you have the clip twice in the 20 seconds.

When the slomo effects now analyses the movement (before knowing that you want at 50% slowmotion) then it analyses 20 seconds instead of 10 seconds clip - waisting a lot time.

And then you tell the effect that you only need the first 10 seconds of the clip.

Sounds strange. Or am I missing something.

 

Harold

 

Marco. wrote on 8/9/2019, 12:06 PM

This strange handling is caused by the existing bug in this tool. It's a workaround. But even if the bug would not exist we would have to set a new event length, then after having used the Slow Motion FX not before like we have to do now (right as we have to do with the legacy slomo tool of Vegas Pro (Velocity Envelope or setting the playback rate)).

So overall the perfect solution of course would be if everything would be automated just like user Veg mentioned it, like it's done in Premiere.

Former user wrote on 8/9/2019, 12:47 PM

So overall the perfect solution of course would be if everything would be automated just like user Veg mentioned it, like it's done in Premiere.

It would be great!

Jack S wrote on 8/10/2019, 5:14 AM

Marco

I'm new to scripting. Can you tell me how I install these two please?

Thanks

My system
Genshin Infinity Gaming PC
Motherboard Gigabyte H610M H: m-ATX w/, USB 3.2, 1 x M.2
Power Supply Corsair RM750X
Intel Core i7-13700K - 16-Core [8P @ 3.4GHz-5.4GHz / 8E @ 2.50GHz-4.20GHz]
30MB Cache + UHD Graphics, Ultimate OC Compatible
Case Fan 4 x CyberPowerPC Hyperloop 120mm ARGB & PWM Fan Kit
CPU Fan CyberPowerPC Master Liquid LITE 360 ARGB AIO Liquid Cooler, Ultimate OC Compatible
Memory 32GB (2 x 16GB) DDR5/5200MHz Corsair Vengeance RGB
MSI GeForce RTX 4060 Ti 8GB - Ray Tracing Technology, DX12, VR Ready, HDMI, DP
System drive 1TB WD Black SN770 M.2 NVMe PCIe SSD - 5150MB/s Read & 4900MB/s Write
Storage 2 x 2TB Seagate BarraCuda SATA-III 6.0Gb/s 7200RPM
Windows 11 Home (x64)
Monitors
Generic Monitor (PHL 222V8) connected to GeForce RTX 4060 Ti
Generic Monitor (SAMSUNG) connected to iGPU

Camcorder
SONY Handycam HDR-XR550VE

Marco. wrote on 8/10/2019, 5:21 AM

The script wwaag provided simply needs to be moved into the Script Menu folder of the Vegas Pro program folder. It then appears as a script in the Vegas Pro menu Tools/Scripting.

The script Harold-Linke posted is based on VegasPython which needs this Python framework to be installed before and then his script could be used as extension from the Vegas Pro menu Tools/Extensions.
More about Harolds VegasPython project to be seen here.

Jack S wrote on 8/10/2019, 5:47 AM

Thanks Marco. Thanks also to wwaag and Harold-Linke for their efforts. Greatly appreciated.

My system
Genshin Infinity Gaming PC
Motherboard Gigabyte H610M H: m-ATX w/, USB 3.2, 1 x M.2
Power Supply Corsair RM750X
Intel Core i7-13700K - 16-Core [8P @ 3.4GHz-5.4GHz / 8E @ 2.50GHz-4.20GHz]
30MB Cache + UHD Graphics, Ultimate OC Compatible
Case Fan 4 x CyberPowerPC Hyperloop 120mm ARGB & PWM Fan Kit
CPU Fan CyberPowerPC Master Liquid LITE 360 ARGB AIO Liquid Cooler, Ultimate OC Compatible
Memory 32GB (2 x 16GB) DDR5/5200MHz Corsair Vengeance RGB
MSI GeForce RTX 4060 Ti 8GB - Ray Tracing Technology, DX12, VR Ready, HDMI, DP
System drive 1TB WD Black SN770 M.2 NVMe PCIe SSD - 5150MB/s Read & 4900MB/s Write
Storage 2 x 2TB Seagate BarraCuda SATA-III 6.0Gb/s 7200RPM
Windows 11 Home (x64)
Monitors
Generic Monitor (PHL 222V8) connected to GeForce RTX 4060 Ti
Generic Monitor (SAMSUNG) connected to iGPU

Camcorder
SONY Handycam HDR-XR550VE

Harold-Linke wrote on 8/15/2019, 10:46 AM

@Marco. , @Former user:

I have created a new VEGASPython script that does everything in one go. It first asks for the slo mo rate then adjusts the event length, adds the slow motion effect, starts the analysis and then updates the slo motion rate parameter with the entered slo mo rate.

The script is named: Add_SlowMotion_to_selected_clips.py

I have created a new page where you can all available script directly and save it into the VEGASPython_PN folder. https://www.hlinke.de/dokuwiki/doku.php?id=en:vegas_python_scripts

Direct link to the script: https://www.hlinke.de/dokuwiki/lib/exe/fetch.php?media=en:add_slowmotion_to_selected_clips.py

Harold

 

Marco. wrote on 8/15/2019, 11:55 AM

@Harold-Linke
Thanks a lot. The new script works pretty fine with one exception. It also already starts the analyze proces which I think it should not do. The way it works it would always use the default "Coarse" (which I never use) and if you'd rather want to use "Medium" or "Fine" you first need to clear the analyzed motion data, select a different mode and re-start the analyze process.

Edit:
Sorry, I see why the script does this. There's no way to set the slomo rate before not the analyze proces was done. Then maybe it's a good trade-off the way it works.

Harold-Linke wrote on 8/16/2019, 5:08 AM

@Marco.

you are right it is not a good idea to start the analysis automatically, as you cannot set the quality and you do not see the progress bar.

I found that I can set the slow motion rate before the analysis is executed. So this should be ok now.

I replaced the old version with a new version that does not start the analysis anymore.

I hope this is more user friendly.

Thank you for your comments.

Harold

 

 

Marco. wrote on 8/16/2019, 5:36 AM

Perfect now!