VEGAS Pro 21 - On Sale Now!
DISCLOSURE: Movie Studio Zen is supported by its audience. When you purchase through links on this site, we may earn an affiliate commission.

Solved Scripting - Batch Render

Scripting - Batch Render was created by kiwihans

Posted 25 Mar 2019 13:45 #1
I have 21 movie clips and I need to render them- but automatically. I have never used Batch Render and need some help on how to proceed. I have a folder for the original captured movie files and secondly I have a folder of Veg files.
I started up "Batch render" and suggested to the program where to find the Veg files such as this: E: veg files/Maks
I clicked to proceed further but get this message:"No render templates selected" Obviously I am missing something here......
Can anyone please help out with a step by step assistance? Thanks in advance!!
Last Edit:26 Jan 2020 12:45 by kiwihans

Please Log in or Create an account to join the conversation.

Replied by Eagle Six on topic Scripting - Batch Render

Posted 26 Mar 2019 01:48 #2
You need all your clips in the same project, mark them with regions, then use the batch render script setting it up with an appropriate file name extension, render format template of your choice, and render by regions.

If you have more than just clips in each project, you could nest all you project into one.

I will not be back in the office for several hours, but if no other member has provided you with additional information by the time I return I will add some then, running out of time now.
Best Regards......George

Please Log in or Create an account to join the conversation.

Replied by Eagle Six on topic Scripting - Batch Render

Posted 26 Mar 2019 08:37 #3
Hi kiwihans,

I have three script files which are public domain I can share with you. As far as I know these are not included with Vegas Pro, however some works similar to the scripts included.

When I have batch rendered in the past, I add clips to a track in the timeline, one after the other until I have them all loaded (it may be best to add maybe 5 at a time until you are sure it is working).

Then I run a script called 'RegionAtEvents'. This script marks a region at each event/clip in the track and also names that region with the same name as the event/clip.

Then I run a script called 'BatchRender-Regions'. This scripts allows you to select the folder for the renders, the render format template to use for rendering, and to save each render region (event/clip) with the same name as the region.

If I am going to do anything else, I run a script called 'RemoveAllMarkerRegions'. This scripts removes all the regions.

If this is something you are interested in I will post the scripts so you can save and use them. However to post the correct scripts I need to know which version and build of Vegas Pro you are using.

If you want to batch render various projects you have made (that is what it sounds like from you OP). You will have to first nest all your projects into one master project. If in these individual projects that you nest, there are more than just one clip/event, such as title/text, etc. you will need to mark the regions for each manually and assign a unique name to each region in order for 'BatchRender-Regions' to work.
Best Regards......George
The following user(s) said Thank You: DoctorZen

Please Log in or Create an account to join the conversation.

Replied by kiwihans on topic Scripting - Batch Render

Posted 26 Mar 2019 12:16 #4
Thanks George it sounds interesting. The 21 movies I mention are all for the same customer (the same project) When I capture the customer movie clips they all go to the same folder in this case: "Maks" . I then edit/process these clips which ends up with Veg files and they are all in the Veg folder. In this case there are 21 Veg files in this folder and 21 movie clips in the customers folder.
I am using Vegas Pro 16.0, 64bit - build 361 running under Win 10.
You talk about "nesting" all my projects (in my case we are talking about just one project at a time) into one master project. (how to do this is beyond me) Need some step by step hand-holding on this. Yes, I would be interested to get the files you talk about. I have done some Googling since yesterday. The Sony Vegas Production Assistant can be got via Internet from various sources, but it is not mentioned which of their versions works with Vegas Pro 16.0
BTW. 80% of my work is digitizing old 8mm movies. The files are quite small - 3 to 4 mins per movie. That's why I am keen to batch process these.......

Please Log in or Create an account to join the conversation.

Replied by Eagle Six on topic Scripting - Batch Render

Posted 27 Mar 2019 02:01 #5
Let's see if nesting will work for you. I will refer to your veg files as simply 1.veg, 2.veg, 3.veg through 21.veg, for this example....

