Archive for July, 2006

Scripting Basics: pulling random values from within a defined range in After Effects

A common scripting requirement is to pull random values from within a defined range. For example, in the block dissolve transition the individual blocks of video are extracted from the video in a random order. Let’s revisit our float away video wall script and customize it to work in the same manner as a block dissolve but with a little more flair. We will scale the individual blocks up instead of just transitioning on and off.

Read the rest of this entry »

Comments off

Designer, developer, let’s call the whole thing off

I’ve always been skittish around After Effects expressions, which when you think about it really doesn’t make much sense. I’m pretty good at programming and I get the concepts, so why the discomfort? Recently, I was adding some expressions to scripts and found myself really enjoying the process. I thought about it a bit, and it wasn’t the expressions I was skittish about, it was the entering the expressions that was making me uncomfortable. The one line data entry, the hierarchical function list, even the pickwhip with its cool little animation feels utterly confining and claustrophobic. What I was struggling with was a programming interface developed for use by designers.

And it’s not just After Effects. Flash has had that same kind of push and pull between developers and designers. From the hideous Normal/Expert mode to the pick your identity at startup evolution, every version seems to take another stab at the right mix. Even tools that have evolved into developer focused applications continue to show the roots of the struggle. I wince when I watch my Filemaker Pro using friends developing Repetitive Stress Injuries from the legacy programming environment, which amounts to a 400px x 200px bit of screen real estate, filled with buttons. Ok, I exaggerate, but still.

I’ve always been the type of guy who pinballs between the left and right sides of the brain. I’ve got a design background, but I like to program and end up working on the technical side of projects a fair bit. I think this is pretty common these days, Jen deHann coined the term deseloper (not much here right now) to describe that combination of designer and developer. What happens sometimes when I have my developer cap on in a design tools environment is a sort of cognitive dissonance between the ideas I want to express and the program interface.

I think this happens from a misguided understanding of what being a designer is all about. Design is not about being able to twiddle buttons and graphics, but about problem solving. Some of the most amazing problem solvers and process experts I know are designers. There has to be a better toolkit for letting designers express their ideas. There is a term used in computer science about a languages expressiveness or its ability to let the programmer express her ideas easily and without hinderance. I think there is a lot of room for design tools to develop that expressiveness outside of the gui toolkit. It’s obvious from the experimentation in interfaces within design applications that there is an embrace of the problem I’m trying to articulate.

My main hope is that there continues to be a flowering of cross discipline avenues of exploration. I hear similar complaints from my developer friends who feel like they are pushed away from creative solution making. I think there will always be folks who are more comfortable in a more analytical setting as well as others who embrace the more feeling parts of the Myers Briggs spectrum, but there’s also a fertile middle ground for us deselopers to explore.

Comments (5)

A small command-line utility to convert paths and pathurls for OSX

One of the notable short comings of the workflow I outlined for converting Final Cut Pro elements into After Effects projects via scripting was the limited path support. That was mainly due to the fact that Final Cut Pro uses a fully qualified path url of the form file://path/to/file and After Effects has an Absolute URI that uses the tilde as a shortcut for the current user’s home directory. So, file://Volumes/MyHD/Users/Dale/Stuff becomes ~/Stuff. Trying to munge all of the contingencies in Javascript is not a pleasant task, and Cocoa has a nice set of methods for dealing with just this situation, including stringByAbbreviatingWithTildeInPath and stringByExpandingTildeInPath.

What I’ve done is written a small Cocoa foundation tool that works on the command line to move between the formats of interest. The tool takes the following switches.

pathconvert -u pathurl
Takes a pathurl of the form file://localhost/Volumes/Storage/Users/Dale/test used by Final Cut XML and converts it to an AbsoluteURI that After Effects will be happy with, including using stringByAbbreviatingWithTildeInPath to resolve directories in the User Home folder, such that the pathurl above becomes ~/test.
pathconvert -f fullpath
Takes a fullpath of the form /Volumes/MyHD/Users/Dale/Test and returns a short cut tilde path when appropriate. The string above would become ~/Test.
pathconvert -t abbreviatedPath
Takes a short cut path of the form ~/Test and returns a full path when appropriate. The string above would become /Volumes/MyHD/Users/Dale/Test.

This utility, combined with system.callSystem() in After Effects 7 will make our work with Final Cut Pro XML a lot more friendly in a scripting environment. Next up is an updated tutorial on working with Final Cut XML and After Effects scripting and more detailed instructions on how to install and use this utility. I wanted to post this now to get feedback from power users and developers on potential problems and gotchas. I’m not much of a c hacker, so I’m enclosing both the XCode project files and a compiled binary. Please send any improvements or ideas to me and I’ll share them here. As always, feedback and improvements to dale(at)creative-workflow-hacks(dot)com.

Compiled Binary and XCode Project files available here

Comments (4)

Script to automate rigging a camera in After Effects

final update July 15, 2006

Added a new Point of Interest expression instead of dealing with the Auto-Orient dialog as detailed in the comments.

second update July 14, 2006

