ffmpeg下载,编译与安装
FFmpeg音视频核心技术精讲与实战
下载地址:https://github.com/FFmpeg/FFmpeg
ffmpeg是高度可定制化的 可以自己配置需要哪些模块功能 ./configure 生成Makefile文件
MAC下:
./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-filter=delogo --enable-debug --disable-optimizations --enable-libspeex --enable-videotoolbox --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --cc=clang --host-cflags= --host-ldflags=
然后再编译和安装 make && make install 成功的话会在安装目录下生成文件 bin lib include ...等
编译最好不要在win上 可以选择Linux or mac
报错:
nasm/yasm not found or too old. Use --disable-x86asm for a crippled build
分析:yasm是汇编编译器,ffmpeg为了提高效率使用了汇编指令,如MMX和SSE等。所以系统中未安装yasm时,就会报上面错误。
解决错误:安装yasm编译器。安装方法如下:
1)下载:[yasm的下载链接](http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz)
http://www.tortall.net/projects/yasm/
2)解压:把下载下来的压缩包进行解压
3)切换路径: cd yasm-1.3.0
4)执行配置: ./configure
5)编译:make
6)安装:make install(提示:Permission denied,就执行sudo make install)
安装成功yasm后再进入到ffmpeg的文件夹下
Mac OS编译ffmpeg出错ERROR: libfdk_aac not found,安装libfdk后解决
First Try -首先执行如下命令brew install fdk-aac
Failing that you can compile like I do-然后执行如下操作:
git clone git://github.com/mstorsjo/fdk-aac
cd fdk-aac
autoreconf -i
./configure
make install
ERROR: speex not found using pkg-config
brew install speex
brew install pkg-config
ERROR: libx264 not found
brew install x264
ERROR: x265 not found using pkg-config
brew install x265
编译 安装 成功后 执行:
dongfangyaodeMacBook-Pro:~ dongfangyao$ /usr/local/ffmpeg/bin/ffmpeg ffmpeg version 4.2.git Copyright (c) 2000-2020 the FFmpeg developers built with Apple LLVM version 10.0.0 (clang-1000.10.44.4) configuration: --prefix=/usr/local/ffmpeg --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-filter=delogo --enable-debug --disable-optimizations --enable-libspeex --enable-videotoolbox --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --cc=clang --host-cflags= --host-ldflags= libavutil 56. 39.100 / 56. 39.100 libavcodec 58. 68.102 / 58. 68.102 libavformat 58. 38.100 / 58. 38.100 libavdevice 58. 9.103 / 58. 9.103 libavfilter 7. 75.100 / 7. 75.100 libswscale 5. 6.100 / 5. 6.100 libswresample 3. 6.100 / 3. 6.100 libpostproc 55. 6.100 / 55. 6.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
为了更方便执行,配置一下环境变量:
vim ~/.bash_profile
# setting ffmpeg
export PATH=$PATH:/usr/local/ffmpeg/bin
保存后退出 重启终端后 直接输入命令ffmpeg 即可
|