Archive for After Effects

Converting a Web Color to an RGB float array for After Effects

I’m writing a script that needs hexadecimal color input, sometimes referred to as a web color, converted to a value usable for a solid in After Effects. After Effects wants an array of RGB values in the range 0 to 1: [R, G, B]. Luckily Javascript supports bit-wise operators so the conversion is pretty straight forward. I used this function.

var hex = 'ffaadd';
var colors = hexToRGBArray(hex);

alert("red =" + colors[0] + " green=" + colors[1] + " blue=" + colors[2]);

function hexToRGBArray(hex){
	var rgb = parseInt(hex, 16); 
	var red   = (rgb >>16) & 0xFF; 
	var green = (rgb >>8) & 0xFF; 
	var blue  = rgb & 0xFF;
	var colorArray = [red/255.0, green/255.0, blue/255.0];
	return colorArray;


Source for this script
Downloadable version of this script

Comments off

Moving toward reading FCP source timecode from imported Quicktimes in After Effects

A recent thread on aenhancers discussed reading source timecode from Quicktimes imported from Final Cut Pro captures in After Effects. Seems like a perfectly reasonable request, there could be a bunch of situations where this information would be useful in an After Effects project. Problem is, it doesn’t seem really easy to grab that data. When you view the timecode track in the imported quicktime, the timecode is in reference to the source Quicktime not the source tape from the capture.


Mark Burton posted on the thread mentioned above that actually the timecode is written to the Quicktime. He offered a link to Sebsky Tools as an example of an app using that info. I simply misread the Quicktime player info. There is still useful info from Final Cut we can access and I think the ideas in this article are interesting so I’m leaving it up with this correction. Thanks Mark.

At least until Apple decides to put that information into the captured Quicktime We’ll need to find a workaround way to read FCP info and that’s what I’m going to cover in this post.

Read the rest of this entry »

Comments (6)

Stupid Scripting Tricks: Import every Quicktime available

Here’s a fun one. Run this script and it will import every Quicktime on your hard drive or mounted server that After Effects understands. Stupidest hack ever, right? Well yeah, but there is some real gold in this line of the script

mdfind 'kMDItemKind == "QuickTime Movie"'

mdfind is the command line version of Apple’s spotlight technology. Combined with the new Quicktime metadata API and system.callSystem() there’s a lot for a hungry developer to chew on.

The script, osX 10.4(Tiger) and After Effects 7 only (I know, I know)

var myProject = app.project;

var osString = "mdfind 'kMDItemKind == "QuickTime Movie"' | wc -l" ;
var numberOfQTs = system.callSystem(osString);
//After Effects seems to choke when I feed it more than 41 items at a time, so let's use sed to give it 40 to chew on at a time
for(x=1; x < numberOfQTs; x = x + 40){
	var osString = "mdfind 'kMDItemKind == "QuickTime Movie"' | sed -n '" + x + ", " + ( x + 40) + "p'";
	var systemCall = system.callSystem(osString);
	var movArray= systemCall.split("\n");

	for(y=0; y < movArray.length; y++){	
				var my_io = new ImportOptions(new File( movArray[y]));
				var myItem = myProject.importFile(my_io);
				//eat errors

And the downloadable version

followup 5/4/2006 2:30P EST:

So, most folks working in motion graphics have a lot of quicktimes on their system and don't necessarily want to take a long time to import all of them into an After Effects project as a proof of concept ( I told you this was a Stupid Scripting Trick). Therefore, here's a version that imports the first 20 of them with head -n 20 to act as a proof of concept for you busy people .

Here ya go:

You'll need to turn on Allow Scripts to Write Files and Access Network and turn off Enable JavaSript Debugger so we can eat the errors. As in anything that allows write access to your file system, be careful in experimenting with this script.

Comments off

Problems with multi-column output from system.callSystem() in After Effects 7?

I’ve been experimenting with system.callSystem() in After Effects 7. It’s a way to call commands and applications like you would from the command line but from within the After Effects scripting environment and get the output returned to the javascript variable. Works pretty great, but I’ve run into what seems like a bug and offer a small work around

If I call

var systemCall = system.callSystem('ls');

I get a nice alert box with my local directory. If I call

var systemCall = system.callSystem('ls -a');

I get a nice alert box including . entries (which is really just to test using the -a command switch to make sure I can send parameters through system.callSystem()). If i call

var systemCall = system.callSystem('ls -la');

I lock up AE7. I’m guessing it doesn’t like the multi-column output? Because if I pipe the ls -la to awk like so

var systemCall = system.callSystem('ls -la | awk '{print $1}');

I get a nice listing of my directory permissions which is the first column of the ls -la standard output.

So, it looks like the workaround if you freeze After Effects 7 with a system.callSystem() command that ouputs multi column output is to grab each column of interest with something like awk'{print $1}’ where $1 etc. is the column to grab. Not sure if this is a bug or a limitation of the standard output to After Effects. Would love some feedback from anybody that knows for sure.

Comments (2)

iPhoto to After Effects Slideshow

I’m taking a slight detour from my Final Cut Pro to After Effects tutorial series to post an application I wrote while experimenting with AE and JSON import and export. iPhotoToAESlideshow allows you to export an iPhoto album to a slideshow in Adobe After Effects.

iPhotoToAESlideshow is a proof-of-concept application and I can see it being fleshed out in many new directions including a dashboard widget, iPhoto Export plugin, etc. and the knowledge I’ve gained will definitely show up in my FCP and AE efforts.

The application itself is largely based on an Apple sample project available here with a huge assist from Blake Seely with his NSDictionary category BSJSonAdditions for the JSON and the BSRoundedBox framework for the nifty rounded box code (thanks Blake).

This is definitely beta code, give me a buzz at dale(at)creative-workflow-hacks(dot)com if you find any bugs or ideas for improvements. I also plan on open-sourcing the source once I’ve debugged and cleaned everything up.

BTW, I realize almost all of the hacks I’ve posted here so far have been OSX-centric. I’m definitely platform agnostic, but I end up being a bit of a Mac-head in my personal work. My plan is to adapt the .jsx version of the enclosed script to run from already imported photos that are selected in the project window. I’ll post those here once I’ve finished them up.

The files are available here: iPhotoToAESlideshow.dmg

Comments (8)

Automating “Guess 3:2 Pulldown” in After Effects

It’s a common problem to run into fields issues when working with imported footage in After Effects. An equally common way to address the problem is to use the Interpret Footage->Main Dialog(Command or Control-F) and press the“Guess 3:2 Pulldown” button in this dialog. Multiply this times 100 footage items (You can only select one footage item for Interpret Footage to be available) and you’ll be crying out for help. The following script gives you that help.
Read the rest of this entry »

Comments (2)


With the release of Automatic Duck as a free product there really isn’t a great reason to use this script except as an example of XML parsing and Comp creation from parsed properties. For general FCP to AE workflows I’d recommend downloading Automatic Duck Pro Import AE 5.0. Depending on what happens with FCPX I may write new tools for import from FCPX to AE.

Update 04.17.2007

I’ve posted a small application and tutorial at Final Cut Pro to After Effects Scripting without the hassle for those that find the scripting presented here a little daunting. The following article covers the steps and ideas encapsulated in the application if you’re more interested in the process for learning to script After Effects and Final Cut Pro yourself.

I work a lot in Final Cut Pro and After Effects. They are both really strong programs and more than once I’ve had reason to move projects, art, text, etc. between the two programs.

Until recently, the only option you had to do this kind of interchange was a product called Automatic Duck (which I highly recommend btw) and in previous versions you still had to use Avid’s interchange format and jump through a few hoops to move between the programs.

Now with Final Cut XML and more robust scripting available in After Effects you can finally flow between the two programs with relative ease. In this first installment, I’ll outline a simple workflow for getting clips in a FCP sequence into a AE project. In future posts I’ll go over text elements, filters, generator items etc., but all of these follow the same general development cycle and will just be elaborations on a theme.

Read the rest of this entry »

Comments (32)

« Newer Posts