centos5.5上apache快速安装H264流媒体支持MP4-H264边下边播

时间:2024-04-17 18:04:24

2013年的某一天,客户反馈北京同事做的广告视频下载速度好慢,几MB的视频在手机上要下载接近一分钟才能开始播放。

我分析后发现两点:1)托管的服务器没支持流媒体;2)广告视频MP4并非流媒体格式。

对于第二点,腾讯QQ视频播放器或者其他专业的视频转换器都能支持把普通MP4转换成H264。

对于第一点,服务器,下面是一个简单的升级方法。

cd /tmp
wget http://people.apache.org/~pquerna/modules/mod_flvx.c
/opt/apache2/bin/apxs -i -a -c mod_flvx.c
wget http://h264.code-shop.com/download/apache_mod_h264_streaming-2.2.7.tar.gz
tar -zxvf apache_mod_h264_streaming-2.2.7.tar.gz
cd mod_h264_streaming-2.2.7/
./configure –with-apxs=/opt/apache2/bin/apxs
make
make install
vi /opt/apache2/conf/httpd.conf
添加以下4行:
LoadModule h264_streaming_module mod_h264_streaming.so
LoadModule mod_flvx.so
AddHandler h264-streaming.extensions .mp4
AddHandler flv-stream .flv

/etc/init.d/httpd restart