参考:
https://wiki.videolan.org/UnixCompile
下载libvlc源代码:
在 libvlc 源码下载页面中找个合适的版本下载,比如 vlc-2.1.1.tar.xz,下载后解压:
tar Jxvf vlc-2.1.1.tar.xz
Build、安装 libvcl:
1) 进入解压后的目录
./bootstrap
这时需要执行类似
yum install libtool.i686
的命令安装libtool
什么是libmad:libmad is a high-quality MPEG audio decoder capable of 24-bit output
打开 libmad 页面,按照其中的“Package Information” 下载libvlc 源码包 和 一个补丁,解压。
目前libmad(2014/01/26)的源码包是 libmad-0.15.1b.tar.gz,补丁是 libmad-0.15.1b-fixes-1.patch
这里的补丁是必须的,否则在make时会出现下面的错误:
unrecognized command line option "-fforce-mem"
libmad 页面 页面给出的 Build、安装libmad 的方法如下
patch -Np1 -i ../libmad-0.15.1b-fixes-1.patch sed "s@AM_CONFIG_HEADER@AC_CONFIG_HEADERS@g" -i configure.ac touch NEWS AUTHORS ChangeLog autoreconf -fi ./configure --prefix=/usr --disable-static make make install
#在 ffmpeg下载页面 中找个合适的版本下载,比如 ffmpeg.static.32bit.2014-01-25.tar.gz
#按照 CentosCompilationGuide 页面 中介绍的,
#【如果没有nasm(A portable x86 assembler which uses Intel-like syntax),则要先 yum install nasm】
# How to install FFmpeg on CentOS using yum 介绍了如何通过yum install搞定ffmpeg-devel及其所有依赖
参考《CentOS下build ffmpeg库》安装ffmpeg库
在alsa下载页面中,下载合适版本的Library (alsa-lib),如1.0.27.2,解压缩。
这时如果先忽略alsa的依赖:./configure --enable-alsa=no --enable-shared=yes,build vlc库会成功,在运行这里的vlc小例子时,如果遇到下面的问题,先yum install libcanberra-devel
Gtk-Message: Failed to load module "canberra-gtk-module": libcanberra-gtk-module.so: cannot open shared object file: No such file or directory
如果出现下面的错误提示[0x7fd1f0008558] avi demux error: no key frame set for track 1 [0x7fd1f000aab8] main decoder error: no suitable decoder module for fourcc `DIV3'. VLC probably does not support this sound or video format. [0x7fd1f000aab8] main decoder error: No suitable decoder module [0x7fd1f000aab8] main decoder error: VLC does not support the audio or video format "DIV3". Unfortunately there is no way for you to fix this. [0x7fd1e4000958] main audio output error: no suitable audio output module [0x7fd1f000aab8] main decoder error: failed to create audio output [0x7fd1f0c1ede8] main decoder error: no suitable decoder module for fourcc `h264'. VLC probably does not support this sound or video format. [0x7fd1f0c1ede8] main decoder error: No suitable decoder module [0x7fd1f0c1ede8] main decoder error: VLC does not support the audio or video format "h264". Unfortunately there is no way for you to fix this. [0x7fd1e4006b78] main audio output error: no suitable audio output module [0x7fd1f0c1ede8] main decoder error: failed to create audio output
在编译 vlc 的时候,先执行下面的 configure,然后其他都同上
做完上面所有操作,然后运行 这里的vlc小例子,打开一个 .avi 文件,结果出现下面的错误./configure --enable-run-as-root=yes --enable-debug=yes --enable-shared=yes --enable-alsa=yes --enable-merge-ffmpeg=yes --enable-avcodec=yes --enable-twolame=yes --enable-faad=yes --enable-freetype=yes --enable-pulse=yes --enable-realrtsp=yes --enable-wma-fixed=yes --enable-shine=yes
[0x7f285400ad68] avi demux error: no key frame set for track 1 [0x7f285400d1c8] main decoder error: no suitable decoder module for fourcc `DIV3'. VLC probably does not support this sound or video format. [0x7f285400d1c8] main decoder error: No suitable decoder module [0x7f285400d1c8] main decoder error: VLC does not support the audio or video format "DIV3". Unfortunately there is no way for you to fix this. ../../include/vlc_xlib.h:46:vlc_xlib_init: Xlib not initialized for threads. This process is probably using LibVLC incorrectly. Pass "--no-xlib" to libvlc_new() to fix this. [0x7f285c001828] pulse audio output error: Xlib not initialized for threads [0x7f285c001828] main audio output error: no suitable audio output module [0x7f285400d1c8] main decoder error: failed to create audio output
根据这个帖子中说的,执行
vlc --list |grep ffmpeg
结果没有搜到,说明对于 vlc 库来说,ffmpeg 插件没有正确安装上!