CentOS7安裝ffmpeg
首先在官網http://ffmpeg.org/download.html下載ffmpeg-4.2.1.tar.bz2
以下為安裝步驟:
1、使用工具將源碼包上傳至Linux主機
2、解壓源碼包
進入該文件夾下:cd /usr/ffmpeg/(這里我是安裝到usr目錄下新建的ffmpeg文件夾中)
解壓該源碼包:tar -jxvf ffmpeg-4.2.1.tar.bz2
[bhsoft@localhost ~]$ cd /usr/ffmpeg/
[bhsoft@localhost ffmpeg]$ tar -jxvf ffmpeg-4.2.1.tar.bz2
3、進入到解壓完成的ffmpeg-4.2.1目錄下安裝yasm(如已安裝跳過此步驟)
安裝yasm命令:yum
install
yasm
[bhsoft@localhost ffmpeg]$ cd ffmpeg-4.2.1/ [bhsoft@localhost ffmpeg-4.2.1]$ yuminstall
yasm
中間遇到Is this ok 選擇y,如圖
4、安裝yasm完畢后執行命令
[bhsoft@localhost ffmpeg-4.2.1]$ ./configure --enable-shared --prefix=/usr/ffmpeg
5、執行make命令(這一步時間比較長,請耐心等待)
[bhsoft@localhost ffmpeg-4.2.1]$ make
6、執行make install(安裝)命令
[bhsoft@localhost ffmpeg-4.2.1]$ make install
7、修改文件/etc/ld.so.conf
使用 vim /etc/ld.so.conf命令打開文件
[bhsoft@localhost ffmpeg-4.2.1]$ vim /etc/ld.so.conf
在文件后面添加 /usr/ffmpeg/lib/
然后執行ldconfig命令使其生效
[bhsoft@localhost ffmpeg-4.2.1]$ldconfig
8、配置環境變量(nginx不可以使用ffmpeg)
[bhsoft@localhost ffmpeg-4.2.1]$ vim /etc/profile
使用 vim /etc/profile命令打開profile文件,在文件末添加環境變量:
#set ffmpeg environment PATH=$PATH:/usr/ffmpeg/bin export PATH
隨后執行 source /etc/profile使配置生效
[bhsoft@localhost ffmpeg-4.2.1]$ source /etc/profile
9、添加ffmpeg的軟鏈接(適合nginx調用使用)
#ln -s /usr/ffmpeg/bin/ffmpeg /usr/local/bin/
10、查看是否配置成功
用命令ffmpeg -version查看,出現下圖信息即安裝成功