1. Open 1.veg, then save this project as (example) 'Master Maks.veg'. Now, nothing we do we harm your original 21 projects.

2. Move the play head cursor to the end.

3. Select 'Import Media', navigate to your veg folder and select 2.veg. This will place that project in the project media bin. Now grab it like you would a clip and pull it down and add it to the timeline track.

4. Select 'Import Media', navigate to your veg folder and select 3.veg. This will place that project in the project media bin. Now grab it like you would a clip and pull it down and add it to the timeline track.

5. You can continue to add 4.veg, 5.veg, 6.veg, etc, until you have loaded all the rest, or just select the remaining and add them all at once to the project media bin, then add them all to the timeline track. Each project veg file that you add will appear to be one event/clip in the timeline/track.

Once all your 21.veg's have been added, check through the timeline to assure they are all there and running as they did in the individual projects. If so, you have successfully nested your 21 veg projects into on. Now save this 'Master Maks.veg' as we will use it to batch render. Please let me know how this works.

I need to step away for a while and will return with the script files.
Best Regards......George

Please Log in or Create an account to join the conversation.

Replied by Eagle Six on topic Scripting - Batch Render

Posted 27 Mar 2019 02:28 #6
kiwihans, this is going to be a bit long, so please read through the instruction to the end before starting (you do not need to read the code contents of the scripts, unless you are familiar with scripting code it is just a bunch of gibberish!).....

1. Load up the Windows 'Notepad'. Copy and paste the following text into Notepad (this is the BatchRender-Regions script file) do not include the Start and End lines.....(this 1st script is quite long, the following 2 are much shorter).

START of 1st SCRIPT- DO NOT INCLUDE THIS LINE
/**
* Sample script that performs batch renders with GUI for selecting
* render templates.
*
* Revision Date: Mar. 31, 2009.
* Updated 2nd January 2017 to run on Vegas 14 for Magix Zulqar Cheema
**/
using System;
using System.IO;
using System.Text;
using System.Drawing;
using System.Collections;
using System.Diagnostics;
using System.Windows.Forms;

using ScriptPortal.Vegas;

