Mac(Android)集成ffmpeg/x264:ERROR: libx264 not found的问题


x264的编译脚本内容为:

#!/bin/bash
NDK=/Users/xxx/Documents/tool/android-ndk-r13
#一定要注意设置的架构,要与后面编译ffmpeg的架构保持一致,否则ffmpeg找不到x264
PLATFORM=$NDK/platforms/android-18/arch-arm/
TOOLCHAIN=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64
PREFIX=/usr/local/x264

function build_one
{
  ./configure \
  --prefix=$PREFIX \
  --enable-static \
  --enable-pic \
  --host=arm-linux \
  --cross-prefix=$TOOLCHAIN/bin/arm-linux-androideabi- \
  --sysroot=$PLATFORM

  make clean
  make
  make install
}

build_one

echo Android ARM builds finished

ffmpeg的编译脚本为:

#!/usr/bin/env bash

export NDK=/Users/pingzhang/Documents/tool/android-ndk-r1
#这下面的架构要与x264的架构保持一致
export PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64 
export PLATFORM=$NDK/platforms/android-23/arch-arm  
export PREFIX=$NDK/sources/ffmpeg/android  
build_one(){  
./configure --target-os=linux \
    --extra-cflags="-fPIC -DANDROID -D__thumb__ -mthumb -Wfatal-errors -Wno-deprecated -mfloat-abi=softfp -marm -march=armv7-a" \
    #指定x264的安装路径
    --extra-cflags="-I/usr/local/x264/include" \
    --extra-ldflags="-L/usr/local/x264/lib" \
    --prefix=$PREFIX --enable-cross-compile \
	--enable-runtime-cpudetect --disable-asm \
	--arch=arm --cc=$PREBUILT/bin/arm-linux-androideabi-gcc \
	--cross-prefix=$PREBUILT/bin/arm-linux-androideabi \
	--disable-stripping --nm=$PREBUILT/bin/arm-linux-androideabi-nm \
	--sysroot=$PLATFORM --enable-gpl --enable-shared --disable-static \
	--enable-small --disable-ffprobe --disable-ffplay --disable-ffmpeg \
    --enable-gpl \
    --enable-libx264 \
    --extra-libs="-lgcc" \
	--disable-ffserver --disable-debug
}  
  
build_one  

make clean  
make  
make install


在配置的时候,要注意一下NDK的安装路径,替换成自己NDK的安装路径。

你可能感兴趣的:(Android移植)