Script for add stereo 3D adjust fx and more

Comments

zzzzzz9125 wrote on 7/18/2025, 1:10 AM

Is it impossible to access "Pair as stereoscopic 3d subclip" command via script?
So i don't have to always make a right mouse click and find the command.

@relaxvideo I don't use this feature, so I'm not sure if this one works or not:

using ScriptPortal.Vegas;

namespace Test
{
    public class TestClass
    {
        public Vegas myVegas;
        public void Main(Vegas vegas)
        {
            myVegas = vegas;

            Media[] selectedMedia = myVegas.Project.MediaPool.GetSelectedMedia();
            if (selectedMedia.Length > 1)
            {
                Media mediaLeft = selectedMedia[0], mediaRight = selectedMedia[1];
                if (myVegas.Project.MediaPool.CanCreateStereo3DSubclip(mediaLeft, mediaRight))
                {
                    try
                    {
                        Subclip clip = myVegas.Project.MediaPool.CreateStereo3DSubclip(mediaLeft, mediaRight);
                    } catch { }
                }
            }
        }
    }
}

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

Last changed by zzzzzz9125 on 7/18/2025, 1:11 AM, changed a total of 1 times.

Using VEGAS Pro 22 build 250 & VEGAS Pro 21 build 208.

Information about my PC:
Brand Name: HP VICTUS Laptop
System: Windows 11.0 (64-bit) 10.00.22631
CPU: 12th Gen Intel(R) Core(TM) i7-12700H
GPU: NVIDIA GeForce RTX 3050 Laptop GPU
GPU Driver: NVIDIA Studio Driver 560.70

relaxvideo wrote on 7/18/2025, 1:21 AM

thanks, i just tried it, seems does nothing.
no error message either

#1 Ryzen 5-1600, 16GB DDR4, Nvidia 1660 Super, M2-SSD, Acer freesync monitor

#2 i7-2600, 32GB, Nvidia 1660Ti, SSD for system, M2-SSD for work, 2x4TB hdd, LG 3D monitor +3DTV +3D projectors

Win10 x64, Vegas22 latest

zzzzzz9125 wrote on 7/18/2025, 2:14 AM

thanks, i just tried it, seems does nothing.
no error message either

@relaxvideo To show the error message:

try
{
    Subclip clip = myVegas.Project.MediaPool.CreateStereo3DSubclip(mediaLeft, mediaRight);
} catch (System.Exception ex) { myVegas.ShowError(ex); }

I know very little about 3D, so I'm not quite sure how to make it work properly...

Last changed by zzzzzz9125 on 7/18/2025, 2:15 AM, changed a total of 1 times.

Using VEGAS Pro 22 build 250 & VEGAS Pro 21 build 208.

Information about my PC:
Brand Name: HP VICTUS Laptop
System: Windows 11.0 (64-bit) 10.00.22631
CPU: 12th Gen Intel(R) Core(TM) i7-12700H
GPU: NVIDIA GeForce RTX 3050 Laptop GPU
GPU Driver: NVIDIA Studio Driver 560.70

relaxvideo wrote on 7/18/2025, 3:09 AM

no message

silent

#1 Ryzen 5-1600, 16GB DDR4, Nvidia 1660 Super, M2-SSD, Acer freesync monitor

#2 i7-2600, 32GB, Nvidia 1660Ti, SSD for system, M2-SSD for work, 2x4TB hdd, LG 3D monitor +3DTV +3D projectors

Win10 x64, Vegas22 latest

zzzzzz9125 wrote on 7/18/2025, 4:00 AM

no message

silent

@relaxvideo How do you expect it to work?

In the current script, you need to select two media in Project Media window. It creates a new Stereo 3D SubClip for these two media.

Last changed by zzzzzz9125 on 7/18/2025, 4:00 AM, changed a total of 1 times.

Using VEGAS Pro 22 build 250 & VEGAS Pro 21 build 208.

Information about my PC:
Brand Name: HP VICTUS Laptop
System: Windows 11.0 (64-bit) 10.00.22631
CPU: 12th Gen Intel(R) Core(TM) i7-12700H
GPU: NVIDIA GeForce RTX 3050 Laptop GPU
GPU Driver: NVIDIA Studio Driver 560.70

relaxvideo wrote on 7/18/2025, 6:21 AM

Wow, on project media window it seems working!

But 3D videos in separate left-right source format are not paired in project media window, because we need to syncronize first on the timeline. So i select 2 events on the timeline which is on 2 different tracks. I hope these can be also paired with your script :)

 

#1 Ryzen 5-1600, 16GB DDR4, Nvidia 1660 Super, M2-SSD, Acer freesync monitor