public class EntryPoint {

// set this to true if you want to allow files to be overwritten
bool OverwriteExistingFiles = false;

String defaultBasePath = "Untitled_";

ScriptPortal.Vegas.Vegas myVegas = null;

enum RenderMode
{
Project = 0,
Selection,
Regions,
}

ArrayList SelectedTemplates = new ArrayList();

public void FromVegas(Vegas vegas)
{
myVegas = vegas;

String projectPath = myVegas.Project.FilePath;
if (String.IsNullOrEmpty(projectPath)) {
String dir = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
defaultBasePath = Path.Combine(dir, defaultBasePath);
} else {
String dir = Path.GetDirectoryName(projectPath);
String fileName = Path.GetFileNameWithoutExtension(projectPath);
defaultBasePath = Path.Combine(dir, fileName + "_");
}

DialogResult result = ShowBatchRenderDialog();
myVegas.UpdateUI();
if (DialogResult.OK == result) {
OverwriteExistingFiles = OverwriteFiles.Checked;

// inform the user of some special failure cases
String outputFilePath = FileNameBox.Text;
RenderMode renderMode = RenderMode.Project;
if (RenderRegionsButton.Checked) {
renderMode = RenderMode.Regions;
} else if (RenderSelectionButton.Checked) {
renderMode = RenderMode.Selection;
}
DoBatchRender(SelectedTemplates, outputFilePath, renderMode);
}
}

void DoBatchRender(ArrayList selectedTemplates, String basePath, RenderMode renderMode)
{
String outputDirectory = Path.GetDirectoryName(basePath);
String baseFileName = Path.GetFileName(basePath);

// make sure templates are selected
if ((null == selectedTemplates) || (0 == selectedTemplates.Count))
throw new ApplicationException("No render templates selected.");

// make sure the output directory exists
if (!Directory.Exists(outputDirectory))
throw new ApplicationException("The output directory does not exist.");

RenderStatus status = RenderStatus.Canceled;

// enumerate through each selected render template
foreach (RenderItem renderItem in selectedTemplates) {
// construct the file name (most of it)
String filename = Path.Combine(outputDirectory,
FixFileName(baseFileName) +
FixFileName(renderItem.Renderer.FileTypeName) +
"_" +
FixFileName(renderItem.Template.Name));

if (RenderMode.Regions == renderMode) {
int regionIndex = 0;
String regionFilename;
foreach (ScriptPortal.Vegas.Region region in myVegas.Project.Regions) {
regionFilename = String.Format("{0}[{1}]{2}",
filename,
regionIndex.ToString(),
renderItem.Extension);

if (NameAsRegionTitle.Checked)
{
if (!(region.Label == "") && !(region.Label == null))
{
regionFilename = Path.Combine(outputDirectory, String.Format("{0}{1}",
FixFileName(region.Label),
renderItem.Extension));
}
}

// Render the region
status = DoRender(regionFilename, renderItem, region.Position, region.Length);
if (RenderStatus.Canceled == status) break;
regionIndex++;
}
} else {
filename += renderItem.Extension;
Timecode renderStart, renderLength;
if (renderMode == RenderMode.Selection) {
renderStart = myVegas.SelectionStart;
renderLength = myVegas.SelectionLength;
} else {
renderStart = new Timecode();
renderLength = myVegas.Project.Length;
}
status = DoRender(filename, renderItem, renderStart, renderLength);
}
if (RenderStatus.Canceled == status) break;
}
}

// 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.
RenderStatus DoRender(String filePath, RenderItem renderItem, Timecode start, Timecode length)
{
ValidateFilePath(filePath);

// make sure the file does not already exist
if (!OverwriteExistingFiles && File.Exists(filePath)) {
throw new ApplicationException("File already exists: " + filePath);
}

// perform the render. The Render method returns
// a member of the RenderStatus enumeration. If
// it is anything other than OK, exit the loops.
RenderArgs args = new RenderArgs();

args.OutputFile = filePath;
args.RenderTemplate = renderItem.Template;
args.Start = start;
args.Length = length;
args.IncludeMarkers = false;
args.StretchToFill = StretchToFill.Checked;
args.UseChannelMapping = false;

RenderStatus status = myVegas.Render(args);

// RenderStatus status = myVegas.Render(filePath, renderItem.Template, start, length);

switch (status)
{
case RenderStatus.Complete:
case RenderStatus.Canceled:
break;
case RenderStatus.Failed:
default:
StringBuilder msg = new StringBuilder("Render failed:\n");
msg.Append("\n file name: ");
msg.Append(filePath);
msg.Append("\n Renderer: ");
msg.Append(renderItem.Renderer.FileTypeName);
msg.Append("\n Template: ");
msg.Append(renderItem.Template.Name);
msg.Append("\n Start Time: ");
msg.Append(start.ToString());
msg.Append("\n Length: ");
msg.Append(length.ToString());
throw new ApplicationException(msg.ToString());
}
return status;
}

String FixFileName(String name)
{
const Char replacementChar = '-';
foreach (char badChar in Path.GetInvalidFileNameChars()) {
name = name.Replace(badChar, replacementChar);
}
return name;
}

void ValidateFilePath(String filePath)
{
if (filePath.Length > 260)
throw new ApplicationException("File name too long: " + filePath);
foreach (char badChar in Path.GetInvalidPathChars()) {
if (0 <= filePath.IndexOf(badChar)) {
throw new ApplicationException("Invalid file name: " + filePath);
}
}
}

class RenderItem
{
public readonly Renderer Renderer = null;
public readonly RenderTemplate Template = null;
public readonly String Extension = null;

public RenderItem(Renderer r, RenderTemplate t, String e)
{
this.Renderer = r;
this.Template = t;
// need to strip off the extension's leading "*"
if (null != e) this.Extension = e.TrimStart('*');
}
}

Button BrowseButton;
TextBox FileNameBox;
TreeView TemplateTree;
RadioButton RenderProjectButton;
RadioButton RenderRegionsButton;
RadioButton RenderSelectionButton;
CheckBox NameAsRegionTitle;
CheckBox OverwriteFiles;
CheckBox StretchToFill;

DialogResult ShowBatchRenderDialog()
{
Form dlog = new Form();
dlog.Text = "Batch Render";
dlog.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
dlog.MaximizeBox = false;
dlog.StartPosition = FormStartPosition.CenterScreen;
dlog.Width = 620;
dlog.FormClosing += this.HandleFormClosing;

int titleBarHeight = dlog.Height - dlog.ClientSize.Height;
int buttonWidth = 80;

FileNameBox = AddTextControl(dlog, "Base File Name", titleBarHeight + 6, 480, 10, defaultBasePath);

BrowseButton = new Button();
BrowseButton.Left = FileNameBox.Right + 4;
BrowseButton.Top = FileNameBox.Top - 2;
BrowseButton.Width = buttonWidth;
BrowseButton.Height = BrowseButton.Font.Height + 12;
BrowseButton.Text = "Browse...";
BrowseButton.Click += new EventHandler(this.HandleBrowseClick);
dlog.Controls.Add(BrowseButton);

OverwriteFiles = AddCheckBox(dlog,
"Overwrite Existing Files",
FileNameBox.Left,
BrowseButton.Bottom,
true);
OverwriteFiles.Checked = OverwriteExistingFiles;

StretchToFill = OverwriteFiles = AddCheckBox(dlog,
"Stretch to Fill",
OverwriteFiles.Left + OverwriteFiles.Width + 24,
BrowseButton.Bottom,
true);


TemplateTree = new TreeView();
TemplateTree.Left = 10;
TemplateTree.Width = dlog.Width - 20;
TemplateTree.Top = OverwriteFiles.Bottom + 10;
TemplateTree.Height = 300;
TemplateTree.CheckBoxes = true;
TemplateTree.AfterCheck += new TreeViewEventHandler(this.HandleTreeViewCheck);
dlog.Controls.Add(TemplateTree);

int buttonTop = TemplateTree.Bottom + 16;
int buttonsLeft = dlog.Width - (2*(buttonWidth+10));

RenderProjectButton = AddRadioControl(dlog,
"Render Project",
6,
buttonTop,
true);
RenderSelectionButton = AddRadioControl(dlog,
"Render Selection",
RenderProjectButton.Right,
buttonTop,
(0 != myVegas.SelectionLength.Nanos));
RenderRegionsButton = AddRadioControl(dlog,
"Render Regions",
RenderSelectionButton.Right,
buttonTop,
(0 != myVegas.Project.Regions.Count));
RenderProjectButton.Checked = true;

NameAsRegionTitle = AddCheckBox(dlog,
"Use Region Titles as Filename",
RenderSelectionButton.Right,
buttonTop + 20,
RenderRegionsButton.Enabled);

buttonTop = buttonTop + 16;


Button okButton = new Button();
okButton.Text = "OK";
okButton.Left = dlog.Width - (2*(buttonWidth+10));
okButton.Top = buttonTop;
okButton.Width = buttonWidth;
okButton.Height = okButton.Font.Height + 12;
okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
dlog.AcceptButton = okButton;
dlog.Controls.Add(okButton);

Button cancelButton = new Button();
cancelButton.Text = "Cancel";
cancelButton.Left = dlog.Width - (1*(buttonWidth+10));
cancelButton.Top = buttonTop;
cancelButton.Height = cancelButton.Font.Height + 12;
cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
dlog.CancelButton = cancelButton;
dlog.Controls.Add(cancelButton);

dlog.Height = titleBarHeight + okButton.Bottom + 8;
dlog.ShowInTaskbar = false;

FillTemplateTree();

return dlog.ShowDialog(myVegas.MainWindow);
}

TextBox AddTextControl(Form dlog, String labelName, int left, int width, int top, String defaultValue)
{
Label label = new Label();
label.AutoSize = true;
label.Text = labelName + ":";
label.Left = left;
label.Top = top + 4;
dlog.Controls.Add(label);

TextBox textbox = new TextBox();
textbox.Multiline = false;
textbox.Left = label.Right;
textbox.Top = top;
textbox.Width = width - (label.Width);
textbox.Text = defaultValue;
dlog.Controls.Add(textbox);

return textbox;
}

CheckBox AddCheckBox(Form dlog, String labelName, int left, int top, bool enabled)
{
CheckBox checkbox = new CheckBox();
checkbox.AutoSize = true;
checkbox.Text = labelName;
checkbox.Left = left;
checkbox.Top = top + 4;
checkbox.Enabled = enabled;
dlog.Controls.Add(checkbox);

return checkbox;
}


RadioButton AddRadioControl(Form dlog, String labelName, int left, int top, bool enabled)
{
Label label = new Label();
label.AutoSize = true;
label.Text = labelName;
label.Left = left;
label.Top = top + 4;
label.Enabled = enabled;
dlog.Controls.Add(label);

RadioButton radiobutton = new RadioButton();
radiobutton.Left = label.Right;
radiobutton.Width = 36;
radiobutton.Top = top;
radiobutton.Enabled = enabled;
dlog.Controls.Add(radiobutton);

return radiobutton;
}

void FillTemplateTree()
{
int projectAudioChannelCount = 0;
if (AudioBusMode.Stereo == myVegas.Project.Audio.MasterBusMode) {
projectAudioChannelCount = 2;
} else if (AudioBusMode.Surround == myVegas.Project.Audio.MasterBusMode) {
projectAudioChannelCount = 6;
}
bool projectHasVideo = ProjectHasVideo();
bool projectHasAudio = ProjectHasAudio();
foreach (Renderer renderer in myVegas.Renderers) {
try {
String rendererName = renderer.FileTypeName;
TreeNode rendererNode = new TreeNode(rendererName);
rendererNode.Tag = new RenderItem(renderer, null, null);
foreach (RenderTemplate template in renderer.Templates) {
try {
// filter out invalid templates
if (!template.IsValid()) {
continue;
}
// filter out video templates when project has
// no video.
if (!projectHasVideo && (0 < template.VideoStreamCount)) {
continue;
}
// filter out audio-only templates when project has no audio
if (!projectHasAudio && (0 == template.VideoStreamCount) && (0 < template.AudioStreamCount)) {
continue;
}
// filter out templates that have more channels than the project
if (projectAudioChannelCount < template.AudioChannelCount) {
continue;
}
// filter out templates that don't have
// exactly one file extension
String[] extensions = template.FileExtensions;
if (1 != extensions.Length) {
continue;
}
String templateName = template.Name;
TreeNode templateNode = new TreeNode(templateName);
templateNode.Tag = new RenderItem(renderer, template, extensions[0]);
rendererNode.Nodes.Add(templateNode);
} catch (Exception e) {
// skip it
MessageBox.Show(e.ToString());
}
}
if (0 == rendererNode.Nodes.Count) {
continue;
} else if (1 == rendererNode.Nodes.Count) {
// skip it if the only template is the project
// settings template.
if (0 == ((RenderItem) rendererNode.Nodes[0].Tag).Template.Index) {
continue;
}
} else {
TemplateTree.Nodes.Add(rendererNode);
}
} catch {
// skip it
}
}
}

bool ProjectHasVideo()
{
foreach (Track track in myVegas.Project.Tracks)
{
if (track.IsVideo()) return true;
}
return false;
}

bool ProjectHasAudio() {
foreach (Track track in myVegas.Project.Tracks) {
if (track.IsAudio()) {
return true;
}
}
return false;
}


void UpdateSelectedTemplates()
{
SelectedTemplates.Clear();
foreach (TreeNode node in TemplateTree.Nodes) {
foreach (TreeNode templateNode in node.Nodes) {
if (templateNode.Checked) {
SelectedTemplates.Add(templateNode.Tag);
}
}
}
}

void HandleBrowseClick(Object sender, EventArgs args)
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "All Files (*.*)|*.*";
saveFileDialog.CheckPathExists = true;
saveFileDialog.AddExtension = false;
if (null != FileNameBox) {
String filename = FileNameBox.Text;
String initialDir = Path.GetDirectoryName(filename);
if (Directory.Exists(initialDir)) {
saveFileDialog.InitialDirectory = initialDir;
}
saveFileDialog.DefaultExt = Path.GetExtension(filename);
saveFileDialog.FileName = Path.GetFileNameWithoutExtension(filename);
}
if (System.Windows.Forms.DialogResult.OK == saveFileDialog.ShowDialog()) {
if (null != FileNameBox) {
FileNameBox.Text = Path.GetFullPath(saveFileDialog.FileName);
}
}
}

