FFMPEG + Android包装使用最新版本关闭FFMPEG [英] FFMPEG + Android wrapper using the latest versions off FFMPEG

查看:231
本文介绍了FFMPEG + Android包装使用最新版本关闭FFMPEG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译FFMPEG以使用我的Android应用程序。我看过: https://github.com/halfninja/android-ffmpeg-x264几乎是我想要的,但我需要一个更高版本的FFMPEG(所以我试图使用最新的2.2)。

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 of FFMPEG (so I'm trying to use the latest, 2.2).

我使用最多的脚本位于那里,但问题是在我运行compile_make_everything.sh之后,我尝试运行ndk-build,但是我收到错误(基本上找不到ffmpeg.c中的主要功能)。

I'm using most of the scripts located there, but the problem is after I run compile_make_everything.sh, I try to run ndk-build but I get errors (basically it can't find the main function in ffmpeg.c).

这是我的Android.mk:

This is my Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

#LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
LOCAL_MODULE  := videokit
LOCAL_SRC_FILES := videokit/com_myapp_example_FFMpegService.c 

LOCAL_LDLIBS := -llog -ljnigraphics -lz -landroid

LOCAL_STATIC_LIBRARIES :=ffmpeg

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

如果我修改m y LOCAL_SRC_FILES包含ffmpeg.c,当我尝试找到一些需要的帮助程序库时,它失败:
LOCAL_SRC_FILES:= videokit / com_myapp_example_FFMpegService.c ffmpeg / ffmpeg.c ffmpeg / cmdutils.c

If I modify my LOCAL_SRC_FILES to include ffmpeg.c, it fails when I tries to find some of the helper libraries it requires: LOCAL_SRC_FILES := videokit/com_myapp_example_FFMpegService.c ffmpeg/ffmpeg.c ffmpeg/cmdutils.c

错误:



/ home / me / ffmpeg / new-android-ffmpeg / Project / jni / ffmpeg / ffmpeg.c:44:0:
/home/me/ffmpeg/new-android-ffmpeg/Project/jni/ffmpeg/libavformat/avformat.h:255 :32:
致命错误:libavcodec / avcodec.h:没有这样的文件或目录
编译终止。

In file included from /home/me/ffmpeg/new-android-ffmpeg/Project/jni/ffmpeg/ffmpeg.c:44:0: /home/me/ffmpeg/new-android-ffmpeg/Project/jni/ffmpeg/libavformat/avformat.h:255:32: fatal error: libavcodec/avcodec.h: No such file or directory compilation terminated.

如何添加最新的ffmpeg库,但仍然可以调用主函数?

How can I include the latest ffmpeg library while still being able to call the main function?

推荐答案

添加LOCAL_C_INCLUDES + = $( LOCAL_PATH)/ ffmpeg可能会有所帮助。

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

但是,你会有更多的麻烦。基本上,videokit目录中的ffmpeg.c是ffmpeg源中的原始文件的副本,但是它已经被修改了一点,不能终止和清理重复使用,以及使用android日志功能。当您构建videokit库时,而不是链接到ffmpeg / ffmpeg.c,您将链接修改的一个,videokit / ffmpeg.c。

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.

您的问题您正在更新ffmpeg目录中的所有源(以及其下的所有libav *库),但是您仍然尝试将该旧的videokit / ffmpeg.c从0.x链接到新的2 .x来源。可以想象,它有所改变。

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.

我会建议您将ffmpeg / ffmpeg.c与ffmpeg / ffmpeg.c相对应,而旧的ffmpeg版本已检出,看看有什么改变。然后,您需要将新的ffmpeg.c复制到videokit目录并执行等效的更改。记录的东西很简单,清理重复使用,而不是终止...那将是一个更多的工作。事情已经有一点点了。

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.

哦,你还需要将cmdutils.c,ffmpeg_opt.c和ffmpeg_filter.c从新的源文件复制到videokit ,并将其包含在您的makefile中。他们也可能需要更改。

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.

这篇关于FFMPEG + Android包装使用最新版本关闭FFMPEG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