Apply plugin and run analyze button via script

marcinzm wrote on 4/18/2023, 4:50 PM

Hello,

Is it possible to apply Prodad Marcalli v5 Pro plugin effect on event via script and also via script fire "Analyze" button?

I would like to click analyze stabilization button via C# script.

Regards
Marcin

Last changed by marcinzm

If you are bored, drink water, you will want to pee. -> Albert Einstein - my idol!

I am 42. I have been creating videos since 2009 (the date when my first daughter was born in). My first video software was Pinnacle, next one was Sony Vegas 8 (I am not sure if remember it correctly). I am also a developer and wedding movie operator and editor. For example: I have created an Android app which let me control Vegas Pro rendering progress level on Android smartphone. I created it for fun, because I also love programming. I also created my own plugin for Audio To Text feature specified usage from Vegas Pro 19. I created proxy creation plugin which uses multiple GPU threads (maximum 3) to create proxy files for Vegas Pro. I also written many others plugin/softwares which enhance my video editing, also wedding editing.

Camera/video camera: Sony FX3, Sony A7 III, Sony FDR AX 100, Canon 5D Mark III, GoPro Hero Black 7,8,9,10

Lenses for Sony: Tamron 28-75mm F/2.8 Di III , Sony 24mm gm 1.4 FE, Sony 20 mm G FE 1.8

Lenses for Canon: Canon EF 24-70 mm F/2.8 L USM, Canon 70-200 f/2.8 L

Drone: DJI Mavic 3 & DJI Phantom 4 Pro v2.0

 

Editing: Vegas Pro 20 (365) with a lot of third party plugins, also my own plugins written in C#

 

PC:

CPU: Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz   3.31 GHz

RAM: 128 GB

GPU: Nvidia RTX 2080 TI

storage: 4 SSD drives (including two M.2 flash drives) and two HDD drives

Windows system: 10 Home edition

Comments

jetdv wrote on 4/18/2023, 7:35 PM

Peter_P wrote on 4/19/2023, 12:41 AM

@marcinzm

AddMercalli not only works with Mercalli but also with the Vegas internal Stabilizer and it can automatically decide to use a preset for static or another for 'dynamic' scenes. Just try it, it is free.

marcinzm wrote on 4/19/2023, 4:28 AM

@jetdv
 

Thank you again for your help.

Thank you all for your replies.

 

Here are my code, which works and covers my requirements:

 

using System;
using ScriptPortal.Vegas;
using System.IO;
using System.Text;
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows.Forms;


public class EntryPoint
{

    Vegas myVegas;

    public void FromVegas(Vegas vegas)
    {

        myVegas = vegas;
        string p_czy_usunac_efekt="TN";
        
        DialogResult dialogResult = MessageBox.Show("Czy zastosować efekt dot. stabilizacji video ProDad Marcalli v4 i uruchomić automatycznie stabilizację?", "Pytanie o stablizację ujęć", MessageBoxButtons. YesNoCancel);
        if(dialogResult == DialogResult. Yes)
        {
            //kod jest nizej
        }
        else if (dialogResult == DialogResult.No)
        {
                return;
        }
        else
        {
            return;        
        }
        
        foreach (Track track in myVegas.Project.Tracks)
        {
                if (track.IsAudio())
                {
                    continue;
                }

                foreach (TrackEvent evnt in track.Events)
                {

                    if (!evnt.Selected)
                    {
                        continue;
                    }

                    var plugInName="{Svfx:com.proDAD:StabilizerV4}";
                    var fx = myVegas.VideoFX;

                    /*if (effect.PlugIn.UniqueID == effID)*/

                    /*foreach (PlugInNode fx1 in myVegas.VideoFX)
                    {
                        string s = fx1.Name + " - " + fx1.ClassID + " UID: " + fx1.UniqueID + "  isOFX: " + fx1.IsOFX+Environment.NewLine;
                        File.AppendAllText(@"d:\PluginX.txt",s);
                    }*/

                    var plugIn = fx.GetChildByUniqueID(plugInName);
                    
                    if (null == plugIn)
                    {
                        MessageBox.Show("Nie znaleziono plug-in o nazwie: '"+plugInName+"'");
                        return;
                    }
                    VideoEvent vEvnt=(VideoEvent)evnt;

                    foreach (Effect ve in vEvnt.Effects)
                    {
                        if (ve.PlugIn.UniqueID==plugInName)
                        {

                            if (p_czy_usunac_efekt.Equals("TN"))
                            {
                                DialogResult dialogResult1 = MessageBox.Show("Zauważyłem, że wcześniej już dodano efekt stabilizujcy proDAD Marcalli v4? Czy usunąć nadany wcześniej efekt i uruchomić analizowanie stabilizacji jeszcze raz?"+Environment.NewLine+Environment.NewLine+"UWAGA!!! Zmiana zostanie zastosowana do wszystkich klipów.", "Pytanie o usunięcie stablizacji ujęć", MessageBoxButtons. YesNoCancel);
                                if(dialogResult1 == DialogResult.Yes)
                                {
                                    p_czy_usunac_efekt="T";
                                }
                                else if(dialogResult1 == DialogResult.No)
                                {
                                    p_czy_usunac_efekt="N";
                                }
                                else
                                {
                                        return;
                                }
                            }
                            
                            if (p_czy_usunac_efekt.Equals("T"))
                            {
                                vEvnt.Effects.Remove(ve);
                            }
                        }
                    }


                    var effectX = new Effect (plugIn);
                    vEvnt.Effects.Add(effectX);

                    /*if (null!=presetName)
                    {
                        effect.Preset = presetName;
                    }*/

                    if (effectX.PlugIn.IsOFX)
                    {
                        OFXEffect ofx = effectX.OFXEffect;
                        foreach (OFXParameter ofxparm in ofx.Parameters)
                        {
                            if (ofxparm.ParameterType.ToString()=="PushButton")
                            {
                                ofxparm.ParameterChanged();
                            }
                        }

                    }
            }
            
        }
        
        
    }

    

}

