Archive for May, 2006

A timestamp script for After Effects

Why a timestamp script?

With a timestamp you can do things like…

  • Mark the timeline necessary from animatic to finished spot.
  • Do version tracking and timelines for alternate takes.
  • Follow job tracking info for project management and billing.

The first version of this script will be a simple date and time timestamp. We’ll follow up with demos on how to connect this script to databases for project and scene information to help with project management.

Windows Timestamp UI
AE Comp With Time Stamp Applied

(notes)Due to limitations in the accessibility of formatting options for Text Layers via scripting the first version of this script only uses a left side orientation.

Source JSX script
Downloadable Zip Version

Comments off

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

Why you should learn to love your brother’s tech

What I’ve noticed from trying to stay platform agnostic for a while is that there are a lot of great ideas and techniques that tend to be blindingly obvious and part of muscle memory on one platform that are either unavailable or under used on the other. Today’s example is one that is part of almost every Windows users toolkit, but hasn’t been available as long on the Macintosh and ends up being under used.

Let’s say your working in Final Cut Pro and you’re saving a file. You’re working on a complicated project and the file names are variations of a base filename. You’ve opened up the save dialog and your presented with something like…

Save Dialog in Final Cut Pro

So, we’ll just start typing our long filename and…Not so fast. If you take your cursor and select the grayed out filename from the dialog below, you’ll get…

Final Save Dialog in Final Cut Pro

The name of the file you just selected, inserted into the text field ready for you to append a new version number. Seven out of ten Macintosh users don’t know about this feature just as seven out of ten Windows users are aware of it. Cross-cultural technology astigmatism can bite you in the butt.

The funny thing is from a user interface stand point you can argue this is a bug not a feature. On the Macintosh grey text indicates that the interface cue is inactive. So, if you were really a platform zealot you would say that they need to take this away in the next version of OSX or at least give us some indication that it is selectable. Maybe so, but once again I’ll just try to get my work done faster and easier.

Comments (2)

Using Batch Export in Final Cut Pro

I love using batch media programs like Cleaner and Compressor. They allow you to set up a workflow and accomplish a lot of work unattended. What I didn’t realize until just recently was that there was a great little mini-batch processing program built right into Final Cut Pro.
Read the rest of this entry »

Comments (15)

Beginning javascript tutorial: Parsing a date from a sequenced jpeg filename

The other day I ran across another post at aenhancers.com. (aenhancers is a really great AE scripting forum by the way). The poster, Dan wrote:

I have shot thousands of stills
that I am now wanting to make
a time lapse movie out of. Each
still is named with the date and time
it was taken. For example
0507270505011.jpg would have been
taken yy/mm/dd/hh/mm/ss/(camera ID).
...
is there a way to parse the filename
to convert it into something more
legible? So 0507230004461.jpg would
translate into July 23, 2005 - 12:10 AM?...


The more I thought about it, this is exactly the kind of task I’m hoping to cover here at Creative Workflow Hacks. So in addition to posting a usable solution at aenhancers I decided to do a tutorial here with the problem solving steps involved. You know, teach a guy to fish and all.

I’m also going to try something new here. From the feedback I’m getting from users, the skill level and interest in DIY varies a lot. Some of you are hoping for beginners tutorials, some are looking for more advanced ideas and inspiration, and some of you are looking for solutions that are already thought through where you can download a bit of software, do your work and forget about it. So, I’m going to try labeling categories with beginner, intermediate, advanced and shrinkwrapped (although not that much software is actually shrinkwrapped anymore) depending on the skill level and the degree of involvement necessary to get the solution working. Send some feedback if you find it useful or not.

Back to our date parsing problem. Like almost all computer problems, the key here is to break down the big problem into a series of smaller problems. Read the rest of this entry »

Comments (2)

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.

Correction

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'";
	//alert(osString);
	var systemCall = system.callSystem(osString);
   
	var movArray= systemCall.split("\n");

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

And the downloadable version

importEveryQuicktime.jsx.zip

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:

import20Quicktimes.jsx.zip

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');
alert(systemCall);

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

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

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');
alert(systemCall);

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}');
alert(systemCall);

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)

Analyzing access logs to find patterns, or “Just how many bots are out there anyway?”: In which we give a gentle introduction to command-line tools.

You find the most interesting stuff in access logs. I spend a fair amount of time digging around in web analytic software. Looking at who is referring to us, analyzing traffic patterns, figuring out peak usage times…you get the picture. Sometimes though, you just need to get right down into the raw logs to figure out what’s going on, and that situation happened to me a while back.

Around the middle of last year a security exploit was found in the implementation of the XML-RPC protocol in PHP. PHP is obviously a very popular web scripting language and dozens of content management systems, including the blogging software I use for this blog, utilize the language. Now an open security hole in such a popular language is just an invitation for the underground to attempt to exploit the situation, and try to exploit they did.

It started out as just a trickle, but before long it became obvious that the underground was attempting to exploit the security hole. How’d we know? By analyzing our logs.

Read the rest of this entry »

Comments (7)