25

Mac系统搭建FFmpeg环境并生成静态文件库

 5 years ago
source link: http://www.coderqi.com/2019/02/12/00009_FFmpegenviromentconstruct/?amp%3Butm_medium=referral
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

目前客户端对于视频的深度编辑处理,无论是视频编辑还是流媒体播放,基本都是采用的FFmpeg来进行。

FFmpeg是一个开源免费跨平台的视频和音频流方案,属于自由软件,采用LGPL或GPL许可证(依据你选择的组件)。它提供了录制、转换以及流化音视频的完整解决方案。它包含了非常先进的音频/视频编解码库libavcodec,为了保证高可移植性和编解码质量,libavcodec里很多codec都是从头开发的。

FFmpeg的名称来自MPEG视频编码标准,前面的“FF”代表“Fast Forward”,FFmpeg是一套可以用来记录、转换数字音频、视频,并能将其转化为流的开源计算机程序。可以轻易地实现多种视频格式之间的相互转换。

MAC安装FFmpeg环境

1 安装homebrew

如果已安装,可以跳过此步骤。

homebrew类似maven和cocoapods,是一个安装包管理工具,方便MAC用户对于软件包的安装。

安装方式:终端输入下列指令

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install )”

2 安装FFmpeg

终端输入下列指令

brew install ffmpeg

安装之后可在终端输入一下指令查看安装信息,安装无误会显示ffmpeg的相关安装信息

brew info ffmpeg

3 下载FFmpeg的脚本

要生成静态文件库需要预先下载FFmpeg的运行脚本,

这里是iOS库文件脚本 传送门

传送门是github地址,目前是4.1版本

终端输入 cd 进到下载的文件夹内,然后执行以下指令

./build-ffmpeg.sh

或者,直接将这个文件拖到终端内,按回车。

4 注意点

注1:这里的指令编译会耗时较长,需要下载依赖基础类库,需要网络,耐心等待即可

注2:这里在安装的时候可能会失败,报错如下:

xcrun -sdk iphoneos clang is unable to create an executable file. C compiler test failed. If you think configure made a mistake, make sure you are using the latest version from Git. If the latest version fails, report the problem to the [email protected] mailing list or IRC #ffmpeg on irc.freenode.net. Include the log file “config.log” produced by configure as this will help solve the problem.

这个时候执行以下指令即可

sudo xcode-select –switch /Applications/Xcode.app

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK