Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Viewing live video to Java Applications

Status
Not open for further replies.

ypl

Programmer
Feb 20, 2003
1
CA
Since I have been unsuccessful thus far, I thought I might throw out the question "is this even possible?" Much like JMStudio, I would like to view the live video stream from my webcam in a java application. Eventually I would like to take still shots of the video stream and save them... for now I just would like to view the stream. So far I have learned how to capture the device info, create a DataSource using a MediaLocator and create a processor to store it to a DataSink. I DON'T want to capture, store, then playback... I want to view this all in real time but I am having some problems figuring this out and what type of functions need to be used... sample code (not the stuff from JMF Solutions website because I have been through ALL of them quite thoroughly) would help.
Thanks.

Stephanie
 
Hi,

If you only want to take still shots of the video stream while viewing it live, you don't need a datasink. You can find the required capture device via the CaptureDeviceManager, create a Player for the media locator provided in the CaptureDeviceInfo and start the player (don't forget the Player.getVisualComponent).

To take a snapshot, you would need to ask the player for a FrameGrabbingControl. With this control, you can grab the current frame that is being displayed. You will get a Buffer object. You can then use javax.media.util.BufferToImage class to convert the Buffer to an Image.

After you get an image you can use one of the JDK 1.4 Image I/O APIs to save to a jpeg or any other image formats that are supported by that API.

-jmfGuru
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top