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

﹥>﹥吖頭↗ 提交于 2019-11-28 01:24:18

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.

Ilya Yevlampiev

It looks like the best solution is to use Xuggler 5.4 with maven due to How do I have to install/configure Xuggle to not get an UnsatisfiedLinkError?

Following c.s.'s answer this ended out working for me:

  • Instead of xuggle‑xuggler.jar use xuggle-xuggler-5.4.jar (google the name if link is broken)

  • Instead of xuggle-utils-1.20.688.jar use com.xuggle.utils-1.22.jar

  • Create a project, import the 6 jars and run this to test:

    import com.xuggle.xuggler.ICodec;
    import com.xuggle.mediatool.ToolFactory;
    import com.xuggle.mediatool.IMediaWriter;
    import java.awt.image.BufferedImage;
    import java.io.File;
    import java.util.concurrent.TimeUnit;
    
    public class XuggleTest {
    
        private static int idx = 1;
        private static final int WIDTH = 500;
        private static final int HEIGHT = 500;
        private static final int NFRAMES = 200;
    
        public static void main(String[] arguments) {
    
            // Create writer
            IMediaWriter writer = ToolFactory.makeWriter("output.mp4");
            writer.addVideoStream(0, 0, ICodec.ID.CODEC_ID_MPEG4, WIDTH, HEIGHT);
            long ms = 15; // ms per frame
    
            for (int i = 0; i < NFRAMES; i++) {
    
                BufferedImage frame = convert(getFrame());
                long time = i * ms;
                writer.encodeVideo(0, frame, time, TimeUnit.MILLISECONDS);
    
                idx++;
            }
            System.out.println("Finished writing file: " + System.getProperty("user.dir") + File.separator + writer.getUrl());
    
            writer.close();
        }
    
        private static BufferedImage convert(BufferedImage value) {
            // Convert data type
            BufferedImage result = new BufferedImage(value.getWidth(), value.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
            result.getGraphics().drawImage(value, 0, 0, null);
            return result;
        }
    
        private static BufferedImage getFrame() {
            // Create image frame
            BufferedImage img = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_ARGB);
            img.createGraphics().fillRoundRect(idx, idx, idx, idx, 10, 10);
            return img;
        }
    }
    
Palash Hinglaspurkar

Just download the xuggler 3.4 exe in Windows OS and add the jar file 1) xuggle-xuggler-arch-x86_64-w64-mingw32.jar you get this jar from the following link:
https://files.liferay.com/mirrors/xuggle.googlecode.com/svn/trunk/repo/share/java/xuggle/xuggle-xuggler/5.4/

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