1、从github上下载ffmpeg源码,首先安装yasm,否则运行 ./configure 会报下面的错误:
N85-87HP6:~/opensource/FFmpeg-release-4.1$ ./configure
nasm/yasm not found or too old. Use --disable-x86asm 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
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
安装yasm步骤,源码下载地址http://yasm.tortall.net/Download.html:
tar -xvzf yasm-1.3.0.tar.gz
cd yasm-1.3.0/
./configure
make
make install
2、返回ffmpeg源码目录,编译安装
./configure --enable-shared --prefix=/home/xxxxxx/ffmpeg
make
make install
3、配置环境
将lib目录加载到链接到系统库中,系统ld目录列表在/etc/ld.so.conf中,打开文件会发现,里面引用了/etc/ld.so.conf.d/下面所有的.conf文件,只需要创建一个文件并写入lib路径即可,
执行命令: vim /etc/ld.so.conf.d/ffmpeg.conf
然后添加一行内容: /home/xxxxxx/ffmpeg/lib 之后保存并退出,然后执行 ldconfig 使配置生效
通过命令查看ffmpeg安装情况:
4、使用命令行工具 ffmpeg -i 59cbb31588870.mp4 59cbb31588870.avi