Android – how to solve “error: libx264 not found”?
I need to install ffmpeg and support libx264 to enable H.264 encoding. I successfully installed libx264 using the tool chain provided in android-ndk-r9d and the following script
#!/bin/bash
NDK=~/android-ndk-r9d
SYSROOT=$NDK/platforms/android-8/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64
function build_one
{
./configure \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--sysroot="$SYSROOT" \
--host=arm-linux \
--enable-pic \
--enable-shared \
--disable-cli
make clean
make
make install
}
build_one
Now I want to build ffmpeg with libx264 support. I use the following scripts in the following scripts – enable libx264, – enable nonfree, – enable GPL options
#!/bin/bash
NDK=~/android-ndk-r9d
SYSROOT=$NDK/platforms/android-8/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64
function build_one
{
./configure \
--prefix=$PREFIX \
--enable-shared \
--enable-nonfree \
--enable-gpl \
--enable-libx264 \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-avdevice \
--disable-doc \
--disable-symver \
--cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
--target-os=linux \
--arch=arm \
--enable-cross-compile \
--sysroot=$SYSROOT \
--extra-cflags="-Os -fpic $ADDI_CFLAGS" \
--extra-ldflags="$ADDI_LDFLAGS" \
$ADDITIONAL_CONfigURE_FLAG
make clean
make
make install
}
cpu=arm
PREFIX=$(pwd)/android/$cpu
ADDI_CFLAGS="-marm"
build_one
But when I run the script, I get the error "error: libx264 not found"
I don't think ffmpeg can figure out the installation location of libx264. After installing libx264, I have libx264.so file in / usr / local / lib executable file in / usr / local / bin and header file in / usr / local / include directory
I need to make all the changes to the ffmpeg build script to make it detect libx264?
Note: I use Ubuntu 12.04 (64 bit) for cross compilation
resolvent:
Make sure your $addi_ The cflags variable (you pass in – extra cflags) contains - I / usr / local / include