前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >compile ffmpeg for armv7 armv7s[通俗易懂]

compile ffmpeg for armv7 armv7s[通俗易懂]

作者头像
全栈程序员站长
发布2022-07-25 12:48:00
4430
发布2022-07-25 12:48:00
举报
文章被收录于专栏:全栈程序员必看

大家好,又见面了,我是你们的朋友全栈君。

1.下载ffmpeg

git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg

2.下载gas-preprocessor

地址: https://github.com/yuvi/gas-preprocessor

下载完后把gas-preprocessor.pl 复制到 /usr/bin/ 目录下,修改权限 chmod 777

3.解压ffmpeg,并进入ffmpeg文件夹:

a.编译armv7

./configure –cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc –as=’/usr/bin/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc’ –sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk –extra-ldflags=-L/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/usr/lib/system –target-os=darwin –arch=arm –cpu=cortex-a8 –extra-cflags=’-arch armv7′ –extra-ldflags=’-arch armv7′ –extra-cflags=’-mfpu=neon’ –extra-cflags=’-mfloat-abi=softfp’ –enable-pic –enable-cross-compile –enable-ffmpeg –enable-decoder=h264 –disable-doc

b.编译完后,make , sudo make install

c.可以在/usr/local/目录下看到lib inlucde文件夹都有新增文件,将/usr/local/lib/下的.a文件复制到随便新建一个文件夹,命名文件夹armv7

4.编译armv7s

a. ./configure –disable-doc –disable-ffmpeg –disable-ffplay –disable-ffserver –enable-cross-compile –arch=arm –target-os=darwin –cc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc –as=’gas-preprocessor/gas-preprocessor.pl /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc’ –sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk –cpu=cortex-a8 –extra-cflags=’-arch armv7s’ –extra-ldflags=’-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk’ –enable-pic –enable-decoder=rawvideo –disable-asm

b.编译完后,make , sudo make install

c.可以在/usr/local/目录下看到lib inlucde文件夹都有新增文件,将/usr/local/lib/下的.a文件复制到随便新建一个文件夹,命名文件夹armv7s

5.合并两个版本

a.去掉重复的log2_tab.o

ar -dv armv7s/libavutil.a log2_tab.o

ar -dv armv7/libavutil.a log2_tab.o

ar -dv armv7s/libswresample.a log2_tab.o

ar -dv armv7/libswresample.a log2_tab.o

ar -dv armv7s/libavformat.a log2_tab.o

ar -dv armv7/libavformat.a log2_tab.o

b.合并

xcrun -sdk iphoneos lipo -create -arch armv7 armv7/libavcodec.a -arch armv7s armv7s/libavcodec.a -output libavcodec.a

xcrun -sdk iphoneos lipo -create -arch armv7 armv7/libavdevice.a -arch armv7s armv7s/libavdevice.a -output libavdevice.a

xcrun -sdk iphoneos lipo -create -arch armv7 armv7/libavfilter.a -arch armv7s armv7s/libavfilter.a -output libavfilter.a

xcrun -sdk iphoneos lipo -create -arch armv7 armv7/libavformat.a -arch armv7s armv7s/libavformat.a -output libavformat.a

xcrun -sdk iphoneos lipo -create -arch armv7 armv7/libavutil.a -arch armv7s armv7s/libavutil.a -output libavutil.a

xcrun -sdk iphoneos lipo -create -arch armv7 armv7/libswresample.a -arch armv7s armv7s/libswresample.a -output libswresample.a

xcrun -sdk iphoneos lipo -create -arch armv7 armv7/libswscale.a -arch armv7s armv7s/libswscale.a -output libswscale.a

6.添加到xcode

新建文件夹ffmpeg,将合并后的.a文件和/usr/local/include/*的文件复制到ffmpeg夹下,把ffmpeg复制到工程下,并add

7.在工程的build phase引入libz.dylib和libbz2.dylib两个库

8.在Build Settings, 搜索header search paths, 加上ffmpeg

编译运行。。

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/127466.html原文链接:https://javaforall.cn

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2022年4月9,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档