美文网首页
使用FFmpeg常见问题

使用FFmpeg常见问题

作者: MONKEY小巧 | 来源:发表于2016-05-04 00:50 被阅读820次

刚接触ffmpeg,找了好多资料,都没有编译成功,现在奉上github上的脚本链接:https://github.com/kewlbear/FFmpeg-iOS-build-script

大体步骤:

具体步骤如下:

  • 下载脚本:https://github.com/kewlbear/FFmpeg-iOS-build-script
  • 解压,找到文件 build-ffmpeg.sh
  • 执行服本文件:./build-ffmpeg.sh, 由于本人没有事先安装Yasm执行脚本文件会出错,
    如下:
    VeradeMacBook-Pro:~ a1$ ./build-ffmpeg.sh Yasm not found Homebrew not found. Trying to install... Whoops, the Homebrew installer has moved! Please instead run: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 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
    That's,没有yasm, 看到提示执行 :ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"安装
  • 编译完成后,终端进入FFmpeg-iOS-build-script目录,然后输入./build-ffmpeg.sh lipo,这个命令是把.a文件合并为一个
  • ffmpeg-iOS文件加入到工程中
  • 添加一个头文件引用#include "avformat.h"
    添加一个api语句:av_register_all();给一个类文件.m后缀改为.mm,开启混编模式。
    运行工程,如果没有报错,则表明编译成功
  • **注意 **
    编译的时候报错:'libavcodec/avcodec.h' file not found,修改Header search paths 里的路径:$(PROJECT_DIR)/FFmpeg-iOS/include
    加入External libraries
    libz.dylib
    libbz2.dylib
    ``libiconv.dylib

相关文章

网友评论

      本文标题:使用FFmpeg常见问题

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