Can v16 do auto crossfade?

peterh337 wrote on 12/7/2018, 5:54 AM

This came up in years past and the answer was that you could achieve it with some kind of script.

In my normal workflow I do this

- load the video track (from the media list)
- load a GPS subtitle track (SRT file), as a single event, via Vegasaur, and align it with the video
- optionally load an mp3 sound track, and align it with the video
- cut above 3 tracks (while keeping them in sync), removing 95%+ of the material, while adding text onto a 4th track (it is during this that I do a 1 sec crossfade)
- if I didn't add the sound track initially, I add some music to the finished project, onto a new track

So maybe it would be possible to run some sort of script on the whole project at the end (obviously before the very last step) and do it all in one go. But a neater way would be for v16 to do an auto (configurable) crossfade on every cut.

Comments

john_dennis wrote on 12/7/2018, 12:59 PM

Here is a script that will apply a crossfade to all selected events. Admittedly, the subject of the thread would not have gotten you there.

fr0sty wrote on 12/8/2018, 8:36 AM

Is it possible to apply edits to a group track that applies to all tracks within it? Would be cool to at least be able to cut or fade a track at the group level, maybe even fx.

Last changed by fr0sty on 12/8/2018, 8:37 AM, changed a total of 1 times.

Systems:

Desktop

AMD Ryzen 7 1800x 8 core 16 thread at stock speed

64GB 3000mhz DDR4

Geforce RTX 3090

Windows 10

Laptop:

ASUS Zenbook Pro Duo 32GB (9980HK CPU, RTX 2060 GPU, dual 4K touch screens, main one OLED HDR)

peterh337 wrote on 12/10/2018, 2:46 AM

How does one run a script in Vegas 16, and what happens if you run such a script twice on the same project?

john_dennis wrote on 12/10/2018, 2:52 AM

Did it change in 16?

peterh337 wrote on 12/10/2018, 3:42 AM

That looks very simple! Thank you.

The 2nd bit was whether one could apply crossfades to a project where some of the cuts were already crossfaded manually. Can one have a script with conditionals?

snibchi1 wrote on 12/10/2018, 7:30 AM

That looks very simple! Thank you.

The 2nd bit was whether one could apply crossfades to a project where some of the cuts were already crossfaded manually. Can one have a script with conditionals?


Try this:

/**
 * Program: FadeEventInOut.cs
 * Description: This script will add specified fade,
 * transitions and effects
 * both ends of the selected track events
 *
 * Revision Date: Dec 20, 2016
 **/

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

public class EntryPoint
{
    Vegas myVegas = null;
    List<Track> trkListIsSel = new List<Track>();

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

        // Collect list of selected tracks
        foreach (Track selTrk in myVegas.Project.Tracks)
        {
            if (selTrk.Selected)
                trkListIsSel.Add(selTrk);
        }

        // leave if no track selected
        if (trkListIsSel.Count == 0)
        {
            MessageBox.Show("There is no track selected.");
            return;
        }

        // bring up the dialog
        DialogResult result = ShowUIDialog();
        myVegas.UpdateUI();

