Install Red5 Media Server on Ubuntu / Debian

Hits: 4872  

Red5 is free media server based on Java and other open source frameworks. It support FLV, F4V, MP4, 3GP, MP3, F4A, M4A, AAC and protocols like RTMP, RTMPT, RTMPS, RTMPE.

Install Red5 Media server
# apt-get install red5-server

Red5 Need below ports open in firewall / iptable
RTMP: 1935
Debug proxy: 1936
HTTP servlet: 5080
RTMPT: 8088

Red5 Installed location

Red5 application in the location

Install demo Red5 Applications
# wget
# mkdir red5/
# cd red5
# unzip ../
# cd red5-server-1.0/
# cp -R webapps/root/demos /var/lib/red5/webapps/root/demos
# cp -R webapps/installer /var/lib/red5/webapps/installer
# find /var/lib/red5/webapps/ -type d -exec chown _red5 {} \;
# /etc/init.d/red5-server restart

Red5 Installer

Red5 Demo


Hits: 4285  

It’s easy to convert PHP Array to Select Dropdown Box… you need to loop for all element in array to display as dropdown. But may be you ever think for reverse process. Yes, it’s also easy!

You need to scrape / crawl Select box HTML to get PHP Array back from HTML Select Box. Please read our articles for xpath here



$s = '<select name="country">
<option value="">Country...</option>
<option value="AF">Afghanistan</option>
<option value="AL">Albania</option>
<option value="DZ">Algeria</option>
<option value="AS">American Samoa</option>
<option value="AD">Andorra</option>
<option value="AG">Angola</option>
<option value="AI">Anguilla</option>
<option value="AG">Antigua &amp; Barbuda</option>
<option value="AR">Argentina</option>
<option value="AA">Armenia</option>
<option value="AW">Aruba</option>
<option value="AU">Australia</option>
<option value="AT">Austria</option>
<option value="AZ">Azerbaijan</option>
<option value="BS">Bahamas</option>
<option value="BH">Bahrain</option>
<option value="BD">Bangladesh</option>
<option value="BB">Barbados</option>
<option value="BY">Belarus</option>
<option value="BE">Belgium</option>
<option value="BZ">Belize</option>
<option value="BJ">Benin</option>
<option value="BM">Bermuda</option>
<option value="BT">Bhutan</option>
<option value="BO">Bolivia</option>
<option value="BL">Bonaire</option>
<option value="BA">Bosnia &amp; Herzegovina</option>
<option value="BW">Botswana</option>
<option value="BR">Brazil</option>
<option value="BC">British Indian Ocean Ter</option>
<option value="BN">Brunei</option>
<option value="BG">Bulgaria</option>
<option value="BF">Burkina Faso</option>
<option value="BI">Burundi</option>
<option value="KH">Cambodia</option>
<option value="CM">Cameroon</option>
<option value="CA">Canada</option>
<option value="IC">Canary Islands</option>
<option value="CV">Cape Verde</option>
<option value="KY">Cayman Islands</option>
<option value="CF">Central African Republic</option>
<option value="TD">Chad</option>
<option value="CD">Channel Islands</option>
<option value="CL">Chile</option>
<option value="CN">China</option>
<option value="CI">Christmas Island</option>
<option value="CS">Cocos Island</option>
<option value="CO">Colombia</option>
<option value="CC">Comoros</option>
<option value="CG">Congo</option>
<option value="CK">Cook Islands</option>
<option value="CR">Costa Rica</option>
<option value="CT">Cote D\'Ivoire</option>
<option value="HR">Croatia</option>
<option value="CU">Cuba</option>
<option value="CB">Curacao</option>
<option value="CY">Cyprus</option>
<option value="CZ">Czech Republic</option>
<option value="DK">Denmark</option>
<option value="DJ">Djibouti</option>
<option value="DM">Dominica</option>
<option value="DO">Dominican Republic</option>
<option value="TM">East Timor</option>
<option value="EC">Ecuador</option>
<option value="EG">Egypt</option>
<option value="SV">El Salvador</option>
<option value="GQ">Equatorial Guinea</option>
<option value="ER">Eritrea</option>
<option value="EE">Estonia</option>
<option value="ET">Ethiopia</option>
<option value="FA">Falkland Islands</option>
<option value="FO">Faroe Islands</option>
<option value="FJ">Fiji</option>
<option value="FI">Finland</option>
<option value="FR">France</option>
<option value="GF">French Guiana</option>
<option value="PF">French Polynesia</option>
<option value="FS">French Southern Ter</option>
<option value="GA">Gabon</option>
<option value="GM">Gambia</option>
<option value="GE">Georgia</option>
<option value="DE">Germany</option>
<option value="GH">Ghana</option>
<option value="GI">Gibraltar</option>
<option value="GB">Great Britain</option>
<option value="GR">Greece</option>
<option value="GL">Greenland</option>
<option value="GD">Grenada</option>
<option value="GP">Guadeloupe</option>
<option value="GU">Guam</option>
<option value="GT">Guatemala</option>
<option value="GN">Guinea</option>
<option value="GY">Guyana</option>
<option value="HT">Haiti</option>
<option value="HW">Hawaii</option>
<option value="HN">Honduras</option>
<option value="HK">Hong Kong</option>
<option value="HU">Hungary</option>
<option value="IS">Iceland</option>
<option value="IN">India</option>
<option value="ID">Indonesia</option>
<option value="IA">Iran</option>
<option value="IQ">Iraq</option>
<option value="IR">Ireland</option>
<option value="IM">Isle of Man</option>
<option value="IL">Israel</option>
<option value="IT">Italy</option>
<option value="JM">Jamaica</option>
<option value="JP">Japan</option>
<option value="JO">Jordan</option>
<option value="KZ">Kazakhstan</option>
<option value="KE">Kenya</option>
<option value="KI">Kiribati</option>
<option value="NK">Korea North</option>
<option value="KS">Korea South</option>
<option value="KW">Kuwait</option>
<option value="KG">Kyrgyzstan</option>
<option value="LA">Laos</option>
<option value="LV">Latvia</option>
<option value="LB">Lebanon</option>
<option value="LS">Lesotho</option>
<option value="LR">Liberia</option>
<option value="LY">Libya</option>
<option value="LI">Liechtenstein</option>
<option value="LT">Lithuania</option>
<option value="LU">Luxembourg</option>
<option value="MO">Macau</option>
<option value="MK">Macedonia</option>
<option value="MG">Madagascar</option>
<option value="MY">Malaysia</option>
<option value="MW">Malawi</option>
<option value="MV">Maldives</option>
<option value="ML">Mali</option>
<option value="MT">Malta</option>
<option value="MH">Marshall Islands</option>
<option value="MQ">Martinique</option>
<option value="MR">Mauritania</option>
<option value="MU">Mauritius</option>
<option value="ME">Mayotte</option>
<option value="MX">Mexico</option>
<option value="MI">Midway Islands</option>
<option value="MD">Moldova</option>
<option value="MC">Monaco</option>
<option value="MN">Mongolia</option>
<option value="MS">Montserrat</option>
<option value="MA">Morocco</option>
<option value="MZ">Mozambique</option>
<option value="MM">Myanmar</option>
<option value="NA">Nambia</option>
<option value="NU">Nauru</option>
<option value="NP">Nepal</option>
<option value="AN">Netherland Antilles</option>
<option value="NL">Netherlands (Holland, Europe)</option>
<option value="NV">Nevis</option>
<option value="NC">New Caledonia</option>
<option value="NZ">New Zealand</option>
<option value="NI">Nicaragua</option>
<option value="NE">Niger</option>
<option value="NG">Nigeria</option>
<option value="NW">Niue</option>
<option value="NF">Norfolk Island</option>
<option value="NO">Norway</option>
<option value="OM">Oman</option>
<option value="PK">Pakistan</option>
<option value="PW">Palau Island</option>
<option value="PS">Palestine</option>
<option value="PA">Panama</option>
<option value="PG">Papua New Guinea</option>
<option value="PY">Paraguay</option>
<option value="PE">Peru</option>
<option value="PH">Philippines</option>
<option value="PO">Pitcairn Island</option>
<option value="PL">Poland</option>
<option value="PT">Portugal</option>
<option value="PR">Puerto Rico</option>
<option value="QA">Qatar</option>
<option value="ME">Republic of Montenegro</option>
<option value="RS">Republic of Serbia</option>
<option value="RE">Reunion</option>
<option value="RO">Romania</option>
<option value="RU">Russia</option>
<option value="RW">Rwanda</option>
<option value="NT">St Barthelemy</option>
<option value="EU">St Eustatius</option>
<option value="HE">St Helena</option>
<option value="KN">St Kitts-Nevis</option>
<option value="LC">St Lucia</option>
<option value="MB">St Maarten</option>
<option value="PM">St Pierre &amp; Miquelon</option>
<option value="VC">St Vincent &amp; Grenadines</option>
<option value="SP">Saipan</option>
<option value="SO">Samoa</option>
<option value="AS">Samoa American</option>
<option value="SM">San Marino</option>
<option value="ST">Sao Tome &amp; Principe</option>
<option value="SA">Saudi Arabia</option>
<option value="SN">Senegal</option>
<option value="RS">Serbia</option>
<option value="SC">Seychelles</option>
<option value="SL">Sierra Leone</option>
<option value="SG">Singapore</option>
<option value="SK">Slovakia</option>
<option value="SI">Slovenia</option>
<option value="SB">Solomon Islands</option>
<option value="OI">Somalia</option>
<option value="ZA">South Africa</option>
<option value="ES">Spain</option>
<option value="LK">Sri Lanka</option>
<option value="SD">Sudan</option>
<option value="SR">Suriname</option>
<option value="SZ">Swaziland</option>
<option value="SE">Sweden</option>
<option value="CH">Switzerland</option>
<option value="SY">Syria</option>
<option value="TA">Tahiti</option>
<option value="TW">Taiwan</option>
<option value="TJ">Tajikistan</option>
<option value="TZ">Tanzania</option>
<option value="TH">Thailand</option>
<option value="TG">Togo</option>
<option value="TK">Tokelau</option>
<option value="TO">Tonga</option>
<option value="TT">Trinidad &amp; Tobago</option>
<option value="TN">Tunisia</option>
<option value="TR">Turkey</option>
<option value="TU">Turkmenistan</option>
<option value="TC">Turks &amp; Caicos Is</option>
<option value="TV">Tuvalu</option>
<option value="UG">Uganda</option>
<option value="UA">Ukraine</option>
<option value="AE">United Arab Emirates</option>
<option value="GB">United Kingdom</option>
<option value="US">United States of America</option>
<option value="UY">Uruguay</option>
<option value="UZ">Uzbekistan</option>
<option value="VU">Vanuatu</option>
<option value="VS">Vatican City State</option>
<option value="VE">Venezuela</option>
<option value="VN">Vietnam</option>
<option value="VB">Virgin Islands (Brit)</option>
<option value="VA">Virgin Islands (USA)</option>
<option value="WK">Wake Island</option>
<option value="WF">Wallis &amp; Futana Is</option>
<option value="YE">Yemen</option>
<option value="ZR">Zaire</option>
<option value="ZM">Zambia</option>
<option value="ZW">Zimbabwe</option>

