VEGASPYTHON 1.01: New feature - Invert_Copy_Motion_Track_to_PiP_Values

Harold-Linke wrote on 8/18/2019, 5:34 AM

I am glad to announce the release of VEGASPython 1.01 including a new feature Invert_Copy_Motion_Track_to_PiP_Values

https://www.hlinke.de/dokuwiki/doku.php?id=en:vegas_python_download

The main new feature for users is

  • Invert_Copy_Motion_Track_to_PiP_Values:

VEGAS 17 introduced an update of the Motion Tracker including planar tracking. Together with the new PIP (Picture-in-Picture) effect the motion tracker allows to attach media to an object. To achieve this the VEGAS extension „Copy motion track to PIP“ has to be used to transfer the motion tracking information from the tracker to the PIP effect.

Instead of letting a PIP follow an object in a clip, you can use the motion tracker for stabilising a clip too.

The advantage of using the motion tracker for stabilising is that you can select the object that should be stabilzed. In special cases this might give better results than a normal stabilizer can provide.

Using the motion tracker for stabilising is done by inverting the values copied from the tracker to the PIP. This neutralises the movement of the tracked object and it does not leave its position on the screen anymore.

The script for inverting the copied tracking values is part of VEGASPython 1.01.

Please follow the instruction here: https://www.hlinke.de/dokuwiki/doku.php?id=en:vegaspython_clip_stabilisation_using_mt

 

For developers VEGASPython provides one new feature:

  • font and font size of the VEGASPython interactive Window can now be configured in the VEGASpython Config file

Harold

Comments

Marco. wrote on 8/18/2019, 2:41 PM

Don't know what it is. Since I installed VegasPython 1.01 none of your extensions work the direct way via Tools/Extensions. I can only use them via the interactive window.

Harold-Linke wrote on 8/18/2019, 4:10 PM

Thanks for your feedback Marco.

I will check this tomorrow evenning.

Harold

Harold-Linke wrote on 8/18/2019, 11:51 PM

@Marco. I think I see where the problem is.

I made an error when creating the zip file. It start with a folder VEGASPython_V01.01. The content of this folder needs to be moved up to the main folder Vegas Application Extensions and the folder VEGASPython_V01.01needs to be removed. I hope it works then.

I will correct the zip file later today.

Harold

Marco. wrote on 8/19/2019, 2:20 AM

I already did that. With only copying the main folder, each script would throw an error message ("invalid pointer"). With copying files and subfiles there is no error message, but the py scripts don't work either if not used from the interactive window.

Edit:
There is still that "invalid pointer" message, eg. when I try to use "Add_2_Second_Gap".

 

Harold-Linke wrote on 8/19/2019, 11:56 AM

@Marco. Thanks. You are a very good tester. You stumbled into a very seldom error.

I updated the VEGASpython_V01.01.zip.

Harold

Marco. wrote on 8/20/2019, 3:56 AM

Yes, it works now. Also your new extension "Invert_Copy_Motion_Track_to_PiP_Values" works fine. I'm still testing which kind of footage is best to use this solution. So far I can say – same as for the standard stabilizer – if you have a CMOS based video recording you should apply a good CMOS fixer before using this workflow. The result will be much better.

There's another way to get rid of the border of the stabilized event: In the keyframe panel of the PiP FX select all keyframes, then adjust the size.

@Harold-Linke Could you elaborate what you mean with the second option – adding the reference keyframe below track B?

Harold-Linke wrote on 8/20/2019, 11:53 AM

Hi Marco, sure.

the problem with all stabilisation solutions is that they shift the frame and create moving borders. You can compensate these moving border by zooming into the image.

If you are simulating a fixed camera and you want to avoid to zoom in, you can replace the borders by using parts of another frame. The best frame for this is the reference frame that you used as the starting point for the motion tracking. This is the only frame where the PIP is not moved or sheared (all delta values of the tracker are 0 for this frame). If you put this frame (using freeze frame) into the background of the stabilised clip the borders are gone. Depending on the the clip and scene you may see some movement.

