ffmpeg-xcode
ffmpeg xcode project
build steps
step 1 下载ffmpeg源码
- FFmpeg
git clone https://git.ffmpeg.org/ffmpeg.git FFmpeg
step 2 编译 ffmpeg
cd FFmpeg./configure --enable-debug=trace|./configure --enable-debug|./configure --enable-debug=3make -j8
make -j1 一个CPU编译
make -j2 二个CPU编译
问题1
1 | 编译时报错 yasm/nasm not found or too old. Use --disable-yasm for a crippled build. (yasm是汇编编译器, 因为ffmpeg中为了提高效率用到了汇编指令, 比如MMX和SSE) |
解决方法
1 | brew install yasm |
问题2
1 | ~/github/FFmpeg # make -j8 |
解决方法
./configure --enable-debug
问题4
Segfault on macOS 10.15 “Catalina”
1 | $ ffmpeg |
1 | $ ./ffmpeg |
解决方法
./configure —extra-cflags=”-fno-stack-check”
step 3 新建一个空的 xcode 项目
- Create a new Xcode project
新建一个空的 xcode 项目
项目保存路径与
FFmpeg同级.
step 4 添加 FFmpeg 源码目录进 ffmpeg-debug 项目中
- 1 选中FFmpeg目录
- 2 拖到项目目录下
- 3 不要勾选下面这个选项
- 接着一点要选
ffmpeg-debug, 否则看代码时, 不可以跳转. 写代码时不会有提示.
step 5 添加头文件搜索路径
- 到这里就可以实现头文件跳转了. 要等待处理完毕才可以点击头文件或者类来查看代码.
Search Paths
$(SRCROOT)/../FFmpeg
- $(SRCROOT)/../FFmpeg/libavcodec
- $(SRCROOT)/../FFmpeg/llibavfilter
- $(SRCROOT)/../FFmpeg/libavdevice
- $(SRCROOT)/../FFmpeg/libutil
- $(SRCROOT)/../FFmpeg/libformat
- $(SRCROOT)/../FFmpeg/libswscal
- $(SRCROOT)/../FFmpeg/libpostproc
- $(SRCROOT)/../FFmpeg/libavresample
- $(SRCROOT)/../FFmpeg/libswscale
step 6 添加一个 target
File -> New -> Target -> Cross-platform -> Other -> External Build System
- target 命名为
ffmpeg-make
step 7 修改 ffmpeg-make 源码路径配置
- 修改
ffmpeg-make源码路径 - ../FFmpeg
step 8 修改 ffmpeg-make 命令行参数
配置命令行参数
在Xcode工具栏中选择你的target然后点击
Edit Scheme
配置executable
结果
step 9 大功告成 添加断点(ffmpeg.c->main函数), 点击 run