Last changed by marcinzm on 4/19/2023, 10:40 AM, changed a total of 2 times.

If you are bored, drink water, you will want to pee. -> Albert Einstein - my idol!

I am 42. I have been creating videos since 2009 (the date when my first daughter was born in). My first video software was Pinnacle, next one was Sony Vegas 8 (I am not sure if remember it correctly). I am also a developer and wedding movie operator and editor. For example: I have created an Android app which let me control Vegas Pro rendering progress level on Android smartphone. I created it for fun, because I also love programming. I also created my own plugin for Audio To Text feature specified usage from Vegas Pro 19. I created proxy creation plugin which uses multiple GPU threads (maximum 3) to create proxy files for Vegas Pro. I also written many others plugin/softwares which enhance my video editing, also wedding editing.

Camera/video camera: Sony FX3, Sony A7 III, Sony FDR AX 100, Canon 5D Mark III, GoPro Hero Black 7,8,9,10

Lenses for Sony: Tamron 28-75mm F/2.8 Di III , Sony 24mm gm 1.4 FE, Sony 20 mm G FE 1.8

Lenses for Canon: Canon EF 24-70 mm F/2.8 L USM, Canon 70-200 f/2.8 L

Drone: DJI Mavic 3 & DJI Phantom 4 Pro v2.0

 

Editing: Vegas Pro 20 (365) with a lot of third party plugins, also my own plugins written in C#

 

PC:

CPU: Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz   3.31 GHz

RAM: 128 GB

GPU: Nvidia RTX 2080 TI

storage: 4 SSD drives (including two M.2 flash drives) and two HDD drives

Windows system: 10 Home edition

jetdv wrote on 4/19/2023, 8:21 AM

@marcinzm, glad you got it working!

marcinzm wrote on 4/19/2023, 10:41 AM

@jetdv

 

Thank you again, You are my Vegas Scripting guru in this forum.

If you are bored, drink water, you will want to pee. -> Albert Einstein - my idol!

I am 42. I have been creating videos since 2009 (the date when my first daughter was born in). My first video software was Pinnacle, next one was Sony Vegas 8 (I am not sure if remember it correctly). I am also a developer and wedding movie operator and editor. For example: I have created an Android app which let me control Vegas Pro rendering progress level on Android smartphone. I created it for fun, because I also love programming. I also created my own plugin for Audio To Text feature specified usage from Vegas Pro 19. I created proxy creation plugin which uses multiple GPU threads (maximum 3) to create proxy files for Vegas Pro. I also written many others plugin/softwares which enhance my video editing, also wedding editing.

Camera/video camera: Sony FX3, Sony A7 III, Sony FDR AX 100, Canon 5D Mark III, GoPro Hero Black 7,8,9,10

Lenses for Sony: Tamron 28-75mm F/2.8 Di III , Sony 24mm gm 1.4 FE, Sony 20 mm G FE 1.8

Lenses for Canon: Canon EF 24-70 mm F/2.8 L USM, Canon 70-200 f/2.8 L

Drone: DJI Mavic 3 & DJI Phantom 4 Pro v2.0

 

Editing: Vegas Pro 20 (365) with a lot of third party plugins, also my own plugins written in C#

 

PC:

CPU: Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz   3.31 GHz

RAM: 128 GB