Chris Prosser suggested a decent workaround of using app.executeCommand(app.findMenuCommandId(”Auto-Orient…”)) to auto-launch the Auto Orient dialog. Which in my opinion makes the script pretty usable, even with the slider range problem. Right now, I’m launching a dialog that reads “Auto Camera Rig” needs to have Auto-Orient set to “Off”, please set it in the following dialog and then immediately launching the Auto-Orient dialog. I’d be interested in feedback on whether I should leave the two dialog boxes for context or use a saveSetting() preference to give the user a Never Show Again option as well as Ok. Power users could always just comment out the alert line. Scripting UI’s are always difficult for me, I think I know how I’d handle it in a regular mac app, but I’m not so sure how to handle it here.

update July 14, 2006

Stu Maschwitz pointed out some deficiencies with the original version of this script and provided a sample project of a much better implementation of a rigged camera project. Unfortunately, there seem to be a couple of show stoppers for recreating his project via scripting and I’d love some feedback if anybody has worked through these issues, and if not I’ll send them off to The first is the addCamera() method assumes a point of interest in its constructor. That seems to make the UI equivalent of layer:transform:Auto Orient:Off impossible. I’ve tried setting the property to Null, etc. with no success. Interestingly, there is a useful assistant to set the property. Secondly, I can’t seem to set the slider control range via scripting. I can set the value but not the range so this may be less of a show stopper than the first. I’ve uploaded the changes that reflect Stu’s sample project, so if you find running the script then turning Auto orient off (command-option 0, on the Mac..control-alt 0, windows? I don’t have a Windows box handy), and can live with the slider range limitation, then great. Send any fixes my way and I’ll incorporate them. I think I see why nobody took this one on .

I was doing a bit of research and ran across Kyle Sim’s request to automate his process of rigging an After Effects camera on aenhancers and the adobe forums. Seemed like a really useful script and as near as I can tell nobody has tackled it, so I decided to give it a shot.

Usage is really straight forward, copy the script to After Effects:Scripts and run it from the scripts menu with an active Comp selected. I’m not doing any layer name checking because I think it’s possible that you might want more than one camera and null, although we’d have to adjust the expressions accordingly.

When I run the script my effect window for the Mover Null looks like this and it does a great job of making the camera move really straight forward.

Null Effect Controls from automated camera rig script for After Effects

You’ll have to thank Kyle or whoever set up the original expressions for the idea, this just automates the creation of the rig.

Update 04.21.2007

Paul Tuersley kindly updated this script with some cool new features.

I've attached an update to your db_autoCameraRig script. 
I've added a  check for AE8 which then automatically 
turns of Auto-Orient. 
I also  streamlined the bit that sets  the position / POI 

Here’s Paul’s new script, and I’ve left the original up as a legacy 1.0 version in case we get any problems out in the field.
JSX script With Paul’s Improvements
Original Source JSX script
Update 06.10.2007
Paul kindly sent me additonal updates to his modification of the script.
Paul writes…

I’ve tweaked how this version deals with the Auto-Orient issue, which
you may want to check out. In AE6.5 it puts up an alert to tell you
to turn Auto-Orient off, in AE7 it does the same and then opens the
Auto-Orient dialog and in AE8 it turns Auto-Orient off automatically.
I also added expressions to all the properties you shouldn’t alter,
effectively locking them.

Thanks Paul.

Paul’s lates modifications – JSX script in a zip archive

Comments (19)

MPEG Streamclip, a great little free utility for batch format conversions

As I alluded to here, I’m in the middle of a really big HDCam SR job right now. Lots and Lots of data. Part of the job involves batch format conversions. The kind of stuff I usually do with Cleaner, Compressor, or even Batch Export in FCP. For a number of reasons, each of these stepped up to the plate and wiffed. Limitations in cropping, some quality issues, some conversion time issues, etc.. I don’t want to be too critical or specific about my problems with each program because each of these products is great in its own way with individual strengths and weaknesses and our issues were pretty job specific.

What I do want to do however is rave about a great little freeware app from Squared 5 called MPEG Streamclip. When we started to have issues with our usual suite of software we looked around for some alternatives and ended up here. I must admit I was skeptical that it’d really be able to help us on a job of this scope. I’d played with earlier versions of this software when I was doing some HDV conversion and thought it was a pretty cool little utility, but the latest version is really fast, has really stunning quality options, does batch processing, is available in Mac and Windows versions and is free. Really nice work and it looks like the developer is adding features and tweaking the interface at a nice clip.

I’ve crashed a couple of times during heavy batches and it’s a little bit of a concern putting complete faith in a product where the support path is unclear, but download the app and see if it meets your needs. Looks like it’s going to really help in a pinch.

Comments off

How to make a “Float Away Video Wall” in After Effects via scripting

I was watching HBO a bit ago and noticed a fun promo where the playing video breaks into a grid and slowly floats away out of frame (Anybody familiar with the work know where I can find a link to a web video? update: 08-07-2006 Greg Grusby correctly pointed me to this page from Shilo which makes it clear that my script is just a tech demo <grin>.). Although I’m not a fan of duplicating a concept just to mimic it technically, I thought it might be fun to work through the steps necessary to pull off something similar via After Effects scripting.

Update July 12, 2006

Thanks to Jeff Almasol for the tips about Alpha Add and Null names in the comments below. I wasn’t aware of it, but it looks like his script rd_Slicer addressed a lot of this how-to without the float away expression in a really nice package. Jeff’s scripts and resources at redefinery are must see.

Read the rest of this entry »

Comments (9)