        // handle if click ok button
        if (DialogResult.OK == result)
        {
            // get user specified entrys and run fadeinout
            String overlapTimeMask = overlapTextbox.Text;
            DoFadeInOut(overlapTimeMask);
        }
    }

    String plugInName;
    String presetName;

    void DoFadeInOut(String overlapTimeMask)
    {
        Timecode overlap = new Timecode(overlapTimeMask);
        foreach (Track selTrack in trkListIsSel)
        {
            if (selTrack.Events.Count == 0)
                continue;
            Timecode swapStart = new Timecode(0);

            // count the events in track
            int sumEventsInThisTrack = selTrack.Events.Count;
            int evtNo = 0;

            foreach (TrackEvent evtItem in selTrack.Events)
            {
                ++evtNo;

                if (swapStart.ToMilliseconds() == 0)
                {
                   // the first event in track
                    swapStart = evtItem.End;

                    // FadeOut for the first event
                    evtItem.FadeOut.Length = overlap;
                    continue;
                }

                // set FadeIn and FadeOut
                evtItem.FadeIn.Length = overlap;

                // Set transition if selected track is
                // video type and pluginName is not empty
                if (evtItem.MediaType == MediaType.Video && plugInName != "(none)")
                {
                    // set transition
                    PlugInNode fx = myVegas.Transitions;
                    PlugInNode plugIn = fx.GetChildByName(plugInName);
                    Effect effect = new Effect(plugIn);
                    evtItem.FadeIn.Transition = effect;
                    if (presetName.Length != 0)
                        effect.Preset = presetName;
                }

                // the last event have no fadeout
                if (evtNo != sumEventsInThisTrack)
                    evtItem.FadeOut.Length = overlap;

                // move the event
                evtItem.Start = swapStart - overlap;
                swapStart = evtItem.End;
            }
        }
    }

    MaskedTextBox overlapTextbox;
    TreeView crossFadeTree;

    void fillTreeNode()
    {
        // the first item name in root node
        TreeNode treeNode0 = new TreeNode("(none)");
        crossFadeTree.Nodes.Add(treeNode0);

        // find more items
        List<PlugInNode> transList = new List<PlugInNode>();
        int totalTransitions = myVegas.Transitions.Count;

        foreach (PlugInNode trans in myVegas.Transitions)
        {
            transList.Add(trans);
        }

        // bring the item names into TreeView
        int numTransitions = transList.Count;

        for (int ixTrans = 0; ixTrans < numTransitions; ++ixTrans)
        {
            PlugInNode fx = transList[ixTrans];

            if (fx.IsContainer)
            {
                // add more root node to treeView
                TreeNode treeNode1 = new TreeNode(fx.Name);
                crossFadeTree.Nodes.Add(treeNode1);

                // get names from container childs
                IEnumerator enumChilds = fx.GetEnumerator();

                while(enumChilds.MoveNext())
                {
                    TreeNode lastRootNode = crossFadeTree.Nodes[crossFadeTree.Nodes.Count - 1];
                    crossFadeTree.SelectedNode = lastRootNode;
                    PlugInNode childNode = (PlugInNode) enumChilds.Current;

                    // only video crossfades
                    if (childNode.IsVideo)
                    {
                        // add crossfades to treeView
                        TreeNode treeChildNode = new TreeNode(childNode.Name);
                        crossFadeTree.SelectedNode.Nodes.Add(treeChildNode);
                        crossFadeTree.SelectedNode = treeChildNode;

                        // add presets to treeView
                        IEnumerator enumPresets = childNode.Presets.GetEnumerator();

                        while (enumPresets.MoveNext())
                        {
                            // add crossfade presets to treeView
                            String presetName = enumPresets.Current.ToString();
                            crossFadeTree.SelectedNode.Nodes.Add(presetName);
                        }
                    }   
                }
            }
        }

        // select first item in root node = "(none)" as default
        crossFadeTree.SelectedNode = treeNode0;
        crossFadeTree.Select();
    }
    
    /******************************
     * create Dialog
     ******************************/
    DialogResult ShowUIDialog()
    {
        Form dlog = new Form();
        dlog.Text = "FadeInOut";
        dlog.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
        dlog.MaximizeBox = false;
        dlog.StartPosition = FormStartPosition.CenterScreen;
        dlog.Width = 300;
        dlog.Height = 300;
        dlog.FormClosing += this.HandleFormClosing;
        int titleBarHeight = dlog.Height - dlog.ClientSize.Height;
        int buttonWidth = 80;
        overlapTextbox = AddTextControl(dlog, "Overlap", titleBarHeight + 6, 120, 10, "00:00:01.00");

        int buttonTop = dlog.Height - (2 * (buttonWidth + 10));
        int buttonsLeft = dlog.Width - (2 * (buttonWidth + 20));
        crossFadeTree = new TreeView();
        crossFadeTree.Left = 10;
        crossFadeTree.Width = buttonsLeft + (2 * buttonWidth);
        crossFadeTree.Top = overlapTextbox.Bottom + 10;
        crossFadeTree.Height = buttonTop - 50;
        crossFadeTree.AfterSelect += new TreeViewEventHandler(HandleTreeViewClick);
        dlog.Controls.Add(crossFadeTree);

        fillTreeNode();

        Button okButton = new Button();
        okButton.Text = "OK";
        okButton.Left = (dlog.Width / 2) - buttonWidth - 10;
        okButton.Top = buttonTop;
        okButton.Width = buttonWidth;
        okButton.Height = okButton.Font.Height + 12;
        okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
        dlog.AcceptButton = okButton;
        dlog.Controls.Add(okButton);

        Button cancelButton = new Button();
        cancelButton.Text = "Cancel";
        cancelButton.Left = (dlog.Width / 2) + 10;
        cancelButton.Top = buttonTop;
        cancelButton.Height = cancelButton.Font.Height + 12;
        cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
        dlog.CancelButton = cancelButton;
        dlog.Controls.Add(cancelButton);

        dlog.Height = titleBarHeight + okButton.Bottom + 8;
        dlog.ShowInTaskbar = false;

        return dlog.ShowDialog(myVegas.MainWindow);
    }

    MaskedTextBox AddTextControl(Form dlog, String labelName, int left, int width, int top, String defaultValue)
    {
        Label label = new Label();
        label.AutoSize = true;
        label.Text = labelName + ":";
        label.Left = left;
        label.Top = top + 4;
        dlog.Controls.Add(label);
        MaskedTextBox textbox = new MaskedTextBox();
        textbox.Multiline = false;
        textbox.Left = label.Right;
        textbox.Top = top;
        textbox.TextAlign = HorizontalAlignment.Center;
        textbox.Mask = "00:00:00.00";
        textbox.Text = defaultValue;
        dlog.Controls.Add(textbox);
        return textbox;
    }

    /******************************
     * Mouse Handles
     ******************************/
    void HandleTreeViewClick(object sender,
    TreeViewEventArgs e)
    {
        TreeNode tmpNode = e.Node;

        // compute column in treeview
        int col = -1;

        while(tmpNode != null)
        {
            tmpNode = tmpNode.Parent;
            ++col;
        }

        // set pluginName and presetName
        switch(col)
        {
            case 0: // is root container
                crossFadeTree.SelectedNode = crossFadeTree.Nodes[0];
                crossFadeTree.Select();
                plugInName = "(none)";
                presetName = "";
                break;
            case 1: // is crossfade
                plugInName = e.Node.Text;
                presetName = "";
                break;
            case 2: // is preset
                plugInName = e.Node.Parent.Text;
                presetName = e.Node.Text;
                break;
        }
    }

    void HandleFormClosing(Object sender, FormClosingEventArgs args)
    {
        Form dlg = sender as Form;
        if (null == dlg) return;
        if (DialogResult.OK != dlg.DialogResult) return;
    }
}

 

