Béizer masking while Zoomed AND keeping it Centred

BananaDuck schrieb am 23.02.2019 um 13:35 Uhr

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.

 

Kommentare

klt schrieb am 23.02.2019 um 14:21 Uhr

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.

Zuletzt geändert von klt am 23.02.2019, 14:22, insgesamt 1-mal geändert.

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 schrieb am 26.02.2019 um 03:17 Uhr

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 schrieb am 26.02.2019 um 05:06 Uhr

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

Paul B .. PCI Express Video Card: EVGA VCX 10G-P5-3885-KL GeForce RTX 3080 XC3 ULTRA ,,  Intel Core i9-11900K Desktop Processor ,,  MSI Z590-A PRO Desktop Motherboard LGA-1200 ,, 64GB (2X32GB) XPG GAMMIX D45 DDR4 3200MHz 288-Pin SDRAM PC4-25600 Memory .. Seasonic Power Supply SSR-1000FX Focus Plus 1000W ,, Arctic Liquid Freezer II – 360MM .. Fractal Design case ,, Samsung Solid State Drive MZ-V8P1T0B/AM 980 PRO 1TB PCI Express 4 NVMe M.2 ,, Wundiws 10 .. Vegas Pro 19 Edit

klt schrieb am 26.02.2019 um 07:05 Uhr

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 schrieb am 26.02.2019 um 13:01 Uhr

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!

Ehemaliger User schrieb am 26.02.2019 um 15:01 Uhr

@klt

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

klt schrieb am 26.02.2019 um 15:57 Uhr

@Ehemaliger User

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 schrieb am 26.02.2019 um 19:42 Uhr

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

xberk schrieb am 26.02.2019 um 20:20 Uhr

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

Paul B .. PCI Express Video Card: EVGA VCX 10G-P5-3885-KL GeForce RTX 3080 XC3 ULTRA ,,  Intel Core i9-11900K Desktop Processor ,,  MSI Z590-A PRO Desktop Motherboard LGA-1200 ,, 64GB (2X32GB) XPG GAMMIX D45 DDR4 3200MHz 288-Pin SDRAM PC4-25600 Memory .. Seasonic Power Supply SSR-1000FX Focus Plus 1000W ,, Arctic Liquid Freezer II – 360MM .. Fractal Design case ,, Samsung Solid State Drive MZ-V8P1T0B/AM 980 PRO 1TB PCI Express 4 NVMe M.2 ,, Wundiws 10 .. Vegas Pro 19 Edit

Ehemaliger User schrieb am 26.02.2019 um 20:28 Uhr

@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 schrieb am 27.02.2019 um 11:53 Uhr

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.

 

RealBlackinator schrieb am 20.09.2019 um 02:38 Uhr

This script doesn't appear to work with the new Vegas Pro 17, at least on my end. It doesn't detect any motion tracking data.

I suspect it needs a rewrite for the new version. I tried to do it myself by finding the included 'Copy Motion Track to PiP' script to figure out what needs to be changed. However, that script appears to have been moved to the Extensions menu and I can't find the folder for it.

 

Harold-Linke schrieb am 20.09.2019 um 18:47 Uhr

@RealBlackinator

there is a similar script available with my VEGASPython. It stabilizes a clip based on the tracking results.

You can find it here: https://www.hlinke.de/dokuwiki/doku.php?id=en:vegas_python_scripts

You need to install VEGASPython before you can use it.https://www.hlinke.de/dokuwiki/doku.php?id=en:vegas_python_download

I hope it is helpful.

If you have any question and any chnage request, please feel free to ask.

Harold

Zayo21 schrieb am 08.05.2020 um 02:07 Uhr

@RealBlackinator
If you want it for Vegas 17
Go to line 47
(Effect bezierFX = fxList.Find(x => (x.PlugIn.UniqueID == "{Svfx:com.sonycreativesoftware:bzmasking}"));)
and change sonycreativesoftware to vegascreativesoftware.

necromantis schrieb am 10.07.2022 um 19:02 Uhr

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.

 

Hello klt, the link is not working anymore, can you upload the working script? I was looking for this thing for a long time :)

Mykee schrieb am 12.11.2023 um 21:33 Uhr

Anyone have this script? None of the links work anymore. :(