由于ZCMS在上传视频时会强制对视频进行转码,在网上找了些安装教程发现转码服务不能正常使用。经过跟产品负责人(才哥)沟通后得知,当前ZCMS只能适配FFmpeg 2.8.x版本。后根据提供的一键安装包安装后成功实现。
直接使用编译后的文件
wget https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz
xz -d ffmpeg-git-amd64-static.tar.xz
tar -xvf ffmpeg-git-amd64-static.tar
cd /usr/bin
ln -s /app/ffmpeg-git-20211217-amd64-static/ffmpeg
ln -s /soft/ffmpeg_in_docker/qt-faststart
一键安装脚本(install_ffmpeg_centos7.sh)
#! /bin/bash
cur_dir=$(pwd)
#target_ffmpeg_lib_dir=$cur_dir/lib
#target_ffmpeg_inc_dir=$cur_dir/inc
rm -rf ffmpeg-4.3.2*
rm -rf nasm*
rm -rf yasm*
rm -rf x264*
yum install git
# 由于 asm版本是旧的或者没有asm,因此需要安装或者更新
echo " ===================== 开始安装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
echo " ===================== 开始安装nasm ===================== "
wget https://www.nasm.us/pub/nasm/releasebuilds/2.14/nasm-2.14.tar.gz
tar -zxvf nasm-2.14.tar.gz
cd nasm-2.14
./configure
make -j60
make install
echo " ===================== 开始安装x264 ===================== "
git clone https://code.videolan.org/videolan/x264.git
cd x264
./configure --includedir=/usr/local/include --libdir=/usr/local/lib --enable-shared
make -j60
make install
echo " ===================== 开始安装ffmpeg ===================== "
wget http://www.ffmpeg.org/releases/ffmpeg-4.3.2.tar.gz
tar -zxvf ffmpeg-4.3.2.tar.gz
cd ./ffmpeg-4.3.2
# ubuntu 必须添加 --enable-shared https://github.com/lutris/ffmpeg-nvenc/issues/5--prefix=/usr/local/src/ffmpeg
./configure --enable-shared --enable-swscale --enable-gpl --enable-nonfree --enable-pic --enable-version3 --enable-postproc --enable-pthreads --enable-static --enable-libx264
echo " ===================== 开始 make && make install ===================== "
make -j60
make install
echo "您还需要手动设置环境变量: export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/usr/local/lib"
参考链接:
评论 (0)