Install Red5 1.0 on CentOS Latest


Hits: 28094  

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 http://red5.svnlabs.com/apache-ant-1.8.2-bin.tar.gz
# 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

Make sure you have right paths (java, ant etc.) on your server, I have used 32-bits CentOS server … home path might be different on 64-bits or other server 😉

# 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/classes.zip

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

4. Install SVN

# yum install subversion

5. Install RED5 Server

# cd /usr/local/src
# svn checkout http://red5.googlecode.com/svn/java/server/trunk/ red5
# mv red5 /usr/local/
# cd /usr/local/red5
# ant prepare
# ant dist

6. Copy Red5 files

# cp -r dist/conf /usr/local/red5

7. Test Run

# sh red5.sh

ctrl + z

You need to 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

Red5 Server Status

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

http://yourserver.com:5080/

If you have CentOS 64-bits server and you are getting error like

– Buildfile: build.xml does not exist!
– BUILD FAILED
– Cannot allocate memory

You might need to checkout modified files
# cd /usr/local/src
# svn co http://red5.googlecode.com/svn/java/server/tags/1_0/ red5

Build Failed (Life saver)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Cannot run program “chmod”: java.io.IOException: error=12, Cannot allocate memory

# export _JAVA_OPTIONS=’-Xms32m -Xmx56m -Xss128k -XX:PermSize=32m -XX:MaxPermSize=64m’
# export ANT_OPTS=’-Xms32m -Xmx56m -Xss128k -XX:PermSize=32m -XX:MaxPermSize=64m’

Try solution here… http://code.google.com/p/red5/issues/detail?id=337

How to install Red5 Demos?

# cd /usr/local/red5/webapps/root
# svn checkout http://red5.googlecode.com/svn/java/server/tags/0_9_1/webapps/root/demos/

Then go to http://yourserver.com:5080/demos/

Please check all comments below for more help 😉

VLC is not supposed to be run as root. Sorry


Hits: 9670  

Today I need to install VLC Media player on CentOS 5.x to capture remote live event from VLC client as HTTP stream.

So, I have installed that using # yum install vlc

But VLC can not be run as root privileged user 🙁

# vlc
VLC is not supposed to be run as root. Sorry.
If you need to use real-time priorities and/or privileged TCP ports
you can use vlc-wrapper (make sure it is Set-UID root first and
cannot be run by non-trusted users first).

To run VLC from command line we need to edit VLC file located below
# vi /usr/bin/vlc

To edit “/usr/bin/vlc” search for geteuid and replace it with getppid using vi editor’s command

:%s/geteuid/getppid/ (here geteuid is search term and getppid is replace one)

If we still face issues with stream capture, we can use mplayer 😉

# mplayer http://stream_link -dumpstream -dumpfile outFileName

The trouble with doing something right the first time is that nobody appreciates how difficult it was.

 

Audio.js with Volume Control


Hits: 13358  

I was working on HTML5 MP3 Player Project using audio.js and I got Audio.js with Volume Control to control the volume for the Flash alternative player?

Volume Control - audio.js

<script>
      audiojs.events.ready(function() {
        var as = audiojs.createAll(),
            audio = as[0],
            ids = ['vol-0', 'vol-10', 'vol-40', 'vol-70', 'vol-100'];
        for (var i = 0, ii = ids.length; i < ii; i++) {
          var elem = document.getElementById(ids[i]),
              volume = ids[i].split('-')[1];
          elem.setAttribute('data-volume', volume / 100)
          elem.onclick = function(e) {
            audio.setVolume(this.getAttribute('data-volume'));
            e.preventDefault();
            return false;
          }
        }
        
      });
    </script>
<audio src="audiofile.mp3"></audio>
    <p><a href="#" id="vol-0">Volume: 0%</a></p>
    <p><a href="#" id="vol-10">Volume: 10%</a></p>
    <p><a href="#" id="vol-40">Volume: 40%</a></p>
    <p><a href="#" id="vol-70">Volume: 70%</a></p>
    <p><a href="#" id="vol-100">Volume: 100%</a></p>

You can also use the same volume as in https://github.com/dz0ny/AudioJS

Stream Live Event Using VLC Media Player


Hits: 7944  

Windows Media Encoder is a media encoder developed by Microsoft which convert or capture or broadcast both prerecorded & live media like audio, video and computer screens to WMV formats for live and on-demand service.

But if you are on Linux you must have some questions in mind…

1. How to Stream Online Using Internet Streaming Server
2. How to connect camera to the computer and using Media Server for live stream

In Linux environment VLC Media Player is best solution to stream live stream from camera to anywhere in world 😉

Quality vs Size

The Quality and Size always matter while you broadcast streams, but VLC provide you such a facility to manage your camera in real time and send some chunks over particular time interval to publishing point for live broadcast.

If you already plugged camera to your computer then you are ready to stream media to publishing point…

Now what is publishing point?

Publishing Point is a third party server used for providing media stream to real users on internet. Each time VLC send data in blocks to publishing point and users can access that point to enjoy real camera stream live.

You can convert any web server to Publishing Point, but this web server must be connected to internet with real public IP.

We have 2 options for Publishing Point:

1. You can use Port Forwarding if you have no web server with public IP installed on PC.
2. Else use real public IP with web server 😉

Port Forwarding Configuration: Router Setting allows to create, modify and delete port forwarding rules to work on your computers if the Internet connection uses NAT.

Advanced Stream Redirector


Hits: 2744  

The Advanced Stream Redirector (ASX) format is used to store playlist of Windows Media files for a multimedia presentation using HTTP, RTSP and MMS streaming protocols.

ASF (Advanced Streaming Format) is a streaming media format developed by Microsoft. ASF files contain video, audio, slide shows and synchronized events for WMV files.

* The ASF file is media file, containing video, audio, etc.
* The ASX file is a metafile contains data about another file.

<asx version="3.0">
  <title>Video Live Stream</title>
 
  <entry>
    <title>SVNLabs Main Stream</title>
    <ref href="http://www.svnlabs.com/vod/media.wma" />
    <param name="aParameterName" value="aParameterValue" />
  </entry>
 
  <entry>
    <title>SVNLabs Radio</title>
    <ref href="http://www.svnlabs.com:8080" />
    <author>SVNLabs.com</author>
    <copyright>©2012 SVNLabs.com</copyright>
  </entry>

</asx>

PHP Advanced Stream Redirector

<?php

header("Content-Type: video/x-ms-asf;"); 

$title = isset($_REQUEST['title'])?$_REQUEST['title']:"";
$author = isset($_REQUEST['author'])?$_REQUEST['author']:"";
$file = isset($_REQUEST['file'])?$_REQUEST['file']:"";


echo "<asx version=\"3.0\">";
  echo "<title>".$title."</title>";
  echo "<entry>";
    echo "<title>".$title."</title>";
    echo "<author>".$author."</author>";
    echo "<ref href=\"http://www.svnlabs.com/vod/".$file."\"/>";
  echo "</entry>";
echo "</asx>";



?>

Demo: http://www.svnlabs.com/vod/vod.php?title=SVNLabs&author=SVNLabs&file=QFTkJ4gPbk9kiQhmhxmnqw.wmv