ffmpeg java cant locate libraries avformat-51

Help
panga
2009-05-08
2013-03-08
  • panga
    panga
    2009-05-08

    Hi guys!

    I'm trying to use ffmpeg-java on Windows, but I'm having some problems with ffmpeg and yours dlls.
    I have a FFMPEG build and I put the folder with the dll needed in the java path (-Djava.library.path) and in the same folder of the ffmpeg.exe and ffmpeg-java.jar, but always receive the warning:

    WARNING: Unable to initialize ffmpeg libraries: java.lang.UnsatisfiedLinkError: Cannot locate library avformat-51

    What I need to do to solve this problem?

    Thanks.

     
    • BigRedFed
      BigRedFed
      2009-05-08

      try adding the directory where the libraries are located to the windows PATH environment variable.

       
      • panga
        panga
        2009-05-13

        Ok....
        I try to add the folder with the avformat-51.dll direct to Windows path, but i recieve the same error!
        WARNING: Unable to initialize ffmpeg libraries: java.lang.UnsatisfiedLinkError: Cannot locate library avformat-51
        what can I do now?

         
        • BigRedFed
          BigRedFed
          2009-05-13

          How are you building the PATH environment variable?

          Are you modifying it in the Windows System Properties?  Or running a batch file from the command prompt or setting the variable in your IDE?

           
    • Thibault
      Thibault
      2009-05-12

      I thought that "java.library.path" was the same as windows PATH environment.
      I have the same problem as panga, and adding library path to win path env didn't correct it.

      Panga, how did you compile FFMPEG: with MinGW ?

       
      • Thibault
        Thibault
        2009-05-13

        Ok, I reply to myself:
        java.library.path is only used to load the first shared library. If this library depends on another one, it will use the PATH environment variable (on windows, and LD_LIBRARY_PATH, on linux, I guess)

        Moreover, I think that PATH variable cannot be changed at runtime: the value is set at process startup. So we must change PATH environment variable to be able to have FFMPEG-Java getting right the avformat.dll dependencies.

         
      • panga
        panga
        2009-05-13

        Hi reeter! Thanks for the answer!
        Ok, I will try to add the libraries direct to Windows path.

        About the FFMPEG compile, I have 2 auto builds, I could not compile with MinGW. So, if you want I can send the 2 builds for you.

        Regards

         
        • Thibault
          Thibault
          2009-05-13

          Thanks, but that's fine for me, I just achieved compiling ffmpeg!

           
    • Jouvieje
      Jouvieje
      2009-06-08

      Due to library dependency, loading of avcodec or avformat may fail even if they are all in library path.
      I suggest try to initialize the library this order:

          final AVUtilLibrary AVUTIL = AVUtilLibrary.INSTANCE;  //load avutil library first
          final AVCodecLibrary AVCODEC = AVCodecLibrary.INSTANCE; //then avcodec
          final AVFormatLibrary AVFORMAT = AVFormatLibrary.INSTANCE; //and finally avformat

      If you want to be able to load then in any order, you need to remove the explicite dependency during the dll build.

       
    • Jouvieje
      Jouvieje
      2009-06-08

      I just forgot one thing, use jna.library.path instead of java.library.path.