Always warms the cockles of my heart (whatever they are) to hear that someone finds some utility in my scripts.
I have a lot of other scripts that are sometimes useful in conjunction with the one you mention. I've never published most of these, because they are mostly useful to me. However, if something looks interesting, let me know.
AddRegionsToEvents and Name Regions.js
This script will add regions for all events on the selected track, and name those regions to the event's media file name.
AddRegionsToEvents.js
This script will add regions for all events on the selected track
MarkersToRegions.js
This script will convert markers to regions. The original markers are left intact.
The script ignores all markers beyond the last event.
AddRegionsToEvents and name for first effect.js
This script will add regions for all events on the selected track and name them according to the first fX assigned to that event.
AddRegionsToEvents and Name Regions.js
This script will add regions for all events on the selected track, and name those regions to the event's media file name.
If more than one event comes from the same media, this will result in duplicate region names.
Create Regions From Event File Names.js
This script will add regions to all events on the first selected track, and name those regions using the media file name for each event. The regions will not overlap, even if the events overlap (because overlapping regions will be rejected by DVD Architect's subtitle facility).
If a region already exists in the same location, no region is created.
If more than one event comes from the same media, this will result in duplicate region names (which is OK, because you may want the same subtitle text in more than one place).
Use the Edit Details view in Vegas to quickly view, modify, or delete the resulting regions.
You can then use the script that ships with Vegas to convert these region names to a subtitle file that can be imported into DVD Architect (or other DVD authoring program). Thus, the file names of your media can become subtitles, without any work on your part.
fX_HighlightAllEvenetsWithFx.js
This script will find and highlight all video events to the right of the cursor if they contain the specified fX.
Highlight events less than specified duration.js
This script will find and highlight all video events on the first selected track that are less than the certain duration.
Markers at Media Change Points.js
This script adds markers at media transitions on the first selected track.A "media transition" happens when an event comes from a different file than the preceding event.
The markers are labeled with the name of the media file. If a marker already exists, no new marker is created.
Markers at Transitions.js
This script adds markers at transitions on the first selected track. The markers are labeled as "Chapter 0, Chapter 1, etc. If a marker already exists, no new marker is created. If you add a transition and re-run the script without deleting all previous chapter markers, however, the new chapter number will start with "Chapter 0" (i.e., you will end up with duplicate chapter names). Why? Because I am lazy.
Ditto (thanks!). John, I found your script for cropping HDV into SD 4:3 was a huge time saver. With lots of events, it would be quite tedious to attempt it manually.
I don't know much about Vegas's API, but I will dig through your postings and try to figure out how to make a similar script for PAL resolution. Looks like all I need to do is make some calculations (probably someone already did in another posting).
Also I shall try to figure out how I can remove the pan/crop on all events. (So I can prepare the same project I did in NTSC for a PAL render).
John Meyer:
I would be interested in your Markers at Media Change Points.js script. Well, I think that is what I need anyway.
I am simply trying to quickly convert DV home videos to DVD with minimal interaction. I am willing to have a simple menu of chapter marks based on when the camera was turned on/off. I capture the video to separate files at the timecode breaks using Vegas. Paste them all onto the timeline (deleting any really bad ones) and then want to run a quick script to put markers at all the media changes (I think the Vegas terminology is different events). Maybe even apply random fades to the events using the ApplyTransV5.js script to make it a little neater. Then use DVD Architect to quickly build the DVD with a menu based of those chapter marks. For old 8mm tapes, I would just put markers every 2 minutes or so, to be able to quickly skip through the DVD and find things. I really don't want to spend much time doing this conversion. I tried several other ways (not with Vegas) that have failed, so I figure it is time to simply use Vegas to do this work.
Does this seem like a use for your Markers at Media Change Points.js macro or am I simply confused on what I really should be doing?
I have been "playing" with Video on the side for over 7 years now -- never spending enough time to get it really figured out. I like the quality of Vegas and it has been treating me well so far. I just noticed that I am at 6.0b so I need to get the latest updates too. I am a programmer so I don't mind messing with the scripts -- just another challenge.
[Edit]
Seems like after reading your posts in Subtitling Data Code from MiniDV, I might also have a use for Create Regions From Event File Names.js to try to piece together the Data code to subtitles. As this would be useful for these videos as well. For awhile I actually manual figured them out on my home videos and put them on the video but that was too time consuming so I quit doing it. Looks like you spelled out a possible way to do this and maybe from these scripts you already have, I can figure out at least one way to do it.
Thanks, Mike
Here's the markers at media transitions. It is amazingly useful. Just used it yesterday on a long project. Saved an hour of work.
/**
* This script adds markers at media transitions on the first selected track.
* A "media transition" happens when an event comes from a
* different file than the preceding event.
* The markers are labeled with the name of the media file.
* If a marker already exists, no new marker is created.
*
* Written By: John Meyer (from a script by Edward Troxel)
* 12/10/2003
*
**/
try {
var myMarker : Marker;
var LastFileName = " ";
//Find the first selected track
var track = FindSelectedTrack();
if (null == track)
throw "no selected track";
var eventEnum = new Enumerator(track.Events);
// Cycle through all events on the selected track
while (!eventEnum.atEnd()) {
var evnt : TrackEvent = TrackEvent(eventEnum.item());
var MyFilePath = evnt.ActiveTake.MediaPath;
var extFileName = Path.GetFileName(MyFilePath);
var baseFileName = Path.GetFileNameWithoutExtension(extFileName); // Media file name for this event
// Only add marker if this event's media is different from last event, and if no marker already exists.
if ( (baseFileName != LastFileName) && (!MarkerExist(evnt.Start.ToMilliseconds() ) ) ) {
myMarker = new Marker(evnt.Start);
Vegas.Project.Markers.Add(myMarker);
myMarker.Label = baseFileName;
}
// Prepare for next event
LastFileName = baseFileName;
eventEnum.moveNext();
}
} catch (e) {
MessageBox.Show(e);
}
// Function to find first selected track
function FindSelectedTrack() : Track {
var trackEnum = new Enumerator(Vegas.Project.Tracks);
while (!trackEnum.atEnd()) {
var track : Track = Track(trackEnum.item());
if (track.Selected) {
return track;
}
trackEnum.moveNext();
}
return null;
}
// Function to check if there is a marker at timecode passed to this function
// Timecode (dStart) must be in milliseconds
function MarkerExist (dStart) : boolean {
var fmarkerEnum = new Enumerator(Vegas.Project.Markers);
while (!fmarkerEnum.atEnd()) {
var fMyMarker = fmarkerEnum.item();
var fMarkerStart = fMyMarker.Position.ToMilliseconds();
if ( dStart == fMarkerStart ) {
return 1;
}
Here's the "Regions From Event File Names" script. This one was a real life-saver a year ago. I created a VERY long DVD from thousands of still photos and video clips contributed by parent's of the graduating high-school class. I wanted to create a subtitle track so that, twenty years from now, the viewer could turn on the subtitles and see the name of the person they are looking at. I had my daughter look at each file and rename the file using the names of the people in the picture. I then used this script to transfer those names to regions, and then used the script that comes with Vegas to export these regions as subtitles. Two clicks and I had a thousand subtitles for a 90 minute DVD.
There are other uses as well, I am sure.
/**
* This script will add regions to all events on the first selected track,
* and name those regions using the media file name for each event.
* The regions will not overlap, even if the events overlap (because overlapping
* regions will be rejected by DVD Architect's subtitle facility).
* If a region already exists in the same location, no region is created.
*
* If more than one event comes from the same media, this will result in
* duplicate region names (which is OK, because you may want the same
* subtitle text in more than one place).
*
* Use the Edit Details view in Vegas to quickly view, modify, or delete
* the resulting regions.
*
* You can then use the script that ships with Vegas to convert these
* region names to a subtitle file that can be imported into DVD Architect
* (or other DVD authoring program). Thus, the file names of your media
* can become subtitles, without any work on your part.
*
* By John Meyer 4/11/2005
* (updated 8/1/2005)
*
**/
var evnt : TrackEvent;
var myRegion : Region;
var RegionName : String;
try {
//Find first selected track
var track = FindSelectedTrack();
if (null == track)
throw "no selected track";
var eventEnum = new Enumerator(track.Events);
while (!eventEnum.atEnd()) {
evnt = TrackEvent(eventEnum.item());
var MyFilePath = evnt.ActiveTake.MediaPath;
var extFileName = Path.GetFileName(MyFilePath);
var baseFileName = Path.GetFileNameWithoutExtension(extFileName); // Media file name for this event
var StartTime = evnt.Start;
var LengthTime = evnt.Length;
if (evnt.FadeOut.Length.Nanos > 0) {
LengthTime = LengthTime - evnt.FadeOut.Length; // Eliminates region overlaps at crossfades.
}
// if (evnt.Selected) { // Add this IF statement, and ending brace, to only add regions for SELECTED events.
// The RegionExist function checks if a region already exists at this point.
if (!RegionExist(StartTime.ToMilliseconds(),LengthTime.ToMilliseconds() ) ) {
myRegion = new Region(StartTime,LengthTime,baseFileName); //Insert a region over this event
Vegas.Project.Regions.Add(myRegion);
}
// } // End if evnt.Selected
eventEnum.moveNext();
} // End while (!eventEnum.atEnd()
} catch (e) {
MessageBox.Show(e);
}
function FindSelectedTrack() : Track {
var trackEnum = new Enumerator(Vegas.Project.Tracks);
while (!trackEnum.atEnd()) {
var track : Track = Track(trackEnum.item());
if (track.Selected) {
return track;
}
trackEnum.moveNext();
}
return null;
}
function RegionExist(dStart,dLength) : boolean {
var fmarkerEnum = new Enumerator(Vegas.Project.Regions);
while (!fmarkerEnum.atEnd()) {
var fRegion = fmarkerEnum.item();
var fRegionLength = fRegion.Length.ToMilliseconds();
var fRegionStart = fRegion.Position.ToMilliseconds();