FORUMS: list search recent posts

Please assist with Batch Rendering script for Vegas 12

COW Forums : VEGAS Pro

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Roger Smith
Please assist with Batch Rendering script for Vegas 12
on Jan 10, 2015 at 3:53:47 am

Hey all, I'm trying to get this script to work that I found. It's free, so I assume it's OK for me to get help to get it to work. I get errors when I execute it, and followed the instructions exactly. I'll post the script, and a screen shot of the errors I'm receiving. All I want is batch rendering to work. I know there is commercial scripts out there that do tons of things, but I only need consecutive batch rendering for .veg files, nothing else. If I drag all the .veg files to a new Vegas window and render them as regions, it takes FOREVER! Each render of a hockey game .veg file is about 2:15 for an 1:15 hockey game. Rendering as described above takes over 12 hours for two .veg files, so I can't do it that way. Any help is appreciated.

Script:

/**
* This script renders all VEG projects that reside in the same folder
* as the currently opened project (i.e., you choose the directory by opening any
* VEG file in that directory).
*
* Created by John Meyer on January 28, 2010
**/

import System.IO;
import System.Windows.Forms;
import Sony.Vegas;

// Modify the following two lines to specify the render AND the template.

//var rendererRE = /Video for Windows/;
var rendererRE = /MainConcept AVC&#092;/AAC/;
// Put the template name betwee the ^ and $ characters to ensure that only the EXACT render name is used.
// Capitalization matters!! Copy/paste from Render As Custom dialog to make sure name is correct.
var templateRE = /^Internet HD 1080p CUDA$/;

// Set this to a valid out directory or set it to null if you want the
// output files to be created in the same directory as their project file.
//var defaultOutputDir = &quot;E:&#092;&#092;Football iPod Files&#092;&#092;&quot;;
var defaultOutputDir =

// Set the following variable to true if you want to allow the script
// to overrwite existing rendered output files.
var allowFileOverwrites = false;



// The inputFileRegexp is used to filter the input files. For this script, it
// will always be .veg.
var inputFileRegexp = /.veg$/i;

try {
if ((null != defaultOutputDir) &amp;&amp; !Directory.Exists(defaultOutputDir))
throw &quot;output directory does not exist: &quot; + defaultOutputDir;

// find the renderer and template
var renderer : Renderer = FindRenderer(rendererRE);
if (null == renderer)
throw &quot;failed to find renderer&quot;;
var renderTemplate :RenderTemplate = FindRenderTemplate(renderer, templateRE);
if (null == renderTemplate)
throw &quot;failed to find render template&quot;;

// get file name extension that will be appended to each output file
var rendererExt = renderer.FileExtension.substring(1);

// Set up the array which will hold the list of all files in the project directory.
var renderQueue = new Array();
var queueIndex = 0
var dir = Path.GetDirectoryName(Vegas.Project.FilePath);

var fileEnum = new Enumerator(Directory.GetFiles(dir));

// Go through all the files in the project directory and build a list of the
// VEG files.
while (!fileEnum.atEnd()) {
var nextVeg = fileEnum.item();

// skip files that don&#0039;t end with the right extension
if (null == nextVeg.match(inputFileRegexp)) {
fileEnum.moveNext();
continue;
}

renderQueue[queueIndex] = nextVeg;
queueIndex++;
fileEnum.moveNext();
}

// for each project file in the queue...
var renderIndex = 0
while (renderIndex < queueIndex) {
// open the next project
var vegFilename = renderQueue[renderIndex];
if (!Vegas.OpenProject(vegFilename)) {
throw &quot;failed to open project file: &quot; + vegFilename;
}

// compute the output directory
var outputDir;
if (null == defaultOutputDir) {
outputDir = Path.GetDirectoryName(vegFilename);
} else {
outputDir = defaultOutputDir;
}

// create the output file name
var outputName = Path.GetFileNameWithoutExtension(vegFilename);
var outputFilename = outputDir + Path.DirectorySeparatorChar + outputName + rendererExt;
if ((!allowFileOverwrites) &amp;&amp; File.Exists(outputFilename))
throw &quot;file already exists: &quot; + outputFilename;

// perform the render
var renderStatus = Vegas.Render(outputFilename, renderTemplate);

if (RenderStatus.Complete != renderStatus)
throw &quot;failed to complete render: &quot; + outputFilename;

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


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 (renderTemplate.Name.match(templateRegExp)) {
return renderTemplate;
}
templateEnum.moveNext();
}
return null;
}


Error window:



Return to posts index

John Rofrano
Re: Please assist with Batch Rendering script for Vegas 12
on Jan 10, 2015 at 12:37:44 pm

You named the file wrong. You named the file with a .cs extension which indicates that it's a C# file. That is NOT C# code in that file, that's JavaScript. Try changing the file extension to .js instead.

~jr

http://www.johnrofrano.com
http://www.vasst.com



Return to posts index

Roger Smith
Re: Please assist with Batch Rendering script for Vegas 12
on Jan 10, 2015 at 5:34:46 pm

Thanks. I know absolutely nothing about scripting, coding, etc... I guess I'll have to spend some time learning it if I can retire soon....


Return to posts index


Roger Smith
Re: Please assist with Batch Rendering script for Vegas 12
on Jan 10, 2015 at 6:13:15 pm

[John Rofrano] "You named the file wrong. You named the file with a .cs extension which indicates that it's a C# file. That is NOT C# code in that file, that's JavaScript. Try changing the file extension to .js instead."

Well, different set of errors, and a lot more.







Return to posts index

John Rofrano
Re: Please assist with Batch Rendering script for Vegas 12
on Jan 10, 2015 at 11:29:06 pm

I'm guessing that whatever web site you copied that script from actually corrupted the code by escaping illegal characters. I noticed things like &quot; instead of a real "

This code is never going to work until you get a clean copy.

~jr

http://www.johnrofrano.com
http://www.vasst.com



Return to posts index

Roger Smith
Re: Please assist with Batch Rendering script for Vegas 12
on Jan 10, 2015 at 11:35:11 pm

Unfortunately that came right out of the zip file. I looked at it and it has the same characters... I've attached it if you want to look at it.

8392_renderallvegfilesinadirectory.zip


Return to posts index


John Rofrano
Re: Please assist with Batch Rendering script for Vegas 12
on Jan 10, 2015 at 11:43:41 pm

[Roger Smith] "Unfortunately that came right out of the zip file. I looked at it and it has the same characters"
Yup. Whoever created that zip file didn't know what they were doing. That files is already corrupt. You would have to go through it and clean out all of the HTML markup manually.

~jr

http://www.johnrofrano.com
http://www.vasst.com



Return to posts index

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