Archive

Posts Tagged ‘Xuggle’

Maven2 + Red5 + Xuggle

February 26th, 2009 6 comments

 

This time I would like to invite you to my project jakubiak-red5, the purpose of which is the combination of the following technologies : Red5, Xuggle and Maven2. Xuggle is a tool for the conversion of video images in real-time. Red5 is a server of multimedia applications. Maven2 is the most efficient tool for organizing the process of building applications. My goal is to combine them all together.

 

My project is ,in fact it is a building script. It is supposed to be an instruction for Maven2 on how to build server Red5 and a (Java) part of Xuggle library. Let’s have a look on how it works. In SVN repository there is a structure of the Maven project, along with the files pom.xml. The source code of Red5 and Xuggle libraries does not change because it is connected to the source code of the original projects using svn:externals. All you need to do in order to build a project is to write mvn clean install. I assume that each Java programmer is already a fan of Maven or will become such in a future, so there is no need to dwell on it any more.

The results of work are the dependencies that can be used in a new project – a new Red5 based application (or Red5 and Xuggle based).

Welcome to a battle-field!

What we need is Xuggle. The installation of Xuggle Instalacja Xuggle jest prosta seems to be suprisingly simple, compared to the capability of this library (at least for Windows) Setup.exe.

The next installation is Red5. I recommend you to try wersje 0.8RC2 version. Again, follow the procedure setup.exe. For Windows you will need a 32-bit Java.

One more thing – a binary Maven2. Download, unzip and try out.

Finally, you need to download the sources of my project:

svn checkout http://jakubiak-red5.googlecode.com/svn/trunk/ jakubiak-red5-read-only

 

This command is supposed to download the sources of my project as well as the sources of Red5 server, and partly the sources of Xuggle project. Now it’s time for a testing compilation:

cd jakubiak-red5-pom/
mvn clean install
cd ../jakubiak-xuggle-pom/
mvn clean install

 

Yet, before we can finally see this long expected message, we need to use the Internet to download a few dependencies which, for a couple of reasons, might not be found in depositories and they are not downloaded automatically.

It’s a testing time now. You need to publish on the Red5 server the examples build by my script ; in other words, just copy the directories:

cp -r jakubiak-red5-oflaDemo/target/jakubiak-red5-oflaDemo-0.8-SNAPSHOT/ ../../Program Files (x86)/Red5/webapps/
cp -r jakubiak-xuggle-xuggler-red5-videotranscoder/target/jakubiak-xuggle-xuggler-red5-videotranscoder-1.0-SNAPSHOT/ ../../Program Files (x86)/Red5/webapps/
net start Red5

 

Once we start up the internet browser, we can try out a few examples:

If we want to see Xuggle “in action”, we need to connect to the application videotranscoder: rtmp://localhost/videotranscoder using the Publisher program. The name of the stream should be preceded by a prefix “xuggle_“.

My library Jakubiak-red5 to some extend replaces the usual building process. Red5 and Xuggle are built by means of Apache Ant and Ivy (I am genuinely thrilled hearing these names). I, on the other hand, prefer building them using Maven2. It is quite a complex and time-consuming process, yet it is definitely worth the shot, because it enables me to create applications combining lots of fascinating technologies, for example: JPA, Spring. I can also create the WAR application including Red5 and Xuggle, which will then be started up on Apache Tomcat 6. Moreover, I can enjoy working with Eclipse IDE. To sum up, it offers lots of opportunities.

However, the most significant fact is that my library does not modify the sources of Xuggle and Red5 projects.

One of the alternatives to my building script would be to add the libraries of JAR, Red5 and Xuggle straight to the Maven repository. But, this method will not be sufficient in building WAR version of Red5 application. WAR version is extremely useful, but I will return to this issue next time.

Categories: Java Tags: , , ,

How to start Xuggle at Red5

February 2nd, 2009 12 comments
A big breakthrough today – I finally managed to start a Xuggle demo on the server Red5. I am really proud of this, because this kind of technologies will have a tremendous impact on further advancement in the Internet world. I have already given the details of the functioning of the tandem Xuggle and Red5. Now it is time to present how I have activated Xuggle and Red5 on my computer with Windows Vista64bit. I began with downloading and installing the latest version of the server Red5 – 0.8RC2. Of course I also installed the Xuggle. All the Widnows versions are really easy to install – by using the command: Setup.exe and restarting a computer. What I did next was to create an web application archive, consisting of the following files:

