加入收藏 | 设为首页 | 会员中心 | 我要投稿 PHP编程网 - 钦州站长网 (https://www.0777zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 教程 > 正文

linux系统中ffmpeg安装配置步骤教程

发布时间:2022-06-15 13:33:24 所属栏目:教程 来源:互联网
导读:FFmpeg是一套可以用来记录、转换数字音频、视频,并能将其转化为流的开源计算机程序,下面我们来给各位介绍在linux系统中ffmpeg安装配置步骤,有需要的可以和小编来看看具体步骤如下. http://ffmpeg.org/download.html windows版本比较容易. Linux,安装环境Ce
  FFmpeg是一套可以用来记录、转换数字音频、视频,并能将其转化为流的开源计算机程序,下面我们来给各位介绍在linux系统中ffmpeg安装配置步骤,有需要的可以和小编来看看具体步骤如下.
 
  http://ffmpeg.org/download.html
 
  windows版本比较容易.
 
  Linux,安装环境CentOS,下载tar.bz2安装包.
 
  tar -xvf XX.tar.bz2
 
  yasm/nasm not found or too old. Use –disable-yasm for a crippled build.
 
  If you think configure made a mistake, make sure you are using the latest
 
  version from Git. If the latest version fails, report the problem to the
 
  ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
 
  Include the log file “config.log” produced by configure as this will help
 
  solve the problem.
 
  http://yasm.tortall.net/Download.html 下载yasm
 
  tar -zxvf yasm.tar.gz
 
  ./configure
 
  make
 
  make install
 
  再来,ffmpeg下面 ./configure 安装完毕,发现无法将amr转成MP3.
 
  ./ffmpeg -i x.amr x.mp3
 
  ./configure –enable-libmp3lame
 
  少这个libmp3lame:
 
  # wget http://downloads.sourceforge.net/lame/lame-3.97.tar.gz
 
  # tar xzf lame-3.97.tar.gz
 
  # cd lame-3.97
 
  # ./configure
 
  # make
 
  # make install
 
  ERROR: libmp3lame >= 3.98.3 not found
 
  http://downloads.sourceforge.net/lame/去这里找最新的版本,下载一个。
 
  我下到的是lame-3.99.5.tar.gz
 
  # ./configure
 
  # make
 
  # make install
 
  ./ffmpeg -i x.amr x.mp3
 
  ffmpeg: error while loading shared libraries: libmp3lame.so.0: cannot open shared object file: No such file or directory
 
  发生这个我们这样弄
 
  编辑/etc/ld.so.conf文件加入如下内容:
 
  /usr/local/lib
 
  保存退出后执行ldconfig命令,大功告成,你缺少的库,可能都在下面了,FFmpeg软件只是个解码编码软件,如果支持多种格式必须先安装好对应的库,下面就说下我装的库:
 
  1.安装libamrnb
 
  # wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-7.0.0.2.tar.bz2
 
  # tar xvfj amrnb-7.0.0.2.tar.bz2
 
  # cd amrnb-7.0.0.2
 
  # ./configure
 
  # make
 
  # make install
 
  2.安装libamrwb
 
  # wget http://ftp.penguin.cz/pub/users/utx/amr/amrwb-7.0.0.3.tar.bz2
 
  # tar xvfj amrwb-7.0.0.3.tar.bz2
 
  # cd amrwb-7.0.0.3
 
  # ./configure
 
  # make
 
  # make install
 
  3.安装libmp3lame
 
  # wget http://downloads.sourceforge.net/lame/lame-3.97.tar.gz
 
  # tar xzf lame-3.97.tar.gz
 
  # cd lame-3.97
 
  # ./configure
 
  # make
 
  # make install

  4.安装faad2
 
  # wget http://downloads.sourceforge.net/faac/faad2-2.6.1.tar.gz
 
  # tar xvfz faad2-2.6.1.tar.gz
 
  # cd faad2
 
  # ./bootstrap
 
  # ./configure
 
  # make
 
  # make install
 
  5安装liba52
 
  # wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
 
  # tar xvfz a52dec-0.7.4.tar.gz
 
  # cd a52dec-0.7.4
 
  # ./configure
 
  # make
 
  # make install
 
  6.安装libdirac
 
  # wget http://downloads.sourceforge.net/dirac/dirac-0.10.0.tar.gz
 
  # tar xvfz dirac-0.10.0.tar.gz
 
  # cd dirac-0.10.0
 
  # ./configure
 
  # make
 
  # make install
 
  7.安装faac2
 
  # wget http://downloads.sourceforge.net/faac/faac-1.26.tar.gz
 
  # tar xvfz faac-1.26.tar.gz
 
  # cd faac
 
  # ./bootstrap
 
  # ./configure
 
  # make
 
  # make install
 
  8.安装libx264
 
  此软件包需要用git来获取,所以要先安装git:
 
  # wget http://kernel.org/pub/software/scm/git/git-1.6.2.tar.gz (地址要确认)
 
  # tar zxvf git-1.6.2.tar.gz
 
  # cd git-1.6.2
 
  # ./configure
 
  # make
 
  # make install
 
  然后安装libx264.
 
  # /usr/local/bin/git clone git://git.videolan.org/x264.git x264
 
  # cd x264
 
  # ./configure –enable-pthread –enable-shared –disable-asm
 
  # make
 
  # make install
 
  8.安装libnut,该软件需要用svn获取源代码,svn可以直接用yum install svn来装,先下载:
 
  # svn co svn://svn.mplayerhq.hu/nut/src/trunk libnut
 
  下载后代码保存在新建立的libnut目录下,对于64位Linux需要修改配置文件:
 
  # cd libnut
 
  # vi config.mak
 
  在最后一个CFLAGS下一行增加:CFLAGS += -fPIC 然后编译安装:
 
  # make
 
  # make install
 
  9.安装libogg
 
  # wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
 
  # tar xvf libogg-1.1.3.tar.gz
 
  # cd libogg-1.1.3
 
  # ./configure
 
  # make
 
  # make install
 
  10.安装libtheora(svn获取)
 
  # svn co http://svn.xiph.org/trunk/theora theora
 
  # cd theora
 
  # ./autogen.sh
 
  # ./configure
 
  # make
 
  # make install
 
  11.安装libvorbis
 
  # wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.0.tar.gz
 
  # tar xvfz libvorbis-1.2.0.tar.gz
 
  # cd libvorbis-1.2.0
 
  # ./configure
 
  # make
 
  # make install
 
  12.安装libxvid
 
  # wget http://downloads.xvid.org/downloads/xvidcore-1.2.1.tar.gz
 
  # tar xvf xvidcore-1.2.1.tar.gz
 
  # cd xvidcore-1.2.1/build/generic
 
  # ./bootstrap.sh  --phpfensi.com
 
  # ./configure –disable-assembly
 
  # make
 
  # make install
 
  上面的媒体支持库安装完后,可以设置下环境准备编译FFmpeg了.
 
  13.修改环境变量
 
  # vi /etc/ld.so.conf
 
  在文件末增加一行:/usr/local/lib
 
  然后生效之:# ldconfig
 
  14.安装FFmpeg
 
  可以通过svn获取,不过文件比较大,所以特别慢:
 
  # svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
 
  # cd ffmpeg
 
  //也可以自己下载:
 
  # http://www.ffmpeg.org/releases/ffmpeg-0.5.tar.bz2
 
  # bzip2 -d ffmpeg-0.5.tar.bz2
 
  # tar -xf ffmpeg-0.5.tar
 
  # cd ffmpeg-0.5
 
  编译(64位系统需要设置PKG_CONFIG_PATH参数):
 
  # export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig CFLAGS=”-fPIC -m64″
 
  # ./configure –enable-shared
 
  –enable-gpl
 
  –enable-nonfree
 
  –enable-postproc
 
  –enable-avfilter
 
  –enable-avfilter-lavf
 
  –enable-pthreads
 
  –enable-libamr-nb
 
  –enable-libamr-wb
 
  –enable-libdirac
 
  –enable-libfaac
 
  –enable-libfaad
 
  –enable-libfaadbin
 
  –enable-libmp3lame
 
  –enable-libnut
 
  –enable-libtheora
 
  –enable-libvorbis
 
  –enable-libx264
 
  –enable-libxvid
 
  –enable-decoder=libx264
 
  –enable-encoder=libx264
 
  # make
 
  # make install
 
  14.可能出现的错误:
 
  /usr/include/linux/videodev.h:56: error: syntax error before “ulong”
 
  /usr/include/linux/videodev.h:72: error: syntax error before ‘}’ token
 
  libavdevice/v4l.c: In function `grab_read_header’:
 
  libavdevice/v4l.c:75: error: storage size of ‘tuner’ isn’t known
 
  libavdevice/v4l.c:133: error: invalid application of `sizeof’ to incomplete type `video_tuner’
 
  libavdevice/v4l.c:140: error: invalid application of `sizeof’ to incomplete type `video_tuner’
 
  libavdevice/v4l.c:75: warning: unused variable `tuner’
 
  这可能是源代码videodev.h不是针对次版本Linux写的,标准C没有ulong类型,所以要改成unsigned long.
 
  15.运行ffmpeg -formats,可能出的错误:
 
  ffmpeg: error while loading shared libraries:libavfilter.so.0: cannot open shared object file: No such file or directory
 
  这事没有设置环境路径造成了,增加一个ffmpeg.conf配置文件:
 
  # cd /etc/ld.so.conf.d
 
  # vi ffmpeg.conf
 
  //在文件内写上:
 
  /usr/local/lib
 
  //然后确认生效:
 
  # ldconfig。
 

(编辑:PHP编程网 - 钦州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!