【安装】Linux安装ffmpeg

ffmpeg

下载地址

Index of /releases (ffmpeg.org)

下载

wget https://ffmpeg.org//releases/ffmpeg-6.1.1.tar.gz
tar -zxvf ffmpeg-6.1.1.tar.gz

进入解压后目录,输入如下命令/usr/local/ffmpeg为自己指定的安装目录

cd ffmpeg-6.1.1
./configure --prefix=/usr/local/ffmpeg
make && make install

这里可能会遇到问题, 可以参考下边对应的解决方案

配置环境变量

vi /etc/profile
# 在最后PATH添加环境变量:
export PATH=$PATH:/usr/local/ffmpeg/bin

# 保存退出
:wq

# 查看是否生效
source /etc/profile  设置生效

查看版本

ffmpeg -version    查看版本


遇到的问题

问题一

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
[email protected] mailing list or IRC #ffmpeg on irc.libera.chat.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.

解决方案

分析:yasm是汇编编译器,ffmpeg为了提高效率使用了汇编指令,如MMX和SSE等。所以系统中未安装yasm时,就会报上面错误。

解决错误:安装yasm编译器。安装方法如下

yasm官网

The Yasm Modular Assembler Project (tortall.net)

Download - The Yasm Modular Assembler Project (tortall.net)

1)下载:​ ​yasm

2)解压:把下载下来的压缩包进行解压

3)切换路径: cd yasm-1.3.0

4)执行配置: ./configure

5)编译:make

6)安装:make install

wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar -zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure
make && make install

问题二

若运行 ffmpeg -i 报错误:

ffmpeg: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory

安装 libiconv.so.2

#下载libiconv
wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
tar -zxvf libiconv-1.16.tar.gz
cd libiconv-1.16
 
#编译安装
./configure --prefix=/usr/local
make
make_install
ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2
ldconfig

你可能感兴趣的:(安装配置,运维服务,linux,ffmpeg,运维)