Render out regions on multiple tracks!

TobHammm wrote on 2/9/2021, 12:17 AM

Looking for a script that let's me render regions on multiple tracks. Imagine 3 video tracks, and 3 regions. The result should be 9 files.

RegionNameA_track1

RegionNameB_track1

RegionNameC_track1

RegionNameA_track2

RegionNameB_track2

(...)

Vegasaur Transcoder, for example, has tons of options, but not this one...

Grateful for help!

Comments

wwaag wrote on 2/9/2021, 1:10 AM

HappyOtterScripts already has this option for its AudioTrim tool as shown.

However, that option has not been added to its more general render tool, RenderPlus which renders both video and audio, although it could be easily added in a future build.

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

TobHammm wrote on 2/9/2021, 1:49 AM

That's cool, but it doesn't let me render videotracks, right? Any way to contact the makers, are they in this forum?

wwaag wrote on 2/9/2021, 10:16 AM

@TobHammm

I'm the developer. As I said, that feature is not available for the main rendering tool, RenderPlus but could be added as a new feature.

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

TobHammm wrote on 2/9/2021, 10:22 AM

Thanks, didn't know that. If you were so kind to intigrate that to be available within a month, I'd buy the scripts!

jetdv wrote on 2/10/2021, 10:32 AM

Here's a solution for you that should get you going now:

1. Go to c:\Program Files\VEGAS\Vegas Pro <version>\Script Menu

2. Open "Batch Render.cs" in a text editor such as NotePad

3. Look for this section (about 52 lines down):

        DialogResult result = ShowBatchRenderDialog();
        myVegas.UpdateUI();
        if (DialogResult.OK == result)
        {
            // inform the user of some special failure cases
            String outputFilePath = FileNameBox.Text;
            RenderMode renderMode = RenderMode.Project;
            if (RenderRegionsButton.Checked)
            {
                renderMode = RenderMode.Regions;
            }
            else if (RenderSelectionButton.Checked)
            {
                renderMode = RenderMode.Selection;
            }
            DoBatchRender(SelectedTemplates, outputFilePath, renderMode);
        }

4. Now let's modify it so it will do it individually for every track by changing the above to:

        foreach (Track myTrack in myVegas.Project.Tracks)
        {
            myTrack.Mute = true;
        }

        foreach (Track myTrack in myVegas.Project.Tracks)
        {
            myTrack.Mute = false;
            CurrentTrack = myTrack.DisplayIndex;
//The bold section here stays the same with no changes. We are just adding code around the bold section!
            DialogResult result = ShowBatchRenderDialog();
            myVegas.UpdateUI();
            if (DialogResult.OK == result)
            {
                // inform the user of some special failure cases
                String outputFilePath = FileNameBox.Text;
                RenderMode renderMode = RenderMode.Project;
                if (RenderRegionsButton.Checked)
                {
                    renderMode = RenderMode.Regions;
                }
                else if (RenderSelectionButton.Checked)
                {
                    renderMode = RenderMode.Selection;
                }
                DoBatchRender(SelectedTemplates, outputFilePath, renderMode);
            }

            myTrack.Mute = true;
        }

        foreach (Track myTrack in myVegas.Project.Tracks)
        {
            myTrack.Mute = false;
        }

What this does is first mute every track. Then it goes through the tracks, unmuteing one track, render the regions on that one track, and then mutes it again. Once all tracks have been individually rendered, it then unmutes all tracks. Unfortunately, every track rendered would overwrite the previous track's render without a couple more changes. So let's add the current track as a variable at the top of the script - change:

    ScriptPortal.Vegas.Vegas myVegas = null;

to:

    ScriptPortal.Vegas.Vegas myVegas = null;
    int CurrentTrack = 0;

And then change where it sets the file name from:

            if (RenderMode.Regions == renderMode) {
                int regionIndex = 0;
                foreach (ScriptPortal.Vegas.Region region in myVegas.Project.Regions) {
                    String regionFilename = String.Format("{0}[{1}]{2}",
                                                          filename,
                                                          regionIndex.ToString(),
                                                          renderItem.Extension);

to:

            if (RenderMode.Regions == renderMode) {
                int regionIndex = 0;
                foreach (ScriptPortal.Vegas.Region region in myVegas.Project.Regions) {
                    String regionFilename = String.Format("{0}[{1}][{2}]{3}",
                                                          filename,
                                                          CurrentTrack.ToString(),
                                                          regionIndex.ToString(),
                                                          renderItem.Extension);

Naturally the file naming could be modified however you desire to get the naming designation that you want. So you might just change the "String regionFilename" section to something like this to better match your naming description from your original post:

String regionFilename = Path.Combine(outputDirectory,
                                           FixFileName(region.Label) +
                                           "_" +
                                           "Track" + CurrentTrack.ToString() +
                                           renderItem.Extension);

5. Save this as a new file name such as "Batch Render Tracks Separately.cs" or whatever name you prefer.

TobHammm wrote on 2/10/2021, 12:55 PM

Thats very insightful Edward! Thanks a lot :)

I will certainly check it out and try it!