BATCH RENDER AT MARKERS?

Acts7 wrote on 5/29/2003, 12:20 PM
To me a big benefit of markers is that you could render each marker with same setting as batch process without having to return in 20 min to see if each section is rendered then start another.
I am splitting up a promo video into downloadable sizes (also sections)

Is it possible to batch render at marker point and if so how
PLEASE

Acts7

Comments

Grazie wrote on 5/29/2003, 1:00 PM
Sounds like a job for "Script Man!"

There may be one out there looking for you as we speak . . . .

Grazie
Acts7 wrote on 5/29/2003, 1:07 PM
I dont deal a whole lot with scripts.
Could you point me in direction where I may find a script like this?
just www.google.com or does anyone know of a vegas script site like this?
jetdv wrote on 5/29/2003, 1:25 PM
The script would have to be written to specifically perform this task. There are several rendering scripts out there and I have written one that is "close" to what you want (it renders to a specified length - such as 4 minute clips) but not exactly. How quickly does it need to be done? I don't have time to write it this instant.
Acts7 wrote on 5/29/2003, 1:51 PM
Its not urgent since there are only 8 sections and no effects but it would be cool AWESOME even to have for furture projects

If you write this - you would be forever in my good graces.
jetdv wrote on 5/29/2003, 2:25 PM
The script has been completed. If you have a project with 3 markers, it will render FOUR segments:
1. Beginning to marker 1
2. Marker 1 to marker 2
3. Marker 2 to marker 3
4. Marker 3 to end of project

It has been submitted for posting and will, hopefully, be posted shortly at:

http://www.creativecow.net/articles/vegas_scripts.html

The name of this script is RenderOnMarkers.js
TorS wrote on 5/29/2003, 2:54 PM
Acts7,
With a handle like that, I don't believe you "don't deal a lot in scriptures".

Grazie,
That Script Man Cometh gag was beautiful. Keep 'em coming.
Tor
Grazie wrote on 5/29/2003, 3:12 PM
Hiyah Jet!

Not been posted yet on the COW site - sooooo . . . did the Notepad thingy! Tried my first Text to Script conversion - manually . ..

I've got a error on Line 17:

" Variable 'trackEnum' has not been declared "

I haven't got the foggiest as to what this menas, other than maybe I've screwed up one the callout lines, resulting in the variable it is needing not being seen - hands-up here I aint no programmer - wanted to have a go - not that scary, is it?

Grazie
Acts7 wrote on 5/29/2003, 7:25 PM
enour - mouse
thanks for the assistance-
Its not up yet but anything will help
jetdv wrote on 5/29/2003, 10:43 PM
Hopefully they will get it up in the morning. If not, post your e-mail address and I'll send it directly in the morning.
Acts7 wrote on 5/30/2003, 10:37 AM
JET,

here's my email addey -
I Gotta use that - theres a lot of spammers out there!
Thanks so much.
Ps what model(s) DV do you use?

Thanks a ton!!!

Acts7
jetdv wrote on 5/30/2003, 11:16 AM
Acts,
The file has been sent.

The script is set to render to NTSC DV. If you want PAL DV, that line will have to be modified. Also, it is set to render to d:\vmedia. For some other directory, that line will also have to be modified.
jetdv wrote on 5/30/2003, 11:41 AM
Since it is taking longer than normal to get posted, here is the script. Just copy, paste into notepad, and save as RenderOnMarkers.js

/**
* This script will render between markers
*
* Written By: Edward Troxel
* www.jetdv.com/tts
* Modified: 05-29-2003
**/

import System;
import System.Text;
import System.IO;
import System.Windows.Forms;
import System.Object;
import SonicFoundry.Vegas;

// here are some default variables for the GUI.
//Path names must use "\\" to indicate a standard path "\"
//so, defaultBasePath refers to D:\renders
var defaultBasePath = "D:\\vmedia\\";

// set this to true if you want to allow files to be overwritten
var overwriteExistingFiles = false;

try {

var mrkEnum = new Enumerator(Vegas.Project.Markers);

var zeroMark = new Timecode(0);
var PrevMark = zeroMark;
var currMark = zeroMark;
var SubClipNum = 1;
var renderStart : Timecode;
var totalLength = Vegas.Project.Length;
var renderLength : Timecode;

var renderer = FindRenderer(/Video for Windows/);
if (null == renderer)
throw "failed to find renderer";

var template = FindRenderTemplate(renderer, /NTSC DV/);
if (null == template)
throw "failed to find template";


//Go through the list of Markers
while (!mrkEnum.atEnd()) {
currMark = Marker(mrkEnum.item()).Position;

renderStart = PrevMark;
renderLength = currMark - PrevMark;
DoRender(defaultBasePath + "test" + SubClipNum + ".AVI", renderer, template, renderStart, renderLength);

PrevMark = currMark
SubClipNum++;
mrkEnum.moveNext();
}

// Do the final clip
renderStart = PrevMark;
renderLength = totalLength - PrevMark;
DoRender(defaultBasePath + "test" + SubClipNum + ".AVI", renderer, template, renderStart, renderLength);

} catch (e) {
MessageBox.Show(e);
}


