离线安装ffmpeg
linux离线安装ffmpeg
获取安装包:[ffmpeg-release](Index of /releases (ffmpeg.org))
下载最新版本,ffmpeg-4.4.tar.gz
然后传送到服务器上,解压安装
# 解压
tar -zxvf ffmpeg-4.4.tar.gz
# 安装
cd ffmpeg-4.4
./configure --enable-share --prefix=/usr/local/ffmpeg
# 发现报错,提示yasm版本太老或者没安装
所以要安装yasm
获取安装包:[yasm-release](Index of /projects/yasm/releases/ (tortall.net))
下载最新版:yasm-1.3.0.tar.gz
然后传送到服务器上,解压安装
# 解压安装
tar -zxvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure --prefix=/usr/local/yasm
# 编译安装
make && make install
# 配置环境变量,将一下内容加到/etc/profile以及/root/.bashrc中去
export PATH=$PATH:/usr/local/yasm/bin
# 执行配置文件,让环境变量生效
source /etc/profile
source ~/.bashrc
然后开始重新安装ffmpeg
# 之前已经进行了解压,直接执行安装即可
./configure --enable-shared --prefix=/usr/local/ffmpeg
# 编译安装,这一步比较耗时,多等一会儿
make && make install
# 完成安装之后检查运行
cd /usr/local/ffmpeg/bin
ldd ffmpeg
linux-vdso.so.1 => (0x00007ffe8916a000)
libavdevice.so.58 => not found
libavfilter.so.7 => not found
libavformat.so.58 => not found
libavcodec.so.58 => not found
libswresample.so.3 => not found
libswscale.so.5 => not found
libavutil.so.56 => not found
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f750fffa000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f750fddd000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f750fa13000)
/lib64/ld-linux-x86-64.so.2 (0x00007f7510303000)
# 发现缺少了一些so文件,是因为这些so文件也需要配置到环境变量中
# 修改环境变量,首先修改ffmpeg的环境变量,将如下内容加到export PATH=$PATH:/usr/local/yasm/bin后面
export PATH=$PATH:/usr/local/yasm/bin:/usr/local/ffmpeg/bin
# 同样的需要修改两个配置文件
# 修改lib的环境变量,将如下内容加到/etc/profile以及/root/.bashrc中去
export LD_LIBRARY_PATH=/usr/local/ffmpeg/lib/:$LD_LIBRARY_PATH
# 执行配置文件使环境变量生效即可,再检查运行结果即可
ldd ffmpeg
linux-vdso.so.1 => (0x00007ffd988da000)
libavdevice.so.58 => /usr/local/ffmpeg/lib/libavdevice.so.58 (0x00007f34080df000)
libavfilter.so.7 => /usr/local/ffmpeg/lib/libavfilter.so.7 (0x00007f3407b59000)
libavformat.so.58 => /usr/local/ffmpeg/lib/libavformat.so.58 (0x00007f34076d8000)
libavcodec.so.58 => /usr/local/ffmpeg/lib/libavcodec.so.58 (0x00007f34061ce000)
libswresample.so.3 => /usr/local/ffmpeg/lib/libswresample.so.3 (0x00007f3405fb1000)
libswscale.so.5 => /usr/local/ffmpeg/lib/libswscale.so.5 (0x00007f3405d1f000)
libavutil.so.56 => /usr/local/ffmpeg/lib/libavutil.so.56 (0x00007f340586b000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3405562000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3405345000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3404f7b000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f3404d59000)
libxcb-shape.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shape.so.0 (0x00007f3404b55000)
libxcb-xfixes.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-xfixes.so.0 (0x00007f340494d000)
libz.so.1 => /usr/local/lib/libz.so.1 (0x00007f3404731000)
/lib64/ld-linux-x86-64.so.2 (0x00007f34082f0000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f340452d000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f3404327000)
./ffmpeg
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) 20160609
configuration: --enable-shared --prefix=/usr/local/ffmpeg
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'