环境:CentOS 6.3 + VLC 2.0.5
1、下载源码:
wget http://download.videolan.org/pub/videolan/vlc/2.0.5/vlc-2.0.5.tar.xz
2、检查依赖关系,根据情况安装需要的软件
cd vlc-2.0.5/extras/tools/
./bootstrap
cd ../..
./bootstrap
3、安装autoconf
由于系统默认的autoconf-2.63版本低了,编译vlc最低要2.69的
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar xzf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure && make && make install && make clean && cd ..
4、安装ffmpeg
安装ffmpeg,而不是libav,ffmpeg中包含libpostproc
wget http://ffmpeg.mplayerhq.hu/releases/ffmpeg-1.2.tar.gz
tar zxvf ffmpeg-1.2.tar.gz
cd ffmpeg-1.2
make distclean # 防止报"relocation R_X86_64_PC32 against undefined symbo"这样的错误
CFLAGS=-fPIC ./configure --enable-shared --enable-gpl --enable-nonfree && make && make install
在文件/etc/profile末尾加入:
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
注:/usr/local是ffmpeg的默认安装路径
执行:
source /etc/profile 或 ". /etc/profile"
否则会报如下错误:
...
checking for AVCODEC... no
configure: error: Could not find libavcodec or libavutil. Use --disable-avcodec to ignore this error.
...
5、安装libmad
wget http://downloads.sourceforge.net/mad/libmad-0.15.1b.tar.gz
tar zxvf libmad-0.15.1b.tar.gz
cd libmad-0.15.1b
sed -i '/-fforce-mem/d' configure && ./configure --prefix=/usr && make && make install
6、安装liba52
wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
tar zxvf a52dec-0.7.4.tar.gz
cd a52dec-0.7.4 && ./configure --prefix=/usr --mandir=/usr/share/man --enable-shared --disable-static CFLAGS="-g -O2 $([ $(uname -m) = x86_64 ] && echo -fPIC)" && make && make install
5、安装其它依赖包
yum install dbus-devel libcddb-devel libva* libxcb-devel ghc-OpenGL-devel -y
yum install alsa-lib-devel -y # 相关错误 configure: error: No package 'alsa' found. alsa-lib 1.0.16 or later required
yum install libgcrypt-devel -y # 相关错误 configure: error: libgcrypt version 1.1.94 or higher not found. Install libgcrypt or use --disable-libgcrypt.
6、安装vlc:
cd vlc-2.0.5 && ./configure --enable-run-as-root && make && make install