Skip to main content
cheyrn
Inspiring
December 13, 2014
Answered

boilerplate render pipeline

  • December 13, 2014
  • 1 reply
  • 831 views

I figured out the answer to the question that I added into the answer to the footage properties post.

With the goal of loading a video and processing it in batch, I had gotten this far:

var footage = app.project.importFile(new ImportOptions(File("c:\\some.avi")));

var comp = app.project.items.addComp(footage.name, footage.width, footage.height, footage.pixelAspect, footage.duration, footage.frameRate);

var layer = comp.layers.add(footage);

layer.openInViewer();

This loads footage, creates a suitable composition and adds the video to a layer. I wasn't sure how to then get it into the timeline. There is just on more step:

comp.openInViewer();

Do you know of a skeleton render pipeline either all extendscript, or perhaps a combination of aerender.exe and scripts. I think that scripts on redifinery, for example, expect there to be a human waving a mouse around who then starts the script. I would to achieve this:

Video file -> Load video and do stuff to it in after effects -> Render

Do you know how to do that, or what I might be overlooking the scripting guide. I've read through everything in the guide but haven't necessarily grasp the implications of what it says.

I should clarify, the middle part where you do stuff in after effects should be accomplished by scripting, i.e. not:

1 Create a project

2. Create a composition

3. Create layers

4. Setup transformations,

5. Save.

and then process the prepared project. I want to automate steps 1-5.

This topic has been closed for replies.
Correct answer Dan Ebberts

Try something like this:

var footage = app.project.importFile(new ImportOptions(File("c:/some.avi")));

var footageIn = 1;

var footageOut = 2;

var comp = app.project.items.addComp(footage.name, footage.width, footage.height, footage.pixelAspect, footageOut-footageIn, footage.frameRate);

var layer = comp.layers.add(footage);

layer.startTime = -footageIn;

layer.inPoint = 0;

layer.outPoint = comp.duration;

comp.displayStartTime = 0.0

comp.openInViewer();

Dan

1 reply

UQg
Legend
December 14, 2014

0: If if a project is already open, close it with app.project.close(closeOptions), where closeOptions is one of the enumerated closeOptions (see scripting guide)

1: Create a project: app.newProject();

2-3-4: your code

5:

     app.project.save(file);      // If no file is specified, a dialog is shown, so better specify a valid file path

     app.project.close();

     // app.quit();

Note: i think you don't need that "layer.openInViewer();". Only comp.openInViewer(); is actually needed most of the time.

See this thread to run the script from the command line, without opening ae: https://forums.adobe.com/thread/1212267

Xavier.

cheyrn
cheyrnAuthor
Inspiring
December 14, 2014

Thank you. My question is inarticulate, looking at it again. Really, I'm asking for a skeleton script that is for transforming video, where I think that consists of some set of actions that I do.

I usually go through this routine:

Import media

Open in footage panel and set in and out points

Create a composition from the footage, which creates a layer and adds it to the timeline, where the clip is trimmed from the in and out points.

Then I "do stuff".

Then I render and save the project.

Here is my revised code in caveman syntax, as opposed to maintainable code like http://www.crgreen.com/boethos/

(in other words, I suppose I'm not actually looking for "boilerplate" code, though that is interesting too. I mean the types of api calls needed to do basic setup and teardown for transforming and rendering video in batch)

app.project.importFile(new ImportOptions(File("c:/some.avi")))

var footage = app.project.item(1)

var comp = app.project.items.addComp(footage.name, footage.width, footage.height, footage.pixelAspect, footage.duration, footage.frameRate)

var layer = comp.layers.add(footage)

layer.inPoint = 1.0

layer.outPoint = 2.0

comp.displayStartTime = 0.0

comp.openInViewer()

This still doesn't work as I expect though. The timeline starts at 0 and lasts for the duration of the footage. I'm not sure how you trim.

I'm also not sure if trimming in the timeline is different from trimming in the footage panel and then adding trimmed footage to a composition.

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
December 14, 2014

Try something like this:

var footage = app.project.importFile(new ImportOptions(File("c:/some.avi")));

var footageIn = 1;

var footageOut = 2;

var comp = app.project.items.addComp(footage.name, footage.width, footage.height, footage.pixelAspect, footageOut-footageIn, footage.frameRate);

var layer = comp.layers.add(footage);

layer.startTime = -footageIn;

layer.inPoint = 0;

layer.outPoint = comp.duration;

comp.displayStartTime = 0.0

comp.openInViewer();

Dan