资源描述:
《ffmpeg移植android方法以及常见问题汇总》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、ffmpcg移植Android方法以及常见问题汇总:1.在ffmpeg官网下载源码包,比如ffmpeg-2.30在ffmpeg目录下增加Android,mk和av.mkconfig,sh三个文件。2.config,sh用于配置ffmpeg环境脚木,可键入#!/bin/shPREBUILT二…android~ndk-r7b/toolchains/arm-linux-androideabi-4.4.3/prebui11/1inux~x86PLATFORM二…android-ndk-r7b/platforms/androidT4/a:rch-en'niexp
2、ortTMPDIR=.../tmp./configure—target-os=linux―arch=arm一-enab1e-cross-compi1e--cc=$PREBUILT/bin/arm-1inux-androideabi-gcc~4.4.3--cross-prefix=$PREBUTLT/bin/arm~linux~androideabi-―nm=$PREBUTLT/bin/arm-1inux~androideabi-nm―extra-cflags=//-fPIC-DANDROID"一-enable-static一disabl
3、e-shared一-disable-asm―disable-yasm―extra-ldflags=//-Wl,-T,$PREBUILT/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x-W1,-rpath-1ink=$PLATFORM/usr/lib-L$PLATFORM/usr/lib-nostdlib$PREBU1LT/1ib/gcc/arni-1inux-androideabi/4.4.3/crtbegin.o$PREBUlLT/lib/gcc/arm-linux-android
4、eabi/4.4.3/crtend.()-lc~lmTdl"PREBUILT、PLATFORM、TMPD1R是需要修改的,配置自己的ndk路径,通常这一步出错概率极高。TMPD1R路径一定要存在且可以访问。常见错误:arm~linux~androideabi-gccisunabletocreateanexecutablefile,般是tmp文件没有设置。UnknownCcompiler/toolchains/arm-linux-androidoabi-4.4.3/prcbuiIt/windows/bin/arm~linux-androideabi-gc
5、c,一般是MDK配置错谋。./config,sh:line8:―arch:commandnotfound,./configure每一个参数后的转行符号,注意后而不要有空格符,另外也有可能是字符格式错谋,要转为unix,在vim里:setff二unix保存退出。-cc、—cross-prefix、—nm>—extra-ldflags注意配置路径要正确,否则脚本执行失败。./configure是配置ffmpeg选项的,口J以按个人盂求添加删减,不赘述。执行该脚本,如果正确,大约数分钟后执行结束,会自动生成config,h和config,inak。如果执行
6、出错,一般是配置问题。1.av.mk文件键入inc1ude$(LOCAL_PATH)/../config.makOBJS:=OBJS-yes:二MMX-OBJS-yes:=inc1ude$(LOCAL_PATII)/Makefile#collectobjectsOBJS-$(HAVE_MMX)+=$(MMX-OBJS-yes)OBJS+=$(OBJS-yes)FFNAME:=lib$(NAME)FFLIBS:=$(foreach,NAME,$(FFLIBS),lib$(NAME))FFCFLAGS二-DHAVE_AV_CONFIG_H-Wno~sign
7、-compare-Wno-switch-Wno~pointer-signFFCFLAGS+二-DTARGETCONFIG="config-$(TARGETARCH).h〃ALL_S_FILES:=$(wildcard$(LOCAL_PATH)/$(TARGET_ARCH)/*.S)ALL_S_FILES:=$(addprefix$(TARGET_ARCH)/,$(notdir$(ALL_S_FILES)))ifneq($(ALLSFILES),)ALL_S_OBJS:=$(patsubst%.S,%.o,$(ALL_S_FTLES))C_OBJS:
8、=$(filter-out$(ALL_S_OBJS),$(OBJS))S_OBJS:=$(f订