编译FFmpeg:找不到libx264 [英] Compiling FFmpeg : libx264 not found

查看:1527
本文介绍了编译FFmpeg:找不到libx264的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望有人帮我解决这个问题。我正在尝试使用android ndk r10e在ubuntu 12.04LTS下编译FFmpeg 2.2.3库,方法如下:



Tutorial1



Tutorial2



这是我的build_android.sh文件:

  #!/ bin / bash 
NDK = / home / rango / Desktop / android-ndk-r10e
SYSROOT = $ NDK / platforms / android-19 / arch-arm /
TOOLCHAIN = $ NDK / toolchains / arm-linux-androideabi-4.8 / prebuilt / linux-x86

#ADDI_LDFLAGS = - L / usr / local / lib
#ADDI_CFLAGS = - I / usr / include

函数build_one
{
./configure \
--prefix = $ PREFIX \
--enable-shared \
--enable-static \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
- 禁用-ffpr obe \
--disable-ffserver \
--disable-doc \
--disable-symver \
--enable-protocol = concat \
--enable-protocol = file \
--enable-muxer = mp4 \
--enable-demuxer = mpegts \
--enable-memalign-hack \\ \\
--enable-gpl \
--enable-libx264 \
--cross-prefix = $ TOOLCHAIN / bin / arm-linux-androideabi- \
--target-os = linux \
--arch = arm \
--enable-cross-compile \
--sysroot = $ SYSROOT \
- -extra-cflags = - Os -fpic -marm $ ADDI_CFLAGS\
--extra-ldflags =$ ADDI_LDFLAGS\

make clean
make -j4
make install
}

CPU = arm
PREFIX = $(pwd)/ android / $ CPU

build_one

当我执行buid_android.sh脚本没有--enable-libx264 \一切都进展顺利,我可以得到。一个文件在android / arm /文件夹。但是使用此行会失败,并在控制台中显示以下错误:


错误:未找到libx264



如果您认为配置有误,请确保您使用Git的
最新版本。如果最新版本失败,请将
问题报告给ffmpeg-user@ffmpeg.org邮件列表或
irc.freenode.net上的IRC #ffmpeg。包括由
configure生成的日志文件config.log,因为这将有助于


它似乎不能找到库的位置,因为我在config.log文件中收到以下错误:


LIBNAME.h:否这样的文件或目录
newlib.h:没有这样的文件或
目录mingw.h:没有这样的文件或目录
x264.h:没有这样的文件或
目录


这是config.log文件的尾部:

  check_mathfunc truncf 1 
check_ld cc
check_cc
BEGIN /tmp/ffconf.zGKqGin6.c
1 #include< math.h>
2 float foo(float f,float g){return truncf(f); }
3 int main(void){return(int)foo; }
END /tmp/ffconf.zGKqGin6.c
/home/rango/Desktop/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm -linux-androideabi-gcc --sysroot = / home / rango / Desktop / android-ndk-r10e / platforms / android-19 / arch-arm / -isysroot / home / rango / Desktop / android-ndk-r10e / android-19 / arch-arm / -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS = 64 -D_LARGEFILE_SOURCE -Dstrtod = avpriv_strtod -DPIC -Os -fpic -marm -march = armv5te -std = c99 -fomit-frame-pointer -fPIC -marm -pthread -c -o /tmp/ffconf.8Q9ke3aO.o /tmp/ffconf.zGKqGin6.c
/home/rango/Desktop/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86 / bin / arm-linux-androideabi-gcc --sysroot = / home / rango / Desktop / android-ndk-r10e / platforms / android-19 / arch-arm / -isysroot / home / rango / Desktop / android-ndk- r10e / platforms / android-19 / arch-arm / -Wl, - 需要-o /tmp/ffconf.3sjTkc5z /tmp/ffconf.8Q9ke3aO.o -lm -lz -pthread
check_lib x264.h x264_encoder_encode -lx264
check_header x264.h
check_cpp
B EGIN /tmp/ffconf.zGKqGin6.c
1 #include< x264.h>
2 int x;
END /tmp/ffconf.zGKqGin6.c
/home/rango/Desktop/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm- linux-androideabi-gcc --sysroot = / home / rango / Desktop / android-ndk-r10e / platforms / android-19 / arch-arm / -isysroot / home / rango / Desktop / android-ndk-r10e / platforms / android -19 / arch-arm / -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS = 64 -D_LARGEFILE_SOURCE -Dstrtod = avpriv_strtod -DPIC -Os -fpic -marm -march = armv5te -std = c99 -fomit-frame-pointer -fPIC -marm -pthread -E - o /tmp/ffconf.8Q9ke3aO.o /tmp/ffconf.zGKqGin6.c
/tmp/ffconf.zGKqGin6.c:1:18:致命错误:x264.h:没有这样的文件或目录
#include< x264.h>
^
编译终止。
错误:libx264未找到


