linux下ffmpeg安装教程(小学生都能看懂)
目录
二、用WinSCP工具上传到linux的相应目录,这个目录自己定。
序言,什么是FFmpeg?
以下内容来自百度百科。
FFmpeg是一套可以用来记录、转换数字音频、视频,并能将其转化为流的开源计算机程序。采用LGPL或GPL许可证。它提供了录制、转换以及流化音视频的完整解决方案。它包含了非常先进的音频/视频编解码库libavcodec,为了保证高可移植性和编解码质量,libavcodec里很多code都是从头开发的。
FFmpeg在Linux平台下开发,但它同样也可以在其它操作系统环境中编译运行,包括Windows、Mac OS X等。这个项目最早由Fabrice Bellard发起,2004年至2015年间由Michael Niedermayer主要负责维护。许多FFmpeg的开发人员都来自MPlayer项目,而且当前FFmpeg也是放在MPlayer项目组的服务器上。项目的名称来自MPEG视频编码标准,前面的"FF"代表"Fast Forward"。 [1] FFmpeg编码库可以使用GPU加速。
一、官网下载
官网地址:http://ffmpeg.org/download.html#build-windows
我这里点击这个下载。
二、用WinSCP工具上传到linux的相应目录,这个目录自己定。
完了,这个还不知道咋解压,看另外一篇博客:https://blog.****.net/qq_29720657/article/details/107687155
三、linux安装yasm
先安装yasm,再安装ffmpeg。
官网下载:http://yasm.tortall.net/Download.html
cd yasm-1.3.0/
执行./configure的时候报错了
[email protected]:/opt/install/yasm-1.3.0# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for style of include used by make... GNU
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/opt/install/yasm-1.3.0':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
原因是缺少了gcc
执行命令apt install gcc 安装 gcc
完了再执行以下命令
./configure
make
make install
四、安装ffmpeg
安装yasm成功之后继续回到ffmpeg解压后的目录,执行下面命令编译并安装
./configure --enable-shared --prefix=/monchickey/ffmpeg
make
make install
make编译过程有点长
make install会把ffmpeg相关执行程序、头文件、lib库安装在/monchickey/ffmpeg/下
耐心等待完成之后执行
cd /monchickey/ffmpeg/
进入安装目录,查看一下发现有bin、include、lib、share这4个目录
bin是ffmpeg主程序二进制目录
include是C/C++头文件目录
lib是编译好的库文件目录
share是文档目录
然后进入bin目录,执行
./ffmpeg -version
查看当前版本的详细信息,默认情况下会报
/ffmpeg: error while loading shared libraries: libavdevice.so.58: cannot open shared object file: No such file or directory
类似信息,原因是lib目录未加载到链接到系统库中
系统ld目录列表在/etc/ld.so.conf中,打开文件会发现,
里面引用了/etc/ld.so.conf.d/下面所有的.conf文件,比如mariadb-x86_64.conf
创建一个ffmpeg.conf文件并写入lib路径即可。
然后添加一行内容: /monchickey/ffmpeg/lib
之后保存并退出,然后执行 ldconfig 命令使配置生效,
现在再次执行 ./ffmpeg -version ,又报错了
没找到ffmpeg命令,根据提示apt install ffmpeg安装
等待执行完成,再次输入 ./ffmpeg -version,看到已经安装成功
安装好了,拿去玩耍。
2020年7月30号。