Audiovisuelle Geräte

  • Canon EOS 6D
  • Canon EOS 450D
  • Nicon Coolpix S7000
  • AC800 Actioncam
  • Sony HDR-SR5

Hardware-Ausstattung

  • Monitor: LG Ultrawide 34UC79G
  • Tastatur: MSI GK 50 Elite
  • Maus: Corsair M65 PRO RGB
  • Gehäuse: CooMas HAF X 942-KKN1 ATX
  • PSU: be quiet! Staight P11 850W
  • Board: MSI MEG X570 ACE (Bios 7C35 v 1.P0, 04.07.2024)
  • CPU: AMD Ryzen 9 3900x
  • Cooler: Noctua NH-D14 SE2011 (AMD Adapter)
  • RAM: 2x 16GB D432GB 3600-17 Predator K2 KHX
  • M_2.1: 1x 2TB Gigabyte GP-ASM2NE6200
  • M_2.2: 1x 1TB Gigabyte GP-ASM2NE6100
  • M_2.3: 1x 1TB Samsung SSD Pro 980
  • SSD: 1x 4TB SanDisk Ultra 3D
  • SSD: 1x 512GB Samsung 850 Pro
  • GPU: 1x 12GB MSI Radeon RX 6750 XT
  • NAS: Synology DS 218+ 2x 6TB

