在CentOS-4.4 x86_64安裝FFmpeg (非原創)

來源:互聯網
上載者:User
 
 
本文提到的安裝方式基本都是採用原始碼編譯的方式,非RPM包安裝,請讀者注意。
FFmpeg軟體只是個解碼編碼軟體,如果支援多種格式必須先安裝好對應的庫,下面就說下我裝的庫:
1. 安裝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

2. 安裝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

3. 安裝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

4. 安裝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

5. 安裝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

6. 安裝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

7. 安裝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

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 
# ./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

16. 其他:
本文中沒有提到libgsm的安裝,請參考下面的資料。

 

 原文地址 http://www.blogjava.net/javaren/articles/install_ffmpeg_on_linux_64bit.html
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.