void HandleTreeViewCheck(object sender, TreeViewEventArgs args)
{
if (args.Node.Checked) {
if (0 != args.Node.Nodes.Count) {
if ((args.Action == TreeViewAction.ByKeyboard) || (args.Action == TreeViewAction.ByMouse)) {
SetChildrenChecked(args.Node, true);
}
} else if (!args.Node.Parent.Checked) {
args.Node.Parent.Checked = true;
}
} else {
if (0 != args.Node.Nodes.Count) {
if ((args.Action == TreeViewAction.ByKeyboard) || (args.Action == TreeViewAction.ByMouse)) {
SetChildrenChecked(args.Node, false);
}
} else if (args.Node.Parent.Checked) {
if (!AnyChildrenChecked(args.Node.Parent)) {
args.Node.Parent.Checked = false;
}
}
}
}

void HandleFormClosing(Object sender, FormClosingEventArgs args)
{
Form dlg = sender as Form;
if (null == dlg) return;
if (DialogResult.OK != dlg.DialogResult) return;
String outputFilePath = FileNameBox.Text;
try {
String outputDirectory = Path.GetDirectoryName(outputFilePath);
if (!Directory.Exists(outputDirectory)) throw new ApplicationException();
} catch {
String title = "Invalid Directory";
StringBuilder msg = new StringBuilder();
msg.Append("The output directory does not exist.\n");
msg.Append("Please specify the directory and base file name using the Browse button.");
MessageBox.Show(dlg, msg.ToString(), title, MessageBoxButtons.OK, MessageBoxIcon.Error);
args.Cancel = true;
return;
}
try {
String baseFileName = Path.GetFileName(outputFilePath);
if (String.IsNullOrEmpty(baseFileName)) throw new ApplicationException();
if (-1 != baseFileName.IndexOfAny(Path.GetInvalidFileNameChars())) throw new ApplicationException();
} catch {
String title = "Invalid Base File Name";
StringBuilder msg = new StringBuilder();
msg.Append("The base file name is not a valid file name.\n");
msg.Append("Make sure it contains one or more valid file name characters.");
MessageBox.Show(dlg, msg.ToString(), title, MessageBoxButtons.OK, MessageBoxIcon.Error);
args.Cancel = true;
return;
}
UpdateSelectedTemplates();
if (0 == SelectedTemplates.Count)
{
String title = "No Templates Selected";
StringBuilder msg = new StringBuilder();
msg.Append("No render templates selected.\n");
msg.Append("Select one or more render templates from the available formats.");
MessageBox.Show(dlg, msg.ToString(), title, MessageBoxButtons.OK, MessageBoxIcon.Error);
args.Cancel = true;
return;
}
}

