Liunx下安裝ffmpeg,支持視頻H264,音頻MP3和AAC格式

以下操作自測通過!CentOS系統

這個視頻轉換讓我很是糾結,windows下更糾結!先把Liunx下成功案例公佈一下,供大家參考,歡迎拍磚

部分摘抄自 http://blog.csdn.net/luka2008/article/details/21243499

Codecs

Xvid Codec

Visit the Xvid site to retrieve the latest version of the codec.

1
2
3
4
5
6
7
tar -zxvf xvidcore-1.3.2.tar.gz
cd xvidcore/build/generic
./configure
make 
make install
ldconfig

Lame Codec

Visit the LAME MP3 Encoder project to obtain their latest version.

1
2
3
4
5
6
7
tar -zxvf lame-3.98.4.tar.gz
cd lame-3.98.4
./configure
make 
make install
ldconfig

Faac Codec

Visit the AudioCoding site for the latest version of the codec.

1
2
3
4
5
6
7
8
tar -zxvf faac-1.28.tar.gz
cd faac-1.28
./bootstrap
./configure
make 
make install
ldconfig

OpenCore AMR Codec

Get the latest version of OpenCore AMR from their repository at SourceForge.

1
2
3
4
5
6
7
tar -zxvf opencore-amr-0.1.2.tar.gz
cd opencore-amr-0.1.2
./configure
make 
make install
ldconfig

OGG Codec

Visit Xiph.org for the latest version of libogg.

1
2
3
4
5
6
7
tar -zxvflibogg-1.3.0.tar.gz
cd libogg-1.3.0
./configure
make 
make install
ldconfig

Vorbis Codec

Visit Xiph.org for the latest version of Vorbis (libvorbis).

1
2
3
4
5
6
7
tar -jxvf libvorbis-1.3.2.tar.bz2
cd libvorbis-1.3.2
./configure
make 
make install
ldconfig
 

Theora Codec

Visit Theora.org for the latest version of Theora (libtheora).

1
2
3
4
5
6
7
tar -jxvf libtheora-1.1.1.tar.bz2
cd libtheora-1.1.1
./configure
make 
make install
ldconfig

x264

1
2
3
4
5
6
這個不知道在哪下載,如果找不到就娶我的資源裏下載吧點擊打開鏈接下載后里面的包只需要找到你需要的安裝即可)

cd x264-snapshot-20140502-2245
./configure --enable-static
make 
make install
ldconfig
cd

FFMPEG

1
2
3
4
5
6
7
8
9
同樣可以去我資源中下載,解壓後,進入目錄執行以下命令點擊打開鏈接(下載后里面的包只需要找到你需要的安裝即可)

   ./configure --enable-version3 --enable-libopencore-amrnb  
   --enable-libopencore-amrwb   --enable-libfaac  --enable-libmp3lame 
   --enable-libtheora --enable-libvorbis  --enable-libx264 --enable-libxvid 
   --enable-gpl --enable-postproc  --enable-nonfree
make 
make install
ldconfig
如果你看到類似於“libxxx.so找不到”的錯誤提示,解決辦法如下:
    (1).表象:ffmpeg運行的時候試圖去鏈接libxxx.so,但是卻找不到相應的libxxx.so。
    (2).疑惑:我之前明明安裝了libxxx.so的。
    (3).原因:程序運行的時候默認是去/usr/lib下找libxxx.so,但是我們之前安裝的確實在/usr/local/lib下,所以造成這個報錯。
    (4).解決辦法:有很多,我說一種我親測過的。
    在/etc/ld.so.conf文件中添加一行/usr/local/lib,當然是用root用戶啦。然後執行ldconfig命令使得剛纔的修改生效,完了再運行ffmpeg的轉碼命令試試,可以了吧。
   如果還是不可以,則這是因爲SELINUX的問題,需要關閉SELINX,執行/usr/sbin/setenforce 0
    我們經常由於默認系統的安全性配置導致些莫名其妙的問題,比如SElinux本來是用於安全子系統的權限控制,可是搞不好就發現限制多多,我們可以用如下方法快速關閉SElinux 
/usr/sbin/setenforce 0 立刻關閉 SELINUX
/usr/sbin/setenforce 1 立刻啓用 SELINUX

加到系統默認啓動裏面
echo "/usr/sbin/setenforce 0" >> /etc/rc.local
OVER
本人在LiUNX下自測方法
ffmpeg -i 待轉視頻路徑及視屏名稱 -vcodec libx264 -acodec mp3 -strict -2  -ab 64k -ar 44100 -y 存放視頻路徑+test.mp4 (MP3音頻格式視頻

ffmpeg -i 待轉視頻路徑及視屏名稱 -vcodec libx264 -acodec aac -strict -2  -ab 64k -ar 44100 -y 存放視頻路徑+test.mp4 (AAC音頻格式視頻

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章