ERROR: libfaac not found while compiling FFMPEG library

ERROR: libfaac not found while compiling FFMPEG library

我试图在 ubuntu 下为 android 编译 FFMPEG 库,包括所有可能的编解码器。 我遵循了本教程 http://www.roman10.net/2013/08/18/how-to-build-ffmpeg-with-ndk-r9/。 但是当我执行 ./build_android.sh 它给了我这个错误:

root@AK-74:/home/rango/Desktop/android-ndk-r10e/sources/ffmpeg-3.0# ./build_android.sh ERROR: libfaac 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 solve the problem.

这是我的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

function build_one
{
./configure \
    --prefix=$PREFIX \
    --enable-shared \
    --disable-static \
    --disable-doc \
    --disable-ffmpeg \
    --disable-ffplay \
    --disable-ffprobe \
    --disable-ffserver \
    --disable-avdevice \
    --disable-doc \
    --disable-symver \
    --enable-gpl \
    --enable-version3 \
    --enable-nonfree \
    --enable-shared \
    --enable-libopencore-amrnb \
    --enable-libopencore-amrwb \
    --enable-libfaac \
    --enable-libgsm \
    --enable-libmp3lame \
    --enable-libtheora \
    --enable-libvorbis \
    --enable-libx264 \
    --enable-libxvid \
    --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 -j4
make install
}

CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm"

build_one

libfaac sucks。删除 --enable-libfaac--enable-nonfree。您可以改用本机 FFmpeg AAC 编码器,并且不需要额外的外部库即可使用它。

我终于让它工作了。问题是它找不到库的位置。 我输入了这个命令:locate libfaac。从输出中我意识到它在“/usr/lib/i386-linux-gnu/”下:

/usr/lib/i386-linux-gnu/libfaac.a

/usr/lib/i386-linux-gnu/libfaac.so

/usr/lib/i386-linux-gnu/libfaac.so.0

/usr/lib/i386-linux-gnu/libfaac.so.0.0.0

所以我接下来要做的是将这一行添加到“./build_android.sh”以告诉它看那里:

--extra-ldflags=-L/usr/lib/i386-linux-gnu/

所以脚本变成:

#!/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

function build_one
{
echo $PREFIX
./configure \
--prefix=$PREFIX \
--enable-shared \
--disable-static \
--disable-doc \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-ffserver \
--disable-avdevice \
--disable-doc \
--enable-nonfree \
--disable-symver \
--enable-gpl \
--enable-version3 \
--enable-shared \
--enable-libmp3lame \
--enable-libopencore-amrnb \
--enable-libopencore-amrwb \
--enable-libtheora \
--enable-libvorbis \
--enable-libx264 \
--enable-libxvid \
--enable-libgsm \
--enable-libfaac \
--extra-ldflags=-L/usr/lib/i386-linux-gnu/
--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 -j4
make install
}

CPU=arm
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-marm"

build_one

从 link 下面安装 faac-1.26-1.el6.rf.x86_64.rpm 和 faac-devel-1.26-1.el6.rf.x86_64.rpm .

http://pkgs.repoforge.org/faac/

安装 libfdk-aac-dev 以解决此错误

apt install libfdk-aac-dev