tags:

views:

1021

answers:

1

I'm trying to read raw video frames from a video capture device using JMF - the Java Media Framework.

I've successfully written the "capture" part - using a Player object created by Manager, I can display realtime video from a webcam. I don't know how to go about creating a custom component to access the actual frames, however. This is probably because up until now Manager has created every class instance I needed for me.

I would like to start by writing a GUI component that displays the video. (I'm not familiar with AWT/Swing, but based on knowledge of other GUI frameworks, I'd say something derived from a, say, JPanel that draws the video when a repaint request is made or a new frame is available.) I would like to be able to process every new frame and loop on x/y over all the pixels. I have access to the raw/RGB format on my device, but automatic conversion from, say, YUV wouldn't hurt.

I have no idea where to start. The JMF documentation recommends I derive my class from Processor or DataSink in several different places. Using the Processor interface seems like an overkill - I would have no need for the playback and timing control functions, for example; and I wouldn't know how to implement them in the first place. Deriving from DataSink seems like a simpler option with less useless abstract functions. However, in either case, I'm at a complete loss as how to:

a) Connect the component to my video capture DataSource
b) Access the actual frame buffers from within the class

I may even be going in a wrong direction here; I just wanted to document what I've tried so far. JMF documentation seems scarce and mostly oriented towards [designing] media players and converters.

Note: The Processing library seems to have a simple solution for this. I've seen an example along the lines of: x = new Image(captureDevice.getFrame()) which seems to suggest pixel-level access is possible, through Image if not the intermediate type.

But I would really like to see how hard it is in JMF first.

A: 

Can I know how you were able to capture a video from webcam.I have constantly been trying for days,could'nt figure it out.If you could post the sample code ,it would be greatly helpful.Thanking you in advance.

Jessie