美文网首页
FFMpeg编译

FFMpeg编译

作者: Recorder_MZou | 来源:发表于2020-04-07 10:02 被阅读0次

    准备条件

    先下载文件:https://github.com/libav/gas-preprocessor

    复制gas-preprocessor.pl到/usr/sbin下,

    修改文件权限:chmod 777 /usr/local/bin/gas-preprocessor.pl

    安装yasm

    具体步骤如下:

    1. 下载脚本:https://github.com/kewlbear/FFmpeg-iOS-build-script

    2. 解压,找到文件 build-ffmpeg.sh

    3. 执行服本文件:./build-ffmpeg.sh, 由于本人没有事先安装Yasm 执行脚本文件会出错,

    如下:

    1、MAC:FFmpeg-iOS-build-script-master-2 jinsonglnan$ ./build-ffmpeg.sh 
    2、Yasm not found
    3、Homebrew not found. Trying to install...
    4、Whoops, the Homebrew installer has moved! Please instead run:
    5、ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    6、Also, please ask wherever you got this link from to update it to the above.
    Trying to install Yasm...
    ./build-ffmpeg.sh: line 67: brew: command not found
    
    

    4.编译完成后,终端进入FFmpeg-iOS-build-script目录,然后输入./build-ffmpeg.sh lipo,这个命令是讲.a文件合并成一个

    5.把ffmpeg-iOS文件加入到工程中

    6.添加一个头文件引用 #include "avformat.h"

    添加一个api语句:av_register_all();给一个类文件.m后缀改为.mm,开启混编模式。

    运行工程,如果没有报错,则表明编译成功

    7.其他注意细节

    编译的时候报错: 'libavcodec/avcodec.h' file not found ,修改Header search paths 里的路径:$(PROJECT_DIR)/FFmpeg-iOS/include

    加入External libraries:

    libz.dylib
    libbz2.dylib
    libiconv.dylib
    

    大千世界,求同存异;相遇是缘,相识是份,相知便是“猿粪”(缘分)
    From MZou

    相关文章

      网友评论

          本文标题:FFMpeg编译

          本文链接:https://www.haomeiwen.com/subject/ggkgphtx.html