Install Wowza Media Server for Google Compute Engine

Hits: 4098  

Hope you really enjoyed our articles about Google Compute Engine..

Install Apache, PHP, MySQL on Google Compute Engine

Build your business on Google Cloud Platform

Install Red5 on Google Compute Engine

First you need to install Google Cloud platform command-line tools

$ wget
$ sudo apt-get install unzip

$ export PATH=${PATH}:$HOME/gcutil-1.9.1
$ sudo ln -s /usr/local/share/gcutil-1.9.1/gcutil /usr/local/bin/gcutil

Then make sure you have Ports used for Wowza streaming

TCP 1935: RTMP (all variants)
TCP 8084-8085: JMX/JConsole monitoring and administration
TCP 8086: HTTP administration
TCP 80: Apple HTTP Live Streaming (Apple HLS), Adobe HTTP Dynamic Streaming (Adobe HDS), Microsoft Smooth Streaming, MPEG-DASH streaming, RTMPT

$ gcutil addfirewall red5 –description=”Let open port 5080.” –allowed=”tcp:5080″
$ gcutil addfirewall rtsp –description=”Let open 554 rtmp port.” –allowed=”tcp:554″
$ gcutil addfirewall rtmp –description=”Let open 1935 rtmp port.” –allowed=”tcp:1935″
$ gcutil addfirewall http2 –description=”Let open port 5080.” –allowed=”tcp:8086″
$ gcutil getfirewall

Check Java Version or Install

$ sudo apt-get update
$ sudo apt-get install java-package
$ sudo apt-get install openjdk-6-jdk
$ sudo apt-get install openjdk-6-jre

Now read Install Wowza Examples

Download Wowza and install examples

$ wget
$ chmod +x WowzaMediaServer-3.6.2.deb.bin
$ ./WowzaMediaServer-3.6.2.deb.bin
$ cd /usr/local/WowzaMediaServer/bin
$ sudo ./
$ cd /usr/local/WowzaMediaServer-3.6.2/examples
$ sudo chmod +x
$ sudo ./

$ sudo service WowzaMediaServer start

Please check Wowza Forum for more help…

Red5 RTMP Protocol

Hits: 3575  

rtmp protocol

RTMP: Real Time Messaging Protocol

It is TCP based protocol developed by Adobe System for streaming Audio/Video between Flash Player and Media server.

RTMPT: Real Time Messaging Protocol with Tunnel

It is a variation of RTMP which works behind the firewalls.

RTMPE: Real Time Messaging Protocol with Encryption

It is a new encrypted protocol developed by Adobe systems for securing (lightweight than SSL) the streams between flash client and Media server. It provide DRM solution from Adobe for flash.

RTMPS: Real Time Messaging Protocol Secure

It is a variation of RTMP which works over secure HTTPS connection.

RTMPTE: Real Time Messaging Protocol with Encryption and Tunnel

It is a RTMPE tunneling over HTTP.

How to enable rtmpt on Red5 Server?

/usr/local/red5/conf/jee-container.xml uncomment full section

<!– RTMPT (dedicated server) –>

<bean id=”rtmpt.server” class=”org.red5.server.tomcat.rtmpt.RTMPTLoader” init-method=”init” lazy-init=”true”>


Liquidsoap GStreamer

Hits: 5640  

LiquidSoap Liquidsoap is a programming language to manage audio and video source streams for Icecast Radio server.

Liquidsoap is a powerful and flexible language for describing, creating or transforming streams. It offers rich operators and library that you can be used for making Icecast Radio Server.

Now Play Your Favorite Radio FM Stream in HTML5 Player…..
Live Audio Streaming, Internet Radio Player


* It can play icecast stream from files, playlists, directories or scripted playlists.
* Liquidsoap used for scheduling of source streams.
* It help to Mix sources streams.
* It allows queuing of user requests.
* It allows sound compression, normalization, echo, volume, Blank detection.
* It is useful for rewriting and inserting Metadata in Radio Stream.
* It can play live stream play files and streams like
* It can output to Radio Server Icecast/Shoutcast (MP3/Ogg).
* It also support Video streams generation.

You can use it to stream RTMP MP3 stream to Icecast/Shoutcast using mplayer, rtmpdump or gstreamer …

GStreamer- open source multimedia framework

GStreamer provide a rich library to manage streaming audio/video with complex audio (mixing) and video (non-linear editing) processing.