Does this explanation make it clearer?

Harold

 

lan-mLMC wrote on 9/19/2019, 2:10 AM

If I change the filnname to other language such CN or KR, the script can't function.

Harold-Linke wrote on 9/20/2019, 11:42 AM

@lan-mLMC

Thank you for your interest.

Question 1: Is it related to VEGASPython at all or to the stablisation script? For the stabilisation script there is a short description here: https://www.hlinke.de/dokuwiki/doku.php?id=en:vegaspython_clip_stabilisation_using_mt

If you have a problem, please aks, I am happy to help.

Question 2: Yes, I can. You can find the new script here: https://www.hlinke.de/dokuwiki/doku.php?id=en:vegas_python_scripts

The last script in the table.

Question 3: What do you want to achieve? If translate the script and chnage the filename and keep it in the same directory, the system will recognize the new VEGASpython script with the next restart of VEGAS.

If you have translations of a script I would be happy to add them to my script list.

Harold

lan-mLMC wrote on 9/20/2019, 1:29 PM

@lan-mLMC

Thank you for your interest.

Question 1: Is it related to VEGASPython at all or to the stablisation script? For the stabilisation script there is a short description here: https://www.hlinke.de/dokuwiki/doku.php?id=en:vegaspython_clip_stabilisation_using_mt

If you have a problem, please aks, I am happy to help.

Question 2: Yes, I can. You can find the new script here: https://www.hlinke.de/dokuwiki/doku.php?id=en:vegas_python_scripts

The last script in the table.

Question 3: What do you want to achieve? If translate the script and chnage the filename and keep it in the same directory, the system will recognize the new VEGASpython script with the next restart of VEGAS.

If you have translations of a script I would be happy to add them to my script list.

Harold

Thanks, the new script work fine.

However if I change the name of the script ("add_markers_at_interval_ui.py") to CN or KR, it can't work in VEGAS Pro (clicking the script can't result in anything ). The changed script link.

Vincent-Mesman wrote on 9/21/2019, 5:20 AM

Hi Harold,

I'm unable to test your script at this moment so I have to ask directly: is there a method to fade-in/out the correction of your script?

I'd like to be able to gradually switch from one object to another because objects tend to disappear outside the frame or in motion blur.

Harold-Linke wrote on 9/21/2019, 6:05 AM

@lan-mLMC,

Question 1: CN or KR filename: there seems to be an issue with PythonNet when using non-ASCII identifiers and filenames. Your filenames look very strange when I download them: "按一定间隔添加标记_ui.py"

Is this correct?

The same issue is with your video file: "究极风暴-革命-开头.mp4"

Question 3: Unfortunately the script is changing all clips and not only the selected clips. Do you need a version affecting selected clips only?

@Vincent-Mesman

No this is not possible yet. Sounds interesting. Do you have an example and how should this work?

lan-mLMC wrote on 9/21/2019, 6:21 AM

@lan-mLMC,

Question 1: CN or KR filename: there seems to be an issue with PythonNet when using non-ASCII identifiers and filenames. Your filenames look very strange when I download them: "按一定间隔添加标记_ui.py"

Is this correct?

The same issue is with your video file: "究极风暴-革命-开头.mp4"

Question 3: Unfortunately the script is changing all clips and not only the selected clips. Do you need a version affecting selected clips only?

@Vincent-Mesman

No this is not possible yet. Sounds interesting. Do you have an example and how should this work?

Question 1: Is there a solution to solve it to support non-ASCII identifiers ?

video file: "究极风暴-革命-开头.mp4", I change it to 1234.mp4 and scenedetect still can't work. link

Question 3:Yes, thanks.

Vincent-Mesman wrote on 9/21/2019, 7:56 AM
@Vincent-Mesman

No this is not possible yet. Sounds interesting. Do you have an example and how should this work?

For example: a panning shot with tracked items that disappear outside the frame.

I'm not sure about the possibilities of your script and how it references one or more trackers but I can imagine your script could use a frame number and the number of transition frames to blend linear between the two trajectories of both trackers.