Software

  • Windows 11 64 Pro (24H2 Build 26100.3915)
  • MAGIX Vegas Suite 365 (Build 22.250)
  • MAGIX Photostory deluxe 2025 (V 24.0.1.204 (UDP3))
  • Sound Forge Pro 18
  • ACID Pro 11.0 (x64)
  • Music Maker 2025
  • ADOBE Master Suite CS6, CC
mbarton wrote on 12/11/2018, 12:30 AM

You mentioned you had Vegasaur. Is this something that Fades/Transitions under Quick Properties cannot do for selected events?

peterh337 wrote on 12/11/2018, 1:10 AM

There is a lot of great stuff there (especially the one for removing a split) but I can't see one which will fade two or more selected events.

OldSmoke wrote on 12/11/2018, 1:43 AM

There is a lot of great stuff there (especially the one for removing a split) but I can't see one which will fade two or more selected events.

I am not at my computer but I don’t think it’s in the 1-click menu. Check the other tools, I am almost certain it can do it.

Also, have you tried selecting two events and drop a cross fade transition at the cut? Wouldn’t that do it? I believe the length of the transition is determined by the overlap under preferences.

Proud owner of Sony Vegas Pro 7, 8, 9, 10, 11, 12 & 13 and now Magix VP15&16.

System Spec.:
Motherboard: ASUS X299 Prime-A

Ram: G.Skill 4x8GB DDR4 2666 XMP

CPU: i7-9800x @ 4.6GHz (custom water cooling system)
GPU: 1x AMD Vega Pro Frontier Edition (water cooled)
Hard drives: System Samsung 970Pro NVME, AV-Projects 1TB (4x Intel P7600 512GB VROC), 4x 2.5" Hotswap bays, 1x 3.5" Hotswap Bay, 1x LG BluRay Burner

PSU: Corsair 1200W
Monitor: 2x Dell Ultrasharp U2713HM (2560x1440)

mbarton wrote on 12/11/2018, 11:44 AM

@peterh337 The Quick Properties are under the Editing menu in Vegasaur..

peterh337 wrote on 12/11/2018, 12:29 PM

Yes, thank you all. That works well. I tested it to make sure it doesn't mess up existing transitions.

There is a funny thing which I am sure all you experts will laugh at. A long time ago I asked here (or another video forum) how can one do crossfades without making the overall movie shorter. I got some long explanations that it doesn't because what you steal from one event you add to the next one, or some such. But using this function does simply shrink the stuff on the timeline - just as I would expect! It seems obvious that every time you do a 1 second crossfade you lose 1 second from the movie. So if doing any "batch crossfade" one has to group everything together so it all gets done together (or maybe just select events on all the tracks that need doing together). I have tended to not use grouping for my simple projects and this may be one good case for it.

OldSmoke wrote on 12/11/2018, 1:32 PM

Yes, thank you all. That works well. I tested it to make sure it doesn't mess up existing transitions.

There is a funny thing which I am sure all you experts will laugh at. A long time ago I asked here (or another video forum) how can one do crossfades without making the overall movie shorter. I got some long explanations that it doesn't because what you steal from one event you add to the next one, or some such. But using this function does simply shrink the stuff on the timeline - just as I would expect! It seems obvious that every time you do a 1 second crossfade you lose 1 second from the movie. So if doing any "batch crossfade" one has to group everything together so it all gets done together (or maybe just select events on all the tracks that need doing together). I have tended to not use grouping for my simple projects and this may be one good case for it.

