FMJ Video Capture in Java
I'm trying to capture video from a webcam connected via usb, but for some reason FMJ can't load or find the registry file. When I try to run my program, every call to a FMJ function produces the warning:
[time] net.sf.fmj.utility.Registry <init>
WARNING: Problem loading JMF registry: org/jdom/JDOMException. Using Defaults
Consequently, it doesn't recognize the webcam and the program fails. The same program works with JMF, but in an effort to make it cross-platform, I'm migrating the code over. I have uninstalled JMF, but I don't understand why its trying to load the JMF registry. I also get the f开发者_运维百科ollowing errors when running fmjregistry.bat:
FINE: PlugInUtility: Unable to register plugin net.sf.fmj.ffmpeg_java
FINE: PlugInUtility: Unable to register plugin net.sf.fmj.theora_java.NativeOggParser
FINE: PlugInUtility: Unable to register plugin com.omnividea.media.parser.video.Parser
FINE: PlugInUtility: Unable to register plugin com.omnividea.media.codec.video.NativeDecoder
FINE: PlugInUtility: Unable to register plugin com.omnividea.media.codec.video.JavaDecoder
all of the above are java.lang.ClassNotFoundException
Please help, video with java is such a big headache
This question can be a little old, but for those who are facing the same problem (like I), here is the answer.
FMJ requires JDOM (and NOT JDOM2) to be included in classpath because it use it to read
C:\Documents And Settings\[user]\.fmj.registry.xml
This file contains settings from FMJ registry. JDOM jar is located in libs directory within FMJ pack you downloaded from its home page. You can either copy it and include in yours project build path, or add dependency if you are a Maven user:
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1.3</version>
</dependency>
Don't forget to add other required libraries ;]
If this is not the case, then there are other possible options:
- Your program do not have permissions to read this file, or
- XML syntax of this file content is malformed (incorrect XML) - in this case, to find a bug in XML code, you can validate it with one of the free XML validators available online
精彩评论