在ffmpeg的Andr​​oid组建libx264 EN codeR错误 [英] libx264 encoder error in ffmpeg android build

查看:429
本文介绍了在ffmpeg的Andr​​oid组建libx264 EN codeR错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,我不得不承认libx264并成功地编译一个ffmeg构建脚本。我也编X264和libx264.a文库获得。双方的ffmpeg和libx264从源代码构建。我可以建立的ffmpeg没有libx264成功地为好。下面你会发现我的脚本尝试构建与ffmpeg的libx264。

 #!/斌/庆典
NDK =〜/ Android_NDK_r7b
平台= $ NDK /平台/ Android的-8 /弓臂/
preBUILT = $ NDK /工具链/ ARM-Linux的androideabi-4.4.3 / prebuilt / Linux的x86的
阿利坦=〜/ X264 / ndk7_build
功能build_one
{
的./configure --target-OS = Linux的\\
- preFIX = $preFIX \\
--enable-交叉编译\\
--extra-库= - lgcc\\
--arch =手臂\\
--CC = $preBUILT /斌/ ARM-Linux的androideabi-GCC \\
--cross- preFIX = $preBUILT /斌/ ARM-Linux的androideabi- \\
--nm = $preBUILT /斌/ ARM-Linux的androideabi纳米\\
--sysroot = $ PLATFORM \\
--extra-CFLAGS =-I $阿利坦/包括\\
--disable共享\\
--enable-静\\
--extra-LDFLAGS =-L $阿利坦/ lib目录\\
--enable-版本3 \\
--enable-GPL \\
--disable-DOC \\
--disable-一切\\
--enable-libx264 \\
--enable-CN codeR = libx264 \\
$ ADDITIONAL_CONFIGURE_FLAG使清洁
使-J4安装
$preBUILT /斌/ ARM-Linux的androideabi-ARðlibav codeC / libav codec.a inverse.o
$preBUILT /斌/ ARM-Linux的androideabi-LD -rpath链接= $平台/ usr / lib目录-L $平台/ usr / lib目录-soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic - -whole归档--no-未定义-o $preFIX / libffmpeg.so libav codeC / libav codec.a了libavformat / libavformat.a libavutil / libavutil.a libswscale / libswscale.a -lc -lm -lz -ldl -llog --warn一次--dynamic链接器= /系统/斌/连接器$preBUILT / lib中/ GCC / ARM-Linux的androideabi / 4.4.3 / libgcc.a中
}#arm v7vfpv3
CPU =的ARMv7-A
OPTIMIZE_CFLAGS = - mfloat-ABI = softfp -mfpu =的VFPv3-D16 -marm -march = $ CPU
preFIX = / DONE / $ CPU
ADDITIONAL_CONFIGURE_FLAG =
build_one

以上脚本不给我libx264.a在ffmpeg的输出builds.Several其他情况如下。
如果我能带X264 codeR,我得到了一个未定义引用错误在x264.c一些变量(在libav codeC)。
如果我的ffmpeg配置启用共享,我得到它说的错误它不能cd到我的preFIX目录(顺便说一句无权限问题)。

我使用的ffmpeg和X264的最新版本(克隆了git的今天)和NDK 7的Ubuntu上运行虚拟机,安装在Windows 7上关于我的ffmpeg / X264移植到Android的冒险有关详细信息,您可以参阅< A HREF =htt​​p://stackoverflow.com/questions/12200172/yet-another-ffmpeg-libx264-issue>这里。

我应该怎么做与ffmpeg的使用libx264?我一直在试图用不同的配置这个脚本,删除了所有的ffmpeg x264的文件夹,并重新安装它们,但无济于事。

感谢很多提前。

修改
下面是我的X264构建脚本。它建立精细,给我的静态库和头。

 出口ARM_ROOT = /家庭/穆罕默德/ Android_NDK_r7b
