ynnadkrap
ynnadkrap

Reputation: 258

Android NDK w/ ffmpeg library - error running project

Using this guide, http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/, I successfully compiled ffmpeg-2.4.2 with Android NDK 10, but now I'm having issues using it in my eclipse project.

The error I'm getting:

*** Android NDK: Aborting    .  Stop.

which points to this in prebuilt-library.mk:

ifndef prebuilt
$(call __ndk_info,ERROR:$(LOCAL_MAKEFILE):$(LOCAL_MODULE): LOCAL_SRC_FILES points to a missing file)
$(call __ndk_info,Check that $(prebuilt_path) exists, or that its path is correct)
$(call __ndk_error,Aborting) <----- ***** This line is specifically pointed out by the error log
endif

Here's my ...jni/Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := VideoTest
LOCAL_SRC_FILES := videotest.c
LOCAL_LDLIBS := -llog -ljnigraphics -lz -landroid
LOCAL_SHARED_LIBRARIES := libavformat libavcodec libswscale libavutil

include $(BUILD_SHARED_LIBRARY)
$(call import-module,ffmpeg-2.4.2/android/arm)

Here's my android-ndk/sources/ffmpeg-2.4.2/android/arm/Android.mk:

LOCAL_PATH:= $(call my-dir)


include $(CLEAR_VARS)
LOCAL_MODULE:= libavcodec
LOCAL_SRC_FILES:= lib/libavcodec-55.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:= libavformat
LOCAL_SRC_FILES:= lib/libavformat-55.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:= libswscale
LOCAL_SRC_FILES:= lib/libswscale-2.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:= libavutil
LOCAL_SRC_FILES:= lib/libavutil-52.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:= libavfilter
LOCAL_SRC_FILES:= lib/libavfilter-3.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE:= libwsresample
LOCAL_SRC_FILES:= lib/libswresample-0.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)

Here's my project structure:

https://i.sstatic.net/QfjYJ.jpg

So it seems to me that the project isn't building because the LOCAL_SRC_FILES doesn't point to anything, but is it referring to LOCAL_SRC_FILES in jni/Android.mk or the one in ...ffmpeg-2.4.2/android/arm/Android.mk? Either way, it seems like they are actually pointing to something. I've also tried looking at this solution, Android NDK: Aborting stop?, but I'm having a hard time understanding it. Which Android.mk file needs changing?

Upvotes: 0

Views: 1598

Answers (2)

grzebyk
grzebyk

Reputation: 1034

ffmpeg 2.4.2 uses newer libraries:

libavcodec-56.so, libavformat-56.so, libswscale-3.so, libavutil-54.so, libavfilter-5.so, libswresample-1.so

UPDATE: and i think you've got a typo in android-ndk/sources/ffmpeg-2.4.2/android/arm/Android.mk. 4th line from the end - it should be LOCAL_MODULE:= libswresample

Upvotes: 1

Vikas Malhotra
Vikas Malhotra

Reputation: 131

Your project structure and build commands seem fine to me. I would suggest some points to try: 1. Try adding an Application.mk file in jni. 2. Try building the VideoTest.so in linux environment with linux ndk and maybe with a lower and stable version of ndk.

Upvotes: 0

Related Questions