MAGIX VEGAS: MAGIX Vegas Tutorials MAGIX Vegas Forum Articles Black Magic Design Forum AJA Xena Forum

Delete spaces between selected videos modify script

COW Forums : VEGAS Pro

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Ramil Pescador
Delete spaces between selected videos modify script
on Jul 26, 2019 at 4:00:28 am

I am currently doing edits in a studio as a sideline, working with their machine with Vegas 14 installed. I am editing mostly mtv style edits & many small clips are involved. I have this script which currently affects video only when closing gaps & I want to modify it to include also the audio with the corresponding videos selected. So the function must be like in Vegasaur close gaps with selected events NOT TRACKS. Tried HOS trim frames with selected events but it moves the clips to the start of TL or other clips to the left , Vegasaur trial has ended in this machine so no good. Someone can help me with this, thank you.



/**
* Program:
* Description: Remove gaps between events. This removes gaps in SELECTED events only. The remove gap function only works on selected events.
All events before and after the selected event are NOT processed. The GAP constant is used as the defined spacer between events
as they are processed. If you want the space between events to be 0, then set GAP to 0. GAP unit is milliseconds. Default is 1000 (1sec).
This script was created because the only other RemoveGaps script found on the interet had a bug where it truncated the end of each event
on complex tracks. This script works on complex tracks with 1000's of events. Also the other script processed all events on a track, this
script processes only selected tracks, so you can selectivly decide which evemts to process and which to not process.
* Author: JRD
*
* Date: April 17, 2011
**/

import Sony.Vegas;
import System.Windows.Forms;
import Microsoft.Win32;
import System.Diagnostics;


try
{
Debug.WriteLine("RemoveGaps-> START");

var GAP = 0;

// step through all selected video events:
var FirstTrack : Track = Vegas.Project.Tracks.Item(0);
var idx = 0;
var countSel = 0;
// step through all selected video events:
for (var track in Vegas.Project.Tracks)
{
if( !track.Selected || track.MediaType == MediaType.Audio) continue;

var tracktime = new Timecode(0);
var last = 0;
var begin = 0;
for (var evnt in track.Events)
{
if (evnt.Selected)
{
// start after first event
if (idx > 0 && countSel > 0)
{
Debug.WriteLine("RemoveGaps-> idx -> " + idx);
// get diff between previous this event and last
var diff = (evnt.Start.ToMilliseconds() - last);
Debug.WriteLine("RemoveGaps-> diff -> " + diff);
// if diff is greater than GAP? then fill it
if (diff > GAP)
{
var start = Timecode.FromMilliseconds(last + GAP);
var end = Timecode.FromMilliseconds(start.ToMilliseconds() + evnt.Length.ToMilliseconds());
var len = Timecode.FromMilliseconds( evnt.End.ToMilliseconds() - evnt.Start.ToMilliseconds());

Debug.WriteLine("RemoveGaps-> diff > GAP " );
Debug.WriteLine("RemoveGaps-> diff > Set evnt.Start to-> " + start.ToMilliseconds().ToString());
Debug.WriteLine("RemoveGaps-> diff > Set evnt.End to-> " + end.ToMilliseconds().ToString());
Debug.WriteLine("RemoveGaps-> diff > Set evnt.Length to-> " +len.ToMilliseconds().ToString());

evnt.Start = start; // new start
evnt.End = end; // new end
evnt.Length = len; // calculate exact length
countSel++;
}
}
countSel++;
}
last = evnt.End.ToMilliseconds();
tracktime = tracktime + evnt.Length;
idx++;
}
}
Debug.WriteLine("RemoveGaps-> DONE");
}

catch (errorMsg)
{
Debug.WriteLine("RemoveGaps-> ERROR-> " + errorMsg);
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}


Return to posts index

Graham Bernard
Re: Delete spaces between selected videos modify script
on Jul 26, 2019 at 5:10:48 am

[Ramil Pescador] "Someone can help me with this, thank you. "
Hi Ramil. Well, you’re working MAGIX VegasPro 14, and not a SONY product anymore. There are references to SONY in the Script which could have something to do with it. You’ve also said you’re running a DEMO of another s/w that’s run out. At this point, if nobody is capable or willing to debug this for you then I strongly advise you to hop on over to the OFFICIAL MAGIX Forum where you’d get a better chance of getting focussed responses :

https://www.vegascreativesoftware.info/us/vegas-pro-forum/scripting/

Or wait here till one of Scripting Gurus may pop in. Your call.

* Grazie

Video Content Creator and Potter
PC 10 64-bit 64gb * Intel® Core™i9 - 3.3GHz * 40Gb NVIDIA GeForce RTX 2070
PC 7 64-bit 16gb * Intel® Core™i7-2600k Quad Core 3.40GHz * 2GB NVIDIA GEFORCE GTX 560 Ti
Cameras: Canon XF300 + PowerShot SX60HS Bridge


Return to posts index

Ramil Pescador
Re: Delete spaces between selected videos modify script
on Jul 26, 2019 at 6:30:11 am

Yes I've run that script in VP14 by changing the Sony to ScriptPortal, I just posted my reference script with the original one with Sony on it.
I'll seek help from the Magix Forum if I am not lucky enough here. Thank you for the response.


Return to posts index


Graham Bernard
Re: Delete spaces between selected videos modify script
on Jul 26, 2019 at 7:47:31 am
Last Edited By Graham Bernard on Jul 26, 2019 at 7:48:06 am

[Ramil Pescador] "Yes I've run that script in VP14 by changing the Sony to ScriptPortal, I just posted my reference script with the original one with Sony on it."
In the future post what you ARE using. Your "reference" just confuses the issues and wastes time in getting you an answer.

* Grazie

Video Content Creator and Potter
PC 10 64-bit 64gb * Intel® Core™i9 - 3.3GHz * 40Gb NVIDIA GeForce RTX 2070
PC 7 64-bit 16gb * Intel® Core™i7-2600k Quad Core 3.40GHz * 2GB NVIDIA GEFORCE GTX 560 Ti
Cameras: Canon XF300 + PowerShot SX60HS Bridge


Return to posts index

John Rofrano
Re: Delete spaces between selected videos modify script
on Aug 4, 2019 at 12:26:20 pm

[Ramil Pescador] "...Vegasaur trial has ended in this machine so no good."
You can buy VASST Event Tools for $12.95 USD and have this capability and a whole lot more. 😉



~jr

http://www.johnrofrano.com
http://www.vasstsoftware.com



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]