After Effects: basic command line rendering.

(actually this is a tutorial on quotation marks management)

This aims to explain how to do after effects rendering on the command line. This is a desirable method of working for a number of reasons which I might go into later. I hope that by articulating this I can impart something of a deeper understanding for how this stuff works. Let’s get started. In an ideal world the command is very simple. It would look like this:

aerender -project myAep.aep

here is the command color coded with matching explanation:

aerender -project myAep.aep
this part calls the aerender program this is a flag this is the value of the flag

Nice and easy. We open the rendering executable and tell it that we want it to use myAep.aep as its argument. aerender knows that when passed a -project flag to open the project and render everything on the renderqueue. aerender is not an interactive program. if you just run:

aerender

It will print out help information and quit. Most useful. We run into 2 immediate problems though with our command

problem #1: we are most likely not in the same directory as our .aep file
problem #2: we are almost definitely not in the same directory as aerender

When you open a window in Terminal.app it opens a shell. The default shell for osx is bash. There are many types of shell but damn near all of them open by default in the same place, which is Home. Shorthand for Home in the shell is

~

~ is synonymous with /Users/you/

Chances are you don’t have aerender or your project aeps in ~. So we must specify paths to both of these. This makes the command a lot uglier:

/Applications/Adobe\ After\ Effects\ CS4/aerender -project /Volumes/Active\ Projects/aep/DEC_trans_am_091409_07.aep

The observant reader will notice some backslashes. These backslashes are necessary when spaces exist in a shell command because they escape the character following it.
A synonymous way to do it would be to enclose the paths in quotes:

"/Applications/Adobe After Effects CS4/aerender" -project "Volumes/Active Projects/aep/DEC_trans_am_091409_07.aep"

There is no practical difference with these approaches. A convenient way to get paths is to drag a file from the finder into a terminal window, which will automatically print its path. The approach we choose matters, however, when we get more complicated. For many people this much is sufficient. If the command gives you an error, check your grammar, paths, and punctuation. 90% of the time people have the wrong path or a misplaced /

Note that this next line has unescaped space characters (this will not work):

/Applications/Adobe After Effects CS4/aerender -project /Volumes/Active Projects/aep/DEC_trans_am_091409_07.aep

This is what a typical human sees:


/Applications/Adobe After Effects CS4/aerender
this is a path to aerender
-project
this is the flag
/Volumes/Active Projects/aep/DEC_trans_am_091409_07.aep
this is a path to my project

and this is what a computer sees
/Applications/Adobe
THIS IS A THING
After
THIS IS A THING
Effects
THIS IS A THING
CS4/aerender
THIS IS A THING
-project
THIS IS A THING
/Volumes/Active
THIS IS A THING
Projects/aep/DEC_trans_am_091409_07.aep
THIS IS A THING

The command that Lloyd Alvarez’s bg renderer puts forth, additionally, wraps the aerender command in a different shell (I assume for backwards compatibility reasons). I suspect there’s not really any reason to do this anymore but who am I to argue with Lloyd. Let’s get fancy:

/bin/tcsh -c "nice +20 '/Applications/Adobe After Effects CS4/aerender' -sound OFF -mem_usage 60 120 -project 'myAep.aep'"

A bunch of things to note here. First and most importantly note that the whole command being passed to /bin/tcsh is wrapped in quotes. Especially note that the quotes around the after effects executable path and the project path are now enclosed in single quotes instead of double quotes. This is necessary because if we used double quotes we’d have the computer thinking this:

/bin/tcsh
THIS IS A THING
-c
THIS IS A THING
"nice +20 "
THIS IS A THING
/Applications/Adobe
THIS IS A THING
After
THIS IS A THING
Effects
THIS IS A THING
CS4/aerender
THIS IS A THING
" -sound OFF -mem_usage 60 120 -project "
THIS IS A THING
myAep.aep
THIS IS A THING
""
THIS IS A THING

Note that this:
/bin/tcsh -c "nice +20 '/Applications/Adobe After Effects CS4/aerender' -sound OFF -mem_usage 60 120 -project 'myAep.aep'"

is functionally identical to this:
/bin/tcsh -c 'nice +20 "/Applications/Adobe After Effects CS4/aerender" -sound OFF -mem_usage 60 120 -project "myAep.aep"'

See the difference? I told you this was about quotes.

There are some additional flags to note in this script: -mem_usage provides memory options, -sound is pretty self explanatory. Another favorite (or not) is -mp which turns multiprocessing on or off.
In addition, the aerender executable is itself being passed as an argument to nice which is a nifty program that allows you to set application priorities, but we won’t get into that here.

Please let me know if I have any computational or typographic errors. This is not meant to be an official resource. I am not affilated with Apple nor Adobe.

Also, if you have CS3 instead of CS4 you’ll need to change that in all of the examples.


About this entry