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.