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.

Raspberry Pi – It’s Alive!

I got a Raspberry Pi (RPi) model B when it first came out. BTW, the RPi just turned 2 years old a few days ago. After waiting quite a while until it shipped, I opened it up, plugged a bunch of stuff into it, booted, and then said, “now what?” It seemed to have so many possibilities that I was excited about, but I got too busy with other stuff, to do much with it at first – story of my life.

A month or so ago I started looking into my next long-term project and the RPi seemed to fit in, so I decided to get it going again. This time I ordered the RPi camera, a USB wireless dongle, and a motion sensor so I could have something to play with.

Right away I realized that I needed a case to stabilize the RPi and mount the camera. I was tired of ordering things so I just made one real quick (see the pic).

Raspberry Pi in case

I still need to come up with a way to mount the motion sensor. Shouldn’t be a big deal. The wireless dongle is a lot cooler than I expected. With it, the current setup is only the power and hdmi cables connected to the RPi instead of power, hdmi, USB hub, and wired ethernet. I SSH into it to run scripts and management tasks. I setup an AFP share so I can drag and drop files to and from it via my Mac’s Finder.

Programming the RPi with Python is fun and there are lots of examples out there. I already have it snapping pictures and uploading them to Dropbox. I also have the motion sensor working. At the moment, the sensor will trigger the camera to come on for 10 seconds.

For the time being I’m going to set it up to spy on my dogs. Their movement will turn the camera on and snap a few pictures for now. I can add motion video to the mix later. When I get that set up the only cable needed will be for power.

When I can set aside more time, I’ll get openFrameworks running on it and play around with its graphics capabilities. I’m still on the fence as to whether I am going to keep moving forward with openFrameworks or if I’m gonna go another route with my long-term project. Once I nail that down, I’ll get the RPi setup to support the project.