编译 x264 for iOS

文章目录


环境 :

macOS 14.3.1

x264 - 20191217-2245


编译

1、下载 x264 源码

http://download.videolan.org/pub/videolan/x264/snapshots/

这里我下载x264-snapshot-20191217-2245.tar.bz2 (截止2024-05-04最新)

解压后,将文件夹命名为 x264 (编译脚本写死这个地址)


2、下载 x264 编译脚本
https://github.com/kewlbear/x264-ios

将脚本和源码 x264 放在同一级目录


3、编译 x264

这里我将脚本中的 ARCHS 选项只保留 arm64 x86_64,然后执行

shell 复制代码
./build-x264.sh

编译完将生成 x264-iOS 文件夹

shell 复制代码
% cd /Users/shushu/Downloads/x264/x264-iOS 
% tree
.
├── include
│   ├── x264.h
│   └── x264_config.h
└── lib
    └── libx264.a

在 FFMpeg 启用 x264


修改 ffmpeg 编译脚本

对于 <目前大家都是用这份脚本

https://github.com/kewlbear/FFmpeg-iOS-build-script\> 的 ./build-ffmpeg.sh 文件

1、17 行的注释打开

sh 复制代码
X264=`pwd`/fat-x264

在 脚本同一级目录,新建文件夹命名为 fat-x264,将 x264 编译出来的 x264-iOS 文件夹下的 lib 复制到 fat-x264 下。
x264-iOS保持还不懂,后续会拖放到 iOS 工程中。


2、将 104行的 -fembed-bitcode 去掉

sh 复制代码
CFLAGS="$CFLAGS -mios-version-min=$DEPLOYMENT_TARGET -fembed-bitcode"

修改为

sh 复制代码
CFLAGS="$CFLAGS -mios-version-min=$DEPLOYMENT_TARGET"

其他编译选项


  • To build everything:
shell 复制代码
./build-x264.sh

  • To build for arm64:
shell 复制代码
./build-x264.sh arm64

  • To build fat library for armv7 and x86_64 (64-bit simulator):
shell 复制代码
./build-x264.sh armv7 x86_64

  • To build fat library from separately built thin libraries:
shell 复制代码
./build-x264.sh lipo

  • Library and Header Files are in ./x264-iOS

报错处理

shellsh 复制代码
building x86_64...
Found no assembler
Minimum version is nasm-2.13
If you really want to compile without asm, configure with --disable-asm.

CONFIGURE_FLAGS 键添加选项 --disable-asm

不知道这个 未来是否会用上,先这么做


sh 复制代码
brew upgrade nasm 

伊织 2024-05-04(六)

要上班了,是否焦虑?

相关推荐
CHB11 小时前
uni-app x 蒸汽模式 性能测试基准报告 Benchmark【Android版】
android·ios·uni-app
Magic-ZYJ13 小时前
不登录、不联网也能用:我是如何设计一款“本地优先”iOS App 的
ios·app·iphone·研发·独立开发者·心情日记
_阿南_14 小时前
flutter 展示的字体突然奔放了
android·flutter·ios
90后的晨仔18 小时前
你的 iOS 最低部署版本即将不再被 App Store 接受
ios
程序员老陆21 小时前
FFmpeg libswresample 模块的关键函数swr_convert 到底在干嘛?
ffmpeg·音视频·格式转换·音频重采样
海兰21 小时前
ffmpeg-wasm 完整安装指南(Ubuntu 24.04)
ubuntu·ffmpeg·wasm
2601_9657984721 小时前
Launch Your Wellness App Fast: The Truth About Meditation Source Code
前端·macos·ios·objective-c·cocoa
初级代码游戏1 天前
iOS开发 Swift 速记7:结构体和类
开发语言·ios·swift
Anhty2 天前
手机端叮咚变声器2026实测:功能表现、优缺点完整解析
功能测试·ios·智能手机·安卓
SameX2 天前
后台定位耗电的问题,我花两年把它压到了3%-5%
ios