xcode 如何将 FFMpeg 构建为 iOS 框架
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35498103/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to Build FFMpeg as iOS Framework
提问by Devin
I'm trying to build my own Player base on FFMpeg,
我正在尝试基于 FFMpeg 构建我自己的 Player 基础,
I succes to build FFMpeg as static library(*.a),
我成功地将 FFMpeg 构建为静态库(*.a),
but its need to copy another header file to use,
但它需要复制另一个头文件才能使用,
I hope it can used like framework,
我希望它可以像框架一样使用,
but even I add header file into framework (set as public)
但即使我将头文件添加到框架中(设置为公共)
My Demo App can not find .h file in FFMpeg.framework,
我的演示应用程序在 FFMpeg.framework 中找不到 .h 文件,
is there any suggestion or tutorial can help me to build it as real framework?
有什么建议或教程可以帮助我将其构建为真正的框架吗?
Thanks
谢谢
回答by Badal Shah
Yes because there is proper procedure to setup FFMPEG in project.
是的,因为有在项目中设置 FFMPEG 的正确程序。
Please follow procedure in below link.
请按照以下链接中的程序进行操作。
Compile ffmpeg for iOS 6, support Simulator & armv7 & armv7s
为iOS 6编译ffmpeg,支持Simulator & armv7 & armv7s
1) First Download FFmpegFrom github.
1)首先从github下载FFmpeg。
2) Then just copy folder in your project directory.
2)然后只需复制项目目录中的文件夹。
3) Then Add it into your project with Add fileoption in xcode.
3)然后使用xcode中的添加文件选项将其添加到您的项目中。
Note:- Below library must be added in your Project.
注意:- 必须在您的项目中添加以下库。
and don't forget to set HEADER SEARCH PATHin Build Settingoption.
并且不要忘记在Build Setting选项中设置HEADER SEARCH PATH。
Try to compile.
尝试编译。
You will find example for FFMPEG in below link,
您将在以下链接中找到 FFMPEG 的示例,
1) ffmpegc-demo
1) ffmpegc 演示
2) kxmovie(Best to use ffmpeg)
2)kxmovie(最好使用ffmpeg)
still you need to add ffmpeg in this demo also. else you will get error for headerfile missing or library missing or etc.
您仍然需要在此演示中添加 ffmpeg。否则你会得到头文件丢失或库丢失等错误。
回答by Peter Hale
I've included several C libraries into an iOS project. The way to do it, I think is to add the .a file to the Build Phases > Link Binary With Library, and drag your .a file there. If you compiled ffmpeg from source, there should be a header file. For your .h file, make sure you update the Library Search Path in Build Settings.
我在一个 iOS 项目中包含了几个 C 库。我认为这样做的方法是将 .a 文件添加到 Build Phases > Link Binary With Library,然后将 .a 文件拖到那里。如果你从源代码编译 ffmpeg,应该有一个头文件。对于 .h 文件,请确保在构建设置中更新库搜索路径。
Also, if you are using the ffmpeg api's, maybe getting the libavcodec, libavformat, and libavscale libraries, as these are what the main ffmpeg program uses.
此外,如果您使用的是 ffmpeg api,可能会获得 libavcodec、libavformat 和 libavscale 库,因为这些是主要 ffmpeg 程序使用的。