【安裝 Priorities】
參考:http://wiki.centos.org/zh-tw/PackageManagement/Yum/Priorities

解決MPlayer 或 VLC Player.....多媒體套件無法安裝的問題,
因為官方版權的限制所以相關的多媒體套件在官方的套件庫是沒有提供的,所以我們需要安裝第三方套件庫,
同時安裝前也需要安裝 Priorities 套件來設定套件庫參考網站下載優先權,告知 yum 在官方套件庫找不到套件時前往第三方套件庫的順序。

步驟一:安裝 Priorities 套件
官方提供的套件庫,都是比較穩定的。要安裝第三方套件庫來源時就需要安裝 priorities 這個套件確保官方提供的套件庫下載順位在第一位。

CentOS-4 或 CentOS-6:
[root@localhost ~]# yum install yum-plugin-priorities

CentOS-5:
[root@localhost ~]# yum install yum-priorities

步驟二:修改與檢查 priorities.conf
[root@localhost ~]# vi /etc/yum/pluginconf.d/priorities.conf

[main]
enabled=1

步驟三:新增 obsoletes 套件屬性(非必須)
是否取代更新的版號套件
編輯 /etc/yum/pluginconf.d/priorities.conf

[main]
check_obsoletes=1

當 priorities 套件被啟用後,你可以加入下面一行為套件庫增設優先次序:
priority=N

步驟四:修改 CentOS-Base.repo
[root@localhost ~]# vi /etc/yum.repos.d/CentOS-Base.repo

[base]
...
priority=1

[addons]
...
priority=1

[updates]
...
priority=1

[extras]
...
priority=1

[centosplus]
...
priority=2

[contrib]
...
priority=2

 


安裝 RPMforge 第三方套件庫

安裝 RPMforge 套件

請先至 http://pkgs.repoforge.org/rpmforge-release/ 下載最新的 RPMforge 套件庫到你的電腦

[root@localhost ~]# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm

安裝 DAG 的 GPG 金鑰
[root@localhost ~]# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

檢查你所下載的套件
[root@localhost ~]# rpm -K rpmforge-release-0.5.2-2.el5.rf.i386.rpm

安裝
[root@localhost ~]# rpm -ivh rpmforge-release-0.5.2-2.el5.rf.i386.rpm

步驟四:修改 rpmforge.repo

# vi /etc/yum.repos.d/rpmforge.repo

[rpmforge]
...
priority=10

[rpmforge-extras]
...
priority=10

檢查更新
[root@localhost ~]# yum check-update

Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* base: mirror01.idc.hinet.net
* extras: mirror01.idc.hinet.net
* rpmforge: fr2.rpmfind.net
* updates: mirror01.idc.hinet.net
base                                         | 1.1 kB 00:00
extras                                       | 2.1 kB 00:00
rpmforge                                       | 1.1 kB 00:00
rpmforge/primary                                  | 4.0 MB 00:05
rpmforge                                       11046/11046
updates                                      | 1.9 kB 00:00
108 packages excluded due to repository priority protections

flash-plugin.i386          11.0.1.152-0.1.el5.rf          rpmforge

安裝 Macromedia 套件庫(提供 flash 支援如有安裝過就不用再安裝)
rpm -Uhv http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm

 


安裝相關多媒體函示庫套件

安裝 VideoLAN VLC Player
[root@localhost ~]# yum install compat-libstdc++-33 libdvdcss libdvdread libdvdplay libdvdnav lsdvd libquicktime

 


使用 YUM 安裝 MPlayer

安裝 MPlayer
[root@localhost ~]# yum install mplayerplug-in mplayer mplayer-gui gstreamer-ffmpeg gstreamer-plugins-bad gstreamer-plugins-ugly

 


使用 YUM 安裝 VLC Player

安裝 VideoLAN VLC Player
[root@localhost ~]# yum -y install vlc

注意:VLC 不能用 ROOT 帳號執行


使用 Source Code 重新編譯 VLC Player

最新版VLC:http://download.videolan.org/pub/videolan/vlc/last/

[root@localhost ~]# yum -y install glibc gcc gcc-c++ autoconf automake libtool
[root@localhost ~]# yum -y install yasm nasm
[root@localhost ~]# yum -y install lua-devel libmad-devel ffmpeg-devel a52dec-devel libxcb-devel libX11-devel mesa-libGLU-devel dbus-devel fribidi fribidi-devel poppler-qt4-devel libgcrypt-devel

[root@localhost ~]# wget -c http://download.videolan.org/pub/videolan/vlc/0.9.9a/vlc-0.9.9a.tar.bz2
[root@localhost ~]# tar -xvf vlc-0.9.9a.tar.bz2
[root@localhost ~]# cd vlc-0.9.9a
[root@localhost vlc-0.9.9a]# ./configure --enable-run-as-root --disable-qt4 --disable-skins2
[root@localhost vlc-0.9.9a]#  make
[root@localhost vlc-0.9.9a]#  make install 

[root@localhost ~]# yum install libmpeg2-devel

[root@localhost ~]# wget -c http://download.videolan.org/pub/libdvbpsi/0.1.6/libdvbpsi5-0.1.6.tar.bz2
[root@localhost ~]# tar -xvf libdvbpsi5-0.1.6.tar.bz2
[root@localhost ~]# cd libdvbpsi5-0.1.6
[root@localhost libdvbpsi5-0.1.6]# ./configure
[root@localhost libdvbpsi5-0.1.6]# make
[root@localhost libdvbpsi5-0.1.6]# make install

