CentOS下yum安装ffmpeg/mencoder/mplayer
| [dag]name=Dag RPM Repository forRed Hat Enterprise Linuxbaseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/daggpgcheck=0enabled=1 | 
| yum -y installffmpeg | 
1、安装所需软件
yum install -y automake autoconf libtool gcc gcc-c++
2、安装第三方更新源
rpm -ivh http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
3、安装ffmpeg
yum install ffmpeg ffmpeg-devel
会自动安装众多解码器,ffmpeg版本为0.6.5-1.el6.rf。看了下yum安装的解码器版本还不是很旧,但是ffmpeg版本较老。
4、测试一下
将一个.avi视屏转为.flv格式
ffmpeg -i Destination.avi -y -ab 56 -ar 22050 -r 15 -sameq test2.flv
转换前后两个文件的格式比较:
转换前
Destination.avi
   General
      Complete name : E:PVDestination.avi
      Format : AVI
      Format/Info : Audio Video Interleave
      Format/Family : RIFF
      File size : 79.5 MiB
      PlayTime : 4mn 1s
      Bit rate : 2754 Kbps
      StreamSize : 469 KiB
      Subject : doobie (2007)
      Writing application : VirtualDubMod 1.5.10.2 (build 2540/release)
      Writing library : VirtualDubMod build 2540/release
   Video #0
      Codec : XviD
      Codec/Family : MPEG-4
      Codec/Info : XviD project
      Codec profile : Streaming Video Profile/Level 1
      Codec settings/PacketBitStream : Yes
      Codec settings/BVOP : Yes
      Codec settings/QPel : No
      Codec settings/GMC : 0
      Codec settings/Matrix : Default
      PlayTime : 4mn 1s
      Bit rate : 2556 Kbps
      Width : 640 pixels
      Height : 480 pixels
      Display Aspect ratio : 4/3
      Frame rate : 29.976 fps
      Resolution : 8 bits
      Chroma : 4:2:0
      Interlacement : Progressive
      Bits/(Pixel*Frame) : 0.277
      StreamSize : 73.5 MiB
   Audio #1
      Codec : MPEG-1 Audio layer 3
      Codec profile : Joint stereo
      PlayTime : 4mn 1s
      Bit rate : 190 Kbps
      Bit rate mode : CBR
      Channel(s) : 2 channels
      Sampling rate : 48 KHz
      Resolution : 16 bits
      StreamSize : 5.47 MiB
      Writing library : Gogo (after 3.0)
转换后
test2.flv
   General
      Complete name : E:PVtest2.flv
      Format : Flash Video
      File size : 45.0 MiB
      PlayTime : 4mn 1s
      Bit rate : 1564 Kbps
   Video
      Codec : Sorenson H263
      PlayTime : 4mn 1s
      Bit rate : 195 Kbps
      Width : 640 pixels
      Height : 480 pixels
      Display Aspect ratio : 4/3
      Frame rate : 15.000 fps
      Bits/(Pixel*Frame) : 0.042
   Audio
      Codec : MPEG-1 Audio Layer 3
      Bit rate : 55 bps
      Channel(s) : 2 channels
      Sampling rate : 22 KHz
      Resolution : 16 bits
| cd/App/srcwget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz    tarxvf autoconf-2.69.tar.xzcdautoconf-2.69./configuremakemakeinstall | 
| cd/App/srcwget http://ftp.gnu.org/gnu/automake/automake-1.15.tar.xz  tarxvf automake-1.15.tar.xzcdautomake-1.15./configuremakemakeinstall | 
| cd/App/srcwget http://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.xztarxvf libtool-2.4.6.tar.xzcdlibtool-2.4.6./configuremakemakeinstall | 
| cd/App/srcwget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gztarxvf yasm-1.3.0.tar.gzcdyasm-1.3.0./configuremakemakeinstall | 
| echo'/usr/local/lib'>> /etc/ld.so.conf.d/local.conf | 
| cd/App/srcwget http://jaist.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz  tarxvf lame-3.99.5.tar.gzcdlame-3.99.5./configuremakemakeinstall | 
| #ifdef __cplusplusextern"C"{#endifchar*strcasestr(constchar*haystack, constchar*needle);#ifdef __cplusplus}#endif | 
| #ifdef __cplusplusextern"C++"{#endifconstchar*strcasestr(constchar*haystack, constchar*needle);#ifdef __cplusplus}#endif | 
| cd/App/srcwget http://jaist.dl.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.bz2 tarxvf faac-1.28.tar.bz2cdfaac-1.28./bootstrap./configure--with-mp4v2 #按前文修改mpeg4ip.h内容makemakeinstall | 
| cd/App/srcwget http://jaist.dl.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gztarxvf opencore-amr-0.1.3.tar.gzcdopencore-amr-0.1.3./configuremakemakeinstall | 
| # libvorbis需要libogg,先安装libogg库cd/App/srcwget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.xztarxvf libogg-1.3.2.tar.xzcdlibogg-1.3.2./configuremakemakeinstallcd/App/srcwget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xztarxvf libvorbis-1.3.5.tar.xzcdlibvorbis-1.3.5./configuremake
 如果出现下面的提示,cd .. 然后 echo /usr/local/lib >> /etc/ld.so.conf; ldconfig *** Could not run Ogg test program, checking why... *** The test program compiled, but did not run. This usually means *** that the run-time linker is not finding Ogg or finding the wrong *** version of Ogg. If it is not finding Ogg, you'll need to set your *** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point *** to the installed location Also, make sure you have run ldconfig if that *** is required on your system *** *** If you have an old version installed, it is best to remove it, although *** you may also be able to get things to work by modifying LD_LIBRARY_PATH configure: error: must have Ogg installed! | 
| cd/App/srcgit clone git://git.videolan.org/x264.gitcdx264./configure--enable-sharedmakemakeinstall | 
| cd/App/srcwget http://downloads.xvid.org/downloads/xvidcore-1.3.3.tar.bz2tarxvf xvidcore-1.3.3.tar.bz2cdxvidcore/build/generic./configuremakemakeinstall | 
| cd/App/srcwget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.xztarxvf libtheora-1.1.1.tar.xzcdlibtheora-1.1.1./configuremakemakeinstall | 
| cd/App/srcsvn co svn://svn.mplayerhq.hu/nut/src/trunklibnutcdlibnut./configuremakemakeinstall | 
| cd/App/src cdlibvpx./configure--enable-sharedmakemakeinstall | 
| cd/App/srcwget http://ffmpeg.org/releases/ffmpeg-2.6.3.tar.bz2tarxvf ffmpeg-2.6.3.tar.bz2cdffmpeg-2.6.3./configure--enable-version3 --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libxvid --enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads --enable-libnut --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-sharedmakemakeinstallldconfig | 
| git clone https://github.com/johnf/m3u8-segmentercdm3u8-segmenterPKG_CONFIG_PATH=/usr/local/lib/pkgconfig./configuremakemakeinstallln-s /usr/local/bin/m3u8-segmenter/usr/local/bin/segmenter | 
| yum deplist ffmpeg | grep-vffmpeg | grepprovider | awk'{print $2}'| sort-u | 
| rpm -e --nodeps a52dec dirac dirac-libs faac gsm lame libtheora opencore-amr SDL x264rpm -e --nodeps $(rpm -qa | grep-i ffmpeg) | 
方法二:
2.yum install ffmpeg ffmpeg-devel
3.rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
4.yum install mplayer mencoder


