I encountered a very strange issue when adding items to the Render Queue via script. Most of the time the script works
great, but if the render should start for example on frame 3, 4 - 8, 9 - 13, 14 ... it starts one frame before ...
Here´s some background: I have to render about two hundred separate clips from one Comp in After Effects. To automate things I created Comp Markers from the Edits and wrote a script that adds new items to the RenderQueue for every Marker. It is not the prettiest script but it worked ... only issue is the weird behaviour with certain start points.
At first I thought it might be some kind of rounding error since after effects uses seconds and the render queue uses the current time settings, but even if I hard code said frames I get the same result ...
One thing I found out: if I change the fps for the comp the pattern of problematic Starting Points shifts....
So here´s the script I wrote:
Code: Select all
{
// RenderQueueFromMarkers_v01.jsx
//
// This script renders multiple clips from one composition
// the duration of each clip is defined by composition markers
//
// Make sure to adjust output path and output module before use !!!
// also: clear Render Queue before runing this script
function RenderQueueFromMarkers(thisObj)
{
var proj = app.project;
var scriptName = "Add to Render Queue from Markers";
// Set path to output folder
var outputFolder = "/Users/Markus/Downloads";
// Set name of the output module
var outputModule = "PR 422 HQ 16bit";
// main function
if (proj) {
var activeItem = app.project.activeItem;
if (activeItem != null && (activeItem instanceof CompItem)) {
app.beginUndoGroup(scriptName);
// get active composition
var myComp = app.project.activeItem;
// go through all markers of the active composition
for (j = 1; j <= myComp.markerProperty.numKeys-1; j++) {
// add composition to render queue, set start point, duration, output module and path
app.project.renderQueue.items.add(myComp);
app.project.renderQueue.item(j).setSetting("Time Span Start", myComp.markerProperty.keyTime(j));
app.project.renderQueue.item(j).setSetting("Time Span Duration", myComp.markerProperty.keyTime(j+1) - myComp.markerProperty.keyTime(j));
app.project.renderQueue.item(j).outputModule(1).applyTemplate(outputModule);
app.project.renderQueue.item(j).outputModule(1).file = File(outputFolder + "/" + myComp.name + "_" + j);
// Debug alert:
//alert(myComp.markerProperty.keyTime(j));
}
app.endUndoGroup();
} else {
alert("Please select an active comp to use this script", scriptName);
}
} else {
alert("Please open a project first to use this script.", scriptName);
}
}
RenderQueueFromMarkers(this);
}
So if anyone can tell me what I am doing wrong (besides the whole rendering 200 clips in After Effects things) I would appreciate any help!
Cheers, Markus