Actionscript 3 Video Color Sampler Experiment
12.06.07 @ 6:48 am
A while back I published a small Actionscript experiment that sampled colors of video and displayed a matrix of the sampled colors it retrieved. I mentioned that I would be posting a follow-up once I ported all the code to Actionscript 3 and was able to do some interesting experiments with this technique. The current color sampler can give you the rgb code, red channel, green channel, blue channel, hue, saturation and brightness. It took a bit of time, but I have made five different motion treatments generated from my color sampling engine. The port of the color sampler class to Actionscript 3 made a significant difference in terms of performance and offered many more possibilities to what I could attempt. These five experiments are really just scratching the surface of what can be done with this technique - I have already thought of 3 or 4 different methods I would like to create.
Since I have been making a big deal about Nine Inch Nails on this site ever since the Year Zero hoopla, I thought I would use a few music videos from the aforementioned band. I found a few of these videos worked especially well due to their color composition.
I will be posting the full documented code with examples later this week. Until then, please feel free to download the color sampler class. Protected under the GNU Public License.
Select from the motion treatments below:
These videos are relatively large so I suggest clicking the ‘X’ button once you are done watching a video in order to move onto the next. If you keep the videos open, they will continue to progressively download and therefore can possibly slow down the next video you view.
Brightness Detection
This is the simplest treatment but no less interesting from my perspective. The scale of the crosses signifies the brightness in that particular region. This sampling technique is not too rough on the CPU either.
Only by Nine Inch Nails
Circular Hue Visualization
The hue value in HSV ranges from 0 to 360. I thought that worked perfectly with a axis-based visualization with the hue being the rotation. The brightness value signifies the scale.
The Becoming by Nine Inch Nails
Chain Visualization
This is another quite simple implementation with the X and Y coordinates of each anchor representing the brightness of the sampled area. This particular visualization works well with black and white samples with high contrast.
We’re In This Together by Nine Inch Nails
Diagonal Lines
This is easily the most challenging video to use due to its low tonal and brightness contrast. The lines are contrived from various computations of multiple sample values.
Survivalism by Nine Inch Nails
Vertical Casecade
The various shades of blue in this video made a sampling visualization extremely easy for this video. Opacity, height and color were influenced by color, brightness and saturation.
The Hand That Feeds by Nine Inch Nails
abstract, actionscript, actionscript 3, actionscript video, as3, brightness, color composition, color sampler, color sampling, colors, design, experiment, flash, flash motion, flv, hue saturation, motion design, music videos, nine inch nails, programming, rgb code, sampler class, scratching the surface, video color sampler, visualization year zero

June 12th, 2007 at 4:16 pm
$0.00 in Comment Love for November
This is a cool idea. I wonder about sampling the HSV values and converting sending them to the background color of the web page, dynamically. It would also be cool to see the loudness values of your program tossed into the mix.
June 18th, 2007 at 6:45 am
$0.00 in Comment Love for November
Thats really cool… I’ve been experimenting with this myself. I will publish something shortly, the differance is that mine works with flickr instead of video. Excellent choice of videos by the way
June 18th, 2007 at 11:47 am
$0.00 in Comment Love for November
I like your chain visualization the best. It is interesting to see how the peaks and valleys seem to exist in accordance to the positive and negative of the black and white film. Even when it gets an information overload the lines go all crazy. Very cool.
January 4th, 2008 at 9:42 am
$3.00 in Comment Love for November
[…] video… Yes, I know, this is a good thing, but it broke my code for this, this, this and this. I have managed to partially fix a couple of them, but this is really my fault as well since the […]
February 25th, 2008 at 3:56 am
$0.00 in Comment Love for November
i have problems
SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: http://www.somerandomdude.net/f/articles/sampler-as3/together.swf cannot access unknown URL. No policy files granted access.
at flash.display::BitmapData/draw()
at VideoColorSamplerFlash/sampleVideo()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at ()
at SetIntervalTimer/onTimer()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()