C/C++教程

centos7.x安装FFMPEG

本文主要是介绍centos7.x安装FFMPEG,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

centos7.x安装FFMPEG

  • 安装依赖

[root@content yukw]# yum -y install gcc
  • 安装编译yasm

[root@content yukw]# mkdir /data/{src,service}
[root@content yukw]# cd /data/src
[root@content yukw]# wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
[root@content yukw]# tar xf yasm-1.3.0.tar.gz 
[root@content yukw]# cd yasm-1.3.0/
[root@content yukw]# ./configure --enable-shared --prefix=/data/service/yasm
[root@content yukw]# make
[root@content yukw]# make install
  • 安装编译ffmpeg

[root@content yukw]# cd ..
[root@content yukw]# wget http://www.ffmpeg.org/releases/ffmpeg-4.4.tar.gz
[root@content yukw]# tar xf ffmpeg-4.4.tar.gz 
[root@content yukw]# cd ffmpeg-4.4/
[root@content yukw]# ./configure --enable-shared --disable-x86asm --prefix=/data/service/ffmpeg
[root@content yukw]# make
[root@content yukw]# make install
  • 加载库文件

[root@content yukw]# vim /etc/ld.so.conf
include ld.so.conf.d/*.conf
/data/service/yasm/lib/
/data/service/ffmpeg/lib/
[root@content yukw]# ldconfig
[root@content yukw]# /data/service/ffmpeg/bin/ffmpeg -version
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44)
configuration: --enable-shared --disable-x86asm --prefix=/data/service/ffmpeg
libavutil      56. 70.100 / 56. 70.100
libavcodec     58.134.100 / 58.134.100
libavformat    58. 76.100 / 58. 76.100
libavdevice    58. 13.100 / 58. 13.100
libavfilter     7.110.100 /  7.110.100
libswscale      5.  9.100 /  5.  9.100
libswresample   3.  9.100 /  3.  9.100

  • 添加环境变量

[root@content yukw]# vim /etc/profile    添加如下四行
PATH=$PATH:/data/service/ffmpeg/bin
export PATH
PATH=$PATH:/data/service/yasm/bin
export PATH

[root@content yukw]# source /etc/profile
[root@content yukw]# ffmpeg -version

这篇关于centos7.x安装FFMPEG的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!