• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
May 14, 2024 May 14, 2024

Copy link to clipboard

Copied

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]
{
	// 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);
}
[/code]

 

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

 

Bug Unresolved
TOPICS
Scripting

Views

58

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
2 Comments
Community Expert ,
May 14, 2024 May 14, 2024

Copy link to clipboard

Copied

I wonder if it's some kind of round-off error converting marker times to start frame. Maybe try subtracting some small fraction of a frame duration from the marker times and see if that helps/makes a difference.

Votes

Translate

Translate

Report

Report
New Here ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

LATEST

Thanks for your reply Dan!

That´s what I thought at first ... then I added a Marker on every Frame and realized even if I round the Marker-Time to XX.XX and put it in a new render queue item. When I read out the start point from the render queue item I get some

values as before but some come back like XX.XXXXXXXX 

So to me it is big mystery what is going on there... Also I am still don´t understand how this can be the reason for some render que items starting one frame before they are supposed to start.

Votes

Translate

Translate

Report

Report