Well, I'd say it depends. If the events end then yes, the final result will be shorter. But, if the event still has actual footage before or after the cut, it could also be that the event get's extended to accommodate for the transition; I guess this is controlled in the script?

Proud owner of Sony Vegas Pro 7, 8, 9, 10, 11, 12 & 13 and now Magix VP15&16.

System Spec.:
Motherboard: ASUS X299 Prime-A

Ram: G.Skill 4x8GB DDR4 2666 XMP

CPU: i7-9800x @ 4.6GHz (custom water cooling system)
GPU: 1x AMD Vega Pro Frontier Edition (water cooled)
Hard drives: System Samsung 970Pro NVME, AV-Projects 1TB (4x Intel P7600 512GB VROC), 4x 2.5" Hotswap bays, 1x 3.5" Hotswap Bay, 1x LG BluRay Burner

PSU: Corsair 1200W
Monitor: 2x Dell Ultrasharp U2713HM (2560x1440)

peterh337 wrote on 12/11/2018, 4:15 PM

That would be pretty clever - detecting that the footage is the same after a cut as before. Video has no time stamps in the frames (generally).

Also - and I learnt all this myself so don't know how others work - I start at the left and cut out the bits I don't want, so a lot of stuff gets removed, and usually at every cross-fade point a huge % of stuff was removed.

OldSmoke wrote on 12/11/2018, 4:27 PM

That would be pretty clever - detecting that the footage is the same after a cut as before. Video has no time stamps in the frames (generally).

Also - and I learnt all this myself so don't know how others work - I start at the left and cut out the bits I don't want, so a lot of stuff gets removed, and usually at every cross-fade point a huge % of stuff was removed.

Removed doesn’t mean it’s gone unless you rendered an new file, it just got trimmed.

Proud owner of Sony Vegas Pro 7, 8, 9, 10, 11, 12 & 13 and now Magix VP15&16.

System Spec.:
Motherboard: ASUS X299 Prime-A

Ram: G.Skill 4x8GB DDR4 2666 XMP

CPU: i7-9800x @ 4.6GHz (custom water cooling system)
GPU: 1x AMD Vega Pro Frontier Edition (water cooled)
Hard drives: System Samsung 970Pro NVME, AV-Projects 1TB (4x Intel P7600 512GB VROC), 4x 2.5" Hotswap bays, 1x 3.5" Hotswap Bay, 1x LG BluRay Burner

PSU: Corsair 1200W
Monitor: 2x Dell Ultrasharp U2713HM (2560x1440)

peterh337 wrote on 12/11/2018, 4:54 PM

OK; true. However, why would you make a cut unless you wanted to remove some stuff?

Maybe you are thinking of using up some removed material for the crossfade. That would be clever and feasible.

OldSmoke wrote on 12/11/2018, 5:22 PM

Maybe you are thinking of using up some removed material for the crossfade. That would be clever and feasible.

That is what Ibwas thinking about. That is actually how it works in a multicam edit. You select several events with straight cuts and when drop a transition in one, it will be applied to all selected events. However, the tansition doesn’t “ripple” the event but will use part of the editing footage back and front.

Proud owner of Sony Vegas Pro 7, 8, 9, 10, 11, 12 & 13 and now Magix VP15&16.

System Spec.:
Motherboard: ASUS X299 Prime-A

Ram: G.Skill 4x8GB DDR4 2666 XMP

CPU: i7-9800x @ 4.6GHz (custom water cooling system)
GPU: 1x AMD Vega Pro Frontier Edition (water cooled)
Hard drives: System Samsung 970Pro NVME, AV-Projects 1TB (4x Intel P7600 512GB VROC), 4x 2.5" Hotswap bays, 1x 3.5" Hotswap Bay, 1x LG BluRay Burner

PSU: Corsair 1200W
Monitor: 2x Dell Ultrasharp U2713HM (2560x1440)