解决方案

理论上使用 libx264 支持 Android 构建 FFmpeg 支持您需要执行以下步骤:



1)为Android 构建 libx264 。现在你没有任何建立的libx264 ,这就是为什么你得到上面的错误。



2)更改你的 buid_android.sh 并添加其他选项到配置 - extra-cflags - extra-ldflags )指定路径包含 lib 目录 libx264 在步骤1。



3)运行修改的 build_android.sh



不幸的是,我没有为 Android 构建 libx264 。但我认为有办法做到这一点...


I hope some one helps me the solve this problems. I was trying to compile FFmpeg 2.2.3 library under ubuntu 12.04LTS for android using android ndk r10e by following this tutorials:

Tutorial1

Tutorial2

here is my build_android.sh file:

#!/bin/bash
NDK=/home/rango/Desktop/android-ndk-r10e
SYSROOT=$NDK/platforms/android-19/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86

#ADDI_LDFLAGS="-L /usr/local/lib"
#ADDI_CFLAGS="-I /usr/include"

function build_one
{
./configure \
--prefix=$PREFIX \
--enable-shared \
--enable-static \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-doc \
--disable-symver \
--enable-protocol=concat \
--enable-protocol=file \
--enable-muxer=mp4 \
--enable-demuxer=mpegts \
--enable-memalign-hack \
--enable-gpl \
--enable-libx264 \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--target-os=linux \
--arch=arm \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic -marm $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \

make clean
make -j4
make install
}

CPU=arm
PREFIX=$(pwd)/android/$CPU

build_one

when i execute buid_android.sh script without --enable-libx264 \ line everything is going well and i can get .a files on android/arm/ folder. but with this line it fails and show the following error in the console:

ERROR: libx264 not found

If you think configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to the ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net. Include the log file "config.log" produced by configure as this will help

it seems like it can't find where the libraries are, as i get a lot of the following errors in config.log file:

"LIBNAME".h: No such file or directory newlib.h: No such file or directory mingw.h: No such file or directory x264.h: No such file or directory

Here is the tail of config.log file:

check_mathfunc truncf 1
check_ld cc
check_cc
BEGIN /tmp/ffconf.zGKqGin6.c
    1   #include <math.h>
    2   float foo(float f, float g) { return truncf(f); }
    3   int main(void){ return (int) foo; }
END /tmp/ffconf.zGKqGin6.c
/home/rango/Desktop/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc --sysroot=/home/rango/Desktop/android-ndk-r10e/platforms/android-19/arch-arm/ -isysroot /home/rango/Desktop/android-ndk-r10e/platforms/android-19/arch-arm/ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Dstrtod=avpriv_strtod -DPIC -Os -fpic -marm -march=armv5te -std=c99 -fomit-frame-pointer -fPIC -marm -pthread -c -o /tmp/ffconf.8Q9ke3aO.o /tmp/ffconf.zGKqGin6.c
/home/rango/Desktop/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc --sysroot=/home/rango/Desktop/android-ndk-r10e/platforms/android-19/arch-arm/ -isysroot /home/rango/Desktop/android-ndk-r10e/platforms/android-19/arch-arm/ -Wl,--as-needed -o /tmp/ffconf.3sjTkc5z /tmp/ffconf.8Q9ke3aO.o -lm -lz -pthread
check_lib x264.h x264_encoder_encode -lx264
check_header x264.h
check_cpp
BEGIN /tmp/ffconf.zGKqGin6.c
    1   #include <x264.h>
    2   int x;
END /tmp/ffconf.zGKqGin6.c
/home/rango/Desktop/android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc --sysroot=/home/rango/Desktop/android-ndk-r10e/platforms/android-19/arch-arm/ -isysroot /home/rango/Desktop/android-ndk-r10e/platforms/android-19/arch-arm/ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Dstrtod=avpriv_strtod -DPIC -Os -fpic -marm -march=armv5te -std=c99 -fomit-frame-pointer -fPIC -marm -pthread -E -o /tmp/ffconf.8Q9ke3aO.o /tmp/ffconf.zGKqGin6.c
/tmp/ffconf.zGKqGin6.c:1:18: fatal error: x264.h: No such file or directory
 #include <x264.h>
                  ^
compilation terminated.
ERROR: libx264 not found

解决方案

Theoretically to build FFmpeg for Android with libx264 support you need to go through these steps:

1) Build libx264 for Android. Now you haven't any built libx264, that's why you get above error.

2) Change your buid_android.sh and add additional options to configure (--extra-cflags and --extra-ldflags) to specify paths to include and lib directories of libx264 which was built on step 1.

3) Run modified build_android.sh.

Unfortunately, I haven't built libx264 for Android. But I assume that there're ways to do it...

这篇关于编译FFmpeg:找不到libx264的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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