All the useful files can be found here:
  1. http://xuggle.googlecode.com/svn/trunk/repo/share/java/xuggle/xuggle-xuggler-red5/xuggle-xuggler-red5-1.17.117.jar
  2. http://xuggle.googlecode.com/svn/trunk/java/xuggle-xuggler-red5/web/videotranscoder/WEB-INF/red5-web.properties
  3. http://xuggle.googlecode.com/svn/trunk/java/xuggle-xuggler-red5/web/videotranscoder/WEB-INF/red5-web.xml
  4. http://xuggle.googlecode.com/svn/trunk/java/xuggle-xuggler-red5/web/videotranscoder/WEB-INF/web.xml
I then saved my application in the folder webapps in the server Red5. Using the 32bit version of Java I started the server Red5. I also set the environment variables:  
$ export | grep HOME
declare -x JAVA_HOME="C:\Program Files\Java\jdk1.6.0_10"
declare -x RED5_HOME="C:\Program Files (x86)\Red5"
declare -x XUGGLE_HOME="C:\Program Files (x86)\Xuggle"
    I started red5: red5.bat. For testing I used the demo application from the server Red5 – Publisher. http://localhost:5080/demos/publisher.html. It is important to remember to connect to the videotranscoder application rather than oflaDemo. All other settings do not require any changes. I just turn on the camera and the microphone and begin a video session. The name of the stream is antek. In order to see the results of Xuggle operations I start the option “View”. The name is xuggle_antek. After severals hours of trials and errors and using Art Clarke I got it! I’ve finally seen my “second nature” – my second faceJ Thanks a lot, Art! In the next chapter I’m going to explain how to programme Xuggle using Eclipse and Maven 2. However, first I have to learn how to do it and, most importantly, EAT SOMETHING!
Categories: Java Tags: , ,

Xuggle + Red5 = Hello World

February 2nd, 2009 5 comments

I finally got it ! I managed to activate an example of the class Hello Word in tandem with Xuggle and Red5.

Now, how does it work? In the internet browser I start the application which publishes the image from the digital camera of my laptop. This image is then being converted (processed?) on the server by means of Xuggle. In this way the net surfers are able to see in their browsers the target image that has been processed by a server. Welcome to the new era in the multimedia web applications!

It seems to me that this application opens a window of new, amazing opportunities. For example, we can image a video conference which allows the participants to see each other’s if they were actually sitting together at one table:). Another possibility might be the server recognizing the users face and, as a result, greeting him with his name, nickname or some other familiar phrase. Or, for example, let’s say we visit the tourist agency website. We start our laptop’s web cam and, after a while, we could see the blissful image of ourselves resting in a hammock hanging between trees on the beautiful beach far away.

There is no doubt that the image of lying in a hammock is far more tempting than sitting at the computer desk. But let’s go back to details. What is actually going on in the server area? The server – Red5 – receives the video from the user. This video is in the form of a data stream. It might contain an image, music or other data. The video stream is, of course, compressed. The server’s is now required to decompress it so that we receive the successive shots (and this is the task performed by Xuggle and FFmpeg). In fact it reminds of the old-fashioned film tape, which has still been in use for movie-making in Hollywood.

As a result of a video’s decompression we receive a sequence of pictures. What the server does next depends entirely of the imagination and goals of the web-site designers. Then the server compresses the sequence of pictures, thus creating a brand new video – a new data stream. The server can save the results of its operation, or create and access enabling an online transfer.

Obviously this method can be also used for the processing of sound. For instance, we can introduce some changes in popular communicators, such as Skype by adding the users’ favourite music to the background, or creating other sounds typical for cafe, pub or other popular meeting places.

As you can see, the server, which is supposed to perform so many tasks, may be overloaded: it is responsible for decompression and compression of the audio / video stream, as well as processing images or sounds. During the system testing , the overload of my laptop went up to 10%. However, we should keep in mind that the server is performing a new operation, something that has never been done before . Something that might actually become a key to success. Personally I am convinced that the expected results are worth its costs, and it pays off to risk an occasional overload.

In my next article I am going to explain how to start and application Xuggle Hello World on the server Red5.

Categories: Java Tags: , ,

Red5 – the installation of administrator’s pane

February 2nd, 2009 12 comments

Briefly speaking, Red5 is a server of the multimedia web applications. It is undoubtedly booming right now; I have just managed to start the administrator’s panel and, since it is a complicated process, I find it reasonable to describe it here in order to remember it well.

The first step is to load the latest version of Red5 0.8RC2 from the website Xuggle . Then I install it according to instructions: I unzip and set the environment variables RED5_HOME. The next thing to do is to start the Installer application : http://localhost:5080/installer/, install the administer application and restart Red5. Thereafter, following the instructions provided on forum, I register at: http://localhost:5080/admin/register.html After registration I move to restarting Red5 again. Now I can finally log in: http://localhost:5080/demos/adminPanel.html

Using the administrator’s panel I can view the list of active applications, find the active online users or check the transfer.

Categories: Java Tags: , ,