Problem with render queue and start time span

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
Simma
Posts: 98
Joined: June 8th, 2010, 2:57 pm

I'm trying to write a script that add a composition to the render que and set up a frame range in the render settings. But I'm having some problems. Everything seems to work without any problem if the composition start time is set to 0. But If I have the start time of the composition set to something like 200 I get a problem. The following code does set the start time span to the correct variable, but AE shows a nasty error. It says that the start time span is 0, but if I click on the render settings it does indeed say 200. Any Idea to get this to work?

Code: Select all

var myComp = app.project.activeItem;

var myRQItem = app.project.renderQueue.items.add(myComp) ;

var startFrame = 200;

var startSec = currentFormatToTime(startFrame, myComp.frameRate, false);

var startTime = myComp.displayStartTime;

app.project.renderQueue.item(lastInRQ).timeSpanStart = startSec - startTime;
Also (with composition start time set to 200), if I just do app.project.renderQueue.item(lastInRQ).timeSpanStart = startSec, I get a start time of 400 in the render settings. That's why I have done the startSec - startTime thing, but it feels like a hack.

Thankful for your help.
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

This seems to be working as expected for me.

Are you saying you set your comp settings to display first frame as 200? If I try it set like this (at 25 fps), I can get the message "'After Effects warning: timeSpanStart of 0 seconds will cause render to have frames outside of range defined by comp displayStartTime (8) and end of comp duration..."

The problem is that you're compensating for the displayStartTime when you don't need to. You only need startSec or startTime, which are both 200 frames converted to seconds (8) in this case.

Also generally I wouldn't use CurrentFormatToTime as it relies on display being set to show frames. You can convert from frames to seconds with startSec = startFrame * myComp.frameDuration.
Simma
Posts: 98
Joined: June 8th, 2010, 2:57 pm

Hi Paul, thanks for your reply and thanks for the method of converting frames to seconds. Hadn't thought of that.

However, it's still not working for me. This is what I do.

- Create a new composition with the display start time of 200 (first frame is 200).
- Create a new layer and add timecode effect to it. Set it to display frames. On the first frame of the composition it says 200.
- Run the following script:

Code: Select all

var myComp = app.project.activeItem;
var startFrame = 200;
app.project.renderQueue.items.add(myComp);
var lastInRQ = app.project.renderQueue.numItems;
var startSec = startFrame * myComp.frameDuration;
app.project.renderQueue.item(lastInRQ).timeSpanStart = startSec;
- In the render que/render settings, the start frame to render is now 400.
- If I render the composition it renders a file and the timecode displays frames 400 - end frame.

So from what I understand you have to compensate for the compositions display start, but if you do, you get the error. Or am I missing something?
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

Ok, yes I do see what you mean. You could try wrapping it in this to prevent the error appearing, but that's a bit of a hack.

Code: Select all

app.beginSuppressDialogs();
app.project.renderQueue.item(lastInRQ).timeSpanStart = startSec;
app.endSuppressDialogs(false);
Simma
Posts: 98
Joined: June 8th, 2010, 2:57 pm

Thank you Paul, it's a hack, but it a usable workaround. A lot better than having users see the warning. Wouldn't have found this solution by myself, this forum is a great resource.

Still I think it should work with just setting the timeSpanStart to frame 200 and it should be there no matter what the composition start time is.
Post Reply