- 浏览: 128193 次
- 性别:
- 来自: 武汉
最新评论
-
cangbaotu:
我觉得对于开发者来说,能脚本化编写爬虫是一件挺开心的事情( ̄▽ ...
用Watij爬取网页内容 -
qq_31941407:
请问怎么设置才不是自动播放啊,为什么我一运行就是自动播放啊。。 ...
Android 歌词同步滚动效果 -
whl_1990:
这个有点抖动,不知道怎么去抖动啊?将线程睡眠时间降低也不行,可 ...
Android 歌词同步滚动效果 -
翼扬gg:
Android 歌词同步滚动效果 -
至尊包:
Instance方法上应该加上同步锁 方法名小写
单例模式(Singleton)在SQLite操作中的应用
近期项目需要解析苹果的HLS流媒体协议,而FFmpeg从0.11.1“Happiness”版本开始,才增加了对HLS协议的支持。目前网上关于FFmpeg编译移植的文章有很多,但大多都是对旧版本的说明。新版本的源码对很多地方做了改动,包括一些变量名、常量名、函数名、函数参数、结构体等,所以在用旧版本的JNI接口时,需要相应地做出改动。这个编译移植工作确实花了本人不少时间,现在总结一下,希望能给到大家一些帮助。说明一点,本文阐述的不一定都正确,大家在编译过程中,难免会遇到各种各样的错误,可以提出来,一起讨论。
编译环境:Ubuntu 12.04、Android NDK r8
一、下载源码、新建工程
下载地址:http://ffmpeg.org/download.html ,下载最新ffmpeg-0.11.1压缩包。
在$NDK_HOME/samples/目录下(我的是/root/Develop/android-ndk-r8/samples/)创建一个FFMPEG-0.11目录,在里面新建一个jni目录,然后把ffmpeg源码解压放在jni里面,源码的文件夹重命名为libffmpeg,所以最后源码的路径是:
二、配置源代码
1. 创建config_common.sh脚本
在jni目录下创建一个config_common.sh,内容如下:
#!/bin/bash FFCONFIG_COMMON=' --enable-version3 --disable-gpl --disable-nonfree --disable-debug --disable-ffmpeg --disable-ffplay --disable-ffserver --disable-ffprobe --disable-encoders --disable-muxers --disable-devices --disable-protocols --enable-protocol=file --disable-swscale --disable-avfilter --enable-network --disable-avdevice --enable-parsers --disable-decoders --disable-demuxers --enable-demuxer=matroska --disable-demuxer=rm --disable-demuxer=avi --disable-demuxer=flv --disable-demuxer=mov --enable-demuxer=mp3 --enable-demuxer=mpegps --enable-demuxer=mpegvideo --enable-demuxer=asf --enable-decoder=aac --enable-decoder=ac3 --enable-decoder=dca --enable-decoder=flv --disable-decoder=h263 --disable-decoder=h264 --enable-decoder=svq3 --enable-decoder=amrnb --enable-decoder=nellymoser --enable-decoder=pcm_alaw --enable-decoder=pcm_dvd --enable-decoder=pcm_mulaw --enable-decoder=pcm_s16be --enable-decoder=pcm_s16le --enable-decoder=pcm_s16le_planar --enable-decoder=pcm_s24be --enable-decoder=pcm_s24daud --enable-decoder=pcm_s24le --enable-decoder=pcm_s32be --enable-decoder=pcm_s32le --enable-decoder=pcm_s8 --enable-decoder=pcm_u16be --enable-decoder=pcm_u16le --enable-decoder=pcm_u24be --enable-decoder=pcm_u24le --enable-decoder=pcm_u32be --enable-decoder=pcm_u32le --enable-decoder=atrac3 --enable-decoder=pcm_u8 --enable-decoder=sipr --enable-decoder=mjpeg --enable-decoder=mp1 --enable-decoder=mp2 --enable-decoder=mp3 --enable-decoder=tscc --enable-decoder=mpeg1video --enable-decoder=mpeg2video --enable-decoder=mpeg4 --enable-decoder=ra_144 --enable-decoder=ra_288 --enable-decoder=cook --enable-decoder=rv10 --enable-decoder=rv20 --enable-decoder=rv30 --enable-decoder=rv40 --enable-decoder=wmav1 --enable-decoder=wmav2 --enable-decoder=wmapro --disable-decoder=wmv1 --disable-decoder=wmv2 --disable-decoder=wmv3 --enable-decoder=vc1 --enable-decoder=msmpeg4v1 --enable-decoder=msmpeg4v2 --enable-decoder=msmpeg4v3 '
可以根据需要自行配置以上参数。
2. 创建config.sh脚本
在jni目录下创建一个config.sh,内容如下:
#!/bin/bash source config_common.sh /*这里执行上面的config_common.sh脚本*/ cd libffmpeg /*进入libffmpeg目录*/ PREBUILT=/root/Develop/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86 PLATFORM=/root/Develop/android-ndk-r8/platforms/android-14/arch-arm ./configure --target-os=linux \ --arch=arm \ --enable-shared \ --enable-cross-compile \ --cc=$PREBUILT/bin/arm-linux-androideabi-gcc \ --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \ --strip=$PREBUILT/bin/arm-linux-androideabi-strip \ --extra-cflags="-fPIC -DANDROID" \ --extra-ldflags="-Wl,-T,$PREBUILT/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o -lc -lm -ldl" \ $FFCONFIG_COMMON cd .. /*返回jni目录*/ ndk-build clean
3. 执行config.sh脚本
然后打开终端,执行以下命令:
$./config.sh
如果配置正确的话,显示出来的最后两行是这样的:
Creating config.mak and config.h...
若出现WARNING:/root/Develop/android-ndk-8/.............../arm-linux-androideabi-pkg-config not found, library detection may fail. 可忽略。
4. 修改config.h
进入jni/libffmpeg/目录,在刚刚生成的config.h中找到这句:
因为Android的gcc并不认得restrict这个关键字,所以把它改写成:
如果需要联网的话,还需要将config.h中的以下定义置为1:
#define CONFIG_HTTP_PROTOCOL 1
#define CONFIG_HTTPPROXY_PROTOCOL 1
#define CONFIG_HTTPS_PROTOCOL 1
#define CONFIG_TCP_PROTOCOL 1
#define CONFIG_UDP_PROTOCOL 1
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
#define HAVE_STRUCT_ADDRINFO 1
#define HAVE_SOCKLEN_T 1
#define HAVE_INET_ATON 0
相应的,config.mak中也需要修改为:
CONFIG_HTTP_PROTOCOL=yes
CONFIG_HTTPPROXY_PROTOCOL=yes
CONFIG_HTTPS_PROTOCOL=yes
CONFIG_TCP_PROTOCOL=yes
CONFIG_UDP_PROTOCOL=yes
HAVE_STRUCT_SOCKADDR_STORAGE=yes
HAVE_STRUCT_ADDRINFO=yes
HAVE_SOCKLEN_T=yes
!HAVE_INET_ATON=yes
5. 修改libm.h文件
将/libavutil/libm.h中所有的static函数全部注释掉。
6. 修改Makefile文件
分別修改libavcodec、libavfilter、libavformat、libavutil、libpostproc和libswscale目录下的Makefile文件,将下面一句注释掉:
7. 新建av.mk脚本
在/jni/libffmpeg下建立一个脚本文件av.mk,內容如下:
#include $(LOCAL_PATH)/../config-$(TARGET_ARCH).mak
include $(LOCAL_PATH)/../config.mak
OBJS :=
OBJS-yes :=
MMX-OBJS-yes :=
include $(LOCAL_PATH)/Makefile
ifdef ADDITION_INC
include $(ADDITION_INC)
endif
# collect objects
OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
OBJS += $(OBJS-yes)
FFNAME := lib$(NAME)
FFLIBS := $(foreach,NAME,$(FFLIBS),lib$(NAME))
FFCFLAGS = -DHAVE_AV_CONFIG_H $(CFLAGS)
FFCFLAGS += -DTARGET_CONFIG=\"config-$(TARGET_ARCH).h\"
ALL_S_FILES := $(wildcard $(LOCAL_PATH)/$(TARGET_ARCH)/*.S)
ALL_S_FILES := $(addprefix $(TARGET_ARCH)/, $(notdir $(ALL_S_FILES)))
ifneq ($(ALL_S_FILES),)
ALL_S_OBJS := $(patsubst %.S,%.o,$(ALL_S_FILES))
C_OBJS := $(filter-out $(ALL_S_OBJS),$(OBJS))
S_OBJS := $(filter $(ALL_S_OBJS),$(OBJS))
else
C_OBJS := $(OBJS)
S_OBJS :=
endif
C_FILES := $(patsubst %.o,%.c,$(C_OBJS))
S_FILES := $(patsubst %.o,%.S,$(S_OBJS))
FFFILES := $(sort $(S_FILES)) $(sort $(C_FILES))
8. 新建Android.mk脚本
在jni目录下新建Android.mk,內容如下:
include $(CLEAR_VARS)
LOCAL_SRC_FILES := ExportJNI.cpp ExportPlayer.cpp PacketQueue.cpp /*其中ExportJNI.cpp是我编写的JNI接口*/
LOCAL_STATIC_LIBRARIES := libavformat libavcodec libswscale libavutil libpostproc ffmpeg libsubtitle /*注意Libraries的顺序*/
LOCAL_MODULE := export /*最终生成libexport.so*/
LOCAL_ARM_MODE := arm
LOCAL_CFLAGS := -D__STDC_CONSTANT_MACROS -I$(LOCAL_PATH)/libffmpeg/ -I$(LOCAL_PATH)/libsubtitle/
LOCAL_LDLIBS := -llog
include $(BUILD_SHARED_LIBRARY)
include $(call all-makefiles-under,$(LOCAL_PATH))
在jni/libffmpeg目录下新建Android.mk:
include $(CLEAR_VARS)
LOCAL_SRC_FILES := settings.c MyLog.cpp /*如果不需要打印输出等辅助功能,这行可删去*/
LOCAL_MODULE := ffmpeg
LOCAL_ARM_MODE := arm
include $(BUILD_STATIC_LIBRARY)
include $(call all-makefiles-under,$(LOCAL_PATH))
在jni/libffmpeg/libavformat目录下新建Android.mk:
include $(CLEAR_VARS)
include $(LOCAL_PATH)/../av.mk
LOCAL_SRC_FILES := $(FFFILES)
LOCAL_C_INCLUDES := \
$(LOCAL_PATH) \
$(LOCAL_PATH)/..
LOCAL_CFLAGS += $(FFCFLAGS)
LOCAL_CFLAGS += -include "string.h" -Dipv6mr_interface=ipv6mr_ifindex
LOCAL_LDLIBS := -lz
LOCAL_STATIC_LIBRARIES := $(FFLIBS)
LOCAL_MODULE := $(FFNAME)
LOCAL_ARM_MODE := arm
include $(BUILD_STATIC_LIBRARY)
在jni/libffmpeg/libavcodec目录下新建Android.mk:
include $(CLEAR_VARS)
ADDITION_INC := $(LOCAL_PATH)/arm/Makefile
include $(LOCAL_PATH)/../av.mk
ADDITION_INC :=
LOCAL_SRC_FILES := $(FFFILES)
LOCAL_C_INCLUDES := \
$(LOCAL_PATH) \
$(LOCAL_PATH)/..
LOCAL_CFLAGS += $(FFCFLAGS)
ifeq ($(TARGET_ARCH_ABI),armeabi)
LOCAL_CFLAGS += -DUSE_INT
endif
LOCAL_LDLIBS := -lz
LOCAL_STATIC_LIBRARIES := $(FFLIBS)
LOCAL_MODULE := $(FFNAME)
LOCAL_ARM_MODE := arm
include $(BUILD_STATIC_LIBRARY)
在libavfilter、libavutil、libpostproc和libswscale目录下都分別新建Android.mk:
include $(CLEAR_VARS)
include$(LOCAL_PATH)/../av.mk
LOCAL_SRC_FILES:= $(FFFILES)
LOCAL_C_INCLUDES:= \
$(LOCAL_PATH) \
$(LOCAL_PATH)/..
LOCAL_CFLAGS+= $(FFCFLAGS)
LOCAL_STATIC_LIBRARIES:= $(FFLIBS)
LOCAL_MODULE:= $(FFNAME)
include$(BUILD_STATIC_LIBRARY)
9. 新建Application.mk脚本
在jni目录下创建一个Application.mk,内容如下:
APP_ABI := armeabi
三、 NDK编译
在FFMPEG-0.11/下执行ndk-build:
编译过程需要十分钟左右,最后会在FFMPEG-0.11/obj/local/armeabi/目录下生成libavcodec.a、libavformat.a、libavutil.a、libffmpeg.a、libswscale.a和libpostproc.a以及libexport.so,在FFMPEG-0.11/libs/armeabi/目录下生成libexport.so。
- ExportJNI.rar (734 Bytes)
- 下载次数: 316
评论
Compile arm : ffmpeg <= fifo.c
Compile arm : ffmpeg <= file.c
Compile arm : ffmpeg <= imgutils.c
Compile arm : ffmpeg <= intfloat_readwrite.c
make: *** 没有规则可以创建“/home/wu/android-ndk-r6/samples/ffmpeg/obj/local/armeabi/objs/ffmpeg/libavutil/inverse.o”需要的目标“/home/wu/android-ndk-r6/samples/ffmpeg/jni/libavutil/inverse.c”。 停止。
不知道什么原因
License: LGPL version 3 or later
Creating config.mak and config.h...
WARNING: /home/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-pkg-config not found, library detection may fail.
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/home/android-ndk-r8/build/core/build-local.mk:130: *** Android NDK: Aborting . Stop.
其他設定都是一樣的,可是還是發生之前的錯誤,不知道樓主公開jni的source code。另外一提我的os是fedora不知道是否有關系
这个问题我没遇到过,貌似网上有解决办法。。
樓主 先前的問題似乎解決了,但是這些遇到兩個問題
1.config.h裡的HAVE_ISATTY若不設為0,似乎會找不到function
2.若是要聯網,開啟config.h裡的設定後,libavformat/tcp.c,也似乎會找不到closesocket這個function
不知道樓主是否有遇到這些問題
License: LGPL version 3 or later
Creating config.mak and config.h...
WARNING: /home/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-pkg-config not found, library detection may fail.
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/home/android-ndk-r8/build/core/build-local.mk:130: *** Android NDK: Aborting . Stop.
其他設定都是一樣的,可是還是發生之前的錯誤,不知道樓主公開jni的source code。另外一提我的os是fedora不知道是否有關系
这个问题我没遇到过,貌似网上有解决办法。。
License: LGPL version 3 or later
Creating config.mak and config.h...
WARNING: /home/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-pkg-config not found, library detection may fail.
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/home/android-ndk-r8/build/core/build-local.mk:130: *** Android NDK: Aborting . Stop.
其他設定都是一樣的,可是還是發生之前的錯誤,不知道樓主公開jni的source code。另外一提我的os是fedora不知道是否有關系
你能不能发份你编译的通过ffmpeg工程给我,JNI给个HelloWorld的就可以了 我邮箱:691684@qq.com ,谢谢了
我就写了一份:helloWord.c
#include<jni.h>
#include<libavcodec/avcodec.h>
#include<libavformat/avformat.h>
#include<string.h>
JNIEXPORT jstring JNICALL Java_lichunxia_android_ffmpegtest001_MainActivity_mediaPlayer(
JNIEnv *env, jobject obj) {
av_register_all();
return (*env)->NewStringUTF(env, "调用ffmpeg里的函数av_register_all()成功!");
}
还是报有些东西没定义错误
/home/liu/workspace/ffmpeg/jni/libffmpeg/libavcodec/utils.c:1771: undefined reference to `ff_truemotion2_decoder'
/home/liu/workspace/ffmpeg/jni/libffmpeg/libavcodec/utils.c:1771: undefined reference to `ff_fraps_decoder'
/home/liu/workspace/ffmpeg/jni/libffmpeg/libavcodec/utils.c:1771: undefined reference to `ff_exr_decoder'
./obj/local/armeabi/libavcodec.a(dsputil_init_arm.o): In function `ff_dsputil_init_arm':
/home/liu/workspace/ffmpeg/jni/libffmpeg/libavcodec/arm/dsputil_init_arm.c:122: undefined reference to `ff_dsputil_init_armv5te'
./obj/local/armeabi/libavcodec.a(mpegvideo_arm.o): In function `ff_MPV_common_init_arm':
/home/liu/workspace/ffmpeg/jni/libffmpeg/libavcodec/arm/mpegvideo_arm.c:47: undefined reference to `ff_MPV_common_init_armv5te'
./obj/local/armeabi/libavutil.a(cpu.o): In function `av_get_cpu_flags':
/home/liu/workspace/ffmpeg/jni/libffmpeg/libavutil/cpu.c:35: undefined reference to `ff_get_cpu_flags_arm'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/libexport.so] Error 1
SharedLibrary : libffmpeg-jni.so obj/local/armeabi/libavformat.a(matroskadec.o): In function `matroska_decode_buffer': ffmpeg-jni/libffmpeg/libavformat/matroskadec.c:1071: undefined reference to `inflateInit_' jni/libffmpeg/libavformat/matroskadec.c:1086: undefined reference to `inflate' jni/libffmpeg/libavformat/matroskadec.c:1079: undefined reference to `inflateEnd' ffmpeg-jni/libffmpeg/libavformat/matroskadec.c:1091: undefined reference to `inflateEnd' ffmpeg-obj/local/armeabi/libavformat.a(id3v2.o): In function `ff_id3v2_parse': jni/libffmpeg/libavformat/id3v2.c:683: undefined reference to `uncompress' obj/local/armeabi/libavcodec.a(svq3.o): In function `svq3_decode_init': jni/libffmpeg/libavcodec/svq3.c:915: undefined reference to `uncompress' obj/local/armeabi/libavcodec.a(tscc.o): In function `decode_end': jni/libffmpeg/libavcodec/tscc.c:201: undefined reference to `inflateEnd' obj/local/armeabi/libavcodec.a(tscc.o): In function `decode_frame': jni/libffmpeg/libavcodec/tscc.c:92: undefined reference to `inflateReset' jni/libffmpeg/libavcodec/tscc.c:101: undefined reference to `inflate' obj/local/armeabi/libavcodec.a(tscc.o): In function `decode_init': jni/libffmpeg/libavcodec/tscc.c:177: undefined reference to `inflateInit_' obj/local/armeabi/libavcodec.a(dsputil_init_arm.o): In function `ff_dsputil_init_arm': libffmpeg/libavcodec/arm/dsputil_init_arm.c:122: undefined reference to `ff_dsputil_init_armv5te' ffmpeg-obj/local/armeabi/libavcodec.a(mpegvideo_arm.o): In function `ff_MPV_common_init_arm': ffmpeg-jni/libffmpeg/libavcodec/arm/mpegvideo_arm.c:47: undefined reference to `ff_MPV_common_init_armv5te' ffmpeg-obj/local/armeabi/libavutil.a(cpu.o): In function `av_get_cpu_flags': jni/libffmpeg/libavutil/cpu.c:35: undefined reference to `ff_get_cpu_flags_arm' collect2: ld returned 1 exit status make: *** [obj/local/armeabi/libffmpeg-jni.so] Error 1
你的问题解决了吗?
BFD: ./libs/armeabi/stL7bXOO: warning: sh_link not set for section `.ARM.exidx'
./obj/local/armeabi/libavcodec.a(dsputil_init_arm.o): In function `ff_dsputil_init_arm':
/home/liu/workspace/ffmpeg/jni/libffmpeg/libavcodec/arm/dsputil_init_arm.c:122: undefined reference to `ff_dsputil_init_armv5te'
./obj/local/armeabi/libavcodec.a(mpegvideo_arm.o): In function `ff_MPV_common_init_arm':
/home/liu/workspace/ffmpeg/jni/libffmpeg/libavcodec/arm/mpegvideo_arm.c:47: undefined reference to `ff_MPV_common_init_armv5te'
./obj/local/armeabi/libavutil.a(cpu.o): In function `av_get_cpu_flags':
/home/liu/workspace/ffmpeg/jni/libffmpeg/libavutil/cpu.c:35: undefined reference to `ff_get_cpu_flags_arm'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/libexport.so] Error 1
楼主大神请问下这是什么错觉,调了好久不知道哪里的错误。
/home/android-ndk-r8/build/core/build-binary.mk:41: *** target file `clean' has both : and :: entries. Stop.
这个问题我没有发现过哦,你再仔细检查一遍参数。。
/home/android-ndk-r8/build/core/build-binary.mk:41: *** target file `clean' has both : and :: entries. Stop.
SharedLibrary : libffmpeg-jni.so obj/local/armeabi/libavformat.a(matroskadec.o): In function `matroska_decode_buffer': ffmpeg-jni/libffmpeg/libavformat/matroskadec.c:1071: undefined reference to `inflateInit_' jni/libffmpeg/libavformat/matroskadec.c:1086: undefined reference to `inflate' jni/libffmpeg/libavformat/matroskadec.c:1079: undefined reference to `inflateEnd' ffmpeg-jni/libffmpeg/libavformat/matroskadec.c:1091: undefined reference to `inflateEnd' ffmpeg-obj/local/armeabi/libavformat.a(id3v2.o): In function `ff_id3v2_parse': jni/libffmpeg/libavformat/id3v2.c:683: undefined reference to `uncompress' obj/local/armeabi/libavcodec.a(svq3.o): In function `svq3_decode_init': jni/libffmpeg/libavcodec/svq3.c:915: undefined reference to `uncompress' obj/local/armeabi/libavcodec.a(tscc.o): In function `decode_end': jni/libffmpeg/libavcodec/tscc.c:201: undefined reference to `inflateEnd' obj/local/armeabi/libavcodec.a(tscc.o): In function `decode_frame': jni/libffmpeg/libavcodec/tscc.c:92: undefined reference to `inflateReset' jni/libffmpeg/libavcodec/tscc.c:101: undefined reference to `inflate' obj/local/armeabi/libavcodec.a(tscc.o): In function `decode_init': jni/libffmpeg/libavcodec/tscc.c:177: undefined reference to `inflateInit_' obj/local/armeabi/libavcodec.a(dsputil_init_arm.o): In function `ff_dsputil_init_arm': libffmpeg/libavcodec/arm/dsputil_init_arm.c:122: undefined reference to `ff_dsputil_init_armv5te' ffmpeg-obj/local/armeabi/libavcodec.a(mpegvideo_arm.o): In function `ff_MPV_common_init_arm': ffmpeg-jni/libffmpeg/libavcodec/arm/mpegvideo_arm.c:47: undefined reference to `ff_MPV_common_init_armv5te' ffmpeg-obj/local/armeabi/libavutil.a(cpu.o): In function `av_get_cpu_flags': jni/libffmpeg/libavutil/cpu.c:35: undefined reference to `ff_get_cpu_flags_arm' collect2: ld returned 1 exit status make: *** [obj/local/armeabi/libffmpeg-jni.so] Error 1
SharedLibrary : libffmpeg-jni.so /home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavformat.a(matroskadec.o): In function `matroska_decode_buffer': /home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavformat/matroskadec.c:1071: undefined reference to `inflateInit_' /home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavformat/matroskadec.c:1086: undefined reference to `inflate' /home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavformat/matroskadec.c:1079: undefined reference to `inflateEnd' /home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavformat/matroskadec.c:1091: undefined reference to `inflateEnd' /home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavformat.a(id3v2.o): In function `ff_id3v2_parse': /home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavformat/id3v2.c:683: undefined reference to `uncompress' /home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavcodec.a(svq3.o): In function `svq3_decode_init': /home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavcodec/svq3.c:915: undefined reference to `uncompress' /home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavcodec.a(tscc.o): In function `decode_end': /home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavcodec/tscc.c:201: undefined reference to `inflateEnd' /home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavcodec.a(tscc.o): In function `decode_frame': /home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavcodec/tscc.c:92: undefined reference to `inflateReset' /home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavcodec/tscc.c:101: undefined reference to `inflate' /home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavcodec.a(tscc.o): In function `decode_init': /home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavcodec/tscc.c:177: undefined reference to `inflateInit_' /home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavcodec.a(dsputil_init_arm.o): In function `ff_dsputil_init_arm': /home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavcodec/arm/dsputil_init_arm.c:122: undefined reference to `ff_dsputil_init_armv5te' /home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavcodec.a(mpegvideo_arm.o): In function `ff_MPV_common_init_arm': /home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavcodec/arm/mpegvideo_arm.c:47: undefined reference to `ff_MPV_common_init_armv5te' /home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libavutil.a(cpu.o): In function `av_get_cpu_flags': /home/boyce/project/android/freshui-palyer/ffmpeg-player/jni/libffmpeg/libavutil/cpu.c:35: undefined reference to `ff_get_cpu_flags_arm' collect2: ld returned 1 exit status make: *** [/home/boyce/project/android/freshui-palyer/ffmpeg-player/obj/local/armeabi/libffmpeg-jni.so] Error 1
Creating config.mak and config.h...
./config.sh: line 10: --arch=arm: command not found
./config.sh: line 11: --enable-shared: command not found
./config.sh: line 12: --enable-cross-compile: command not found
./config.sh: line 13: --cc=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/pre
file or directory
./config.sh: line 14: --cross-prefix=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi
No such file or directory
./config.sh: line 15: --strip=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/
such file or directory
./config.sh: line 16: --extra-cflags=-fPIC -DANDROID: command not found
./config.sh: line 17: --extra-ldflags=-Wl,-T,/cygdrive/e/android-ndk-r8/toolchains/arm-linux-and
i/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=/cygdrive/e/android-ndk-r8/platforms/android
forms/android-14/arch-arm/usr/lib -nostdlib /cygdrive/e/android-ndk-r8/toolchains/arm-linux-andr
roideabi/4.4.3/crtbegin.o /cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/preb
end.o -lc -lm -ldl: No such file or directory
./config.sh: line 18: $'\r': command not found
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/cygdrive/e/android-ndk-r8/build/core/build-local.mk:130: *** Android NDK: Aborting . Stop.
这怎么办,LZ帮看一下
config配置里,每个配置项后面不要有空格,每行之间不要有空行
都去掉了,我的是win7环境
#!/bin/bash
source config_common.sh
cd ffmpeg
PREBUILT=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows
PLATFORM=/cygdrive/e/android-ndk-r8/platforms/android-14/arch-arm
./configure --target-os=windows
--arch=arm
--enable-shared
--enable-cross-compile
--cc=$PREBUILT/bin/arm-linux-androideabi-gcc
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi-
--strip=$PREBUILT/bin/arm-linux-androideabi-strip
--extra-cflags="-fPIC -DANDROID"
--extra-ldflags="-Wl,-T,$PREBUILT/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o -lc -lm -ldl"
$FFCONFIG_COMMON
cd ..
ndk-build clean
这是我的配置
PREBUILT=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows
./configure --target-os=windows
应只有这里要改吧,其他都是ffmpeg的路径都是一样的
Creating config.mak and config.h...
./config.sh: line 10: --arch=arm: command not found
./config.sh: line 11: --enable-shared: command not found
./config.sh: line 12: --enable-cross-compile: command not found
./config.sh: line 13: --cc=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/pre
file or directory
./config.sh: line 14: --cross-prefix=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi
No such file or directory
./config.sh: line 15: --strip=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/
such file or directory
./config.sh: line 16: --extra-cflags=-fPIC -DANDROID: command not found
./config.sh: line 17: --extra-ldflags=-Wl,-T,/cygdrive/e/android-ndk-r8/toolchains/arm-linux-and
i/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=/cygdrive/e/android-ndk-r8/platforms/android
forms/android-14/arch-arm/usr/lib -nostdlib /cygdrive/e/android-ndk-r8/toolchains/arm-linux-andr
roideabi/4.4.3/crtbegin.o /cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/preb
end.o -lc -lm -ldl: No such file or directory
./config.sh: line 18: $'\r': command not found
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/cygdrive/e/android-ndk-r8/build/core/build-local.mk:130: *** Android NDK: Aborting . Stop.
这怎么办,LZ帮看一下
config配置里,每个配置项后面不要有空格,每行之间不要有空行
都去掉了,我的是win7环境
#!/bin/bash
source config_common.sh
cd ffmpeg
PREBUILT=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows
PLATFORM=/cygdrive/e/android-ndk-r8/platforms/android-14/arch-arm
./configure --target-os=windows
--arch=arm
--enable-shared
--enable-cross-compile
--cc=$PREBUILT/bin/arm-linux-androideabi-gcc
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi-
--strip=$PREBUILT/bin/arm-linux-androideabi-strip
--extra-cflags="-fPIC -DANDROID"
--extra-ldflags="-Wl,-T,$PREBUILT/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o -lc -lm -ldl"
$FFCONFIG_COMMON
cd ..
ndk-build clean
这是我的配置
既然是Windows环境,你配置里的linux就应该相应地改成windows吧
Creating config.mak and config.h...
./config.sh: line 10: --arch=arm: command not found
./config.sh: line 11: --enable-shared: command not found
./config.sh: line 12: --enable-cross-compile: command not found
./config.sh: line 13: --cc=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/pre
file or directory
./config.sh: line 14: --cross-prefix=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi
No such file or directory
./config.sh: line 15: --strip=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/
such file or directory
./config.sh: line 16: --extra-cflags=-fPIC -DANDROID: command not found
./config.sh: line 17: --extra-ldflags=-Wl,-T,/cygdrive/e/android-ndk-r8/toolchains/arm-linux-and
i/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=/cygdrive/e/android-ndk-r8/platforms/android
forms/android-14/arch-arm/usr/lib -nostdlib /cygdrive/e/android-ndk-r8/toolchains/arm-linux-andr
roideabi/4.4.3/crtbegin.o /cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/preb
end.o -lc -lm -ldl: No such file or directory
./config.sh: line 18: $'\r': command not found
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/cygdrive/e/android-ndk-r8/build/core/build-local.mk:130: *** Android NDK: Aborting . Stop.
这怎么办,LZ帮看一下
config配置里,每个配置项后面不要有空格,每行之间不要有空行
都去掉了,我的是win7环境
#!/bin/bash
source config_common.sh
cd ffmpeg
PREBUILT=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows
PLATFORM=/cygdrive/e/android-ndk-r8/platforms/android-14/arch-arm
./configure --target-os=windows
--arch=arm
--enable-shared
--enable-cross-compile
--cc=$PREBUILT/bin/arm-linux-androideabi-gcc
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi-
--strip=$PREBUILT/bin/arm-linux-androideabi-strip
--extra-cflags="-fPIC -DANDROID"
--extra-ldflags="-Wl,-T,$PREBUILT/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -nostdlib $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtbegin.o $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/crtend.o -lc -lm -ldl"
$FFCONFIG_COMMON
cd ..
ndk-build clean
这是我的配置
Creating config.mak and config.h...
./config.sh: line 10: --arch=arm: command not found
./config.sh: line 11: --enable-shared: command not found
./config.sh: line 12: --enable-cross-compile: command not found
./config.sh: line 13: --cc=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/pre
file or directory
./config.sh: line 14: --cross-prefix=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi
No such file or directory
./config.sh: line 15: --strip=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/
such file or directory
./config.sh: line 16: --extra-cflags=-fPIC -DANDROID: command not found
./config.sh: line 17: --extra-ldflags=-Wl,-T,/cygdrive/e/android-ndk-r8/toolchains/arm-linux-and
i/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=/cygdrive/e/android-ndk-r8/platforms/android
forms/android-14/arch-arm/usr/lib -nostdlib /cygdrive/e/android-ndk-r8/toolchains/arm-linux-andr
roideabi/4.4.3/crtbegin.o /cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/preb
end.o -lc -lm -ldl: No such file or directory
./config.sh: line 18: $'\r': command not found
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/cygdrive/e/android-ndk-r8/build/core/build-local.mk:130: *** Android NDK: Aborting . Stop.
这怎么办,LZ帮看一下
config配置里,每个配置项后面不要有空格,每行之间不要有空行
Creating config.mak and config.h...
./config.sh: line 10: --arch=arm: command not found
./config.sh: line 11: --enable-shared: command not found
./config.sh: line 12: --enable-cross-compile: command not found
./config.sh: line 13: --cc=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/pre
file or directory
./config.sh: line 14: --cross-prefix=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi
No such file or directory
./config.sh: line 15: --strip=/cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/
such file or directory
./config.sh: line 16: --extra-cflags=-fPIC -DANDROID: command not found
./config.sh: line 17: --extra-ldflags=-Wl,-T,/cygdrive/e/android-ndk-r8/toolchains/arm-linux-and
i/lib/ldscripts/armelf_linux_eabi.x -Wl,-rpath-link=/cygdrive/e/android-ndk-r8/platforms/android
forms/android-14/arch-arm/usr/lib -nostdlib /cygdrive/e/android-ndk-r8/toolchains/arm-linux-andr
roideabi/4.4.3/crtbegin.o /cygdrive/e/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/preb
end.o -lc -lm -ldl: No such file or directory
./config.sh: line 18: $'\r': command not found
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/cygdrive/e/android-ndk-r8/build/core/build-local.mk:130: *** Android NDK: Aborting . Stop.
这怎么办,LZ帮看一下
avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
include $(LOCAL_PATH)/../av.mk
LOCAL_SRC_FILES:= $(FFFILES)
LOCAL_C_INCLUDES:= \
$(LOCAL_PATH) \
$(LOCAL_PATH)/..
LOCAL_CFLAGS+= $(FFCFLAGS)
LOCAL_STATIC_LIBRARIES:= $(FFLIBS)
LOCAL_MODULE:= $(FFNAME)
include $(BUILD_STATIC_LIBRARY)
jni/libffmpeg/libavformat/目录下Android.mk与其他几个不一样,你刷新下博文
这次出来了,还想请教下,就是现在编译完成后那些是有用的文件呢,如果我要在其他的项目用这个,我需要拷贝那些文件到项目目录呢,还请博主指点下
其实有用的文件只有一个,那就是最终的.so文件,前提是你通过LOCAL_SRC_FILES链接了JNI文件,要不然你的项目中根本无法调用这个.so库里的函数...
不知道博主可否提供一个简单的接口的例子呢,我想试试这个库编译的是否正确,谢谢了
发表评论
-
Android 歌词同步滚动效果
2012-09-03 19:51 21727歌词是播放器类App必不可少的组件,而一般的歌词组件都需要做 ... -
FFmpeg媒体打开过程分析
2012-08-09 09:51 2558从打开文件开始,入口 ... -
Android 加载现有数据库文件
2012-03-21 22:03 6042想把一个数据库db文件放在 res/raw/ 目录下,安装应用 ... -
用Dialog创建带箭头的对话框
2012-03-07 18:58 2013很多应用中,在点击Button后,会弹出一个带箭头 ... -
Android消息队列模型——Thread,Handler,Looper,Massage Queue
2012-03-07 09:17 11594Android系统的消息队列和消息循环都是针对具 ... -
浅谈Java平台与Android平台
2012-03-06 13:46 2306先说一说Java平台与Java语言的关系: ... -
Android UI主线程与子线程
2012-03-05 22:47 1726在一个Android 程序开始运行的时候,会单独 ... -
用Watij爬取网页内容
2012-03-03 12:51 3330最近一项目需要从某高校教务处网站爬取各教学楼的教室 ... -
assets目录与res/raw、res/drawable目录的区别
2012-02-26 22:44 6940assets目录与res下的raw、d ... -
Dialog向Activity传递数据
2012-02-22 21:11 9520我们知道,从一个Activity向另一个Acti ... -
用Dialog创建带箭头的对话框
2012-02-22 18:25 5629很多应用中,在点击Button后,会弹出一个带箭头 ...
相关推荐
FFmpeg是一款强大的开源多媒体处理工具,它包含了音视频编解码库...通过以上步骤,我们可以成功地将FFmpeg移植到Android平台,并在Android应用中使用FFmpeg的强大功能,进行音视频的编码、解码、播放、录制等多种操作。
将 FFmpeg 移植到 Android 平台,可以让 Android 应用程序具备处理多媒体文件的强大能力,比如播放视频、音频,进行格式转换等。在 Android 上移植 FFmpeg 需要对 C/C++ 语言、Android NDK(Native Development Kit...
本压缩包“xmt-FFMpeg.rar”显然是针对FFmpeg在Android上的移植进行了优化,目标是使其不依赖于底层的Surface和AudioTrack。 1. **FFmpeg基础知识**: FFmpeg包含了一系列的库,如libavcodec(编码/解码库)、...
Android NDK(Native Development Kit)允许开发者在Android应用中使用原生C/C++代码,为FFmpeg移植提供了基础。 2. **交叉编译**: 由于Android系统与Linux有所不同,需要通过交叉编译来生成适用于Android架构的...
本文将详细介绍如何将FFmpeg移植到Android项目,并使用NDK进行编译,生成可在Android平台JNI层调用的SO库。 首先,我们需要从FFmpeg官方网站下载源代码。通常,选择最新稳定版或根据项目需求选择特定版本。下载完成...
将FFmpeg移植到Android,需要进行一系列的编译和配置工作,以便使其能够与Android系统兼容并集成到Java或Kotlin应用中。以下将详细解释这个过程的关键步骤和知识点。 1. **NDK和Android Studio集成** - Android ...
利用NDK,将FFMPEG移植到android平台 这个是一个完整的android工程,里面有编译好的ffmpeg库 环境: ubuntu 14.04 ffmpeg 2。5 android 4.1.2 android-ndk-r10d
2. **Android上的FFmpeg**:在Android平台上使用FFmpeg需要进行一些额外的配置工作,包括编译FFmpeg库以适应Android的NDK环境,创建适用于Android的静态或动态库。动态库(.so文件)通常体积较小,但需要在运行时...
在将 FFmpeg 移植到 Android 平台时,我们需要进行一系列的步骤以确保其能在 Android 设备上正常工作。 首先,我们需要了解 FFmpeg 的基本结构。libavcodec 提供了各种音频和视频编码器和解码器,能够处理常见的...
在Android平台上实现FFmpeg RTSP播放涉及多个技术层面,包括FFmpeg库的移植、Android多媒体框架的理解以及网络流媒体协议的处理。以下是对这个主题的详细解析: **FFmpeg库移植** FFmpeg是一个开源的多媒体处理框架...
FFmpeg For Android (三) 移植main函数到安卓上执行ffmpeg命令 完整源码 执行在安卓上执行ffmpeg命令, 示范了音频剪切和视频格式转换 有了它 你可以做很多有趣的app
ffmpeg的编译过程详解,ffmpeg命令行工具在android 上的移植,通过ndk-build或者cmake方式在android studio2.2,ndk14(官网下载android studio2.2,然后通过studio上sdk下载ndk-bundle)构建工程项目。使用的ffmpeg...
"Android ffmpeg算法移植所需库文件armeabi"是指将FFmpeg库适配到Android平台的armeabi架构的过程。 首先,armeabi是Android支持的一种处理器架构,它适用于大多数早期的ARM处理器,如ARMv5TE及更高版本。由于...
因此,本文旨在介绍如何将成熟的开源多媒体框架ffmpeg移植到Android平台,以此来扩展Android平台的编解码能力,并利用ffserver作为流媒体服务器,实现摄像头拍摄视频的远程观看功能。本文将重点探讨ffmpeg的移植、...
在Android上移植FFmpeg源码,主要目的是利用其强大的视频音频处理能力,包括解码RTSP流中的H264视频和AAC音频,以及对视频进行封装。 2. **RTSP(Real-Time Streaming Protocol)**: RTSP是一种应用层协议,用于...
build_android.sh ffmpeg编译android库的脚本,ffmpeg2.6、1.1.2编译正常
1.移植ffmpeg到android 2.通过JNI接口调用ffmpeg实现h264的解码以及渲染 3.h264渲染采用opengles技术 代码保护局ffmpeg源码 JNI部分 以及opengles渲染部分,还有上层demo APP程序,该程序可以直接安装,播放h264...
本文主要探讨了如何将FFmpeg移植到Android操作系统上,并提供了移植过程中的注意事项和实践经验。 首先,移植FFmpeg到Android涉及的关键步骤包括: 1. **环境配置**:在Windows、Linux或macOS等平台上搭建交叉编译...