'Privacy is not something that We merely entitled to, it's an absolute prerequisite'
Strong advocate of privacy, anonymity and network neutrality since 2009.
UpdateS and news
WEBCARE360 BLOG: GET ALL LATEST NEWS, UPDATES AND PROMOTIONS
16
Sep / 13

H.264 and FLV streaming for apache/nginx on cPanel/WHM (centos)


CATEGORY: Knowldge Base

Here is the phase/steps we conducted when we installed and tested h264 and flvx streaming modules in WHM/cPanel based apache 2.2.x running on centos 6.4 64bit.

Installing these two modules H.264 and FLV for streaming enables visitors to seek/forward to any position during video, and beneficially browser (flash player) will buffer only from selected position to the end, which would save the bandwidth and provide ease of video streaming.

 

To install h264 streaming (h264_streaming_module)

#; cd /usr/local/src && wget http://bit.ly/1eI99qP -O apache_mod_h264_streaming-2.2.7.tar.gz
#; tar -zxvf apache_mod_h264_streaming-2.2.7.tar.gz && cd mod_h264_streaming-*
#; ./configure && make && make install

To install flv streaming (flvx_module)

 Since most commonly WHM/cPanel is used, the apache development headers should already installed. 

(If you are using a normal version of CentOS without WHM/cPanel,  then consider using this command to install apache development package : #; yum install httpd-devel)

 

#; cd /usr/local/src && wget http://bit.ly/1djHw3c -O mod_flvx.c && apxs -c -i ./mod_flvx.c
 

Adding modules in configuration file. (In case WHM/cPanel isn’t installed or for custom scenario, you can add it manually, via editing /etc/httpd/httpd.conf, but it would be removed every time you recompile Apache via EasyApache.) For whm/cpanel, add two of the compiled modules into Apache configuration Open WHM » Service Configuration » Apache Configuration » Include Editor >> Pre Main Include (All versions)

Add below lines, update settings, restart apache.

# H264 streaming module enabled for mp4 files
AddHandler h264-streaming.extensions .mp4
LoadModule h264_streaming_module /usr/local/apache/modules/mod_h264_streaming.so

# flvx streaming module enabled for flv files
LoadModule flvx_module /usr/local/apache/modules/mod_flvx.so
AddHandler flv-stream .flv
To check if both the modules installed correctly, execute below command in terminal.

#; httpd -M | egrep -e “(h264|flvx)”

  • h264_streaming_module (shared)
  • flvx_module (shared)

 

Tested under below environment

  • CentOS 6.4  x86_64 with extra repositories epel and rpmforge.
  • cPanel / WHM
  • Apache 2.2.x

 


 

For optimizing Nginx for video streaming sites :

 

To verify if flv/mp4 streaming modules enabled, #; nginx -V

command’s output should contain   `–with-http_flv_module` and `–with-http_mp4_module `.

 

Below configuration code should be included within server { …. } in nginx configuration file with needed adjustment.

location ~*.*\.(flv|mp4)$ {
 gzip off;
 flv;
 mp4;
 mp4_buffer_size 4M;
 mp4_max_buffer_size 10M;
 limit_rate_after 10m;
 limit_rate 1m;
 root /var/html/www/;
 }
 

 

 


 

  • To restart Apache Web Server: #; service httpd restart
  • To restart Nginx: #; service nginx restart
  • To check running web server on port :80 #; netstat -tunpl | grep :80

 


  • share on facebook
  • share on twitter
  • share via email