一安装
1.官网下载安装
http://www.ffmpeg.org/download.html
运行configure报错
nasm/yasm not found or too old. Use –disable-x86asm for a crippled build.
原因是未安装
汇编工具没有安装,安装yasm即可:
1.下载
http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
,解压
2.运行configure
3.编译 mke
4.安装 sudo make install
5检查是否安装成功
yasm –version
回到ffmpeg文件夹重新运行 ./configure
二 brew安装方法
brew install ffmpeg
错误解决
1.如果报错:No formulae or casks found for “ffmpeg”.
这时因为分支不对,切换一下:git -C $(brew –repo homebrew/core) checkout master
2.Error: Command failed with exit 128: git
解决:brew -v
3.fatal: unsafe repository
解决:git config –global –add safe.directory “对应路径”
4.Error: No such file or directory @ rb_sysopen
报这个错就需要 单独每项安装一下库,一个一个安装比较麻烦,
写了个脚本循环安装
#!/usr/bin/env bash
echo "==========Start=========="
list=("aom" "dav1d" "freetype" "fontconfig" "frei0r" "lame" "fribidi" "pcre" "gdbm" "mpdecimal" "sqlite" "xz" "python@3.9" "glib" "libpthread-stubs" "xorgproto" "libxau" "libxdmcp" "libxcb" "libx11" "libxext" "libxrender" "lzo" "pixman" "cairo" "gobject-introspection" "graphite2" "icu4c" "harfbuzz" "libass" "libbluray" "cjson" "cmocka" "mbedtls" "librist" "libsoxr" "libvidstab" "libogg" "libvorbis" "libvpx" "opencore-amr" "little-cms2" "openjpeg" "opus" "rav1e" "flac" "libsndfile" "libsamplerate" "rubberband" "sdl2" "snappy" "speex" "srt" "leptonica" "libb2" "lz4" "zstd" "libarchive" "tesseract" "theora" "x264" "x265" "xvid" "libsodium" "zeromq" "zimg")
for item in ${list[*]};
do
echo "======================"
echo "$item brew install"
brew install $item
echo "$item brew cleanup"
brew cleanup $item
done
echo "==========End=========="
运行脚本,重新 brew ffmpeg ,OK安装成功
二、iOS 使用ffmpegAPI
https://www.jianshu.com/p/f07c9278d0f8
Undefined symbols for architecture arm64.:未添加相应的库
项目配置linked frameworks and libraries加上VideoToolbox.framework即可。
其它还有libz.tbd libbz2.tbd libiconv.tbd CoreMedia.framework