I use markers to create chapter points for DVDA. However, I often want to render each chapter as a separate MPEG file, and then create different DVDs for different people, each with different combinations of these chapter files. Of course, the lack of end actions in DVDA makes this workflow difficult but, as I've posted elsewhere, I have a workaround that lets me proceed until that fine day in the future when Sony bestows end actions on the world.
Of course to render each chapter separately requires a script (unless you want to sit around waiting for each render to finish). Fortunately, the BatchGUI script works great.
Just one problem: It wants each segment defined as regions, not with markers.
Now, in Sound Forge, you can just call up Special -> Regions List -> Markers to Regions and the deed is done. I couldn't find any such thing in Vegas, so here's a script that will do this function. I said I wouldn't do any more scripts because of Sony's stupid decision to arbitrarily force us to re-write code because they are too lazy to include the old calls for backward compatibility (can you tell I'm still steamed??). However, such an attitude doesn't get anyone anywere anytime so, without further fanfare, here it is. Hope it does someone some good.
P.S. Remember, that if you cut and paste this code, the HTML coding gives you line breaks instead of carriage return line feed. You may need to put this in your word processor and do a search and replace before you can use the code in Vegas. In Word you search for
^l
and replace with
^p
Of course to render each chapter separately requires a script (unless you want to sit around waiting for each render to finish). Fortunately, the BatchGUI script works great.
Just one problem: It wants each segment defined as regions, not with markers.
Now, in Sound Forge, you can just call up Special -> Regions List -> Markers to Regions and the deed is done. I couldn't find any such thing in Vegas, so here's a script that will do this function. I said I wouldn't do any more scripts because of Sony's stupid decision to arbitrarily force us to re-write code because they are too lazy to include the old calls for backward compatibility (can you tell I'm still steamed??). However, such an attitude doesn't get anyone anywere anytime so, without further fanfare, here it is. Hope it does someone some good.
P.S. Remember, that if you cut and paste this code, the HTML coding gives you line breaks instead of carriage return line feed. You may need to put this in your word processor and do a search and replace before you can use the code in Vegas. In Word you search for
^l
and replace with
^p
/**
* This script will convert markers to regions.
* The original markers are left intact.
*
* The script ignores all markers beyond the last event.
*
* By John Meyer 12/8/2003
*
**/
import System;
import System.IO;
import System.Windows.Forms;
import SonicFoundry.Vegas;
var MyRegion : Region;
var PrevMarker : Marker;
var RegionStart : Timecode;
var RegionEnd : Timecode;
try {
var markerEnum = new Enumerator(Vegas.Project.Markers); // Start going through all the markers
PrevMarker = markerEnum.item(); // Remember first marker
while (!markerEnum.atEnd()) { // Keep going until last marker
markerEnum.moveNext(); // Get next marker
if (markerEnum.atEnd()) { // If no more markers (we're almost finished),
RegionEnd = Vegas.Project.Length; // get timecode at end of project
}
else {
RegionEnd = markerEnum.item().Position; // Get timecode for current marker
}
RegionStart = PrevMarker.Position; // Regions starts at previous marker.
var RegionName = PrevMarker.Label; // Name the region using previous marker's name.
// The RegionExist function checks if a region already exists at this point.
if (!RegionExist(RegionStart.ToMilliseconds(),RegionEnd.ToMilliseconds() ) ) {
MyRegion = new Region(RegionStart,RegionEnd - RegionStart,RegionName);
Vegas.Project.Regions.Add(MyRegion); // Add the new region
}
if (markerEnum.atEnd()) break; // If out of markers, quit.
// If last marker is equal to or beyond the end of the project, stop here.
if ( Vegas.Project.Length.ToMilliseconds() <= markerEnum.item().Position.ToMilliseconds() ) {
break;
}
else {
PrevMarker = markerEnum.item(); // Remember this marker for next loop.
}
}
} catch (e) {
MessageBox.Show(e);
}
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();
if ( (dLength == fRegionLength) && (dStart == fRegionStart) ) {
return 1;
}
fmarkerEnum.moveNext();
}
return 0;
}