gst =”playbin uri=rtmp://″)
output.icecast(%mp3(), host = “localhost”, port = 8000, password = “xxxxxx”, mount = “gst stream”, fallible=true, gst)

Common Errors

File format problem can display ^M characters

😉 : set ff=unix and then : x in vi editor

init: security exit, root euid (user)

😉 you need to run liq file with non root user

the variable used here has not been previously defined

😉 Define variable “” .. .find here

Stay connected for more Audio / Video Programming ….

Audiojs.swf?playerInstance audiojs instances [%27audiojs0%27]

Hits: 4237  

If you are using audio.js as MP3 player or playlist …. on some browser it causing error 403 to access SWF file with player instance[%27audiojs0%27]&datetime=1382426114401.4087

You need to make sure you have right permission on that SWF file and check JavaScript playerInstance below….

Firefox Error

403 Forbidden[%27audiojs0%27]&datetime=1382426114401.4087


Just replace code (Original audio.js)

flashSource: ‘\
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ id=”$1″ width=”1″ height=”1″ name=”$1″ style=”position: absolute; left: -1px;”> \
<param name=”movie” value=”$2?playerInstance=’+audiojs+’.instances[\’$1\’]&datetime=$3″> \
<param name=”allowscriptaccess” value=”always”> \
<embed name=”$1″ src=”$2?playerInstance=’+audiojs+’.instances[\’$1\’]&datetime=$3″ width=”1″ height=”1″ allowscriptaccess=”always”> \


flashSource: ‘\
<object classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″ id=”$1″ width=”1″ height=”1″ name=”$1″ style=”position: absolute; left: -1px;”> \
<param name=”movie” value=”$2?playerInstance=’+audiojs+’.instances[&quot;$1&quot;]&datetime=$3″> \
<param name=”allowscriptaccess” value=”always”> \
<embed name=”$1″ src=”$2?playerInstance=’+audiojs+’.instances[&quot;$1&quot;]&datetime=$3″ width=”1″ height=”1″ allowscriptaccess=”always”> \

This is not permission (0755 or 0777) error of SWF file, Make sure you have valid characters on some browsers…

instances[\’$1\’] => instances[&quot;$1&quot;] 😉

Installing Apache, MySQL, PHP in Gentoo Server

Hits: 9200  

All commands are performed as root to install Apache, MySQL, PHP and phpMyAdmin in Gentoo Linux Server.

1. Update your System

# emerge –sync

2. Install Apache Webserver

# emerge apache

The web server ROOT is in /var/www/localhost/htdocs/

# /etc/init.d/apache2 start

Then go to http://server-ip/
it works on gentoo

Add apache2 to the startup script
# rc-update -v add apache2 default

3. Install MySQL Database

# emerge mysql

Install MySQL database
# /usr/bin/mysql_install_db

Start MySQL Server
# /etc/init.d/mysql start

Change MySQL User Password
# /usr/bin/mysqladmin -u root -h localhost password ‘new-password’

Test MySQL Server
# /etc/init.d/mysql restart

Add MySQL to the startup script
# rc-update -v add mysql default

4. Install the PHP with modules

# USE=”cli cgi apache2 xml mysql mysqli” emerge ‘dev-lang/php’

Before you can use PHP with Apache… Edit /etc/conf.d/apache2 and add “-D PHP5″ to APACHE2_OPTS

It looks like

You can find php.ini in /etc/php/apache2-php5.4

then restart apache server
# /etc/init.d/apache2 restart

Then go to http://server-ip/info.php (Create phpinfo() file)

phpinfo on gentoo
phpinfo on Gentoo

phpinfo php

phpinfo mysql

5. Install phpMyAdmin

# emerge -av phpmyadmin

Then go to http://server-ip/phpmyadmin/

phpMyAdmin on gentoo
phpMyAdmin on Gentoo

Wowza Live Cam Secure Expired Token

Hits: 5645  
Wowza Live Cam Secure Expired Token
Wowza Live Cam Secure Expired Token

// Encrypt original stream URL http://wowza-server:port/stream/playlist.m3u8
$base64ized = encryptDecrypt($secret_key, $streamURL, 0);

// Decrypt stream URL
$streamURL = encryptDecrypt($secret_key, $base64ized, 1);


// Expire stream URL after time interval & check secure token
if (($current – $timestamp) <= $expired && ($checkhash == $hash)) { include("m3u8.php"); } m3u8.php

