一、 windows 下安装
直接下载地址:
https://ffmpeg.zeranoe.com/builds/
https://ffmpeg.zeranoe.com/builds/win64/static/ffmpeg-20160316-git-d0a9114-win64-static.7z
解压后即可使用:
ffmpeg -i C:\ffmpeg\test.avi -b:v 640k c:\ffmpeg\output.ts
二、linux源码安装
1下载 源码包:ffmpeg-2.8.6.tar.bz2
2 解压包 tar -jxvf ffmpeg-2.8.6.tar.bz2 (如果报错需要安装bzip2)
3进入解压目录 cd ffmpeg-2.8.6
4 执行 ./configure --enable-shared --prefix=/usr/local/ffmpeg-2.8.6
报错:
yasm/nasm not found or too old. Use --disable-yasm for a crippled build.
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
[email protected] mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solve the problem.
5需要安装yasm (汇编编译器)
5.1 tar zxvf yasm-1.3.0.tar.gz
5.2 cd yasm-1.3.0/
5.3 ./configure --prefix=/usr/local/yasm-1.3.0
5.4 make
5.5 make install
5.6 /etc/profile 文件末尾添加export PATH="$PATH:/usr/local/yasm-1.3.0/bin"
5.7 source /etc/profile
5.8 yasm --version
6 重新执行 ./configure --enable-shared --prefix=/usr/local/ffmpeg-2.8.6
7 make
8 make install
注意: 时间比较长,需要等待几分钟
9 检查是否安装成功:/usr/local/ffmpeg-2.8.6/bin/ffmpeg --version
报错:
/usr/local/ffmpeg/bin/ffmpeg: error while loading shared libraries: libavdevice.so.56: cannot open shared object file: No such file or directory
提示库文件找不到
修改文件/etc/ld.so.conf 内容,增加/usr/local/ffmpeg-2.8.6/lib/
修改后如下:
include ld.so.conf.d/*.conf
/usr/local/ffmpeg/lib/
使修改生效
ldconfig
执行 /usr/local/ffmpeg-2.8.6/bin/ffmpeg --version 返回版本结果
10 配置环境变量
vi /etc/profile
export PATH=/usr/local/ffmpeg/bin/:$PATH
source /etc/profile
11 任何目录都可以执行ffmpeg --version
到此,安装成功