注意:VLC 不能用 ROOT 帳號執行


安裝編譯 FFMPEG 所需全部套件

檢查是否安裝 Priorities 與 RPMforge 第三方套件與相關設定,請檢查本頁最上面步驟

確認系統是最新的更新
[root@localhost ~]# yum -y update

更新所有用到的套件包含 Codec 與編譯所需套件
[root@localhost ~]# yum -y install lua-devel libmad-devel ffmpeg-devel libxcb-devel dbus-devel fribidi fribidi-devel poppler-qt4-devel libgcrypt-devel
[root@localhost ~]# yum -y install SDL-devel a52dec a52dec-devel alsa-lib-devel faac faac-devel faad2 faad2-devel
[root@localhost ~]# yum -y install freetype-devel giflib gsm gsm-devel imlib2 imlib2-devel lame lame-devel libICE-devel libSM-devel libX11-devel
[root@localhost ~]# yum -y install libXau-devel libXdmcp-devel libXext-devel libXrandr-devel libXrender-devel libXt-devel
[root@localhost ~]# yum -y install libid3tag libogg-devel libvorbis-devel mesa-libGL-devel mesa-libGLU-devel xorg-x11-proto-devel xvidcore xvidcore-devel zlib-devel
[root@localhost ~]# yum -y install amrnb-devel amrwb-devel
[root@localhost ~]# yum -y install libtheora libtheora-devel
[root@localhost ~]# yum -y install glibc gcc gcc-c++ autoconf automake libtool
[root@localhost ~]# yum -y install subversion
[root@localhost ~]# yum -y install ncurses-devel
[root@localhost ~]# yum -y install libdc1394 libdc1394-devel
[root@localhost ~]# yum -y install yasm nasm

安裝 x264 Library
查看是否有最新更新 http://download.videolan.org/pub/videolan/x264/snapshots/
下載最新版本:
[root@localhost ~]# wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/last_x264.tar.bz2

解壓縮:
[root@localhost ~]# bunzip2 last_x264.tar.bz2; tar xvf last_x264.tar

編譯前先確定 x264 沒有安裝過
[root@localhost ~]# yum erase x264*

編譯與安裝 x264
[root@localhost ~]# cd x264-xxxx
[root@localhost ~]# ./configure --enable-shared --prefix=/usr && make && make install


使用 YUM 安裝 FFMPEG

[root@localhost ~]# yum -y install ffmpeg

 


使用 Source Code 重新編譯 FFMPEG

[root@localhost ~]# yum -y install ffmpeg

 

參考來源網址:
http://wiki.centos.org/zh-tw/AdditionalResources/Repositories/RPMForge#head-3471c733c14056c58f8a274b2b22e7ac9f42bf4d

如何在 CentOS 5 設置多媒體
http://wiki.centos.org/zh-tw/TipsAndTricks/MultimediaOnCentOS

http://actychen.blogspot.com/2009/06/centos4flash9-install.html

編譯 VLC 參考
http://www.wretch.cc/blog/chunglai/25941416
http://www.nginxs.com/linux/459.html

ffmpeg 安裝參考
http://wiki.razuna.com/display/ecp/FFMpeg+Installation+on+CentOS+and+RedHat
http://hupuzhao.com/centos-5-ffmpeg-install

測試:
ffmpeg -i boa1.mpg -s 480x270 -vcodec libx264 -acodec aac -ac 1 -ar 16000 -r 13 -ab 32000 -aspect 16:9 -strict experimental output2.mp4


HTTP Live Streaing....
http://gps3939889.blogspot.com/2010/09/http-streaming-server-for-iphone.html

編譯 segmenter
# svn checkout http://httpsegmenter.googlecode.com/svn/trunk/ segmenter
# gcc -Wall -g segmenter.c -o segmenter -lavformat -lavcodec -lavutil -std=c99

轉換為 Apple http live streaming 格式
ffmpeg -i Sa_DingDing_Alive_720x480H264_2Mh.mpg -acodec libmp3lame -ab 96k -ac 2 -vcodec libx264 -s 320x240 -b 300k -level 30 -vpre slow -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -f mpegts - | segmenter - 10 test test.m3u8 http://10.2.2.95/

==OK==
ffmpeg -i Artbeats_1280x720H264_2M.mp4 -f mpegts -s 320x240 -acodec libmp3lame -ar 48000 -ab 96k -vcodec libx264 -b 384k -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bufsize 256k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -g 30 - | segmenter - 5 A5 A5.m3u8 http://10.2.2.94/

ffmpeg -i Jolin_Taiwan_Song_2010_320x240AVC.mp4 -f mpegts -acodec libmp3lame -ar 48000 -ab 128k -s 320*240 -vcodec libx264 -b 300k -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 96k -maxrate 300k -bufsize 300k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 31 -qdiff 4 -level 30 -aspect 320:240 -g 30 -async 1 test.ts

#!/bin/sh
BR=800k

echo ffmpeg -i $1 -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s 320*240 -vcodec libx264 -b $BR -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 96k -maxrate $BR -bufsize $BR -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 31 -qdiff 4 -level 30 -aspect 320:240 -g 30 -async 1 sample_$BR_pre.ts

echo segmenter sample_$BR_pre.ts 30 test test.m3u8 http://10.2.2.95/

echo rm -f sample_$BR_pre.ts
 

最後更新: 2011年11月25日

原文链接:http://60.251.58.66/Documents/Linux/CentOS/CentOS5&MultiMedia.asp