FORUMS: list search recent posts

Looking for a script

COW Forums : VEGAS Pro

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Randal Petryshyn
Looking for a script
on Mar 23, 2014 at 10:48:25 pm

Is it possible to save only frames marked with a marker on the timeline? Has anyone seen a script that will grab frames from markers?

Thanks


Return to posts index

Steve Rhoden
Re: Looking for a script
on Mar 24, 2014 at 4:24:52 am

Never scene such a script, but one that does that may can
easily be written.

Steve Rhoden
(Cow Leader)
Film Editor & Compositor.
Filmex Creative Media.
http://www.facebook.com/FilmexCreativeMedia
1-876-461-9019


Return to posts index

Randal Petryshyn
Re: Looking for a script
on Mar 24, 2014 at 4:57:13 pm

who would be available to whip up such a script? :)

Thanks
Randal


Return to posts index


Aleksey Tarasov
Re: Looking for a script
on Mar 24, 2014 at 5:33:57 am

http://vegasaur.com/snapshots


Return to posts index

Edward Troxel
Re: Looking for a script
on Mar 24, 2014 at 6:22:59 pm

Yes, and Excalibur can take snapshots of the marked frames as well. I imagine Ultimate S can too.

Edward Troxel


Return to posts index

Randal Petryshyn
Re: Looking for a script
on Mar 24, 2014 at 6:37:27 pm

Hi Edward. I only want the marked frames to remain on the timeline. Several thousand. What would you charge me to right one up?

Thanks
Randal


Return to posts index


Steve Rhoden
Re: Looking for a script
on Mar 24, 2014 at 7:24:25 pm

No plugin or script available for specifically what you want,
but as i said a script may can be written for it, i am no good
in that department, but others here are really great at writing
scripts for Vegas.

Steve Rhoden
(Cow Leader)
Film Editor & Compositor.
Filmex Creative Media.
http://www.facebook.com/FilmexCreativeMedia
1-876-461-9019


Return to posts index

Dave Affholter
Re: Looking for a script
on Mar 25, 2014 at 9:14:00 pm

Ultimate S can! I used it in my process for years.


Return to posts index

Matt Carlson
Re: Looking for a script
on Mar 24, 2014 at 8:45:23 pm

Here you go. Tell me if there is something I missed and I will fix it.

7288_keeponlyframesatmarkers.cs.zip


Return to posts index


Randal Petryshyn
Re: Looking for a script
on Mar 25, 2014 at 2:16:05 am

Hi Matt
I really appreciate to spending time on this. The script saved only the frame at the first marker (as seen below). I have found a script that saves the first frame at each event if that would help you. Its all gobboly goop to me.
Thanks
Randal





Return to posts index

Matt Carlson
Re: Looking for a script
on Mar 25, 2014 at 6:16:03 am

I understand the problem. My methodology was off because splitting events is a tricky thing. In my test I had all of the markers over different events. I see from your timeline that the first split would invalidate the rest. It is an easy fix (although it makes the actual script far more clock cycle intensive.)

search for and find the line

backhalf.Length = Timecode.FromFrames(FRAMELENGTHTORETAIN);

change it to

