Issue when adding items to the Render Queue via script (only with certain Starting Points ...)

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
Posts: 6
Joined: July 29th, 2010, 3:04 am

Hi there,

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)) {

				// 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.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).file = File(outputFolder + "/" + + "_" + j);

                    // Debug alert:
			} else {
				alert("Please select an active comp to use this script", scriptName);
		} else {
			alert("Please open a project first to use this script.", scriptName);

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
(2.06 KiB) Downloaded 261 times
Posts: 6
Joined: July 29th, 2010, 3:04 am

Just a quick update on the issue:
for some strange reason the "Time Span Start" property of the renderQueue.item acts really strange.

For most values that are not full seconds I received different values when I use the getSetting to check
after using the setSetting to set the property to the desired time.
But I am not sure if this is the reason for my initial issue with some RenderQueueItem items starting one frame early ...

Since I have no idea how to straighten this out I am trying to work around this issue with another script that moves
all layers in the comp so they all start on full seconds ...
Posts: 2
Joined: December 25th, 2016, 12:27 pm

Hi Markus, do you have a project file that reproduces this error? Because I tried your script and it seems to work 100% of the time. All start times match, although the end time seems to be an open interval. My project is on 30fps and my AE version is 24.1.0 (Build 78).
2024-05-17_16-37.png (73.89 KiB) Viewed 3123 times
Posts: 6
Joined: July 29th, 2010, 3:04 am

Hi Eve, thanks for checking out the issue !

Here´s a project file and I marked two faulty items on the render queue.
Screenshot 2024-05-21 at 11.16.54.jpg
Screenshot 2024-05-21 at 11.16.54.jpg (163.6 KiB) Viewed 3009 times
I am working on the latest version of after effects 24.4.0 my composition is set to 25fps but I could reproduce the problem with different frame rates (only the pattern of the errors is changing ...)
(187.71 KiB) Downloaded 268 times
Post Reply