我的操作:
1 修改 module-lite.sh
注释 #export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-gpl"
添加
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-gpl"
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-libx264"
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-encoder=libx264"
2 修改 do-compile-ffmpeg.sh
添加
FF_CFLAGS="-I/lilin/x264 $FF_CFLAGS"
FF_DEP_LIBS="-L/lilin/x264 $FF_DEP_LIBS"
x264的头文件,.so文件都放在 /lilin/x264目录下面
3 x264按照一样ndk环境编译的
4 编译ijk
错误日志如下:
/lilin/ijkplayer/ijkplayer-android/android/contrib/build/ffmpeg-armv7a/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: warning: skipping incompatible /lilin/x264/libx264.so while searching for x264
/lilin/ijkplayer/ijkplayer-android/android/contrib/build/ffmpeg-armv7a/toolchain/bin/../lib/gcc/arm-linux-androideabi/4.9/../../../../arm-linux-androideabi/bin/ld: error: cannot find -lx264
/tmp/ffconf.zrktnKs9.o:ffconf.nElNN9tP.c:function main: error: undefined reference to 'x264_encoder_encode'
collect2: error: ld returned 1 exit status
ERROR: libx264 not found
提示x264库不合适,忽略了。
x264库我查看函数也是有的,ndk也是一样,是不是哪里出问题了?
I think you have to download and pre-compile this library, as well as the openssl. The details only bbcallen can give you @kria113 .
See Info https://trac.ffmpeg.org/wiki/CompilationGuide/Quick/libx264
Download libx264 http://www.videolan.org/developers/x264.html
@FloridaStream
I got x264 by : git clone http://git.videolan.org/git/x264.git
编译sh是从https://github.com/WritingMinds/ffmpeg-android项目里面剥离出来的
settings.sh android_build.sh x264_build.sh
只是简单修改:
1 android_build.sh只编译x264_build.sh
2 settings.sh修改SUPPORTED_ARCHITECTURES=(armeabi-v7a) 只编译armeabi-v7a版本
3 x264_build.sh修改 --enable-shared \ 添加so生成
其他就是上面编译过程了
上面编译: warning: skipping incompatible /lilin/x264/libx264.so while searching for x264
确定是x264库问题吗?
thank you~
@FloridaStream
It is my mistake~
编译x264的sh剥离少了一个abi_settings.sh;我添加这个文件后编译成功了
非常感谢@FloridaStream
之前编译x264的时候一开始会提示一些错误,没有退出来,接着编译结束后编译出了a,so文件,以为成功了~ [不仔细!!!,编程是一个严谨的过程呢~]
这里再将完整流程整理下:
0 dpkg-reconfigure dash
1 x264
a git clone http://git.videolan.org/git/x264.git
b from: https://github.com/WritingMinds/ffmpeg-android get:
settings.sh android_build.sh x264_build.sh abi_settings.sh
c modify:
settings.sh
- SUPPORTED_ARCHITECTURES=(armeabi-v7a armeabi-v7a-neon x86)
+ SUPPORTED_ARCHITECTURES=(armeabi-v7a)
other: your setting
ANDROID_API_VERSION=9
NDK_TOOLCHAIN_ABI_VERSION=4.8
android_build.sh
only build x264:
+ ./x264_build.sh $i $BASEDIR 0 || exit 1
- ./libpng_build.sh $i $BASEDIR 1 || exit 1
- ./freetype_build.sh $i $BASEDIR 1 || exit 1
- ./expat_build.sh $i $BASEDIR 1 || exit 1
- ./fribidi_build.sh $i $BASEDIR 1 || exit 1
- ./fontconfig_build.sh $i $BASEDIR 1 || exit 1
- ./libass_build.sh $i $BASEDIR 1 || exit 1
- ./lame_build.sh $i $BASEDIR 1 || exit 1
- ./ffmpeg_build.sh $i $BASEDIR 0 || exit 1
x264_build.sh
if you want shared lib
- --disable-shared \
+ --enable-shared \
abi_settings.sh keep~
2 modify module-lite.sh
- #export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-gpl"
+ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-gpl"
+ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-libx264"
+ export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-encoder=libx264"
3 modify do-compile-ffmpeg.sh
4 build ijk
Very good @kria113 , thanks for sharing, do not forget to close the issue. =)
@kria113 hello ,where the folder "lilin" will set?what the path "x264" will be?
@kingty lilin/x264 is x264 git clone path ,
ex at /lilin path do : git clone http://git.videolan.org/git/x264.git
Most helpful comment
I think you have to download and pre-compile this library, as well as the openssl. The details only bbcallen can give you @kria113 .
See Info https://trac.ffmpeg.org/wiki/CompilationGuide/Quick/libx264
Download libx264 http://www.videolan.org/developers/x264.html