Batch Render for multiple files

Hyparxys wrote on 6/22/2010, 11:39 AM
I tried to modify the batch render script to allow multiple file selection but it seems to cause Vegas to crash.

Here is what I tried:

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

String projectPath = myVegas.Project.FilePath;
String dir = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
defaultBasePath = Path.Combine(dir, Path.GetFileNameWithoutExtension(projectPath));
String[] filePaths;
myVegas.NewProject(false, false);
DialogResult result = myVegas.OpenFileDialog(dir, true, out filePaths);
myVegas.CancelAsynchronousTasks();
myVegas.NewProject(false, false);
if (String.IsNullOrEmpty(filePaths[0])) {
dir = Path.GetDirectoryName(projectPath);
String fileName = Path.GetFileNameWithoutExtension(projectPath);
defaultBasePath = Path.Combine(dir, fileName);
}
else {
defaultBasePath = filePaths[0];
myVegas.OpenFile(filePaths[0]);
}
result = ShowBatchRenderDialog();
myVegas.UpdateUI();
if (DialogResult.OK == result) {
// 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;
}
bool first = true;
foreach(string test in filePaths)
{
defaultBasePath = Path.Combine(dir, Path.GetFileNameWithoutExtension(test));
if (first == false)
{
myVegas.NewProject(false, false);
myVegas.OpenFile(test);
}
DoBatchRender(SelectedTemplates, defaultBasePath , renderMode);
first = false;
myVegas.WaitForIdle();
}
}
}

Comments

jetdv wrote on 6/22/2010, 12:36 PM
Looks to me like you're stripping off the file extension so you're telling Vegas to open a non-existent file. i.e. myproject instead of myproject.veg
Hyparxys wrote on 6/22/2010, 12:43 PM
The file extension gets put back in DoBatchRender() in the standard Batch Render script. I only posted the part that I changed. My edit works for a few files and then either crashes or starts to create empty files depending on whether I select more than one render type.

Problem: Unmanaged Exception (0xc0000005)
Fault Module: C:\Program Files\Sony\Vegas Pro 9.0\vegas90k.dll
Fault Address: 0x00000001800D6F5A
Fault Offset: 0x00000000000D6F5A