This content has been marked as final. Show 3 replies
Pixel Bender can be applied to any Display object including FLVs and even UI controls. You can use FLVs as inputs to Pixel Bender filters.
I saw a tutorial on this (FLVs) on someone's blog. If I track it down again, I'll repost, but the help content for Pixel Bender in Flash should get you anything you need.
Like Kevin said, you can do it; however, there are a couple of caveats Kevin didn't mention. If you were processing a filter using only the FLV file as the single input, you could simply attach it to the filters property on the video object. This applies to controls, video, text, and images since they can all derive from DisplayObject.
Since you are planning on using two inputs, you'll need to execute the shader directly (or try using it as a blend modes, but I've had limited success with blend modes). The way to do this is using the ShaderJob object and setting the inputs directly; however, it can get a little tricky and doesn't have a lot of examples (I'm hoping to work through one). There's a post on this forum where someone worked through the ShaderJob idiom for two images.
As you noticed, the input type that the ShaderInputs accept are BitmapData, ByteArray, and Vector.<Number> which does pose a problem for the video. You can get around this by adding a draw command on a BitmapData object to render the current frame of video into an image format. For instance:
var flvFrameData:BitmapData = new BitmapData(myVideo.width, myVideo.height, true, 0x00000000);
You can then use flvFrameData as your input data.
I hope that answers your question.
DISCLAIMER: I'm not sure if this is the most optimal way to acquire the frame data, but it does work.
Thanks Kevin and Brian...this is definitely getting me closer to a solution. I am going to put Brian's idea to the test this afternoon but I suspect the draw method will definitely work. It sounds like a bit of a hack so I am hoping direct input of flv data is in the cards for Pixel Bender in the future (and possibly sound and an interface between Pixel Bender and ComputeSpectrum?...only dreaming here).
I found this link that runs through a tutorial of applying shaders to an flv here http://www.elctech.com/projects/introduction-to-pixel-bender-flash-player-10...this might be the one you were referring to Kevin.
Thanks again for the guidance guys and I will post back with the code that ends up doing the trick.