ijkplayer编译
程序员文章站
2022-07-01 20:31:34
...
安装homebrew、git、yasm
# install homebrew, git, yasm
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install git
brew install yasm
根据自己需要,进行如下设置
If you prefer more codec/format
cd config
rm module.sh
ln -s module-default.sh module.sh
cd android/contrib
# cd ios
sh compile-ffmpeg.sh clean
If you prefer less codec/format for smaller binary size (include hevc function)
cd config
rm module.sh
ln -s module-lite-hevc.sh module.sh
cd android/contrib
# cd ios
sh compile-ffmpeg.sh clean
If you prefer less codec/format for smaller binary size (by default)
cd config
rm module.sh
ln -s module-lite.sh module.sh
cd android/contrib
# cd ios
sh compile-ffmpeg.sh clean
编译
git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-android
cd ijkplayer-android
git checkout -B latest k0.8.4
./init-android.sh
cd android/contrib
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all
cd ..
./compile-ijk.sh all
执行到:
./compile-ffmpeg.sh all
报错:
ANDROID_NDK=
You must define ANDROID_NDK before starting.
They must point to your NDK directories.
解决办法:
1. open .bash_profile
2. 添加:export ANDROID_NDK=你的NDK路径
3. 保存文件
4. source .bash_profile
然后重新执行:
./compile-ffmpeg.sh all
继续报错:
build on Darwin x86_64
ANDROID_NDK=/Users/xxx/Library/Android/sdk/ndk-bundle
IJK_NDK_REL=16.0.4442984
You need the NDKr10e or later
原因是我们的NDK版本太高,还不支持。
解决办法:
1.下载低版本ndk,NDK下载
2.下载版本号14的android-ndk-r14b-darwin-x86_64.zip
3.重新设置ANDROID_NDK为新下载的NDK路径
然后编译成功,我们就可以使用编译好的android目录下的ijkplayer了。
下一篇: 网络术语汇总