第一步:下載gas-preprocessor
1.1 下載地址:https://github.com/libav/gas-preprocessor
1.2 拷貝gas-preprocessor.pl 到/usr/sbin目錄唤反,命令為:sudo -i cp gas-preprocessor.pl? /usr/sbin
1.3 修改gas-preprocessor.pl?文件權(quán)限歪脏,命令為:chmod 777 /usr/sbin/gas-preprocessor.pl
注意:如果執(zhí)行1.2出現(xiàn) Operation not permitted秸侣,該如何操作诉稍?
* 系統(tǒng)開啟了SIP(System Integrity Protection)?跛十,root?權(quán)限也無法修改/usr/sbin?目錄
* 如何禁止SIP伍纫,重啟電腦稠茂,按住Command+R,進入Recovery模式户秤,打開Utilities下的終端
* 在終端中輸入csrutil disable,正常啟動電腦即可讽营。
* 如何查看/usr/sbin目錄是否拷貝成功虎忌,Shift+Command+G,輸入路徑/usr/sbin進入目錄查看即可
第二步:下載編譯腳本
下載地址:https://github.com/kewlbear/FFmpeg-iOS-build-script
第三步:下載FFmpeg
下載地址:https://github.com/FFmpeg/FFmpeg
第四步:編譯
將下載的 FFmpeg 放在編譯腳本目錄下橱鹏,執(zhí)行 sh build-ffmpeg.sh膜蠢,等待完成。
不出意外的話會得到如圖文件夾
即為我們需要的lib包和頭文件莉兰。
第五步:導(dǎo)入
5.1 將編譯好的FFmpeg-iOS包拖入到項目中
5.2 設(shè)置Header Search Path 如圖:
5.3 引用頭文件測試:
編譯未報錯挑围。