Video Stream from a Camera rendered into JavaFX 2.0 MediaView


Since JavaFX2.0 has a media view is it somehow possible to live stream the camera feed into the Media component in real time? Since there is no camera API I am unaware of how to make this happen. Can we use another Java library to work with the camera and then stream the video in the MediaView

So is it possible, and if yes then how can we do it. May be by using any JavaAPI for camera and then streaming the video into the MediaView?

7/3/2012 6:54:08 PM

There is a Java library called Xuggle that is an open source solution for streaming video into Java applications. It is built on top of the ffmpeg libraries.

In my experience it will work with some implementations of the MPEG-2 and MPEG-4 codecs, but not others. If you were not aware, there are something like 800 different versions of those codecs and some of them end up sticking packets on the front, or in the middle, or at the end in order to force you to use their decoders when displaying the video. Up to, and perhaps including, the new JavaFX code there has been very little robust support for streaming video into Java.

You may want to explore doing something like embedding an instance of VLC in a JPanel and displaying that to your user. There are also libraries that attempt to allow some interaction between Flash and Java that could be used to approach this issue.

Good Luck!

7/21/2012 9:48:42 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow