Ask Your Question
2

OpenCV and FFmpeg for Android

asked 2013-01-28 04:03:56 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

Hi everyone, this is my project situation: I compiled ffmpeg on windows using this tutorial and I imported the ffmpeg folder generated (with inside libffmpeg.so file) inside my android project (under jni folder). In my project I have a jni_part.cpp where I inserted my jni function to operate with opencv. In my Android.mk I'm using the code below to import opencv and compile the jni_part.cpp

include $(CLEAR_VARS)
include ../../sdk/native/jni/OpenCV.mk
LOCAL_MODULE    := mixed_sample
LOCAL_SRC_FILES := jni_part.cpp
LOCAL_LDLIBS +=  -llog -ldl 
LOCAL_SHARED_LIBRARY := ffmpeg-prebuilt
include $(BUILD_SHARED_LIBRARY)

But what code I should use to import also ffmpeg? I tried to use this code pasted into Android.mk file:

include $(CLEAR_VARS)
LOCAL_MODULE := ffmpeg-prebuilt
LOCAL_SRC_FILES := ffmpeg-0.8/android/armv7-a/libffmpeg.so
LOCAL_EXPORT_C_INCLUDES := ffmpeg-0.8/android/armv7-a/include/
LOCAL_EXPORT_LDLIBS := ffmpeg-0.8/android/armv7-a/libffmpeg.so
LOCAL_PRELINK_MODULE := true
include $(PREBUILT_SHARED_LIBRARY)

but if from my jni_part.cpp code I try to include some ffmpeg files as for example #include <libavutil/avstring.h> I get this error:

**** Build of configuration Default for project OpenCV Tutorial 4 - Mix Java+Native OpenCV ****

C:\android-ndk-r8c\ndk-build.cmd 
Prebuilt       : libffmpeg.so <= jni/ffmpeg-0.8/android/armv7-a/
Install        : libffmpeg.so => libs/armeabi-v7a/libffmpeg.so
"Compile++ thumb : mixed_sample <= jni_part.cpp
jni/jni_part.cpp:24:32: fatal error: libavutil/avstring.h: No such file or directory
compilation terminated.
make: *** [obj/local/armeabi-v7a/objs/mixed_sample/jni_part.o] Error 1

**** Build Finished ****

Thanks in advance for you suggestions

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
2

answered 2013-10-31 08:32:34 -0600

iReallyUbuntu gravatar image

Try this http://code.google.com/p/javacv/ and follow the instructions under "Quick Start for OpenCV and FFmpeg"

edit flag offensive delete link more
1

answered 2013-01-29 12:11:14 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

FFMPEG is not officially supported in OpenCV4Android OpenCV team works on this problem and I belive FFMPEG support appears in future releases. You can track task status here.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-01-28 04:03:56 -0600

Seen: 5,725 times

Last updated: Oct 31 '13