Archive for August, 2007

More fun with sampleImage(): Ascii animation in After Effects

More experimentation with sampleImage(). This one relies on this expression.


target = thisComp.layer("layerToSample.mov");
samples = new Array();

var spacing = 10;
var w = target.width / spacing ;
var layerOrder = 1;
var h = 10 * layerOrder;

letters = "   .,:!-+=;iot76x0s&8%#@$";

for(x= 0; x < w; x++){
	samples[x] = target.sampleImage([x* spacing ,h],[spacing , spacing], false, time);
}

var string = '';

for(z = 0; z < samples.length; z++){
	var y = Math.round((0.299 * samples[z][0] + 0.587 * samples[z][1] + 0.114* samples[z][2]) * 100)/ 4;
	string = string + letters.substring(y,y + 1);

}

We loop through the row of pixels and place the sampled RGB pixels in the samples array, convert the RGB samples to YUV and grab the Y or brightness value for comparison against a rough gradient of ASCII values. For best results, use a monospace font to retain proper spacing. A more complete script/expression and breakdown to come.

Comments (7)

sampleImage() is fun

sampleImage() is a new layer method expression introduced in After Effects CS3 that allows you to access a layer’s color pixel data. Combined with sophisticated particle systems like Particular, I think we’re likely to see some really interesting designer driven explorations a la Processing, but with more of a tinkering, let’s try things out approach.

I’ll have more scripts, and automated stuff as I explore further, but until then you might want to take a look at theĀ reference and examples that Dan Ebberts is posting at the brilliant MotionScript.com

Comments (2)

Automator Action: Final Cut Pro XML to Tape Log via Markers

I’ve never spent much time with Apple’s Automator technology. Which is a little strange, considering how interested I am in automation and workflow technologies. I think some of it is a sense that it seems inaccessible, it doesn’t seem clear how to make things generalizable enough to be useful, and at least part of it is my aversion to Applescript as a scripting language That said, it’s clear that there is a lot of power available with Automator and I’ve started to dip my toe in the water and seeing If I can learn a few things and maybe create something useful.

This is the first fruit of my experimentation. I often need to make a tape log of a sequence in Final Cut Pro, and a quick way to get the sequence details into a text file could be useful. The most approachable way to address the problem seems to be with markers. You can store all of the values I need for a tape log in a marker – item number, name, description, length and the starting timecode. So, that’s how we’ll approach it.

Read the rest of this entry »

Comments (21)

Apple Sample Code: QTKitTimeCode

Apple posted some sample code demonstrating how to extract timecode from Quicktime files using the objective-c based QTKit only dropping down into the low level C API when “absolutely required”.

I’ve found myself deep into the Quicktime API before and the modernization of the Quicktime architecture can’t come too soon. Unfortunately, digging deeper into the sample code, it’s clear that it’s going to be slow-sledding before we get NSString *timeCodeTime = [movie tcTime]; or some such. Anyway, it’s good to have this info from the definitive source, it’s taken a bit of research to find before now.

Comments off