javamavenxuggleopenimaj

openIMAJ missing class or wrong library


I am doing this and I've encountered a problem.

Here's my code

package vid;

import java.io.File;

import org.apache.log4j.BasicConfigurator;
import org.openimaj.image.MBFImage;
import org.openimaj.video.Video;
import org.openimaj.video.xuggle.XuggleVideo;

public class Movie{

    public static void main(String[] args){
        BasicConfigurator.configure();
        Video<MBFImage> video;
        video = new XuggleVideo(new File("in.flv"));

        for (MBFImage mbfImage : video) {
            //something
        }
        video.close();
    }   
}

and when I run it I'm gettig

21:18:51.520 [main] DEBUG com.xuggle.xuggler - Could not open output url: file:/D:/Workspace/openIMAJ/in.flv (../../../../../../../csrc/com/xuggle/xuggler/Container.cpp:436)
1 [main] INFO org.openimaj.video.xuggle.XuggleVideo  - URL file:/D:/Workspace/openIMAJ/in.flv could not be opened by ffmpeg. Trying to open a stream to the URL instead.
Exception in thread "main" java.lang.NoClassDefFoundError: org/openimaj/io/InputStreamObjectReader
at org.openimaj.video.xuggle.XuggleVideo$MBFImageConverter.toImage(XuggleVideo.java:264)
at com.xuggle.mediatool.MediaReader.dispatchVideoPicture(MediaReader.java:600)
at com.xuggle.mediatool.MediaReader.decodeVideo(MediaReader.java:519)
at com.xuggle.mediatool.MediaReader.readPacket(MediaReader.java:475)
at org.openimaj.video.xuggle.XuggleVideo.readFrame(XuggleVideo.java:482)
at org.openimaj.video.xuggle.XuggleVideo.hasNextFrame(XuggleVideo.java:577)
at org.openimaj.video.VideoIterator.hasNext(VideoIterator.java:59)
at vid.Movie.main(Movie.java:17)
Caused by: java.lang.ClassNotFoundException: org.openimaj.io.InputStreamObjectReader
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 8 more

And my pom.xml (long, so I saved it on pastebin). There is a lot on dependencies to different parts of openIMAJ because I've lost track which does what. I've tried to download libs following this, but when I add any other than core, I'm getting

Missing artifact org.openimaj:video:jar:1.0.6-SNAPSHOT

Libs provided on last site are different than those on Maven Central Repository. So, my problem is, where can I find library (or which one from MCR could help) with desired class? Or libs compatible with tutorials on openIMAJ site.

Thank for any help


Solution

  • Why do you define <sourceDirectory>src</sourceDirectory>? Such not using Maven's widely accepted default ${project.basedir}/src/main/java.

    The OpenIMAJ Wiki page's latest update is from Sep 2012. I'd go with the latest release version 1.3.1 from Sep 2014 on Maven Central.

    If you really want to use snapshots: version 1.0.6-SNAPSHOT of core is from 2013. There is a 1.4-SNAPSHOT which is just about one month old. This probably applies to other core-... libs as well. I recommend to use the latest.