https://github.com/bilibili/ijkplayer
默认ndk10
https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip
编译前环境配置
# install homebrew, git, yasm
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install git
brew install yasm
# add these lines to your ~/.bash_profile or ~/.profile
# export ANDROID_SDK=<your sdk path>
# export ANDROID_NDK=<your ndk path>
# on Cygwin (unmaintained)
# install git, make, yasm
#使修改的配置文件生效
source ~/.profile
更多的编解码器/格式
cd config
rm module.sh
ln -s module-default.sh module.sh
cd android/contrib
# cd ios
sh compile-ffmpeg.sh clean
支持rtsp可以添加 (参考 ijkplayer编译-RTSP)
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-linux-perf"
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bzlib”
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=rtp"
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=rtsp"
更少的编解码器/格式较小的二进制大小(包括hevc函数)
cd config
rm module.sh
ln -s module-lite-hevc.sh module.sh
cd android/contrib
# cd ios
sh compile-ffmpeg.sh clean
更少的编解码器/格式,以较小的二进制大小(默认情况下)
cd config
rm module.sh
ln -s module-lite.sh module.sh
cd android/contrib
# cd ios
sh compile-ffmpeg.sh clean
对于Ubuntu/Debian用户。
# choose [No] to use bash
sudo dpkg-reconfigure dash
初始化
按照官方文档编译 首先修改部分文件
注意修改 : (./init-android.sh 等超时问题)
执行./init-android.sh前先修改
以下文件的 Bilibili -> 改为bilibili
init-android.sh
init-android-openssl.sh
init-android-libyuv.sh
init-android-soundtouch.sh
init-android.sh修改 ijkplayer 依赖的 FFmpeg 的版本(改成 4.0 版本)
参考:https://github.com/alanwang4523/ijkplayer_Build4Android
改成4.0会出现 Unknown option "--disable-ffserver". (4.0删了ffserver)
解决:https://github.com/bilibili/ijkplayer/issues/4690
将config/module.sh中的export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-vda" 和 export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-ffserver"注释了就可以了版本列表:
https://github.com/bilibili/FFmpeg/tags
https://github.com/bilibili/openssl/tags
#IJK_FFMPEG_COMMIT=ff3.4--ijk0.8.7--20180103--001
IJK_FFMPEG_COMMIT=ff4.0--ijk0.8.8--20210426--001
开始初始化
# 下载指定的 ffmpeg 源码 ff4.0--ijk0.8.8--20210426--001
./init-android.sh
# 下载 openssl 源码,用于支持 https
# 最新OpenSSL_1_0_2u
./init-android-openssl.sh
./init-android-openssl.sh: 第 35 行: cd: android/contrib/openssl-arm64: 没有那个文件或目录 ()
ijkplayer-android/android/contrib 目录下
参照compile-ffmpeg.sh 给 compile-openssl.sh 添加 FF_TARGET_EXTRA=$2
开始编译
# 在项目根目录下
android/contrib
# 编译 openssl
./compile-openssl.sh clean
./compile-openssl.sh all
# 编译 FFmpeg
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all
# 编译 ijkplayer
cd ..
./compile-ijk.sh all
ijkmedia/ijksoundtouch: 没有那个文件或目录
或fatal error: ijksoundtouch/ijksoundtouch_wrap.h: No such file or directory
检查是jkplayer/ijkmedia/ijkplayer/ff_ffplay.c中引入了#include "ijksoundtouch/ijksoundtouch_wrap.h",但是工程中没有这个文件。
https://github.com/bilibili/ijkplayer/issues/5219
参考:https://blog.csdn.net/shulianghan/article/details/123618604
#执行
./init-android-soundtouch.sh
官方文档 ↓↓↓
git clone https://github.com/Bilibili/ijkplayer.git ijkplayer-android
cd ijkplayer-android
git checkout -B latest k0.8.8
./init-android.sh
cd android/contrib
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all
cd ..
./compile-ijk.sh all
# Android Studio:
# Open an existing Android Studio project
# Select android/ijkplayer/ and import
#
# define ext block in your root build.gradle
# ext {
# compileSdkVersion = 23 // depending on your sdk version
# buildToolsVersion = "23.0.0" // depending on your build tools version
#
# targetSdkVersion = 23 // depending on your sdk version
# }
#
# If you want to enable debugging ijkplayer(native modules) on Android Studio 2.2+: (experimental)
# sh android/patch-debugging-with-lldb.sh armv7a
# Install Android Studio 2.2(+)
# Preference -> Android SDK -> SDK Tools
# Select (LLDB, NDK, Android SDK Build-tools,Cmake) and install
# Open an existing Android Studio project
# Select android/ijkplayer
# Sync Project with Gradle Files
# Run -> Edit Configurations -> Debugger -> Symbol Directories
# Add "ijkplayer-armv7a/.externalNativeBuild/ndkBuild/release/obj/local/armeabi-v7a" to Symbol Directories
# Run -> Debug 'ijkplayer-example'
# if you want to reverse patches:
# sh patch-debugging-with-lldb.sh reverse armv7a
#
# Eclipse: (obselete)
# File -> New -> Project -> Android Project from Existing Code
# Select android/ and import all project
# Import appcompat-v7
# Import preference-v7
#
# Gradle
# cd ijkplayer
# gradle
编译完成
ijkplayer-android/android/contrib/build目录下
对应每个目录下 output目录
标签:ijkplayer,--,cd,编译,sh,FF,android From: https://www.cnblogs.com/Jieth/p/17396057.html