Skip to content Skip to sidebar Skip to footer

Ffmpeg + Android Wrapper Using The Latest Versions Off Ffmpeg

I am trying to compile FFMPEG to work with my Android app. I've looked at: https://github.com/halfninja/android-ffmpeg-x264 which is almost what I want but I need a later version o

Solution 1:

Adding LOCAL_C_INCLUDES += $(LOCAL_PATH)/ffmpeg will probably help a fair bit.

However, you're gonna have more trouble. Basically the ffmpeg.c in the videokit directory is a copy of the original one in the ffmpeg sources, but it's been modified a little to not terminate and to clean up for repeated use, as well as to use the android logging functions. When you build the videokit library, instead of linking in the ffmpeg/ffmpeg.c, you're linking the modified one, videokit/ffmpeg.c.

The problem you're facing is that you've updated all the sources in the ffmpeg directory (and all the libav* libraries under it), but you're still trying to link that old videokit/ffmpeg.c from 0.x against those new 2.x sources. As you can imagine, it's changed a bit.

I would suggest you diff videokit/ffmpeg.c against ffmpeg/ffmpeg.c while you have the old ffmpeg version checked out, and see what was altered. Then you need to copy the new ffmpeg.c out to the videokit directory and perform equivalent changes. The logging stuff is simple, cleaning up for repeated use instead of terminating... that one will be a bit more work. Things have moved around a fair bit.

Oh and you'll also need to copy cmdutils.c, ffmpeg_opt.c, and ffmpeg_filter.c from the new sources into videokit, and to include those in your makefile. They may need alterations too.

Solution 2:

IMO - the end of your error is about not finding reqd static lib=libavcodec...

where are your "FFMPEG_LIBS" ?? you have "libs=ffmpeg" but that may be null/undef based on what i see...

Its very difficult to upgrade ffmpeg beyond the commits explicitly marked in ./Project/jni

and he says that at the bottom of his readme "Updating Submodules"....

This android make sets the local static libs created by the JNI build from the earlier build of ffmpeg.

LOCAL_PATH := $(call my-dir)include$(CLEAR_VARS)

LOCAL_MODULE  := avffmpeg

FFMPEG_LIBS := $(addprefix ffmpeg/, \
 libavfilter/libavfilter.a \
 libavcodec/libavcodec.a \
  libavformat/libavformat.a \
 libswresample/libswresample.a \
 libswscale/libswscale.a \
 libavutil/libavutil.a \
 libpostproc/libpostproc.a )

LOCAL_CFLAGS += -g -Iffmpeg -Ivideokit -Wno-deprecated-declarations 
LOCAL_LDLIBS += -fuse-ld=gold -llog -lz -ldl -landroid $(FFMPEG_LIBS) x264/libx264.a 
LOCAL_SRC_FILES := videokit/com_b2bpo_media_VideoBrowser.c ffmpeg/ffmpeg.c ffmpeg/cmdutils.c

include$(BUILD_SHARED_LIBRARY)# Use to safely invoke ffmpeg multiple times from the same Activityinclude$(CLEAR_VARS)

LOCAL_MODULE := ffmpeginvoke

LOCAL_CFLAGS += -g -Ivideokit -Wno-deprecated-declarations 
LOCAL_LDLIBS += -llog -lz -ldl
LOCAL_SRC_FILES := videokit/ffmpeg_invoke.c
include$(BUILD_SHARED_LIBRARY)

I think others have succeeded in getting to ffmpeg 2.0 or so , and you may be able to get to the heart of how they managed to upgrade the git submodules (x264 and ffmpeg).

I've long been using the older ffmpeg on android and dont return to issues regarding the linking of an upgraded ffmpeg.. Too time consuming...

Post a Comment for "Ffmpeg + Android Wrapper Using The Latest Versions Off Ffmpeg"