Béizer masking while Zoomed AND keeping it Centred

BananaDuck wrote on 2/23/2019, 6:35 AM

Hello,

I'm using Sony vegas 16

I've recently come accustomed to the Béizer but there is one thing I am struggling to achieve. I looked everywhere, maybe my wording is wrong but basically what I am trying to achieve is tracking a certain area of my video I.e a person moving left to right, while ZOOMED but the object stays Centred throughout its moment.

I've tried various methods, one involved flipping horizontal the video and manged to achieve something to what I wanted but I all seems quite over the top.

 

Comments

klt wrote on 2/23/2019, 7:21 AM

If I understand you right, you need something like I needed too. I achieved this by modifying the motion track to pip script.

With this script I can copy motion tracking data to an event's pan/crop. Because of the nature of pan/crop, this results in a crop which follows the tracked object, but it stays on the screen where it is...

Look at here, you will find the script:

https://www.vegascreativesoftware.info/us/forum/motion-tracking-and-pan-crop-vegas-16-pro--113254/#ca702789

Ok, a small addition:

this works well with 1920*1080 videos, as the coordinates need to be tranformed. The resolution is hardcoded in the script, so if you need this for 4K, or 720p or whatever res. change those constants.

Last changed by klt on 2/23/2019, 7:22 AM, changed a total of 1 times.

Camera: JVC GY-HM600

Desktop: AMD Ryzen 5 1600, 16GB RAM (dual channel 2400 MHz) - Videocard: Radeon R9 380 2GB

Laptop: i5 5200u, 8GB RAM (1600MHz single channel) Videocard: integrated HD5500

BananaDuck wrote on 2/25/2019, 8:17 PM

If I understand you right, you need something like I needed too. I achieved this by modifying the motion track to pip script.

With this script I can copy motion tracking data to an event's pan/crop. Because of the nature of pan/crop, this results in a crop which follows the tracked object, but it stays on the screen where it is...

Look at here, you will find the script:

https://www.vegascreativesoftware.info/us/forum/motion-tracking-and-pan-crop-vegas-16-pro--113254/#ca702789

Ok, a small addition:

this works well with 1920*1080 videos, as the coordinates need to be tranformed. The resolution is hardcoded in the script, so if you need this for 4K, or 720p or whatever res. change those constants.

I seem to be getting this error https://gyazo.com/4e083ca498f2889da3897fc2d5194f95 Any idea what I'm doing wrong?

xberk wrote on 2/25/2019, 10:06 PM

I also tried running the "Copy motion track to pancrop.cs" script. Got the same errors as BananaDuck.

klt wrote on 2/26/2019, 12:05 AM

Seems your preferred text editors -Notepad?- inserts unwanted linebreaks, wordrwraps on paste.

Now I remember someone also had a problem with this and I uploaded the zipped scripts, but I forgot I did it.

https://drive.google.com/open?id=1yEssHCQtwUXPtSB0zHq_ywyArY7GIq8X

Sorry for being so forgetful.

Also, I have an idea to delete previously transferred pan/crop keyframes on subsequent transfers, recently I needed to modify pan/crops and I found uncomfortable to delete few hundred keyframes by hand, even if it's possible to select them all on the timeline.

So I'll polish this up a bit this week. If anyone interested, I'll upload it again.

I may play "Lego" again, and put back the ability to choose which to transfer, if more than one trackdata is present. Maybe choose target resolution, or grab it from the events properties somehow. But have to look into it if it's possible at all?

These are features I don't need myself, so I'll look into it only if at least 3 persons would want it. (Time to vote... 😀 )

BananaDuck wrote on 2/26/2019, 6:01 AM

Seems your preferred text editors -Notepad?- inserts unwanted linebreaks, wordrwraps on paste.

Now I remember someone also had a problem with this and I uploaded the zipped scripts, but I forgot I did it.

https://drive.google.com/open?id=1yEssHCQtwUXPtSB0zHq_ywyArY7GIq8X

Sorry for being so forgetful.

Also, I have an idea to delete previously transferred pan/crop keyframes on subsequent transfers, recently I needed to modify pan/crops and I found uncomfortable to delete few hundred keyframes by hand, even if it's possible to select them all on the timeline.

So I'll polish this up a bit this week. If anyone interested, I'll upload it again.

I may play "Lego" again, and put back the ability to choose which to transfer, if more than one trackdata is present. Maybe choose target resolution, or grab it from the events properties somehow. But have to look into it if it's possible at all?

These are features I don't need myself, so I'll look into it only if at least 3 persons would want it. (Time to vote... 😀 )

I've got it working to the desired effect! Thank you so much! I'm very grateful!

Joelson-Forte wrote on 2/26/2019, 8:01 AM

@klt

Here, in the last script you sent the x and y axes are inverted.

klt wrote on 2/26/2019, 8:57 AM

@Joelson-Forte

I'd say it is by design :)

This script is not intented to use INSTEAD of motion track to PIP. It has a completely different use which is impossible (AFAIK) with PIP FX.

See:

This is a short exaggerated example.

 

Killamarshian wrote on 2/26/2019, 12:42 PM

Thank you Kit, this is just what I was looking for and it works very well. 😁

xberk wrote on 2/26/2019, 1:20 PM

Thanks Kit. I got it working too. Nice to have.

Joelson-Forte wrote on 2/26/2019, 1:28 PM

@klt

Now I understood correctly. Your script copies the motion tracking and applies it to the pan crop to keep the subject in the center of the frame. Everything is working correctly here.

I thought that was great. It will be very useful here. Thank you!

klt wrote on 2/27/2019, 4:53 AM

Thank you guys.

I added the clear method before adding the keyframes. That ensures that if we retrack motion with different settings, such as different keyframe interval, the old keyframes won't interfere with the new ones.

Imagine: you track motion with keyframe interval = 5. Transfer track data to pan/crop. Then retrack the motion with keyframe interval = 20. In this case new keyframes would be transferred to pan/crop, but leaving there 2 additional unnecessary keyframes from the previous transfer before.

So I added a line with

trackEvent.VideoMotion.Keyframes.Clear ();

Sorry to say I cannot find a way to acces the video properties of the event from the script. So the resolution stays hardcoded, but moved it to the beginning of the script with declaring some constants:

    float Horizpixels = 1920;
    float Vertpixels = 1080;
    bool  MoveOnlyHorizontal = false;

Change those according to your needs.

MoveOnlyHorizontal tells, the pancrop should follow only the horizontal (X axis) movement of the motion.

If it's set to "false" both X and Y motions will be followed. If it's set to "true" only motion along X is followed.

I found sometimes following X only is better to follow a talking persons head.

If there are more masks with motiontrack data, the script asks which to use. Just like the original "Copy motion track to PiP" script, which was the base for this.

Actually this choice of which mask to use was there, I just forgot it. I'm terribly forgetful.

And the script is here:

https://drive.google.com/file/d/1e73bUB3_515zExvzbuaZSdMorVR9dUru/view?usp=sharing

And a very short example, in which I prepared only the tracking data before recording it:

If you need to modify the pan/crop that follows the movement, be sure to mak it on the very first keyframe, as that will be copied hundreds times with different center points.