Xcode安装配置ffmpeg开发环境
Posted 亦袁非猿
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Xcode安装配置ffmpeg开发环境相关的知识,希望对你有一定的参考价值。
在Mac平台上,下载安装ffmpeg
配置ffmpeg在Xcode的开发环境
下载ffmpeg
下载ffmpeg
➜ ~ brew install ffmpeg
查看版本
➜ ~ ffmpeg -version
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers查看ffmpeg详细资信息
➜ ~ 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查看下载后的路径,从上面看就可以做知道,默认路径为
/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
查看效果,输出版本号
#include <stdio.h>
#include <libavcodec/avcodec.h>
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
以上是关于Xcode安装配置ffmpeg开发环境的主要内容,如果未能解决你的问题,请参考以下文章