ffmpeg下载和安装
官网:https://ffmpeg.org
下载
wget https://ffmpeg.org/releases/ffmpeg-6.0.tar.gz
tar -zxvf ffmpeg-6.0.tar.gz
准备工作
安装X264库
yum install -y git (如果已安装GIT则忽略) git clone https://code.videolan.org/videolan/x264.git cd x264
#执行 ./configure --enable-shared --enable-static --disable-asm make && make install
进入解压后的目录安装
cd ffmpeg-6.0
yum install yasm -y #这步省略--下一步可能会报错(如果已安装,则不需要) ./configure --prefix=/usr/local/ffmpeg #需要提前mkdir ffmpeg
make && make install
make编译时间很长很长
检查
[root@VM-16-10-centos m3u8]# cat /etc/ld.so.conf include ld.so.conf.d/*.conf #只显示这个 [root@VM-16-10-centos m3u8]# vim /etc/ld.so.conf /usr/local/ffmpeg/lib #追加上这一行,有则忽略这一步
[root@VM-16-10-centos ffmpeg-6.0]# vim /etc/profile #添加环境变量
export PATH=$PATH:/usr/local/ffmpeg/bin
[root@VM-16-10-centos ffmpeg-6.0]# source /etc/profile
[root@VM-16-10-centos ffmpeg-6.0]# ffmpeg -version #查看版本---如果显示如下,安装成功
ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44)
configuration: --prefix=/usr/local/ffmpeg
libavutil 58. 2.100 / 58. 2.100
libavcodec 60. 3.100 / 60. 3.100
libavformat 60. 3.100 / 60. 3.100
libavdevice 60. 1.100 / 60. 1.100
libavfilter 9. 3.100 / 9. 3.100
libswscale 7. 1.100 / 7. 1.100
libswresample 4. 10.100 / 4. 10.100