header(“content-type: application/”);
echo file_get_contents(“http://wowza-server:port/stream/playlist.m3u8”);

Creating Zip Without Recording ROOT Paths

Hits: 3986  

Simply use chdir() to change the working directory before you exec()

Or you can use ….

exec(“cd /var/www/html/media; zip -r -9 . 2>&1”, $log);

exec(“mv /var/www/html/media/ /var/www/html/”);

Get zip file size

exec(“ls -ls /var/www/html/ | awk ‘{print $6}’ 2>&1”, $size);

$zipsize = implode(” “, $size);

Without this solution

Length Date Time Name
——– —- —- —-
0 03-08-13 15:10 /var/www/html/media/dialogs/
125305 08-07-12 16:31 /var/www/html/media/dialogs/1.3.mp3
125305 08-07-12 16:33 /var/www/html/media/dialogs/1.5.mp3
184864 08-07-12 16:32 /var/www/html/media/dialogs/1.4.mp3
125305 08-07-12 16:30 /var/www/html/media/dialogs/1.1.mp3
125305 02-24-13 16:48 /var/www/html/media/dialogs/1.2.mp3
125305 08-07-12 16:34 /var/www/html/media/dialogs/1.6.mp3

With this solution

Length Date Time Name
——– —- —- —-
0 03-08-13 16:40 dialogs/
125305 08-07-12 16:51 dialogs/1.3.mp3
125305 08-07-12 16:53 dialogs/1.5.mp3
184864 08-07-12 16:52 dialogs/1.4.mp3
125305 08-07-12 16:50 dialogs/1.1.mp3
125305 02-24-13 16:58 dialogs/1.2.mp3
125305 08-07-12 17:04 dialogs/1.6.mp3

Best PHP Encryption Decryption

Hits: 5710  

I was working on Secured & Expired MP3 Link in HTML5 MP3 Player. Hope you already read previous article “Amazon S3 Expiring Link”

You can use below code for hiding real mp3 link inside html source using base64_encode, mcrypt_encrypt, base64_decode, mcrypt_decrypt and md5.

This function is also useful when you need to secure & expire media links …

Remote Secure Token
Secure Token Plugin with PHP
JavaScript Encryption Library


function encryptDecrypt($key, $string, $decrypt)
        $string = str_replace("|", "/", $string);
        $decrypted = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($string), MCRYPT_MODE_CBC, md5(md5($key))), "12");
        return $decrypted;
        $encrypted = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $string, MCRYPT_MODE_CBC, md5(md5($key))));        
        $stripping = true;
        while ($stripping){
         if(substr($encrypted, -1) == "="){
         $encrypted = substr($encrypted, 0, strlen($encrypted)-1);
        } else {
         $stripping = false;
        return str_replace("/", "|", $encrypted);

$echo = encryptDecrypt("123", "", 0);
echo $echo."<br>";
echo encryptDecrypt("123", $echo, 1);





Amazon S3 Expiring Link

Hits: 9706  

I was working on Amazon S3 Cloud HTML5 MP3 Player for S3 Bucket security and Expiring Media links.

Amazon S3 Cloud HTML5 MP3 Player
Amazon S3 Cloud HTML5 MP3 Player

      * Calculate the HMAC SHA1 hash of a string.
      * @param string $key The key to hash against
      * @param string $data The data to hash
      * @param int $blocksize Optional blocksize
      * @return string HMAC SHA1
      function el_crypto_hmacSHA1($key,$data,$blocksize=64){

      * Create temporary URLs to your protected Amazon S3 files.
      * @param string $accessKey Your Amazon S3 access key
      * @param string $secretKey Your Amazon S3 secret key
      * @param string $bucket The bucket (
      * @param string $path The target file path
      * @param int $expires In minutes
      * @return string Temporary Amazon S3 URL
      * @see
      function el_s3_getTemporaryLink($accessKey,$secretKey,$bucket,$path,$expires=5){
          // Calculate expiry time
          // Fix the path; encode and sanitize
          // Path for signature starts with the bucket
          // S3 friendly string to sign
          // Calculate the hash
          $signature= el_crypto_hmacSHA1($secretKey,$signsz);
          // Glue the URL ...
          // ... to the query string ...
          // ... and return the URL!



$ExpiringLink = el_s3_getTemporaryLink(‘AWS-KEY’, ‘AWS-SECRET-KEY’, ‘BUCKET’, ‘FILENAME’, ‘EXPIRING-TIME’);

Demo Amazon S3 Cloud HTML5 MP3 Player