用于 Apple Silicon 的 FFmpeg 包

gil*_*_mo 6 macos ffmpeg build

我正在将我们所有的代码移植到 Apple M1 (ARM),我们的一些产品使用 FFmpeg。FFmpeg 是否有任何为 Apple Silicon M1 构建的库包,我在哪里可以找到它们?

小智 8

您可以自己为 Apple Silicon 编译 ffmpeg。为此,您需要 Xcode,它附带了所有必要的工具。

您可以从 App StoreApple 网站下载 Xcode ,或者安装xcode-select --install在终端应用程序上运行的 Xcode 命令行工具。

获得 Xcode 后,您需要打开一次以接受条款并设置所有内容。系统会要求您输入计算机密码。

设置 Xcode 后,以普通用户身份在终端应用程序上按顺序执行以下命令(不需要也不建议使用 root 权限)。以 开头的行#是注释,您不应在终端上执行它们。

# Create and go to a folder where you'll save the ffmpeg source code
mkdir -p /opt/local/src
cd /opt/local/src

# get the ffmpeg source code from the official source
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg

# set up build and begin to compile
./configure --prefix=/opt/local
make
make install

# check that your compiled version of ffmpeg has arm64 (Apple Silicon) architecture
/opt/local/bin/ffmpeg -version
Run Code Online (Sandbox Code Playgroud)