本文记录mac m1电脑上手动编译FFmpeg6.0的踩坑问题
参考官方文档:https://trac.ffmpeg.org/wiki/CompilationGuide/macOS
版本信息
名称 | 版本 |
---|---|
macOS | 13.4 |
芯片 | Apple M1 |
FFmpeg | 6.0 |
下载FFmpeg源码
git clone
cd FFmpeg
git checkout origin/release/6.0
安装依赖
基本覆盖了所需的安装依赖,如果在配置编译信息时报错请参考 问题汇总
brew install automake fdk-aac git lame libass libtool libvorbis libvpx
opus sdl shtool texi2html wget x264 x265 nasm
libbluray dav1d libgsm libmodplug opencore-amr openh264 openjpeg rubberband
snappy libsoxr speex theora two-lame libvidstab xvid zimg zmq
配置编译信息
./configure
--cc=/usr/bin/clang
--prefix=/Users/kejie/code/ffmpeg
--extra-version=tessus
--enable-avisynth
--enable-fontconfig
--enable-gpl
--enable-libaom
--enable-libass
--enable-libbluray
--enable-libdav1d
--enable-libfreetype
--enable-libgsm
--enable-libmodplug
--enable-libmp3lame
--enable-libmysofa
--enable-libopencore-amrnb
--enable-libopencore-amrwb
--enable-libopenh264
--enable-libopenjpeg
--enable-libopus
--enable-librubberband
--enable-libshine
--enable-libsnappy
--enable-libsoxr
--enable-libspeex
--enable-libtheora
--enable-libtwolame
--enable-libvidstab
--enable-libvmaf
--enable-libvo-amrwbenc
--enable-libvorbis
--enable-libvpx
--enable-libwebp
--enable-libx264
--enable-libx265
--enable-libxavs
--enable-libxvid
--enable-libzimg
--enable-libzmq
--enable-libzvbi
--enable-version3
--pkg-config-flags=--static
--disable-ffplay
--extra-cflags="-I/opt/homebrew/Cellar/libgsm/1.0.22/include"
--extra-ldflags="-L/opt/homebrew/Cellar/libgsm/1.0.22/lib"
--extra-cflags="-I/opt/homebrew/Cellar/lame/3.100/include"
--extra-ldflags="-L/opt/homebrew/Cellar/lame/3.100/lib"
--extra-cflags="-I/opt/homebrew/Cellar/opencore-amr/0.1.6/include"
--extra-ldflags="-L/opt/homebrew/Cellar/opencore-amr/0.1.6/lib"
--extra-cflags="-I/opt/homebrew/Cellar/snappy/1.1.10/include"
--extra-ldflags="-L/opt/homebrew/Cellar/snappy/1.1.10/lib"
--extra-cflags="-I/opt/homebrew/Cellar/libsoxr/0.1.3/include"
--extra-ldflags="-L/opt/homebrew/Cellar/libsoxr/0.1.3/lib"
--extra-cflags="-I/opt/homebrew/Cellar/theora/1.1.1/include"
--extra-ldflags="-L/opt/homebrew/Cellar/theora/1.1.1/lib"
--extra-cflags="-I/opt/homebrew/Cellar/libogg/1.3.5/include"
--extra-ldflags="-L/opt/homebrew/Cellar/libogg/1.3.5/lib"
--extra-cflags="-I/opt/homebrew/Cellar/two-lame/0.4.0/include"
--extra-ldflags="-L/opt/homebrew/Cellar/two-lame/0.4.0/lib"
--extra-cflags="-I/opt/homebrew/Cellar/xvid/1.3.7/include"
--extra-ldflags="-L/opt/homebrew/Cellar/xvid/1.3.7/lib"
make
# 启动make具有等于系统上最大逻辑 CPU 数量的并行作业的进程,加快编译速度。
make -j `sysctl -n hw.logicalcpu_max`
make install
问题汇总
1、ERROR: avisynth/avisynth_c.h avisynth/avs/version.h not found
解决方法:
mac安装 https://github.com/AviSynth/AviSynthPlus/releases
2、找不到ERROR: libbluray not found using pkg-config
brew install libbluray
3、ERROR: dav1d >= 0.5.0 not found using pkg-config
brew install dav1d
4、ERROR: libgsm not found
brew install libgsm
5、ERROR: libmodplug not found using pkg-config
brew install libmodplug
6、ERROR: libmysofa not found
git clone
cd ./libmysofa/build
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=OFF -DBUILD_TESTS=OFF ..
make && make insall
7、ERROR: libopencore_amrnb not found
brew install opencore-amr
8、ERROR: openh264 not found using pkg-config
brew install openh264
9、ERROR: libopenjp2 >= 2.1.0 not found using pkg-config
brew install openjpeg
10、ERROR: rubberband >= 1.8.1 not found using pkg-config
brew install rubberband
11、ERROR: shine not found using pkg-config
git clone
cd ./shine
./bootstrap
./configure --prefix=/usr/local --disable-shared
make && make install
12、ERROR: libsnappy not found
brew install snappy
13、ERROR: libsoxr not found
brew install libsoxr
14、ERROR: speex not found using pkg-config
brew install speex
15、ERROR: libtheora not found
brew install theora
16、/opt/homebrew/Cellar/theora/1.1.1/include/theora/theoraenc.h:24:11: fatal error: ‘ogg/ogg.h’ file not found
# 增加 flags
# 先查找ogg.h文件存放在哪里
find /opt -name "ogg.h"
.....
--extra-cflags="-I/opt/homebrew/Cellar/libogg/1.3.5/include"
--extra-ldflags="-L/opt/homebrew/Cellar/libogg/1.3.5/lib"
17、ERROR: libtwolame not found
brew install two-lame
18、ERROR: vidstab >= 0.98 not found using pkg-config
brew install libvidstab
19、ERROR: libvo_amrwbenc not found
# 下载opencore-amr 库
#
wget
tar -zxf vo-amrwbenc-0.1.3.tar.gz
./configure --prefix=/usr/local --disable-shared
make && make install
20、ERROR: libxavs not found
# 下载源码
wget
unzip xavs-code-r55-trunk.zip
cd ./xavs-code-r55-trunk
# !! 注意mac的架构
# ./configure --prefix=/usr/local --host=x86_64-darwin --disable-asm
./configure --prefix=/usr/local --host=arm-darwin --disable-asm
make && make install
# ------------ 分割线-----------------
# 如果 第一次执行错误的./configure 并且make生成了错误的文件, 需要下面操作
make clean
# 然后再执行
make && make install
21、ERROR: libxvid not found
brew install xvid
22、ERROR: zimg >= 2.7.0 not found using pkg-config
brew install zimg
23、ERROR: libzmq >= 4.2.1 not found using pkg-config
brew install zmq
24、ERROR: zvbi-0.2 not found using pkg-config
# 源码地址
wget
tar -jxf zvbi-0.2.35.tar.bz2
./configure --prefix=/usr/local --disable-shared
make && make install
服务器托管,北京服务器托管,服务器租用 http://www.fwqtg.net
痞子衡嵌入式半月刊: 第 80 期 这里分享嵌入式领域有用有趣的项目/工具以及一些热点新闻,农历年分二十四节气,希望在每个交节之日准时发布一期。 本期刊是开源项目(GitHub: JayHeng/pzh-mcu-bi-weekly),欢迎提交 issue,投稿…