#2 i7-2600, 32GB, Nvidia 1660Ti, SSD for system, M2-SSD for work, 2x4TB hdd, LG 3D monitor +3DTV +3D projectors

Win10 x64, Vegas22 latest

zzzzzz9125 wrote on 7/27/2025, 8:45 PM

But 3D videos in separate left-right source format are not paired in project media window, because we need to syncronize first on the timeline. So i select 2 events on the timeline which is on 2 different tracks. I hope these can be also paired with your script :)

@relaxvideo I can't make it work properly..

The following script creates a Stereo 3D subclip from the media of the selected two events on the timeline, but it cannot do pairing based on the event offset.

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ScriptPortal.Vegas;

namespace Test
{
    public class TestClass
    {
        public Vegas myVegas;
        public void Main(Vegas vegas)
        {
            myVegas = vegas;

            if (myVegas.Project.Video.Stereo3DMode == Stereo3DOutputMode.Off)
            {
                myVegas.ShowError("Not Stereo 3D Mode.");
                return;
            }

            foreach (Media m in myVegas.Project.MediaPool.GetSelectedMedia())
            {
                if (m is Subclip)
                {
                    Subclip s = m as Subclip;
                    MessageBox.Show(s.TimecodeIn.ToString() + "\n" + s.TimecodeOut.ToString());
                    return;
                }
            }

            List<VideoEvent> selectedEvents = new List<VideoEvent>();
            foreach (Track trk in myVegas.Project.Tracks)
            {
                if (trk.IsVideo())
                {
                    foreach (TrackEvent ev in trk.Events)
                    {
                        if (ev.Selected && ev.ActiveTake != null && ev.ActiveTake.Media != null)
                        {
                            selectedEvents.Add(ev as VideoEvent);
                        }
                    }
                }

            }

            if (selectedEvents.Count < 2)
            {
                return;
            }

            VideoEvent evLeft = selectedEvents[0], evRight = selectedEvents[1];

            if (myVegas.Project.MediaPool.CanCreateStereo3DSubclip(evLeft.ActiveTake.Media, evRight.ActiveTake.Media))
            {
                try
                {
                    Timecode startOffset = evLeft.ActiveTake.Offset - evRight.ActiveTake.Offset - evLeft.Start + evRight.Start;
                    Subclip clip = myVegas.Project.MediaPool.CreateStereo3DSubclip(evLeft.ActiveTake.Media, evRight.ActiveTake.Media);
                    //clip.Start = startOffset;
                    VideoStream vs = clip.GetVideoStreamByIndex(0);
                    if (vs != null)
                    {
                        Timecode offset = evLeft.ActiveTake.Offset;
                        Take tk = Take.CreateInstance(myVegas.Project, vs, true);
                        evLeft.Takes.Add(tk);
                        tk.Offset = offset;
                        evRight.Track.Events.Remove(evRight);
                    }
                } catch (Exception ex) { myVegas.ShowError(ex); }
            }
        }
    }
}

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

In these codes, you will find one line:

//clip.Start = startOffset;

According to my tests, it seems that the offset of the Stereo 3D subclip is determined by Subclip.Start.

If you uncomment it, Vegas Pro will not allow you to execute this line. The Start of a subclip should only be specified at the moment of creating the subclip.

However, when we create the Stereo 3D subclip, we use this:

Subclip clip = myVegas.Project.MediaPool.CreateStereo3DSubclip(evLeft.ActiveTake.Media, evRight.ActiveTake.Media);

This method does not allow you to set offsets. There's no other way to directly create Stereo 3D subclips from timeline events either. So for now, it seems impossible to do it.

Last changed by zzzzzz9125 on 7/27/2025, 8:51 PM, changed a total of 1 times.

Using VEGAS Pro 22 build 250 & VEGAS Pro 21 build 208.

Information about my PC:
Brand Name: HP VICTUS Laptop
System: Windows 11.0 (64-bit) 10.00.22631
CPU: 12th Gen Intel(R) Core(TM) i7-12700H
GPU: NVIDIA GeForce RTX 3050 Laptop GPU
GPU Driver: NVIDIA Studio Driver 560.70

relaxvideo wrote on 7/28/2025, 2:44 AM

ouch :(
thank you anyaway for your effort!!

#1 Ryzen 5-1600, 16GB DDR4, Nvidia 1660 Super, M2-SSD, Acer freesync monitor

#2 i7-2600, 32GB, Nvidia 1660Ti, SSD for system, M2-SSD for work, 2x4TB hdd, LG 3D monitor +3DTV +3D projectors

Win10 x64, Vegas22 latest