I used the project FFmpeg4Android on sourceforge to build the FFmpeg .so shared library files. However, I am having trouble using them in an ADT Java application. I created a simple JNI call that attempts to call av_register_all and I get library errors.
When I run the application on my Nexus 7 I am told that it is unable to load library libavformat-HEAD-1.0.so
So I tried to load this via the System.loadLibrary method and I was unable to find libavcodec-HEAD-1.0.so. Working my way back in this manner I eventually attempted to load libavutil-HEAD-1.0.so which yielded an error ‘cannot locate symbol “__strchr_chk”‘.
This is my Java class:
public class LibavcodecTest {
public static native void avRegisterAll();
static {
System.loadLibrary("avutil-HEAD-1.0");
System.loadLibrary("avcodec-HEAD-1.0");
System.loadLibrary("avformat-HEAD-1.0");
System.loadLibrary("LibavcodecTest");
}
}
Update
I contacted the developer that maintains ffmpeg4android and he was able to direct me to change the version of the android source I was building against to the same as my device which worked to allow my to call av_register_all successfully.
However, now I get a crash calling avformat_open_input where I receive “Fatal signal 11 (SIGSEGV)”.
My search on the web makes me believe this is a memory access issue. Does anybody know if this may be resolved by loading the shared libraries differently?
The key to getting the built shared libraries to work on my device was to build the source on an older NDK that was compatible with it. I was attempting to build it on the latest source and that did not work.
Here is a link to the discussion I had with the developer who helped me solve it.