Which Java library to use for record a video from a connected camera?

家住魔仙堡 提交于 2019-12-07 08:29:03

问题


You would have thought that tere is a simple solution to this but there isn't :(

My application needs to capture a stream from a USB/firewire (or whatever is the connection) connected camera (result would be a file like output.flv). I would prefer that I can detect all connected cameras and choose which one to use (one or more at the same time --> one or more output files). Application has to be cross platform.

Found libraries:

  1. Xuggle - not very good camera support. Good for manipulating over images and video.
  2. JMF - an old API but if I can use it, I will. I don't see a MAC OS X link on downloads page.
  3. FMJ - looks like a better version of JMF but a can't find a way of installing it.
  4. LTI-CIVIL - FMJ uses it. It looks like it only captures images from camera (not video). I could use Xuggle to create a video from images taken from LTI-CIVIL. And like FMJ, it is difficult to install.

What are your suggestions on this one?


回答1:


I'd recommend VLCj for this - it should be able to stream from webcams onto a Java canvas without any difficulties. It uses native code so you need to provide libvlc.so / dll but from there on it should work on all the major platforms (Windows, Mac, Linux).

You may need to look at out of process players for complete reliability which is a bit more complex (see here for my efforts so far) but once you've got that in place it should work fine.




回答2:


There really is no good camera support for Java. You will have to use native code, tailored for each platform, through JNI to get video capture for your project.

There's a related question here. Basically they're suggesting OpenCV wrapped with JNI.



来源:https://stackoverflow.com/questions/6731844/which-java-library-to-use-for-record-a-video-from-a-connected-camera

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!