基本参照官方说明,这里简单记录一下过程。
# install homebrew, git, yasm
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install git
brew install yasm
Pkg.Desc = Android NDK
Pkg.Revision = 14.0.3770861
r14版本那就用这个吧
在你的环境变量里面加入路径
# add these lines to your ~/.bash_profile or ~/.profile
# export ANDROID_SDK=<your sdk path>
# export ANDROID_NDK=<your ndk path>
vi .bash_profile
export ANDROID_SDK=/Users/jerrypxiao/Library/Android/sdk
export ANDROID_NDK=/Users/jerrypxiao/Library/Android/sdk/ndk-bundle
export ANDROID_NDK_HOME=/Users/jerrypxiao/Library/Android/sdk/ndk-bundle
export PATH=$PATH:$ANDROID_SDK:$adb_path:$ANDROID_NDK
编辑好了保存,生效用下面命令,这里针对的当前窗口的上下文
source .bash_profile
支持更多的编码可以选择
cd config
rm module.sh
ln -s module-default.sh module.sh
cd android/contrib
# cd ios
sh compile-ffmpeg.sh clean
这里删掉了module.sh, 用module-default.sh 给他建立了一个软链接 看下这个文件, 发现并没有相关的解码器指定,原来默认是开启所有的解码器:参考ffmpeg官方说明 来一个中文的地址:ffmpeg 翻译文档(ffmpeg中文文档)
[10 Decoders](http://ffmpeg.org/ffmpeg-all.html#toc-Decoders)
Decoders are configured elements in FFmpeg which allow the decoding of multimedia streams.
When you configure your FFmpeg build, all the supported native decoders are enabled by default.
Decoders requiring an external library must be enabled manually via the corresponding `--enable-lib` option. You can list all available decoders using the configure option `--list-decoders`.
You can disable all the decoders with the configure option `--disable-decoders` and selectively enable / disable single decoders with the options `--enable-decoder=<var style="box-sizing: border-box;">DECODER</var>` / `--disable-decoder=<var style="box-sizing: border-box;">DECODER</var>`.
The option `-decoders` of the ff* tools will display the list of enabled decoders.
翻译一下:
默认在编译FFmpeg时所有(内置)有效的解码器都会自动支持。
如果解码器需要特别扩展库,则需要手动通过--enable-lib选项来进行支持。
可以在配置编译项目中通过--list-decoders了解所有有效解码器(包括需要扩展库的)。
问题又来了,那么ffmpeg默认支持哪些解码器呢? 下载了ffmpeg的库之后,可以通过./configure –list-decoders命令来进行查看:(太多了,截取了部分,可以自行运行命令)
查看支持解码器
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
编译0.8.8版本的ijk,出现了linux/perf_event.h: No such file or directory
在moule.sh文件加入如下两句即可:
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-linux-perf"
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --disable-bzlib"
then
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all
当前目录下编译出来的结果 ├── build-on-travis.sh ├── compile-ijk.sh ├── contrib ├── ijk-addr2line.sh ├── ijk-ndk-stack.sh ├── ijkplayer ├── patch-debugging-with-lldb.sh └── patches
存放在ijkplayer目录里面
├── build.gradle ├── gradle ├── gradle.properties ├── gradlew ├── gradlew.bat ├── ijkplayer-arm64 ├── ijkplayer-armv5 ├── ijkplayer-armv7a ├── ijkplayer-example ├── ijkplayer-exo ├── ijkplayer-java ├── ijkplayer-x86 ├── ijkplayer-x86_64 ├── settings.gradle └── tools
编译IOS的参考 https://github.com/hupfei/MAC-ijkplayer
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。