Linux 下 FFmpeg保姆式安装教程

网络空间安全

  FFmpeg是什么

  FFmpeg是一套可以用来记录、转换数字音频、视频,并能将其转化为流的开源计算机程序,堪称自由软件中最完备的一套多媒体库,它几乎实现了所有当下常见的数据封装格式、多媒体传输协议以及音视频编解码器,堪称多媒体业界的瑞士军刀

  安装环境

  Centos7.9

  FFmpeg5.1

  安装教程

  要实现FFmpeg的绝大数功能,需要安装比较多的依赖库,本文为了最大化简化安装 过程,部分依赖库采用了yum安装方式

  1.基础环境包安装

  yum install automake autoconf make gcc gcc-c++ libtool zlib zlib-devel curl curl-devel alsa-lib alsa-lib-devel gettext gettext-devel expat expat-devel expect libpng-devel freetype-devel redhat-lsb autoconf automake libtheora-devel pkgconfig SDL SDL-devel git doxygen unzip yasm bzip2-devel openssl-devel2.Fribidi 安装

  yum install fribidi-devel3.fonconfig 安装

  yum install fonconfig fonconfig-devel4.libass 安装 (开源字幕库)

  yum install libass libass-devel5.lame 安装(MP3 编码解码库)

  yum install lame lame-devel6.librtmp 安装

  wget http://rtmpdump.mplayerhq.hu/download/rtmpdump-2.3.tgz tar zxvf rtmpdump-2.3.tgzmake SYS=posixmake install7.libspeex (音频压缩方面的)

  yum install speex-devel8.twolame安装

  yum install twolame twolame-devel9.libvorbis安装

  yum install libvorbis libvorbis-devel10.x264编码安装(安装x264 需要先安装nasm)

  #nasm安装wget https://www.nasm.us/pub/nasm/releasebuilds/2.14.01/nasm-2.14.01.tar.gztar zxvf nasm-2.14.01.tar.gz./configure --prefix=/usr/local/ --enable-shared && make && make install#x264安装git clone https://code.videolan.org/videolan/x264.git./configure --prefix=/usr/local/ --enable-shared --enable-picmake && make install11.x265编码安装

  hg clone http://hg.videolan.org/x265yum install numactl numactl-develcd /usr/local/src/x265/build/linux./make-Makefiles.bashmake && make install12.xvidcore安装

  wget https://downloads.xvid.com/downloads/xvidcore-1.3.7.tar.gzcd xvidcore/build/generic ./bootstrap.sh./configure --prefix=/usr/local/ #make && make install13.libraw1394 libusb libdc1394 安装

  yum install libraw1394-develyum install libusb libusb-devel yum install libdc1394-devel14.fdk-aac安装

  git clone https://github.com/mstorsjo/fdk-aac.git./configure --prefix=/usr/local/ --enable-sharedmake && make install14.库文件加载

  echo "/usr/local/lib/" >> /etc/ld.so.confldconfigexport PKG_CONFIG_PATH=/usr/local/lib/pkgconfig15.FFmpeg安装

  wget http://ffmpeg.org/releases/ffmpeg-5.1.tar.bz2tar jxvf ffmpeg-5.1.tar.bz2./configure --enable-shared --prefix=/usr/local/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-zlib --enable-bzlib --enable-libfdk-aac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-pic --enable-pthreads --enable-libdc1394 --enable-libass --enable-pic --enable-openssl --enable-libtwolame --enable-libspeex --enable-librtmp --enable-libfreetype --enable-avfilter --enable-libx265make && make install至此FFmpeg5.1安装成功

  可以执行命令验证

  /usr/local/ffmpeg/bin/ffmpeg

ffmepg 返回

  也可以将ffmpeg执行路径加入PATH 环境变量或者将执行路径链接到/usr/bin/目录,以后不需要路径即可执行该指令

  export PATH=$PATH:/usr/local/ffmpeg/bin/ orln -s /usr/local/ffmpeg/bin/ffmpeg /usr/bin

  至此ffmpeg在Centos7 安装完成

标签: 网络空间安全