views:

102

answers:

1

I run Ubuntu and try to use the ffmpeg wrapper in Java from here: http://code.google.com/p/javacv/

It seems to work fine on other systems, but in Ubuntu the project crashes with the following mistake: Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'avcodec_decode_video2': /usr/lib/i686/cmov/libavcodec.so: undefined symbol: avcodec_decode_video2

ffmpeg is working great from the command line, though.

JavaCV author recommended me to check this link: http://linux-tipps.blogspot.com/2009/05/pretending-package-is-installed-by.html

Probably I'm doing something wrong, but it cannot reinstall libavcodec51 like this.

So the questions are: 1. Is those solution above a good one so I should bring it to success somehow? 2. What are the other ways to solve the problem?

Thank you for your suggestions in advance!

A: 

libavcodec is built with C linkage, but the header does not place the declarations around an extern "C" wrapper when built with C++. If the Java Native Interface wrapper to libavcodec is built with a C++ compiler, it will define the functions using C++ linkage. In this case it needs something like:

extern "C" {
#include <libavcodec.h>
}
reece