Reputation: 13
I am using processing 3.0 and/or eclipse with the Processing plugin.
I am trying to upload/play a video using processing video library based on GStreamer
.
When I run the sketch in both Processing and Eclipse, everything goes fine. But if I export the app, the video function is not available for the windows version (the OSX one works fine).
The Log goes as follows:
Exception in thread "Animation Thread" java.lang.UnsatisfiedLinkError: Could not load library: gstreamer
at org.gstreamer.lowlevel.GstNative.load(GstNative.java:53)
at org.gstreamer.lowlevel.GstNative.load(GstNative.java:43)
at org.gstreamer.Gst.<clinit>(Gst.java:101)
at processing.video.Video.initImpl(Unknown Source)
at processing.video.Video.init(Unknown Source)
at processing.video.Movie.initGStreamer(Unknown Source)
at processing.video.Movie.<init>(Unknown Source)
at Shot_Position_Video.draw(Shot_Position_Video.java:259)
at processing.core.PApplet.handleDraw(PApplet.java:2402)
at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1527)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:316)
This is the line where I upload the video:
at Shot_Position_Video.draw(Shot_Position_Video.java:259)
the code is:
myMovie = new Movie(this, Video_address);
Any idea? I run into a lot of partial solutions regarding the jna.jar and some other stuff, but I wasn't able to find a way to deal with this.
Even suggestion on other libraries to use instead of Gstreamer
would be very appreciated.
Thanks!
M.
Upvotes: 1
Views: 2288
Reputation: 42174
Think about it this way: the GStreamer library has two dependencies: the Java code, and the native code.
You include the Java code aspect on the classpath. Since you're exporting a runnable jar from eclipse, that classpath gets wrapped up in the jar you export.
However, this does not include the native code. This is usually wrapped up in a separate file (often a .dll
file), and eclipse does not know how to automatically include it with the export.
It works okay running from eclipse and Processing because of settings that directly point to the native library file, or because the code is looking for the native file in a known location. But when you export it as a jar, those settings are lost.
So, you need to figure out where the GStreamer native library file is. Then you either need to make sure it's in the correct location (maybe next to the jar?), or you need to run the jar with the -Djava.library.path="path/to/your/native.lib"
setting enabled.
Once you get that working, you can use a tool like JarMatey to create a self-extracting jar that takes care of that step for you. (Note: I am the author of JarMatey.)
Upvotes: 1