void SetChildrenChecked(TreeNode node, bool checkIt)
{
foreach (TreeNode childNode in node.Nodes) {
if (childNode.Checked != checkIt)
childNode.Checked = checkIt;
}
}

bool AnyChildrenChecked(TreeNode node)
{
foreach (TreeNode childNode in node.Nodes) {
if (childNode.Checked) return true;
}
return false;
}

}
END of 1st SCRIPT - DO NOT INCLUDE THIS LINE


2. Now save this file as 'BatchRender-Regions.cs' (without the quotes) to the Vegas Script Menu folder. If you have made a defualt installation of Vegas Pro, it should be C:\Program Files\VEGAS\Vegas Pro 16.0\Script Menu.

3. Clear Notepad and copy and paste the following into Notepad, (this is the RegionsAtEvents script file) do not include the Start and End lines.....
START of 2nd SCRIPT - DO NOT INCLUDE THIS LINE
/**
* Program: RegionsAtEvents.cs
* Author: John Rofrano
* Purpose: This script will place a region at each event on the selected track(s)
* Copyright: (c) 2010, Sundance Media Group / VASST
* Updated: February 27, 2010
**/
using System;
using System.Windows.Forms;
using ScriptPortal.Vegas;

class EntryPoint
{
public void FromVegas(Vegas vegas)
{
foreach (Track track in vegas.Project.Tracks)
{
// only process selected tracks
if (!track.Selected) continue;

foreach (TrackEvent trackEvent in track.Events)
{
Region region = new Region(trackEvent.Start, trackEvent.Length, trackEvent.ActiveTake.Name);
try
{
vegas.Project.Regions.Add(region);
}
catch (Exception e)
{
MessageBox.Show(String.Format("Could not place a region at {0}\nError message is: {1}", trackEvent.Start.ToString(), e.Message), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
}
}
END of 2nd SCRIPT - DO NOT INCLUDE THIS LINE


4. Now save this file as 'RegionsAtEvents.cs' (without the quotes) to the Vegas Script Menu folder.

5. Clear Notepad and copy and paste the following into Notepad, (this is the RemoveAllMarkersRegions script file) do not include the Start and End lines.....
START of 3rd SCRIPT - DO NOT INCLUDE THIS LINE
/**
* This script will remove all Markers, Regions, CD Indices, CD Tracks, and Command Markers
*
* By George Dean 05/27/2016 (with ideas from SonyPJM "Sony Vegas Pro Forums)
*
**/

Vegas.Project.Markers.Clear();

Vegas.Project.Regions.Clear();

Vegas.Project.CDIndices.Clear();

Vegas.Project.CDTracks.Clear();

Vegas.Project.CommandMarkers.Clear();
END of 3rd SCRIPT - DO NOT INCLUDE THIS LINE


6. Now save this file as 'RemoveAllMarkerRegions.js' (without the quotes) to the Vegas Script Menu folder.

7. Load Vegas Pro 16.

8. Go Tools > Scripting > Rescan Script Menu Folder

9. Now Go > Scripting, and you should now see the BatchRender-Regions, RegionsAtEvent, and RemoveAllMarkerRegions scripts in this folder.

10. Load your 'Master Maks' project, which you have made in my previous post, which nests all your 21 vegs into this master.

11. Go Tools > Scripting > RegionsAtEvents script, this will place region markers on each of your events (nested project) and give that region the name of your original veg file.

12. Go Tools > Scripting > BacthRender-Regions. This will pop up a window like this.....

- Press Brouse for the 'Base File Name' and navigate to the folder you wish to save the renders to, don't worry about a name, just the folder location.
- In the center section that list the render format templates, I have scrolled to the bottom and will explain why shortly.
- at the bottom of this window, check 'Render Regions' and 'Use Region Titles as File Names'.

13. In this example I have selected a Magix AVC render format for the batch renders. You can select any format you like. Click on the '+' sign for the format category you like, I have clicked on the '+' for Magix AVC. This will open a list of templates for that format. I have select the Magix AVC 'Internet HD 1080p 59.940 fps (AMD VCE)' template.


14. Click on 'OK'. This is going to take a while, so it may be time to take a coffee break. When finsihed, you chould have a rendered file in the folder you have selected, for each of the 21 veg projects.

15. ABOUT THE RENDER TEMPLATE - In the BatchRender-Regions script interface you cannot modify or select specific settings in a template, you can only select a template. So if you are used to rendering using a specific template that you modify before rendering, you will need to save those changes to a custom template before you start this batch processing.

16. Go Tools > Scripting > RemoveAllMarkerRegions. This will remove all the regions and names and clean up your project.

17. NOTE - sometimes when I run this batch render, at the end it throws an error code. I'm not sure why, but it has never made any difference to the the results.
Best Regards......George
Last Edit:27 Mar 2019 03:36 by Eagle Six

Please Log in or Create an account to join the conversation.

Replied by kiwihans on topic Scripting - Batch Render

Posted 27 Mar 2019 18:41 #7
This is going to take some considerable time to come to grips with! I am going through a busy period doing peoples video work but thanks for your assistance so far.....

Please Log in or Create an account to join the conversation.

Replied by Eagle Six on topic Scripting - Batch Render

Posted 28 Mar 2019 02:44 #8
It is a bit time consuming to get everything setup the first time. But when it is setup, the workflow is quick and easy. Many of the sets above could be eliminated if I had a means to just send you the files, rather than you having to make them. If you have Facebook, you could send me a message with your email and I could send the scripts to you. My Facebook is George Dean.

Also, I have made up 3 small icons which can be used to better identify these script files and then I put the scripts in the tool bar (Options > Customize Toolbar), so each script is just 1 click, they look like this......

This is the icon RegionAtEvent script, that I refer to as Name Regions, therefore the icon is 'NR'


This is the icon for BatchRender-Regions script, that I refer to as Batch Render, therefore the icon is 'BR"


This is the icon for RemoveAllMarkerRegions script, that I refer to as Remove Names, therefore the icon is 'RN'


Icons to be used in the Vegas Pro toolbar are easy to make with any icon tool creator, or you can use PaintShopPro, PhotoShop, and Affinty. They are simply 16x16 pixel format with a transparent background saved in png format.

If you are interested I can provide a step-by-step to place the scripts and icons in the Vegas Pro 'Customize Toolbar'.


AND, Vegas includes a batch render script, which looks very similar to the one I posted above. I never had much success with it, but if this batch render process is a one time thing for you, you may want to take a shot at using it. I would suggest pretty much follow the step in my previous post to get all your projects nested , then instead of the scripts I provided just go to Tools > Scripts and select AddRegionsToEvents, this will mark each event as a region and add a numerical name to each region. Then Go Tools > Scripting and select Batch Render. In the 'Base File Name' browse to the folder you want the renders to be saved and add the name for the render leaving an '_' underscore at the end of the name. This may be all you need to complete your batch render project.
Best Regards......George

Please Log in or Create an account to join the conversation.

Replied by kiwihans on topic Scripting - Batch Render

Posted 28 Mar 2019 17:04 #9
As far as sending me the script files, that's easy, just send them to hans.gelton@gmail.com I remember a couple of years back we had a lot of correspondence regarding working with 8mm movies. Did you have some luck doing some of your own movies?
I had a bad run this afternoon with a customers 8mm wedding movie. He showed me what they looked like. Obviously 20 years ago they did not worry about colour corrections. I did his wedding movie again and it looks much better now! It was a silent movie but he wanted me to add a background music track.
I just couln't get the music to play on the DVD I made for him. Found that the sound track was set to MUTE. I then unmuted the track but that this made NO difference. These days I rarely make DVD's - customers want their old movies on USB sticks the quality is far better.
Looks like old technology is not compatible with new technogoly. 6 DVD got tossed into the rubbish bin! I still haven't worked out what is going wrong.

Please Log in or Create an account to join the conversation.

Replied by Eagle Six on topic Scripting - Batch Render

Posted 29 Mar 2019 02:01 #10
Hi Hans,

I have your email and have sent the scripts to you. You may want to edit your previous post and remove your email address so a robot does not pick it up, although Derek may have these post protected from that.

I will reply next with the instructions how to use them, and then another post answering your question about 8mm.
Best Regards......George
The following user(s) said Thank You: kiwihans

Please Log in or Create an account to join the conversation.

  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to edit your message.
Moderators: DoctorZen
Time to create page: 1.045 seconds