|
| 1 | +## MRFFToolChain 构建脚本 |
| 2 | + |
| 3 | + <img src="https://img.shields.io/badge/Platform-%20iOS%20macOS%20tvOS%20Android-blue.svg"> <img src="https://img.shields.io/badge/FFmpeg-%207.1.1%20-28b463.svg"> <img src="https://img.shields.io/badge/FFmpeg-%206.1.1%20-138d75.svg"> <img src="https://img.shields.io/badge/FFmpeg-%205.1.6%20-17a589.svg"> <img src="https://img.shields.io/badge/FFmpeg-%204.0.5%20-1abc9c.svg"> |
| 4 | + |
| 5 | +**MRFFToolChain 是什么?** |
| 6 | + |
| 7 | +MRFFToolChain 的构建产物是为 [fsplayer](https://github.com/debugly/fsplayer) 、 [ijkplayer](https://github.com/debugly/ijkplayer) 、[FFmpegTutorial](https://github.com/debugly/FFmpegTutorial) 服务的. |
| 8 | + |
| 9 | +目前包含了这些库:`ass、bluray、dav1d、dvdread、dvdnav、ffmpeg、freetype、fribidi、harfbuzz、openssl、opus、unibreak、uavs3d、smb2、yuv、soundtouch、xml2`. |
| 10 | + |
| 11 | +## 支持的平台 |
| 12 | + |
| 13 | +| 平台 | 架构 | 最低部署目标版本 | |
| 14 | +| -------- | -------------------------------------- | ------------------------- | |
| 15 | +| iOS | arm64、arm64_simulator、x86_64_simulator | 11.0 | |
| 16 | +| tvOS | arm64、arm64_simulator、x86_64_simulator | 12.0 | |
| 17 | +| macOS | arm64、x86_64 | 10.11 | |
| 18 | +| Android | arm64、armv7a、x86_64、x86 | 21 | |
| 19 | + |
| 20 | +## 最新动态 |
| 21 | + |
| 22 | +- FFmpeg **7.1.1** 已投入使用 |
| 23 | +- 将所有库升级至最新版本,不少库提升了性能 |
| 24 | +- 使用 macOS 14,Xcode_15.4构建,移除了 bitcode 支持 |
| 25 | + |
| 26 | +[https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes#Deprecations](https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes#Deprecations) |
| 27 | + |
| 28 | +## 依赖关系 |
| 29 | + |
| 30 | +编译了适用于安卓和 iOS 平台的 FFmpeg4,FFmpeg5,FFmpeg6,FFmpeg7。 |
| 31 | + |
| 32 | +- Fontconfig:xml2、freetype |
| 33 | +- Bluray:xml2 |
| 34 | +- Harfbuzz:freetype |
| 35 | +- dvdnav:dvdread |
| 36 | +- 适用于苹果的 Ass:harfbuzz、fribidi、unibreak |
| 37 | +- 适用于安卓的 Ass:harfbuzz、fribidi、unibreak、fontconfig |
| 38 | +- 适用于苹果的 FFmpeg4:openssl3、opus、bluray |
| 39 | +- 适用于苹果的 FFmpeg5:openssl3、opus、bluray、dav1d、dvdread、uavs3d |
| 40 | +- 适用于苹果的 FFmpeg6:openssl3、opus、bluray、dav1d、dvdread、uavs3d、smb2 |
| 41 | +- 适用于苹果的 FFmpeg7:openssl3、opus、bluray、dav1d、dvdnav、uavs3d、smb2 |
| 42 | +- 适用于安卓的 FFmpeg4:openssl3、opus、bluray、soundtouch |
| 43 | +- 适用于安卓的 FFmpeg5:openssl3、opus、bluray、dav1d、dvdread、uavs3d、soundtouch |
| 44 | +- 适用于安卓的 FFmpeg6:openssl3、opus、bluray、dav1d、dvdread、uavs3d、smb2、soundtouch |
| 45 | +- 适用于安卓的 FFmpeg7:openssl3、opus、bluray、dav1d、dvdnav、uavs3d、smb2、soundtouch |
| 46 | + |
| 47 | +提示: |
| 48 | + |
| 49 | +``` |
| 50 | +1、ffmpeg 不依赖 ass |
| 51 | +2、fsplayer 依赖 ffmpeg 和 ass |
| 52 | +3、ijkplayer 依赖 ijkffmpeg |
| 53 | +4、FFmpegTutorial 依赖 fftutorial |
| 54 | +5、安装预编译库时,会包含其所有依赖项 |
| 55 | +``` |
| 56 | + |
| 57 | +## 下载 / 安装预编译库 |
| 58 | + |
| 59 | +直接从 GitHub 下载预编译库可以为您节省大量时间。 |
| 60 | + |
| 61 | +这些预编译库已经应用了 patches 目录下的补丁。 |
| 62 | + |
| 63 | +```bash |
| 64 | +# 先查看帮助 |
| 65 | +./main.sh install --help |
| 66 | +# 使用示例 |
| 67 | +./main.sh install -p macos -l ffmpeg |
| 68 | +./main.sh install -p ios -l 'ass ffmpeg' |
| 69 | +./main.sh install -p android -l openssl3 |
| 70 | +``` |
| 71 | + |
| 72 | +## 自行编译 |
| 73 | + |
| 74 | +### 初始化目标库仓库 |
| 75 | + |
| 76 | +除非您修改了源代码,否则不要浪费时间编译这些库! |
| 77 | +何不直接下载我通过 GitHub 动作准备好的预编译库呢? |
| 78 | +脚本参数灵活,可根据需要组合使用。以下是一些常见示例: |
| 79 | + |
| 80 | +``` |
| 81 | +# 先查看帮助 |
| 82 | +./main.sh init --help |
| 83 | +# 为 iOS 平台准备 libass 源代码 |
| 84 | +./main.sh init -p ios -l ass |
| 85 | +# 为 iOS 的 x86 架构准备 ffmpeg7 源代码 |
| 86 | +./main.sh init -p ios -l ffmpeg7 -a x86_64_simulator |
| 87 | +# 为 Android 平台准备特定库的源代码 |
| 88 | +./main.sh init -p android -l "openssl ffmpeg" |
| 89 | +``` |
| 90 | + |
| 91 | +### 编译 |
| 92 | + |
| 93 | +当源代码仓库初始化完成后,就可以开始编译了。 |
| 94 | + |
| 95 | +``` |
| 96 | +# 先查看帮助 |
| 97 | +./main.sh compile --help |
| 98 | +# 如帮助所示: |
| 99 | +# -p 指定平台 |
| 100 | +# -c 指定操作(例如 build 用于编译,rebuild 用于重新编译) |
| 101 | +# -l 指定要编译的库 |
| 102 | +# -a 指定 CPU 架构 |
| 103 | +``` |
| 104 | + |
| 105 | +以下代码演示如何为 iOS 平台编译 FFmpeg 7: |
| 106 | + |
| 107 | +``` |
| 108 | +# 安装 FFmpeg7 的依赖有两种选择 |
| 109 | +# 推荐选择安装预编译方式(因为预编译的 FFmpeg7 已经包含所有依赖项) |
| 110 | +./main.sh install -p ios -l ffmpeg7 |
| 111 | +# 另外一个选择,自己选择性地安装 FFmpeg7 的依赖库 |
| 112 | +./main.sh install -p ios -l "openssl3 opus bluray dav1d dvdnav uavs3d smb2" |
| 113 | +# 编译 iOS 平台 arm64 架构的 FFmpeg7,并且跳过生成 xcframework |
| 114 | +./main.sh compile -p ios -a arm64 -l ffmepg7 --skip-fmwk |
| 115 | +``` |
| 116 | + |
| 117 | +这些参数的顺序无关紧要,可以按任意顺序排列。 |
| 118 | + |
| 119 | +### 支持镜像 |
| 120 | + |
| 121 | +如果从 GitHub 克隆仓库速度较慢,或者需要使用内部私有仓库,可以在运行编译脚本之前声明相应的环境变量! |
| 122 | + |
| 123 | +| 库名称 | 当前版本 | 仓库 URL | 镜像仓库 URL | |
| 124 | +| --------------- |----------- | ----------- | ------------ | |
| 125 | +| ffmpeg7 | 7.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | |
| 126 | +| ffmpeg6 | 6.1.1 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | |
| 127 | +| ffmpeg5 | 5.1.6 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | |
| 128 | +| ffmpeg4 | 4.0.5 | https://github.com/FFmpeg/FFmpeg.git | export GIT_FFMPEG_UPSTREAM=git@xx:yy/FFmpeg.git | |
| 129 | +| ass | 0.17.3 | https://github.com/libass/libass.git | export GIT_ASS_UPSTREAM=git@xx:yy/libass.git | |
| 130 | +| bluray | 1.3.4 | https://code.videolan.org/videolan/libbluray.git | export GIT_BLURAY_UPSTREAM=git@xx:yy/libbluray.git | |
| 131 | +| dav1d | 1.5.1 | https://code.videolan.org/videolan/dav1d.git | export GIT_DAV1D_UPSTREAM=git@xx:yy/dav1d.git | |
| 132 | +| dvdread | 6.1.3 | https://code.videolan.org/videolan/libdvdread.git | export GIT_DVDREAD_UPSTREAM=git@xx:yy/libdvdread.git | |
| 133 | +| dvdnav | master-9831fe01 | https://code.videolan.org/videolan/libdvdnav.git | export GIT_DVDNAV_UPSTREAM=git@xx:yy/libdvdnav.git | |
| 134 | +| fontconfig | 2.16.0 | https://gitlab.freedesktop.org/fontconfig/fontconfig.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | |
| 135 | +| freetype | 2.13.3 | https://gitlab.freedesktop.org/freetype/freetype.git | export GIT_FREETYPE_UPSTREAM=git@xx:yy/freetype.git | |
| 136 | +| fribidi | 1.0.16 | https://github.com/fribidi/fribidi.git | export GIT_FRIBIDI_UPSTREAM=git@xx:yy/fribidi.git | |
| 137 | +| harfbuzz | 10.2.0 | https://github.com/harfbuzz/harfbuzz.git | export GIT_HARFBUZZ_UPSTREAM=git@xx:yy/harfbuzz.git | |
| 138 | +| openssl | 1.1.1w | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | |
| 139 | +| openssl3 | 3.5.0 | https://github.com/openssl/openssl.git | export GIT_OPENSSL_UPSTREAM=git@xx:yy/openssl.git | |
| 140 | +| opus | 1.5.2 | https://gitlab.xiph.org/xiph/opus.git | export GIT_OPUS_UPSTREAM=git@xx:yy/opus.git | |
| 141 | +| smb2 | 6.2 | https://github.com/sahlberg/libsmb2.git | export GIT_SMB2_UPSTREAM=git@xx:yy/libsmb2.git | |
| 142 | +| soundtouch | 2.3.3 | https://codeberg.org/soundtouch/soundtouch.git | export GIT_SOUNDTOUCH_UPSTREAM=git@xx:yy/soundtouch.git | |
| 143 | +| unibreak | 6.1 | https://github.com/adah1972/libunibreak.git | export GIT_UNIBREAK_UPSTREAM=git@xx:yy/libunibreak.git | |
| 144 | +| uavs3d | 1.2.1 | https://github.com/uavs3/uavs3d.git | export GIT_UAVS3D_UPSTREAM=git@xx:yy/UAVS3D.git | |
| 145 | +| xml2 | 2.13.6 | https://github.com/GNOME/libxml2.git | export GIT_FONTCONFIG_UPSTREAM=git@xx:yy/fontconfig.git | |
| 146 | +| yuv | stable-eb6e7bb | https://github.com/debugly/libyuv.git | export GIT_YUV_UPSTREAM=git@xx:yy/yuv.git | |
| 147 | + |
| 148 | +## 提示 |
| 149 | + |
| 150 | +- 要下载预编译的 xcframework 库,使用 install 命令时添加 --fmwk 参数 |
| 151 | +- 初始化时要跳过拉取远程仓库,使用 init 命令时添加 --skip-pull-base 参数 |
| 152 | +- 初始化时要跳过应用 FFmpeg 补丁,使用 init 命令时添加 --skip-patches 参数 |
| 153 | +- 目前 FFmpeg 使用 module-full.sh 配置,功能全但同时导致包体积略大 |
| 154 | +- 您可以将所有预编译的 GitHub 库下载到自己的服务器,并在运行 install 命令前通过 MR\_DOWNLOAD\_BASEURL 指定您的服务器地址 |
| 155 | + |
| 156 | +## 捐赠 |
| 157 | + |
| 158 | +编译第三方库非常耗时,我将 debugly/fsplayer 所需的所有第三方库预编译为静态库供公众使用,希望为开源社区贡献微薄之力。 |
| 159 | + |
| 160 | +如果屏幕前的你也想为开源社区贡献一份力量,不妨请我喝杯咖啡提提神儿。 |
| 161 | + |
| 162 | + |
0 commit comments