文章目录
前言
java在linux系统中使用ffmpeg对视频进行压缩
提示:以下是本篇文章正文内容,下面案例可供参考
一、下载ffmpeg(此处引用https://www.cnblogs.com/niuben/p/13551013.html)
可以直接从官网上下载linux版本的ffmpeg源码包 ffmpeg-4.1.tar.xz,再ftp上传到linux/usr/local目录
或者在linux终端中 cd /usr/local 目录,输入以下命令下载到 /usr/local 目录
wget https://johnvansickle.com/ffmpeg/release-source/ffmpeg-4.1.tar.xz
新建安装目录
cd /usr/local/ # 切换到 /usr/local 目录
mkdir ffmpeg # 在 usr/local 目录下创建 ffmpeg 目录
解压源码包
tar -xvJf ffmpeg-4.1.tar.xz
编译准备
cd ffmpeg-4.1 # 切换到ffmpeg-4.1目录
yum install gcc # 安装gcc编译器
yum install yasm # 安装yasm编译器
安装设置
./configure --enable-shared --prefix=/usr/local/ffmpeg # --prefix 指定安装目录
如果出现如下错误信息
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 "config.log" produced by configure as this will help
solve the problem.
则需要先安装yasm
步骤(如已安装 则跳过此步骤):
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 #编译安装
编译安装
这一步耗费时间较长
make # 编译
make install # 安装
修改文件/etc/ld.so.conf
vim /etc/ld.so.conf
# 输入以下内容
include ld.so.conf.d/*.conf
/usr/local/ffmpeg/lib/
输入 ldconfig 使修改生效。