Red5: A video-on-demand Flash Server

6 min read

Plone does not provide a responsive user experience out of the box. This is not because the system is slow, but because it simply does (too) much. It does a lot of security checks and workflow operations, handles the content rules, does content validation, and so on. Still, there are some high-traffic sites running with the popular Content Management System. How do they manage?

“All Plone integrators are caching experts.” This saying is commonly heard and read in the Plone community. And it is true. If we want a fast and responsive system, we have to use caching and load-balancing applications to spread the load.

The article discusses a practical example. We will set up a protected video-on-demand solution with Plone and a Red5 server. We will see how to integrate it with Plone for an effective and secure video-streaming solution.

The Red5 server is an open source Flash server. It is written in Java and is very extensible via plugins. There are plugins for transcoding, different kinds of streaming, and several other manipulations we might want to do with video or audio content. What we want to investigate here is how to integrate video streams protected by Plone permissions.

(For more resources on Plone, see here.)

Requirements for setting up a Red5 server

The requirement for running a Red5 Flash server is Java 6. We can check the Java version by running this:

$ java -version
java version "1.6.0_17"
Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-9M3125)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)

The version needs to be 1.6 at least. The earlier versions of the Red5 server run with 1.5, but the plugin for protecting the media files needs Java 6. To get Java 6, if we do not have it already, we can download it from the Sun home page. There are packages available for Windows and Linux.

Some Linux distributions have different implementations of Java because of licensing issues. You may check the corresponding documentation if this is the case for you.

Mac OS X ships with its own Java bundled. To set the Java version to 1.6 on Mac OS X, we need to do the following:

$ cd /System/Library/Frameworks/JavaVM.framework/Versions
$ rm Current*
$ ln -s 1.6 Current
$ ln -s 1.6 CurrentJDK

After doing so, we should double-check the Java version with the command shown before.

The Red5 server is available as a package for various operating systems. In the next section, we will see how we can integrate a Red5 server into a Plone buildout.

A Red5 buildout

Red5 can be downloaded in several different ways. As it is open source, even the sources are available as a tarball from the product home page. For the buildout, we use the bundle of ready compiled Java libraries. This bundle comes with everything needed to run a standalone Red5 server. There are startup scripts provided for Windows and Bash (usable with Linux and Mac OS X). Let’s see how to configure our buildout.

The buildout needs the usual common elements for a Plone 3.3.3 installation. Apart from the application and the instance, the Red5-specific parts are also present: a fss storage part and a part for setting up the supervisor.

[buildout]newest = false
parts =
extends =
versions = versions
find-links =

There is nothing special in the zope2 application part.

[zope2]recipe = plone.recipe.zope2install
fake-zope-eggs = true
url = ${versions:zope2-url}

On the Plone side, we need—despite of the fss eggs—a package called unimr.red5.protectedvod. This package with the rather complicated name creates rather complicated one-time URLs for the communication with Red5.

[instance]recipe = plone.recipe.zope2instance
zope2-location = ${zope2:location}
user = admin:admin
http-address = 8080
eggs =
zcml =

First, we need to configure FileSystemStorage.FileSystemStorage is used for sharing the videos between Plone and Red5. The videos are uploaded via the Plone UI and they are put on the filesystem. The storage strategy needs to be either site1 or site2. These two strategies store the binary data with its original filename and file extension. The extension is needed for the Red5 server to recognize the file.

[fss]recipe = iw.recipe.fss
zope-instances =
storages =
global /
site /site site2

The red5 part downloads and extracts the Red5 application. We have to envision that everything is placed into the parts directory. This includes configurations, plugins, logs, and even content. We need to be extra careful with changing the recipe in the buildout if running in production mode. The content we share with Plone is symlinked, so this is not a problem. For the logs, we might change the position to outside the parts directory and symlink them back.

[red5]recipe =
url =

The next part adds our custom application, which handles the temporary links used for protection, to the Red5 application. The plugin is shipped together with the unimr.red5.protectedvod egg we use on the Plone side. It is easier to get it from the Subversion repository directly.

[red5-webapp]recipe = infrae.subversion
urls = red5-webapp

The red5-protectedVOD part configures the protectedVOD plugin. Basically, the WAR archive we checked out in the previous step is extracted. If the location of the fss storage does not exist already, it is symlinked into the streams directory of the plugin. The streams directory is the usual place for media files for Red5.

[red5-protectedVOD]recipe = iw.recipe.cmd
on_install = true
on_update = false
cmds =
mkdir -p ${red5:location}/webapps/protectedVOD
cd ${red5:location}/webapps/protectedVOD
jar xvf ${red5-webapp:location}/
cd streams
if [ ! -L ${red5:location}
/webapps/protectedVOD/streams/fss_storage_site ];
then ln -s ${buildout:directory}/var/fss_storage_site .;

The commands used above are Unix/Linux centric. Until Vista/ Server 2008, Windows didn’t understand symbolic links. That’s why the whole idea of the recipe doesn’t work. The recipe might work with Windows Vista, Windows Server 2008, or Windows 7; but the commands look different

Finally, we add the Red5 server to our supervisor configuration. We need to set the RED5_HOME environment variable, so that the startup script can find the necessary libraries of Red5.

[supervisor]recipe = collective.recipe.supervisor
programs =
30 instance2 ${instance2:location}/bin/runzope ${instance2:location}
40 red5 env [RED5_HOME=${red5:location} ${red5:location}/]${red5:location} true

After running the buildout, we can start the supervisor by issuing the following command:


The supervisor will take care of running all the subprocesses. To find out more on the supervisor, we may visit its website. To check if everything worked, we can request a status report by issuing this:

bin/supervisorctl status
instance RUNNING pid 2176, uptime 3:00:23
red5 RUNNING pid 7563, uptime 0:51:25


Please enter your comment!
Please enter your name here