GPU: Nvidia RTX 2080 TI

storage: 4 SSD drives (including two M.2 flash drives) and two HDD drives

Windows system: 10 Home edition

marcinzm wrote on 4/19/2023, 5:51 PM

@jetdv

 

One more question JetDV. I would like to write a script which can set up a previously specified value to Master Audio Effect. I mean exactly LoudMax64 plugin. I notice that this audio effect is not OFX effect (LoudMax64    (VST2, 64 Bit) - isOFX: False).

Can you help me how can I set up a value for non OFX audio effects? Is it possible at all?

 

Regards

Marcin

If you are bored, drink water, you will want to pee. -> Albert Einstein - my idol!

I am 42. I have been creating videos since 2009 (the date when my first daughter was born in). My first video software was Pinnacle, next one was Sony Vegas 8 (I am not sure if remember it correctly). I am also a developer and wedding movie operator and editor. For example: I have created an Android app which let me control Vegas Pro rendering progress level on Android smartphone. I created it for fun, because I also love programming. I also created my own plugin for Audio To Text feature specified usage from Vegas Pro 19. I created proxy creation plugin which uses multiple GPU threads (maximum 3) to create proxy files for Vegas Pro. I also written many others plugin/softwares which enhance my video editing, also wedding editing.

Camera/video camera: Sony FX3, Sony A7 III, Sony FDR AX 100, Canon 5D Mark III, GoPro Hero Black 7,8,9,10

Lenses for Sony: Tamron 28-75mm F/2.8 Di III , Sony 24mm gm 1.4 FE, Sony 20 mm G FE 1.8

Lenses for Canon: Canon EF 24-70 mm F/2.8 L USM, Canon 70-200 f/2.8 L

Drone: DJI Mavic 3 & DJI Phantom 4 Pro v2.0

 

Editing: Vegas Pro 20 (365) with a lot of third party plugins, also my own plugins written in C#

 

PC:

CPU: Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz   3.31 GHz

RAM: 128 GB

GPU: Nvidia RTX 2080 TI

storage: 4 SSD drives (including two M.2 flash drives) and two HDD drives

Windows system: 10 Home edition

vkmast wrote on 4/20/2023, 3:09 AM

@marcinzm maybe best to create a separate thread for your new question.

edit: created here. Thanks.

Robert Johnston wrote on 4/30/2023, 11:52 PM

@marcinzm

There is a problem with the code. The Mercalli plugin has three pushbuttons: Unlock, Analyze, Reset.

Your code pushes all three buttons, the last of which is Reset. You may have noticed after running your script that when you play back video, you briefly see the Mercalli Analyze banner suddenly appear for one frame in each event. The banner is appearing on the 3rd frame of each event on my system. I'm almost certain it is because the Reset button is pushed.

Besides checking to see if the parameter is a pushbutton, you also need to inspect the label to see if it is the "Analyze" (whatever that is in your language) button. You need to ignore and not press the other two pushbuttons.

I just changed one line of your code to:

if ((ofxparm.ParameterType.ToString()=="PushButton") &&  (ofxparm.Label == "Analyze"))

Good luck.


 

 

Intel Core i7 10700K CPU @ 3.80GHz (to 4.65GHz), NVIDIA GeForce RTX 2060 SUPER 8GBytes. Memory 32 GBytes DDR4. Also Intel UHD Graphics 630. Mainboard: Dell Inc. PCI-Express 3.0 (8.0 GT/s) Comet Lake. Bench CPU Multi Thread: 5500.5 per CPU-Z.

Vegas Pro 21.0 (Build 108) with Mocha Vegas

Windows 11 not pro

josifek wrote on 5/24/2024, 12:52 PM
if ((ofxparm.ParameterType.ToString()=="PushButton") &&  (ofxparm.Label == "Analyze"))

Mercalli Version: 6.0.671.1 has strange Label "<<< Analyze" therefore I had to change that line to:
 

if ((ofxparm.ParameterType.ToString()=="PushButton") &&  (ofxparm.Label.Contains("Analyze") ))

 

marcinzm wrote on 5/25/2024, 7:46 AM

@josifek Do you have Mercalli V6 version as OFX plugin and you use it in Vegas Pro 21? I heard that Mercalli V6 is not available in Vegas Pro software.

If you are bored, drink water, you will want to pee. -> Albert Einstein - my idol!

I am 42. I have been creating videos since 2009 (the date when my first daughter was born in). My first video software was Pinnacle, next one was Sony Vegas 8 (I am not sure if remember it correctly). I am also a developer and wedding movie operator and editor. For example: I have created an Android app which let me control Vegas Pro rendering progress level on Android smartphone. I created it for fun, because I also love programming. I also created my own plugin for Audio To Text feature specified usage from Vegas Pro 19. I created proxy creation plugin which uses multiple GPU threads (maximum 3) to create proxy files for Vegas Pro. I also written many others plugin/softwares which enhance my video editing, also wedding editing.

