环境
macos 10.15.5
mac自带终端即可。
步骤
- mac上需要先安装homebrew
执行下面的命令,然后选择一个你看的顺眼的源就好了。
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
- 参考这篇ffmpeg安装指南,
首先创建一个你想要存储ffmpeg源码的文件夹,下载源码:
git clone https://git.ffmpeg.org/ffmpeg.git
- 配置configure,下面是指南里没有提到但是我遇到的问题
(1) ERROR: speex not found using pkg-config
解决方法则参考了这个,和这个作为指南貌似更称职。
就是安装speex & pkg-config:
brew install speex
brew install pkg-config
还有一个可能冗余的path配置:
# pkgconfig
export PKG_CONFIG_PATH=/usr/local/pkgconfig:/usr/local/lib/pkgconfig:/usr/share/pkgconfig:/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig
export PATH="$PKG_CONFIG_PATH:$PATH"
以及:
(2) libx264 not found
(3) x265 not found using pkg-config
安装x264 & x265就好了:
brew install x264
brew install x265
配置项就搞定了。
- 正式安装
make && make install
或者发现有各种权限问题啥的,加上sudo:
sudo make && sudo make install
可以运行以下命令查看能不能正常返回version:
/usr/local/ffmpeg/bin/ffmpeg -version
- 最后一步啦,配置环境变量:
export PATH=$PATH:/usr/local/ffmpeg/bin
记得source你的配置文件。
网友评论