$doc = new DOMDocument();
$xpath = new DOMXPath($doc);

$options = $xpath->query('*/select/option');


$values = array();
foreach ($options as $option) {

     $in = $option->getAttribute('value'); 
	 if($in=="") $in = rand(0,2);
	 $values[$in] = $option->textContent;

echo "$"."z = ".var_export($values, true).";";


You can apply same logic for more HTML elements using xpath...

Download Select2Array.php

Install AWStats with GeoIP Plugin

Hits: 6882  

AWStats is a free analytic tool that generates web, streaming, ftp or mail server statistics, graphically. There are many log analyzer but AWStats is open source Web analytics reporting tool, It can analyze log files from Apache, WebStar, IIS.

Installing AWStats on ubuntu 12.04

# apt-get install awstats

Configuring for replace with your real domain

# cp /etc/awstats/awstats.conf /etc/awstats/
# vi /etc/awstats/

Check you have below settings in /etc/awstats/


Generate stats for AWStats for /var/log/apache2/access.log file (Make sure you have fresh log file)

# /usr/lib/cgi-bin/ -update

configuration Apache2 with password

# htpasswd -c /etc/awstats/awstats.pwd admin
# chmod 755 /etc/awstats/awstats.pwd

# vi /etc/apache2/sites-available/awstats

<VirtualHost *:80>
DocumentRoot /var/www
ErrorLog ${APACHE_LOG_DIR}/error_awstats.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access_awstats.log combined
<Directory “/usr/lib/cgi-bin/”>
<Files “”>
Options +ExecCGI
Alias /awstats-icon/ “/usr/share/awstats/icon/”
<Directory /usr/share/awstats/icon>
Options None
AllowOverride All
Order allow,deny
Allow from all
RewriteEngine on
RewriteRule /awstats-icon – [L]
RewriteCond %{QUERY_STRING} !^(.*&)?framename=index(&.*)?$
RewriteCond %{QUERY_STRING} ^(.*&)?framename=.*(&.*)?$
RewriteRule /(.*) /usr/lib/cgi-bin/ [L]
RewriteCond %{QUERY_STRING} ^(.*&)?config=([^&]*)(&(.*))?$
RewriteRule /.* /%2?%1%4 [R,L]
RewriteRule /$ / [R,L]
RewriteRule /([^/]*)(/.*)? /usr/lib/cgi-bin/$1 [QSA,L]
<Location />
SetHandler cgi-script
Satisfy any
Order deny,allow
Deny from all
AuthType Basic
AuthName “AWStats Access”
AuthUserFile /etc/awstats/awstats.pwd
require valid-user
<LocationMatch /(?!|robots.txt)$>
Require user admin
<Location /awstats-icon>
SetHandler None
Allow from all

Enable Virtual Host

# a2ensite awstats
# apache2ctl configtest
# /etc/init.d/apache2 reload

Auto update stats

# crontab -e

*/10 * * * * /usr/share/awstats/tools/
10 03 * * * /usr/share/awstats/tools/
*/10 * * * * /usr/lib/cgi-bin/ -update > /dev/null

Set proper permission on logs

# sudo chmod 644 -R /var/log/apache2/*
# chmod 644 /var/log/apache2

# vi /etc/logrotate.d/apache2   (Replace create 640 root adm with create 644 root adm)

Install GeoIP for AWStats

# apt-get install build-essential zlib1g-dev apg libgeo-ipfree-perl libnet-ip-perl libnet-dns-perl liburi-perl apache2-utils

# cd /usr/src/
# wget
# tar xvzf zlib-1.2.8.tar.gz
# cd zlib-1.2.8
# ./configure –prefix=/usr/local/zlib && make && make install

# wget
# tar xzvf GeoIP-latest.tar.gz
# cd GeoIP-1.6.0
# ./configure && make && make install

# cpan
> install YAML
> install Geo::IP Geo::IPfree Geo::IP::PurePerl URI::Escape Net::IP Net::DNS Net::XWhois Time::HiRes Time::Local
> quit

# cd /usr/src/
# wget
# gzip -d GeoLiteCity.dat.gz
# cp GeoLiteCity.dat /usr/share/GeoIP/GeoLiteCity.dat

Enable AWSTAT configuation for LoadPlugin

# vi /etc/awstats/

Remove comment from /etc/awstats/

LoadPlugin=”geoip GEOIP_STANDARD /usr/share/GeoIP/GeoIP.dat”
LoadPlugin=”geoip_city_maxmind GEOIP_STANDARD /usr/share/GeoIP/GeoLiteCity.dat”

# /etc/init.d/apache2 reload

AWStats will run here




Error opening /usr/share/GeoIP/GeoIPCity.dat at /usr/local/share/perl/5.14.2/Geo/IP/ line [file name in /usr/share/GeoIP]

Make sure you have all files in folder /usr/share/GeoIP/GeoLiteCity.dat else copy

# cp /usr/share/GeoIP/GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat


Other log file analysis and reporting tools

Install Red5 1.0.1 on CentOS release 6.5 (Final) 64-Bit

Hits: 8875  

Contact us for Red5 HLS Plugin

Red5 MySQL Authentication Plugin

Wowza MySQL Authentication Plugin

1. Install Java

# yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel

2. Install Ant

# cd /usr/local/src
# wget
# tar zxvf apache-ant-1.8.2-bin.tar.gz
# mv apache-ant-1.8.2 /usr/local/ant

3. Export path for Ant and Java

# export ANT_HOME=/usr/local/ant
# export JAVA_HOME=/usr/lib/jvm/java
# export PATH=$PATH:/usr/local/ant/bin
# export CLASSPATH=.:$JAVA_HOME/lib/

Also add these lines in /etc/bashrc at last to available every-time logged in to SSH

# echo ‘export ANT_HOME=/usr/local/ant’ >> /etc/bashrc
# echo ‘export JAVA_HOME=/usr/lib/jvm/java’ >> /etc/bashrc
# echo ‘export PATH=$PATH:/usr/local/ant/bin’ >> /etc/bashrc
# echo ‘export CLASSPATH=.:$JAVA_HOME/lib/’ >> /etc/bashrc

4. Install RED5 Server

# cd /usr/local/src
# wget
# tar zxvf red5-1.0.1.tar.gz
# mv /usr/local/src/red5-server-1.0 /usr/local/red5

5. Create a service for Red5 to start and stop

# wget -O /etc/init.d/red5
# chmod +x /etc/init.d/red5

6. Allow port 5080 and 1935 to your server firewall

# iptables -A INPUT -p tcp -m tcp –dport 5080 -j ACCEPT
# iptables -A INPUT -p tcp -m tcp –dport 1935 -j ACCEPT

make sure you have double hyphen no space (- -) in dport option

OR allow from WHM


7. Red5 Server Command

# /etc/init.d/red5 start
# /etc/init.d/red5 stop
# /etc/init.d/red5 status

# netstat -anp | grep 5080
# ps aux | grep red5

Go to to test Red5 Server Videos over RTMP


Wowza Live Stream Countdown

Hits: 2936  

Live Stream Time


function timeElapsed($originalTime){

		return $timeElapsed;

//$Details['datetimepicker'] = "06/26/2014 11:42 am";  // coming from database

$dtp = timeElapsed( strtotime($Details['datetimepicker']) );

var myCountdownTest = new Countdown({
			time: <?php echo $dtp; ?>,
			width	: 300, 
			height	: 50,
			labelText	: 	{
			second 	: "SECONDS",
			minute 	: "MINUTES",
			hour	: "HOURS",
			day 	: "DAYS",
			month 	: "MONTHS",
			year 	: "YEARS"			
			onComplete : doneHandler

Live Video Stream will be coming

Download Code:

Radio Song Album Artwork Cover by YouTube

Hits: 3376  

An album cover is the front / other side of the packaging of a commercially released audio recording product, or album.

You can find online APIs or Websites where artwork available

– Amazon
– LastFM
– Soundcloud
– Apple iTune
– Google Play
– Gracenote
– Free Music Archive

And many more ….

But YouTube is the best source where you can get Album / Song Cover Image for every Title

YouTube provide gdata API to search songs as video title to get image

Deprecated Features for YouTube API v2.0

YouTube Data API (v3)<search term>


$q = isset($_REQUEST['q'])?$_REQUEST['q']:"";

//thumbnail -> sqDefault, hqDefault

// orderby -> title, relevance, published

<div id="videos"></div>
<!-- Include the latest jQuery library -->
<script src=""></script>
<script type="text/javascript">

jQuery.getJSON('<?php echo $q; ?>&max-results=1&v=2&alt=jsonc&orderby=relevance', function(data) {
    var output="<ul>";
    for (var i in {
		output+="<li><img src='" +[i].thumbnail.hqDefault + "' /></li>";
		output+="<li>" +[i].title + "</li>";
	var output="</ul>";


How you can get cover image?

song album artwork

Re Stream Radio Shoutcast / Icecast using Node JS

Hits: 5342  

Re-stream Radio (Shoutcast/Icecast) Stream using Node.JS and get Metadata current playing song title… Use port forwarding to hide real shoutcast IP …. Avoid PHP script to damage Server with too many calls on radio server

Start Restream

> node radio.js

node.js>node radio.js
Server running at

Radio Stream connected!
{ ‘icy-notice1’: ‘<BR>This stream requires <a href=”http’,
‘icy-notice2’: ‘SHOUTcast Distributed Network Audio Server/Linux v1.9.8<BR>’,
‘icy-name’: ‘Radio HSL – Hit Hai Toh Bajega!’,
‘icy-genre’: ‘Indian Hindi Top40’,
‘icy-url’: ‘http’,
‘content-type’: ‘audio/mpeg’,
‘icy-pub’: ‘1’,
‘icy-metaint’: ‘32768’,
‘icy-br’: ’64’ }
StreamTitle=’Bullett Raja – Tamanche Pe Disco [1e92]’;StreamUrl=”;

Get MetaData

> node radio-metadata.js

node.js>node radio-metadata.js
Server listening on port 8079
Radio Stream connected!
StreamTitle=’Bullett Raja – Tamanche Pe Disco [1e92]’;StreamUrl=”;

Output in browser:
“StreamTitle=’Bullett Raja – Tamanche Pe Disco [1e92]’;StreamUrl=”;\u0000\u0000\u0000\u0000\u0000″

Red5 CMS

Hits: 3263  

Hope you already read our article for Media Streaming CMS.

Using Red5 CMS you can manage your Red5, Wowza, RTMP streams and publish using open source player. You can track your media content and embed on other websites.

Red5 Admin Login

Red5 CMS Home

Red5 CMS Categories

Red5 CMS Add Categories

Red5 Server Infomation

Red5 Streams

Red5 CMS Edit Streams

Red5 CMS Stream Offline

Install MistServer

Hits: 10309  

MistServer is a highly versatile, lightweight, customizable open-source multi-standard multimedia server. MistServer configuration is easy to use for full CDN solutions applications.


MistServer is Free, open and well-supported, Truly plug and play, Affordable, seamless and highly scalable control over your media servers. MistServer can be installed on any server to make multimedia server.

Download MistServer Binary here

You can clone source from

Check your server architecture Generic Linux 64-bit or Generic Linux 32-bit then download

# wget

Now extract / copy files to /usr/local/bin/

Check quick start here

# chmod a+x MistController
# MistController -a username:password -n

You need to point your browser to connect Mist Server Manager


Mistserver Manager Login

Kill MistServer

# lsof -i:4242 (Find PID for MistServer)
# kill -9 PID

Find more info about MistServer from

Compare MistServer with other Media Streaming Servers like Wowza or Red5 here

You can find Linux User Guide for MistServer from

Stay connected for more MistServer Configurations and Addons 😉