You may also want to consider a fade-in from the default position/scale/rotation (a 2D 100% coverage of the source) at the beginning and a fade-out at the end of the clip into the default pos/sca/rot.
Multiple trackers would be ideal but maybe that's too much work.

Maybe a simplistic approach ("switching" instead of "blending") would be easier for you, by adding an option to use the end position/scale/rotation of another event as the start position/scale/rotation.
Less advanced but still highly useable.

Harold-Linke wrote on 9/22/2019, 5:00 AM

@lan-mLMC

I tested your video. It has a variable framerate and this is not support in vegasScenedetect. I will add a remark to the description.

Unfortunately I do not have much time at the moment to update the script for selected events. This is much more complicated as there are more questions that can come up, e.g. if you select a clip in the middle of the timeline, what shall the script do? ripple the following events? How to handle grouped events? Move them accordingly? What to do if you selected two events that are grouped? Move twice or only once? etc.

This will take some time. I will inform you when it is available.

@Vincent-Mesman

Nice idea. As I said I have unfortunately not much time now. I will think about it and will come back too you.

Harold

Harold-Linke wrote on 9/22/2019, 6:04 AM

Unfortunately there is no quick solution. I have a workarround in mind but this needs also some time.

Harold

Vincent-Mesman wrote on 9/22/2019, 9:38 AM

@lan-mLMC

I tested your video. It has a variable framerate and this is not support in vegasScenedetect. I will add a remark to the description.

Unfortunately I do not have much time at the moment to update the script for selected events. This is much more complicated as there are more questions that can come up, e.g. if you select a clip in the middle of the timeline, what shall the script do? ripple the following events? How to handle grouped events? Move them accordingly? What to do if you selected two events that are grouped? Move twice or only once? etc.

This will take some time. I will inform you when it is available.

@Vincent-Mesman

Nice idea. As I said I have unfortunately not much time now. I will think about it and will come back too you.

Harold

Hi Harold,

For your (future) experiments I just shot an unstable pan shot with a Sony PMW-EX1:
http://home.kpn.nl/vincentmesman/pan_shot.zip
It's 1080p25, shutter=90°, 8 bit mp4 video, (silent) stereo 48 kHz 16 bit PCM audio.
I used a small shutter angle to minimize motion blur.
If you apply the "VEGAS Stabilize" plugin with default settings, the result is quite stable.

To simplify user interaction, here is another method idea:

step 1 - cut an event into smaller events
step 2 - generate tracker in each event
step 3 - manually select all clip parts: 1, 2, 3 ... n
step 4 - call script
step 5 - process each event, and use the last translation settings of the previous event as a start translation

To prevent a "freeze frame" between shots, here is another method idea:

step 1 - copy an event multiple times, place them on different tracks at the same time
step 2 - cut events (with overlap for crossfade) but don't move them in time to keep them in sync
step 3 - generate tracker in each event
step 4 - manually select all clip parts: 1, 2, 3 ... n
step 5 - call script
step 6 - process each event, and use the [*] translation settings of the previous event as a [*] translation

Where [*] can be any moment in time during the overlap of the two overlapping events.
For instance 50% would be in the middle of the overlap, 0% at the beginning, 100% at the end.
If trackers of the overlapping events have the same motion vector it's now easy to blend by using fade-out and fade-in. If they don't match very well it's better to keep the overlap short (2 frames) or even zero.

I'll take a closer look into this myself as soon as possible.

Have fun!

Harold-Linke wrote on 9/23/2019, 11:55 AM

@Vincent-Mesman

I had a look at your videoclip. What do you want to stabilize in this clip?

Maybe there is a missunderstanding:

What the script is doing: It allows you to track an object in your clip e.g. one of the ships. WEhen you then apply the script the trackled ship will be nailed to the screen and not molve anymore. In you case this will look strange as you pan to the left and the right there will be not much stable video be left.

Maybe I am missunderstanding what you want to achieve.

Harold