Bogachangencturk / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

(Linux) libavcodec.so.54: cannot open shared object file: No such file or directory [school project] #442

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
*What steps will reproduce the problem?*
1. Using IntelliJ
2. Add javacv libraries to project as well as having ffmpeg and opencv 
installed on the machine
3. Trying to initialize FFmpegFrameRecorder results in error

*What is the expected output? What do you see instead?*
I am attempting to use the RTMP protocol to stream video feed from my webcam
{{{
      recorder = new FFmpegFrameRecorder("rtmp://127.0.0.1:8107/live/test.flv", 640, 480, 1);
}}} 

The above statement results in
{{{
Exception in thread "main" java.lang.UnsatisfiedLinkError: 
/tmp/javacpp19297265100685/libjniavcodec.so: libavcodec.so.54: cannot open 
shared object file: No such file or directory
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1965)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1890)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1851)
    at java.lang.Runtime.load0(Runtime.java:795)
    at java.lang.System.load(System.java:1062)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:566)
    at com.googlecode.javacpp.Loader.load(Loader.java:489)
    at com.googlecode.javacpp.Loader.load(Loader.java:431)
    at com.googlecode.javacv.cpp.avcodec.<clinit>(avcodec.java:86)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:270)
    at com.googlecode.javacpp.Loader.load(Loader.java:453)
    at com.googlecode.javacv.cpp.avformat.<clinit>(avformat.java:76)
    at com.googlecode.javacv.FFmpegFrameRecorder.<init>(FFmpegFrameRecorder.java:120)
    at com.teodonnell0.rtp.Hardware.Webcam.<init>(Webcam.java:49)
    at com.teodonnell0.rtp.Client.<init>(Client.java:31)
    at com.teodonnell0.rtp.Webcam_GUI.main(Webcam_GUI.java:25)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
}}}

*What version of the product are you using? On what operating system?*
I am using Javacv0.7, FFmpeg 2.2.1, OpenCV
I am currently running Arch Linux 64 bit. I ran the command 'locate 
libavcodec.so', a few others are returned, but not #54.

Please provide any additional information below.
I directly downloaded the Jars from the downloads page 

Original issue reported on code.google.com by teodonne...@gmail.com on 13 Mar 2014 at 11:31

GoogleCodeExporter commented 9 years ago
I just wanted to add that I tried the same thing on my Macbook Air and the same 
error occurs, however a different file is missing.

I am doing this project for an Undergraduate Research symposium presentation. 
So I appreciate any help.

Original comment by teodonne...@gmail.com on 13 Mar 2014 at 11:35

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I want to report this issue as solved! 
All I needed to do was install a package called 'ffmpeg-compat2' which provides 
version 54 of libavcodec. 

I still am not sure about what the solution for Mac is, but it is irrelevant 
for me at this moment, but I will come back to it.

Original comment by teodonne...@gmail.com on 14 Mar 2014 at 12:00

GoogleCodeExporter commented 9 years ago
Have you tried adding the JAR files from the "CPPJARs" archive to your 
CLASSPATH?

Original comment by samuel.a...@gmail.com on 16 Mar 2014 at 12:55

GoogleCodeExporter commented 9 years ago
I have a similar problem on Windows 8.1 using the Maven module in IntelliJ 
13.0.2 via Gradle like this:

repositories {
    mavenCentral()
    maven {
        url "http://maven2.javacv.googlecode.com/git"
    }
}

dependencies {
    compile 'com.google.code.findbugs:jsr305:2.0.+'
    compile 'com.google.guava:guava:15.0'
    testCompile 'org.apache.commons:commons-lang3:3.1'
    testCompile 'junit:junit:4.+'
    testCompile 'org.assertj:assertj-core:1.5.0'
    testCompile 'com.googlecode.javacpp:javacpp:0.7'
    testCompile 'com.googlecode.javacv:javacv:0.7'
}

They appear on the CLASSPATH like this, which seems correct:

C:\Users\rphelps\.gradle\caches\modules-2\files-2.1\com.googlecode.javacpp\javac
pp\0.7\ff8f2a518e524ae8de093d6556fc21a6ab8f05b2\javacpp-0.7.jar;
C:\Users\rphelps\.gradle\caches\modules-2\files-2.1\com.googlecode.javacv\javacv
\0.7\310927e25b52136954b65608f341dfd5e5ad9d64\javacv-0.7.jar

I unzipped the FFmpeg and OpenCV libraries to:

C:\Users\rphelps\ffmpeg-2.1.1-win64-shared\
C:\Users\rphelps\opencv248\

I add those folders to my java.library.path like this:
-Djava.library.path=C:\Users\rphelps\opencv248\opencv\build\java\x64;C:\Users\rp
helps\ffmpeg-2.1.1-win64-shared\bin

Resulting in:

java.lang.UnsatisfiedLinkError: no jniavcodec in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886)
    at java.lang.Runtime.loadLibrary0(Runtime.java:849)
    at java.lang.System.loadLibrary(System.java:1088)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:711)
    at com.googlecode.javacpp.Loader.load(Loader.java:586)
    at com.googlecode.javacpp.Loader.load(Loader.java:540)
    at com.googlecode.javacv.cpp.avcodec.<clinit>(avcodec.java:39)
    at com.googlecode.javacv.FFmpegFrameGrabber.<clinit>(FFmpegFrameGrabber.java:103)

I can't find jniavcodec anywhere at all.

Original comment by ryancer...@gmail.com on 17 Mar 2014 at 6:01

GoogleCodeExporter commented 9 years ago
@ryancerium It's in javacv-windows-x86_64.jar, so try adding that to your 
CLASSPATH. And please ask your questions on the mailing list if possible, not 
here, thank you.

Original comment by samuel.a...@gmail.com on 18 Mar 2014 at 12:03

GoogleCodeExporter commented 9 years ago
Please try again with JavaCV 0.9 and let me know if this problem still occurs, 
thanks!

Original comment by samuel.a...@gmail.com on 30 Jul 2014 at 11:19

GoogleCodeExporter commented 9 years ago
Given the lack of feedback, I am guessing you figured out what was wrong, but 
please let me know if you still cannot get it running, thanks!

Original comment by samuel.a...@gmail.com on 27 Dec 2014 at 3:51