Mayank Tiwari Mayank Tiwari - 1 year ago 176
Java Question

ERROR com.xuggle.ferry.JNILibraryLoader - Could not load library: xuggle-xuggler; version: 3;

I have recently downloaded a code for, Xuggler Tutorial: Frames Capture and Video Creation from this link, I have added all the .jar files in my project which are required to run this code but, When I am running this code then I am getting Error:

Here is my code:

package xug;

import java.awt.image.BufferedImage;

import javax.imageio.ImageIO;

import com.xuggle.mediatool.IMediaReader;
import com.xuggle.mediatool.MediaListenerAdapter;
import com.xuggle.mediatool.ToolFactory;
import com.xuggle.mediatool.event.IVideoPictureEvent;
import com.xuggle.xuggler.Global;

public class VideoThumbnailsExample {

public static final double SECONDS_BETWEEN_FRAMES = 10;
private static final String inputFilename = "e:/low_light.mp4";
private static final String outputFilePrefix = "e:/Frames/processedImages";
// The video stream index, used to ensure we display frames from one and
// only one video stream from the media container.
private static int mVideoStreamIndex = -1;
// Time of last frame write
private static long mLastPtsWrite = Global.NO_PTS;
public static final long MICRO_SECONDS_BETWEEN_FRAMES =

public static void main(String[] args) {

IMediaReader mediaReader = ToolFactory.makeReader(inputFilename);

// stipulate that we want BufferedImages created in BGR 24bit color space

mediaReader.addListener(new ImageSnapListener());

// read out the contents of the media file and
// dispatch events to the attached listener
while (mediaReader.readPacket() == null) ;


private static class ImageSnapListener extends MediaListenerAdapter {

public void onVideoPicture(IVideoPictureEvent event) {

if (event.getStreamIndex() != mVideoStreamIndex) {
// if the selected video stream id is not yet set, go ahead an
// select this lucky video stream
if (mVideoStreamIndex == -1) {
mVideoStreamIndex = event.getStreamIndex();
} // no need to show frames from this video stream
else {

// if uninitialized, back date mLastPtsWrite to get the very first frame
if (mLastPtsWrite == Global.NO_PTS) {
mLastPtsWrite = event.getTimeStamp() - MICRO_SECONDS_BETWEEN_FRAMES;

// if it's time to write the next frame
if (event.getTimeStamp() - mLastPtsWrite

String outputFilename = dumpImageToFile(event.getImage());

// indicate file written
double seconds = ((double) event.getTimeStamp())
"at elapsed time of %6.3f seconds wrote: %s\n",
seconds, outputFilename);

// update last write time


private String dumpImageToFile(BufferedImage image) {
try {
String outputFilename = outputFilePrefix
+ System.currentTimeMillis() + ".png";
ImageIO.write(image, "png", new File(outputFilename));
return outputFilename;
} catch (IOException e) {
return null;

and I am getting following error in this.

[main] ERROR com.xuggle.ferry.JNILibraryLoader - Could not load library: xuggle-xuggler; version: 3; Visit to find common solutions to this problem
java.lang.UnsatisfiedLinkError: no xuggle-xuggler in java.library.path
at java.lang.ClassLoader.loadLibrary(
at java.lang.Runtime.loadLibrary0(
at java.lang.System.loadLibrary(
at com.xuggle.ferry.JNILibraryLoader.loadLibrary0(
at com.xuggle.ferry.JNILibraryLoader.loadLibrary(
at com.xuggle.xuggler.XugglerJNI.<clinit>(
at com.xuggle.xuggler.Global.<clinit>(
at xug.VideoThumbnailsExample.<clinit>(
Exception in thread "main" Java Result: 1

Please explain why Class-Loader is unable to load the .jar file.

Answer Source

The problem you have is that the native libraries that Xuggle uses cannot be found. I suspect that there is a conflict in your classpath.

If by "all the jars" you mean the jars in the download page, you are not supposed to download all of them. At the Xuggler downloads page it says that either you download the xuggle‑xuggler.jar that contains the native libraries for all operating systems or you choose a specific architecture.

On an attempt to run the example you link to, I have done the following:

  • Downloaded xuggle‑xuggler.jar (v.5.2). I didn't use maven, so as per the instrunctions at the download page I opened the Xuggle POM file to check and get the dependencies using the specific versions.
  • Using a little help from google those dependencies are: slf4j-1.6.4, commons-cli 1.1, logback 1.0, (contains two of the required jars), xuggle-utils 1.20 and junit which you can ignore.
    After downloading you can find inside the zip files the 5 jars (slf4j-api-1.6.4.jar, commons-cli-1.1.jar, logback-core-1.0.0.jar, logback-classic-1.0.0.jar, xuggle-utils-1.20.688.jar) described in the POM file that are the dependencies of the xuggle‑xuggler.jar.
  • Create a project in your favourite IDE (I use Eclipse) import those 6 jar files to your project and you are good to go.

Following the procedure above I was able to run your test program succesfully in a Windows machine.

I hope that helps.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download