本文介绍: 项目中涉及给视频添加水印,使用到ffmpegwindows系统可直接使用,Linux需要手动编译完成ffmpeg后才可正常使用

项目中涉及给视频添加水印,使用到ffmpegwindows系统可直接使用,Linux需要手动编译完成ffmpeg后才可正常使用

配置yum源:

备份repo文件

cd  /etc/yum.repos.d/

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

下载阿里yum配置文件

wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

重建缓存

yum clean all

yum makecache

如果重建缓存提示

file:///mnt/cdrom/repodata/repomd.xml: [Errno 14] curl#37 – “Couldn’t open file /mnt/cdrom/repodata/repomd.xml”
则将系统镜像挂载至对应路径,如/mnt下或/mnt/cdrom下,再重新重建缓存

#卸载挂载
#umount /mnt

#将系统镜像挂载至/mnt/cdrom
mount /dev/sr0 /mnt/cdrom

安装依赖

yum -y install epel-release

yum -y install git gcc gcc-c++ cmake3

安装yasm:

​
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gztar zxvf yasm-1.3.0.tar.gz

cd yasm-1.3.0

./configure

make

make install

安装ffmpeg时间较久):

wget http://www.ffmpeg.org/releases/ffmpeg-4.2.tar.gz

tar -zxvf ffmpeg-4.2.tar.gz

cd ffmpeg-4.2/

./configure --prefix=/usr/local/ffmpeg-4.2

make && make install

配置环境变量

vi /etc/profile

文件最后添加

export PATH=$PATH:/usr/local/ffmpeg-4.2/bin

保存执行

source /etc/profile

检查依赖路径

ldd ffmpeg

vim /etc/ld.so.conf

文件最后添加

/usr/local/ffmpeg-4.2/lib

保存后,执行

ldconfig

再次检查就正常了。

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注