A little automation

While working on a film for one of my colleagues, I found myself staring at a folder of QuickTime movies that needed visual effects work done to them. I thought; wouldn’t it be cool if I could do something simple to make a composite for each one in After Effects (AE), without having to import and then make the composites manually – essentially make those first few steps automated.

I looked into it and came up with a solution:

  1. Use Automator to make a Droplet (app that takes input by dragging and dropping files onto it)
  2. Have Automator run a Python script that:
    1. takes the input files
    2. builds an After Effects jsx script that imports the footage and makes compositions based on them
    3. run an AppleScript script that starts AE and tells it to run the jsx script
    4. delete the jsx script
  3. Be robust enough to re-use without Automator later if needed

Here it is for OSX.8 and OSX.9 (Apple made some slight adjustments to Automator in the two OSs so I compiled two versions)

To use: drag and drop a file that AE can import onto the aepCreator icon. Multiple files will make one AE project that contains each file and a composition based on each one. One file will simply create an aep with one file and one composition. It should break if you drop a folder on it. It will probably break if you drop something that AE cannot import, such as a zip file. It will also probably break on PSD files and image sequences. If that is a problem, then let me know and I will make the program a little smarter. I needed it to handle video files, so that’s all I worried about.

The python script can be run from the command line without Automator so a shell script or another Python script could automate building multiple AE projects – when working with students or a team of artists, or if your pipeline is one project file per shot. I commented out a line in the jsx script that tells AE to exit after it has built the compositions and saved a new aep file. It is trivial to make the Droplets behave that way if interested.

The project uses three scripting languages and a compiled Automator App. Python is used to do most of the work. It stores the incoming file paths, creates a jsx file and populates it with Javascript Extended code that AE can run, and then runs an Applescript script that tells AE to start. The Python script creates the other scripts needed by AE and MacOS. I could have gone without the Applescript, but Adobe decided that AE cannot be run from command line on OS X, which is stupid.

Automation like this is pretty easy with 3D animation and compositing applications. Video editors, on the other hand, do not make this easy at all. It seems Premiere Pro supports Adobe’s version of Javascript, but there is no documentation. When handling multiple visual effects shots, it would be nice if the editors could do some automating. Instead, there are expensive products like Hiero or buying a ton of helper apps designed just for workflows (the App store is full of very cool helper apps for FCPX – they go well beyond filling in so-called “missing features”). I’m looking forward to the upcoming version of OpenShot. It is built using Python and can be interactively controlled using a Python shell. It will hopefully make automating timeline manipulation easy, assuming it supports XML in and out.

Advertisements