在Mac平台上,下载安装ffmpeg
配置ffmpeg在Xcode的开发环境
[TOC]
下载ffmpeg
下载ffmpeg
1
➜ ~ brew install ffmpeg
查看版本
1
2➜ ~ ffmpeg -version
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers查看ffmpeg详细资信息
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29➜ ~ brew info ffmpeg
ffmpeg: stable 3.4.2 (bottled), HEAD
Play, record, convert, and stream audio and video
https://ffmpeg.org/
/usr/local/Cellar/ffmpeg/3.4.2 (248 files, 50.9MB) *
Poured from bottle on 2018-08-18 at 19:01:35
From: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git/Formula/ffmpeg.rb
==> Dependencies
Build: nasm ✘, pkg-config ✔, texi2html ✘
Recommended: lame ✔, x264 ✔, xvid ✔
Optional: chromaprint ✘, fdk-aac ✘, fontconfig ✘, freetype ✘, frei0r ✘, game-music-emu ✘, libass ✘, libbluray ✘, libbs2b ✘, libcaca ✘, libgsm ✘, libmodplug ✘, librsvg ✘, libsoxr ✘, libssh ✘, libvidstab ✘, libvorbis ✘, libvpx ✘, opencore-amr ✘, openh264 ✘, openjpeg ✘, openssl ✔, opus ✘, rtmpdump ✘, rubberband ✘, sdl2 ✘, snappy ✘, speex ✘, tesseract ✘, theora ✘, two-lame ✘, wavpack ✘, webp ✘, x265 ✘, xz ✘, zeromq ✘, zimg ✘
==> Options
--with-chromaprint
Enable the Chromaprint audio fingerprinting library
--with-fdk-aac
Enable the Fraunhofer FDK AAC library
--with-fontconfig
Build with fontconfig support
--with-freetype
Build with freetype support
--with-frei0r
Build with frei0r support
......
--without-xvid
Disable Xvid MPEG-4 video encoder
--HEAD
Install HEAD version查看下载后的路径,从上面看就可以做知道,默认路径为
1
/usr/local/Cellar/ffmpeg
导入到Xcode
新建Command Line Tool项目
导入头文件
点击项目名—> 右侧Build Settings —> 下拉找到Search Paths(也可以在搜索框直接搜索)—> 点击Header Search Paths—>输入头文件路径
/usr/local/Cellar/ffmpeg/3.4.2/include
导入库文件
切换Build Phases的tab—>Link Binary With Libraries—>拖拉
/usr/local/Cellar/ffmpeg/3.4.2/lib
中的.a
库到其中切换回Build Settings的Search Paths中的Library Search Paths,可以看到内容为
/usr/local/Cellar/ffmpeg/3.4.2/lib
查看效果,输出版本号
1
2
3
4
5
6
7
8
9
10
11
int main(int argc, const char * argv[]) {
// insert code here...
printf("ffmpeg version = %s\n", av_version_info());
return 0;
}
// output
// ffmpeg version = 3.4.2