出口ARM_INC = $ ARM_ROOT /平台/ Android的-8 /弓臂/ usr / include目录/
出口ARM_LIB = $ ARM_ROOT /平台/ Android的-8 /弓臂/ usr / lib目录/
出口ARM_TOOL = $ ARM_ROOT /工具链/ ARM-Linux的androideabi-4.4.3 / prebuilt / Linux的x86的
出口ARM_LIBO = $ ARM_TOOL / lib中/ GCC / ARM-Linux的androideabi / 4.4.3
出口PATH = $ ARM_TOOL /斌:$ PATH
出口PATH = $ ARM_TOOL / ARM-Linux的androideabi /斌:$ PATH
出口ARM_ pre =臂Linux的androideabi
#tries搭建4.4.3工具链的./configure - preFIX = / ndk7_build \\。
--disable-GPAC \\
--extra-CFLAGS =-I $ ARM_INC -fPIC -DANDROID -fpic -mthumb-互通-ffunction截面-funwind桌-fstack保护器使用-fno-short-枚举-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno- psabi -march =的ARMv5TE -mtune =的XScale -msoft浮动-mthumb -Os -fomit-frame-pointer的-fno严格走样-finline限制= 64 -DANDROID -Wa, - noexecstack -MMD -MP\\
--extra-LDFLAGS =-nostdlib -Bdynamic轮候册, - 无未定义-Wl,-z,noexecstack -Wl,-z,nocopyreloc轮候册,-soname,/系统/ lib目录/ libz.so轮候册, -rpath链接= $ ARM_LIB,-dynamic-链接= /系统/斌/链接器的-L $ ARM_LIB -nostdlib $ ARM_LIB / crtbegin_dynamic.o $ ARM_LIB / crtend_android.o -lc -lm -ldl -lgcc\\
--cross- preFIX = $ {ARM_ pre} - \\
--disable-ASM \\
--enable-静\\
主机=臂的Linux \\

这是对终端时会发生什么我能libx264 EN $ C $铬。

  STRIP的ffmpeg
安装安装-progs的 - 是的
INSTALL的ffmpeg
INSTALL ffprobe
libav codeC / libav codec.a(libx264.o):在功能`X264_frame:
/home/mehmet/ffmpeg/libav$c$cc/libx264.c:158:未定义参考`x264_picture_init
/home/mehmet/ffmpeg/libav$c$cc/libx264.c:178:未定义的引用`x264_en coder_reconfig
/home/mehmet/ffmpeg/libav$c$cc/libx264.c:189:未定义的引用`x264_en coder_en code'
/home/mehmet/ffmpeg/libav$c$cc/libx264.c:195:未定义的引用`x264_en coder_delayed_frames
libav codeC / libav codec.a(libx264.o):在功能`恩code_nals:
/home/mehmet/ffmpeg/libav$c$cc/libx264.c:100:未定义参考`x264_bit_depth
libav codeC / libav codec.a(libx264.o):在功能`X264_close:
/home/mehmet/ffmpeg/libav$c$cc/libx264.c:230:未定义的引用`x264_en coder_close
libav codeC / libav codec.a(libx264.o):在功能`X264_init:
/home/mehmet/ffmpeg/libav$c$cc/libx264.c:283:未定义参考`x264_param_default
/home/mehmet/ffmpeg/libav$c$cc/libx264.c:291:未定义的引用`x264_param_default_ preSET
/home/mehmet/ffmpeg/libav$c$cc/libx264.c:313:未定义参考`x264_param_parse
/home/mehmet/ffmpeg/libav$c$cc/libx264.c:448:未定义参考`x264_param_apply_fastfirstpass
/home/mehmet/ffmpeg/libav$c$cc/libx264.c:451:未定义参考`x264_param_apply_profile
/home/mehmet/ffmpeg/libav$c$cc/libx264.c:494:未定义的引用`x264_en coder_open_125
/home/mehmet/ffmpeg/libav$c$cc/libx264.c:505:未定义的引用`x264_en coder_headers


解决方案

https://github.com/guardianproject/android-ffmpeg/blob/master/configure_ffmpeg.sh

看看上面的链接和eighthave如何包括L..X264他./ffmpeg/configure ...

如果ü得到正确的库成上的ffmpeg的配置步骤搜索链,那么所有这些不确定的裁判去了......

Right now, I have a ffmeg build script which recognizes libx264 and compiles succesfully. I have also compiled x264 and obtained libx264.a library. Both ffmpeg and libx264 are built from source. I can build ffmpeg without libx264 succesfully as well. Below you may find my script which tries to build ffmpeg with libx264.

#!/bin/bash
NDK=~/Android_NDK_r7b
PLATFORM=$NDK/platforms/android-8/arch-arm/
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86
alitan=~/x264/ndk7_build
function build_one
{
./configure --target-os=linux \
--prefix=$PREFIX \
--enable-cross-compile \
--extra-libs="-lgcc " \
--arch=arm \
--cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
--cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \
--nm=$PREBUILT/bin/arm-linux-androideabi-nm \
--sysroot=$PLATFORM \
--extra-cflags=" -I$alitan/include" \
--disable-shared \
--enable-static \
--extra-ldflags=" -L$alitan/lib " \
--enable-version3 \
--enable-gpl \
--disable-doc \
--disable-everything \
--enable-libx264 \
--enable-encoder=libx264 \
$ADDITIONAL_CONFIGURE_FLAG

make clean
make -j4 install
$PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o
$PREBUILT/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib -soname libffmpeg.so -shared -nostdlib -z,noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a libswscale/libswscale.a -lc -lm -lz -ldl -llog --warn-once --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a
}

#arm v7vfpv3
CPU=armv7-a
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=vfpv3-d16 -marm -march=$CPU "
PREFIX=./DONE/$CPU
ADDITIONAL_CONFIGURE_FLAG=
build_one

Above script doesn't give me libx264.a in ffmpeg output builds.Several other scenarios are as follows. If I enable x264 encoder, I get undefined reference errors to some variables in x264.c (in libavcodec). If I enable shared in ffmpeg configure, I get an error which says it can't cd to my prefix directory (no permission issues by the way).

I am using latest releases of ffmpeg and x264 (cloned the git today) and ndk 7. Ubuntu runs on VM, installed on Windows 7. For further details about my adventure of ffmpeg/x264 porting to Android, you may refer here.

What should I do to use libx264 with ffmpeg? I kept on trying this script with different configurations, removed all ffmpeg x264 folders and reinstalled them, but to no avail.

Thanks a lot in advance.

EDIT Below is my x264 build script. It builds fine, gives me the static library and the headers.

export ARM_ROOT=/home/mehmet/Android_NDK_r7b
export ARM_INC=$ARM_ROOT/platforms/android-8/arch-arm/usr/include/
export ARM_LIB=$ARM_ROOT/platforms/android-8/arch-arm/usr/lib/
export ARM_TOOL=$ARM_ROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86
export ARM_LIBO=$ARM_TOOL/lib/gcc/arm-linux-androideabi/4.4.3
export PATH=$ARM_TOOL/bin:$PATH
export PATH=$ARM_TOOL/arm-linux-androideabi/bin:$PATH
export ARM_PRE=arm-linux-androideabi
#tries to build for 4.4.3 toolchain

./configure --prefix=./ndk7_build \
--disable-gpac \
--extra-cflags=" -I$ARM_INC -fPIC -DANDROID -fpic -mthumb-interwork -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -mtune=xscale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -DANDROID -Wa,--noexecstack -MMD -MP " \
--extra-ldflags=" -nostdlib -Bdynamic -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,nocopyreloc -Wl,-soname,/system/lib/libz.so -Wl,-rpath-link=$ARM_LIB,-dynamic-linker=/system/bin/linker -L$ARM_LIB -nostdlib $ARM_LIB/crtbegin_dynamic.o $ARM_LIB/crtend_android.o -lc -lm -ldl -lgcc " \
--cross-prefix=${ARM_PRE}- \
--disable-asm \
--enable-static \
--host=arm-linux \

This is what happens on terminal when i enable libx264 encoder.

STRIP   ffmpeg
INSTALL install-progs-yes
INSTALL ffmpeg
INSTALL ffprobe
libavcodec/libavcodec.a(libx264.o): In function `X264_frame':
/home/mehmet/ffmpeg/libavcodec/libx264.c:158: undefined reference to `x264_picture_init'
/home/mehmet/ffmpeg/libavcodec/libx264.c:178: undefined reference to `x264_encoder_reconfig'
/home/mehmet/ffmpeg/libavcodec/libx264.c:189: undefined reference to `x264_encoder_encode'
/home/mehmet/ffmpeg/libavcodec/libx264.c:195: undefined reference to `x264_encoder_delayed_frames'
libavcodec/libavcodec.a(libx264.o): In function `encode_nals':
/home/mehmet/ffmpeg/libavcodec/libx264.c:100: undefined reference to `x264_bit_depth'
libavcodec/libavcodec.a(libx264.o): In function `X264_close':
/home/mehmet/ffmpeg/libavcodec/libx264.c:230: undefined reference to `x264_encoder_close'
libavcodec/libavcodec.a(libx264.o): In function `X264_init':
/home/mehmet/ffmpeg/libavcodec/libx264.c:283: undefined reference to `x264_param_default'
/home/mehmet/ffmpeg/libavcodec/libx264.c:291: undefined reference to `x264_param_default_preset'
/home/mehmet/ffmpeg/libavcodec/libx264.c:313: undefined reference to `x264_param_parse'
/home/mehmet/ffmpeg/libavcodec/libx264.c:448: undefined reference to `x264_param_apply_fastfirstpass'
/home/mehmet/ffmpeg/libavcodec/libx264.c:451: undefined reference to `x264_param_apply_profile'
/home/mehmet/ffmpeg/libavcodec/libx264.c:494: undefined reference to `x264_encoder_open_125'
/home/mehmet/ffmpeg/libavcodec/libx264.c:505: undefined reference to `x264_encoder_headers'

解决方案

https://github.com/guardianproject/android-ffmpeg/blob/master/configure_ffmpeg.sh

look at above link and how eighthave includes L..X264 in his ./ffmpeg/configure...

if u get the correct libs into the search chain for the config step on ffmpeg , then all those undefined refs go away...

这篇关于在ffmpeg的Andr​​oid组建libx264 EN codeR错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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