// perform the render. The Render method returns a member of the
// RenderStatus enumeration. If it is anything other than OK, exit
// the loops. This will throw an error message string if the render
// does not complete successfully.
function DoRender(fileName, rndr, rndrTemplate, start, length) {
// make sure the file does not already exist
if (!overwriteExistingFiles && File.Exists(fileName)) {
throw "File already exists: " + fileName;
}

// perform the render. The Render method returns
// a member of the RenderStatus enumeration. If
// it is anything other than OK, exit the loops.
var status = Vegas.Render(fileName, rndrTemplate, start, length);

// if the render completed successfully, just return
if (status == RenderStatus.Complete)
return;

// if the user canceled, throw out a special message that won't be
// displayed.
if (status == RenderStatus.Canceled) {
var cancelMsg = new String("User canceled");
cancelMsg.skipMessageBox = true;
throw cancelMsg;
}

// if the render failed, throw out a detailed error message.
var msg : StringBuilder = new StringBuilder("Render failed:\n");
msg.Append("\n file name: ");
msg.Append(fileName);
msg.Append("\n Renderer: ");
msg.Append(rndr.FileTypeName);
msg.Append("\n Template: ");
msg.Append(rndrTemplate.Name);
msg.Append("\n Start Time: ");
msg.Append(start.ToString());
msg.Append("\n Length: ");
msg.Append(length.ToString());
throw msg;
}



function FindRenderer(rendererRegExp : RegExp) : Renderer {
var rendererEnum : Enumerator = new Enumerator(Vegas.Renderers);
while (!rendererEnum.atEnd()) {
var renderer : Renderer = Renderer(rendererEnum.item());
if (null != renderer.FileTypeName.match(rendererRegExp)) {
return renderer;
}
rendererEnum.moveNext();
}
return null;
}

function FindRenderTemplate(renderer : Renderer, templateRegExp : RegExp) : RenderTemplate {
var templateEnum : Enumerator = new Enumerator(renderer.Templates);
while (!templateEnum.atEnd()) {
var renderTemplate : RenderTemplate = RenderTemplate(templateEnum.item());
if (null != renderTemplate.Name.match(templateRegExp)) {
return renderTemplate;
}
templateEnum.moveNext();
}
return null;
}

ricklaut wrote on 5/30/2003, 8:47 PM
Edward -

I'm trying to get this script to work, but nothing happens when I run it. Here's what I did:
- copied and pasted your text into notepad; created a directory on H drive named vmedia; edited "D" to "H" in the script to reflect the drive letter change; saved as RenderonMarkers.js in my Scripts directory
- Inserted markers into my timeline (used AddMarkersToEvents.js script)
- Ran the RenderonMarkers.js script. I got an hourglass for about 2 seconds; no message boxes appeared.
- Checked my vmedia directory on H; nothing there.

What am I missing?

Rick
jetdv wrote on 5/30/2003, 9:17 PM
I'm not sure. It worked fine in my test (created 4 files from 3 markers). Are you using "M" to create the markers (it has to be that kind of marker)?
ricklaut wrote on 5/30/2003, 9:21 PM
Yes - I tried "M" and then I tried the AddMarkersToEvents.js script. Neither worked.

Any other ideas?

Rick
jetdv wrote on 5/30/2003, 9:37 PM
The only thing I can really suggest is to see how far in the script it is really getting. Add this line in several places in the script:

MessageBox.Show(1);

Upper and lower case DOES matter so type it exactly and do not forget the ";" at the end. Place the first one after after the "try" line. Then place several more scattered throughout the script changing 1 to 2 then 3 then 4 and see how far the numbers go indicating how far you have made it into the script. If you never even see the "1" message, then the script is not running for some reason. If you see "1", "2", "3", but no "4", you will know it is quitting between numbers 3 and 4....

This is really the best suggestion I can offer at this point.

Also, if you post your e-mail address, I'll be happy to send the original file to you.
ricklaut wrote on 5/30/2003, 9:47 PM
Edward - As I read the script as written, it will only render to NTSC DV, correct? I was thinking that it would allow a choice of render templates.

Let me explain what I'm trying to accomplish; perhaps you can provide a suggestion. I need to render each event in the timeline to three formats (.wmv, .rm and .mov). I've been manually creating a region for each clip and then using a script called BatchRenderChooseTemplate.js - this script allow you to select "Render Regions" thus giving me my three encoded clips per event. The hard part is manually setting the regions.

I was hoping to make this a simpler process by using your AddMarkersToEvents.js script and then running your RenderOnMarkers.js script to render between each marker (i.e. each event) (although it doesn't sound like this will give me my 3 encoded clips per event).

Any thoughts?

Rick
ricklaut wrote on 5/30/2003, 9:49 PM
I'll take the original file and see if that works - thanks! ricklaut@lvcm.com is my e-mail address.

Rick