views:

462

answers:

4

Hi canvas experts,

If I have a QT video on a page (where QT is a requirement that can't be changed) how can I grab the pixel data of the current frame that is being shown with canvas? I am aware that this is possible with getImage(videoElement, .....) but I am looking for a solution that uses QT.

If getting the pixel data is not possible then is it possible to take a screenshot of the page using canvas and trim it perhaps?

Or am I going about this the wrong way and don't need to use canvas at all?

+1  A: 

Can you rely on java being available on the client? If so, you could use an offscreen java applet (using the quicktime for java libraries) to talk with javascript and your quicktime plugin to get at pixel data for a given frame. This solution requires loading the movie into the quicktime plugin AND into the applet. See http://processing.org/reference/libraries/video/index.html for a simplified api.

This is not a graceful solution. I don't like it. Just brainstorming.

jedierikb
unfortunately cannot use java applets. can use flash however if thats possible.
Darko Z
A: 

Another idea is to pre-process the quicktime movie, and keep pixel data on your server. Ajax the correct frame's data when your page needs its. Depending on your videos' compression, this might be a good idea because getting accurate pixel data for every frame could be difficult because of keyframes.

jedierikb
keyframes are exactly why I cannot use a flash app to just load the movie and grab frames in flash directly. QT doesn't require keyframes you can just tell it to move to an exact frame. unfortunately cannot pre-process since the amount of movies on the server is ludicrous. not youtube ludicrous but close.
Darko Z
+1  A: 

This is not possible with canvas. The function you are referring to has nothing to do with canvas, it has to do with the video element. The video element returns a picture that the canvas can use, and the QT object (or embed) does not.

Marius
A: 

This example on Mozilla: https://developer.mozilla.org/En/Manipulating_video_using_canvas uses the getImageData() function on the context object to do a chromakey replacement in a video.

Robert