Camera/video camera: Sony FX3, Sony A7 III, Sony FDR AX 100, Canon 5D Mark III, GoPro Hero Black 7,8,9,10

Lenses for Sony: Tamron 28-75mm F/2.8 Di III , Sony 24mm gm 1.4 FE, Sony 20 mm G FE 1.8

Lenses for Canon: Canon EF 24-70 mm F/2.8 L USM, Canon 70-200 f/2.8 L

Drone: DJI Mavic 3 & DJI Phantom 4 Pro v2.0

 

Editing: Vegas Pro 20 (365) with a lot of third party plugins, also my own plugins written in C#

 

PC:

CPU: Intel(R) Core(TM) i9-7900X CPU @ 3.30GHz   3.31 GHz

RAM: 128 GB

GPU: Nvidia RTX 2080 TI

storage: 4 SSD drives (including two M.2 flash drives) and two HDD drives

Windows system: 10 Home edition

Dexcon wrote on 5/25/2024, 8:02 AM

The Mercalli V6 MAGIX plugin is for MAGIX Video Deluxe and MAGIX Video Pro X - https://www.prodad.com/Video-Stabilization-for-Professionals/Mercalli-V6-Plug-Ins-MAGIX-99742,l-us.html. The last Mercalli plugin for Vegas Pro was Mercalli 5.

Cameras: Sony FDR-AX100E; GoPro Hero 11 Black Creator Edition

Installed: Vegas Pro 15, 16, 17, 18, 19, 20, 21 & 22, HitFilm Pro 2021.3, DaVinci Resolve Studio 19.0.3, BCC 2025, Mocha Pro 2025.0, NBFX TotalFX 7, Neat NR, DVD Architect 6.0, MAGIX Travel Maps, Sound Forge Pro 16, SpectraLayers Pro 11, iZotope RX11 Advanced and many other iZ plugins, Vegasaur 4.0

Windows 11

Dell Alienware Aurora 11:

10th Gen Intel i9 10900KF - 10 cores (20 threads) - 3.7 to 5.3 GHz

NVIDIA GeForce RTX 2080 SUPER 8GB GDDR6 - liquid cooled

64GB RAM - Dual Channel HyperX FURY DDR4 XMP at 3200MHz

C drive: 2TB Samsung 990 PCIe 4.0 NVMe M.2 PCIe SSD

D: drive: 4TB Samsung 870 SATA SSD (used for media for editing current projects)

E: drive: 2TB Samsung 870 SATA SSD

F: drive: 6TB WD 7200 rpm Black HDD 3.5"

Dell Ultrasharp 32" 4K Color Calibrated Monitor

 

LAPTOP:

Dell Inspiron 5310 EVO 13.3"

i5-11320H CPU

C Drive: 1TB Corsair Gen4 NVMe M.2 2230 SSD (upgraded from the original 500 GB SSD)

Monitor is 2560 x 1600 @ 60 Hz

Thiago_Sase wrote on 9/8/2024, 4:02 PM

This Script will push automatically the Analyze push button of Mercalli 5 plugin for Vegas Pro.

 

using System;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Drawing;
using System.Runtime;
using System.Xml;
using ScriptPortal.Vegas;

namespace Test_Script
{
    public class Class1
    {
        public Vegas myVegas;

        public void Main(Vegas vegas)
        {
            myVegas = vegas;

            foreach (Track myTrack in myVegas.Project.Tracks)
            {
                if (myTrack.IsVideo())
                {
                    foreach (VideoEvent evnt in myTrack.Events)
                    {
                        if (evnt.Selected)
                        {
                            string plugInUID = "{Svfx:com.proDAD:StabilizerV4}";

                            PlugInNode fx = myVegas.VideoFX;
                            PlugInNode plugin = fx.GetChildByUniqueID(plugInUID);
                            Effect effect = new Effect(plugin);
                            evnt.Effects.Add(effect);

                            OFXEffect ofx = effect.OFXEffect;


                            evnt.OpenVideoEffectUI();

                            foreach (OFXParameter parm in ofx.Parameters)
                            {
                                if (parm.ParameterType.ToString() == "PushButton" && parm.Name == "AnalysisParam")
                                {
                                    parm.ParameterChanged();
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

public class EntryPoint
{
    public void FromVegas(Vegas vegas)
    {
        Test_Script.Class1 test = new Test_Script.Class1();
        test.Main(vegas);
    }
}