backhalf.Split(Timecode.FromFrames((FRAMELENGTHTORETAIN));

Everything will then work as planned. Sorry for the mistake. I assumed incorrectly you were taking 1 frame from different events... not many frames from a single event.


Return to posts index

Steve Rhoden
Re: Looking for a script
on Mar 25, 2014 at 2:15:23 pm

Wish i understood this script writing stuff, lol.

Steve Rhoden
(Cow Leader)
Film Editor & Compositor.
Filmex Creative Media.
http://www.facebook.com/FilmexCreativeMedia
1-876-461-9019


Return to posts index


Randal Petryshyn
Re: Looking for a script
on Mar 25, 2014 at 4:32:47 pm

Hi Matt
Did I bugger something up?
Thanks
Randal




using System;
using Sony.Vegas;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Drawing;

class EntryPoint
{
//Change this to true if you want to default to all tracks
const bool ALLTRACKS = false;

//Change this to false if you want to split audio tracks as well
const bool VIDEOONLY = true;

//This is the length of frames you want each event to keep
const int FRAMELENGTHTORETAIN = 1;

public void FromVegas(Vegas vegas)
{
DeselectAllEvents(vegas);
List TracksUsed = SplitFrameAtMarkers(vegas);
DeleteAllButSelected(TracksUsed);
}

private List SplitFrameAtMarkers(Vegas vegas)
{

List TracksToUse = GetTracksToModify(ALLTRACKS, vegas);
foreach (Marker m in vegas.Project.Markers)
{
List EventsAtMarker = GetEventsAtPosition(m.Position, TracksToUse);
foreach(TrackEvent ev in EventsAtMarker)
{
ev.Split(m.Position - ev.Start);
TrackEvent backhalf = GetNewlySplitEvent(ev);
backhalf.Split(Timecode.FromFrames((FRAMELENGTHTORETAIN));
backhalf.Selected = true;
}
}
return TracksToUse;
}

//Get the tracks to modify by choosing selected tracks
//or all of them if ALLTRACKS is true.
//If there are no tracks selected the default will be the first track only.
private List GetTracksToModify(bool ALLTRACKS, Vegas vegas)
{
List tracks = new List();
foreach(Track t in vegas.Project.Tracks)
{
if (VIDEOONLY && !t.IsVideo()) continue;
if (t.Selected || ALLTRACKS) tracks.Add(t);
}
if (tracks.Count == 0) tracks.Add(vegas.Project.Tracks[0]);

return tracks;
}

private List GetEventsAtPosition(Timecode position,List tracks)
{
List events = new List();
foreach(Track t in tracks)
{
foreach(TrackEvent ev in t.Events)
{
if (ev.Start <= position && ev.End >= position)
events.Add(ev);
}
}
return events;
}

private TrackEvent GetNewlySplitEvent(TrackEvent firsthalf)
{
return firsthalf.Track.Events[firsthalf.Index + 1];
}

private void DeselectAllEvents(Vegas vegas)
{
foreach(Track t in vegas.Project.Tracks)
{
foreach(TrackEvent ev in t.Events)
{
ev.Selected = false;
}
}
}

private void DeleteAllButSelected(List modifiedtracks)
{
List toremove = new List();
foreach (Track t in modifiedtracks)
{
foreach (TrackEvent ev in t.Events)
{
if (!ev.Selected) toremove.Add(ev);
}
}
foreach (TrackEvent ev in toremove)
{
ev.Track.Events.Remove(ev);
}
}

}


Return to posts index

Matt Carlson
Re: Looking for a script
on Mar 25, 2014 at 5:53:57 pm

No you did not screw it up I did. The new changed line somehow has an extra parenthesis.

It should read:


backhalf.Split(Timecode.FromFrames(FRAMELENGTHTORETAIN));


Note the one left parenthesis in front of FRAMELENGTHTORETAIN.

The line I gave you was:



backhalf.Split(Timecode.FromFrames((FRAMELENGTHTORETAIN));



which has two parentheses before FRAMELENGTHTORETAIN. I am not sure how that happened but that creates the odd number of parentheses that caused the error.

Here is the working script with the change (I should have just done this originally....)

7291_keeponlyframesatmarkers.cs.zip


Return to posts index

Randal Petryshyn
Re: Looking for a script
on Mar 25, 2014 at 8:46:58 pm

Hi Matt. We are getting ever so close!
Can we remove all the empty frames as well?




Return to posts index


Matt Carlson
Re: Looking for a script
on Mar 25, 2014 at 8:54:51 pm
Last Edited By Matt Carlson on Mar 25, 2014 at 9:01:46 pm

Do you mean close the gaps between the events that remain?

Also you might as well throw it all at me...

Do you want the markers removed etc?
Are there audio any audio event considerations?

Your timeline looks like all your markers are at equal intervals. If you just want to grab every nth frame from an event and string them together the script can be simplified and markers could be taken out of the process completely.


Return to posts index

Randal Petryshyn
Re: Looking for a script
on Mar 25, 2014 at 9:04:14 pm

You got it Matt! Close the gaps, and remove the markers. If you could delete the audio stream completely it would be great!

Thanks
Randal


Return to posts index

Matt Carlson
Re: Looking for a script
on Mar 26, 2014 at 12:07:20 am

Here is the next version. It will close gaps, delete markers, and hopefully delete all the right audio events.

7292_keeponlyframesatmarkerspluscleanup.cs.zip

I am not sure if you saw the last edit of my previous post about all of your markers being at intervals. There are always dozens of ways to skin a cat programming wise. As your need to automate tasks grows graduating from using scripts to using extension windows will save you a ton of time.

Send me an email at

blackstingproductions@gmail.com

if you need more revisions or want to discuss what you think you need from a script and what you actually need from a script.


Return to posts index


Randal Petryshyn
Re: Looking for a script
on Mar 26, 2014 at 1:43:42 am

It worked very well! I really appreciate the help. Can I paypal you a case of beer?

Thanks
Randal


Return to posts index

Matt Carlson
Re: Looking for a script
on Mar 26, 2014 at 3:34:16 am

I am glad it worked. No beer is necessary :). I have stared down the barrel of an annoyingly repetitive editing task before and know what a relief it is to have a one button push answer.


Return to posts index

Randal Petryshyn
Re: Looking for a script
on Mar 26, 2014 at 5:21:26 am

Well I really do appreciate your efforts and willingness to help. I hope there is something I can do for you at some point. You are a kind soul.

Thanks
Randal


Return to posts index

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