(888) 685-3101 ext. 2

Liferay has some very nice capabilities built in, such as the new Document and Media Library introduced in Liferay 6.1. There are a few interesting enhancements that can be added to the already rich capabilities of the Document and Media Library, one of those being to add video previews and thumbnails to any movie/audio files loaded into the Library, greatly enhancing its appeal. For instance, a standard view and an enhanced view below:

With-Xuggler
With-Xuggler2

The basic installation instructions are detailed on Liferay’s wiki however, the actual successful installation and configuration on a Ubuntu system using the Liferay-Tomcat bundle requires a few extra steps to enable it to be run in a service mode,the way most would run Liferay in production. The software stack for this installation is:

  • Ubuntu 11.10 64 bit server edition, running headless
  • Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)
  • Liferay EE 6.1/Tomcat 7.0.25 bundle running with a MySQL backend and file system based JCR

Installation of Xuggler

First we download the specific referenced version of Xuggler Linux (64-bit) referenced on the wiki (it’s the 3.4.2012 version) and run the installation script (sudo as root). This will install Xuggler into /usr/local/xuggler.

Configuring Tomcat

Once you’ve confirmed that Xuggler does run off the command line, it’s time to setup Tomcat. Due to how Tomcat deals with classloaders, JNI libraries need to be loaded outside of the WAR classloader. This is accomplished by creating a “shared/lib” directory under TOMCAT_HOME. Copy the xuggle-xuggler.jar from /usr/local/xuggler/share/java/jars to shared/lib.

Testing that Xuggler works

Then confirm that Xuggler has been installed correctly by running the following command in a terminal:

java -cp $TOMCAT_HOME/shared/lib/xuggle-xuggler.jar:/usr/local/xuggler/share/java/jars/slf4j-api.jar:/usr/local/xuggler/share/java/jars/logback-classic.jar:/usr/local/xuggler/share/java/jars/logback-core.jar:/usr/local/xuggler/share/java/jars/commons-cli.jar com.xuggle.xuggler.Configuration

This will provide you with some output similar to:

=======================================
Demuxable Formats
=======================================
"vc1": raw VC-1
"mpeg": MPEG-PS format
"truehd": raw TrueHD
"mvi": Motion Pixels MVI format
"dsicin": Delphine Software International CIN format
"f32be": PCM 32 bit floating-point big-endian format
"ogg": Ogg
"pva": TechnoTrend PVA file and stream format
"video4linux": Video4Linux device grab
"bfi": Brute Force & Ignorance
"dv1394": DV1394 A/V grab
"wc3movie": Wing Commander III movie format
"ipmovie": Interplay MVE format
"siff": Beam Software SIFF
"ffm": FFM (FFserver live feed) format
.
.
.
color_range; default= 0; type=PROPERTY_INT;
help for color_range: no help available
chroma_sample_location; default= 0; type=PROPERTY_INT;
help for chroma_sample_location: no help available
=======================================
com.xuggle.xuggler.IVideoResampler Properties
=======================================
sws_flags; default= 2684354592; valid values=(-fast_bilinear; -bilinear; -bicubic; -experimental; -neighbor; +area; -bicublin; -gauss; -sinc; -lanczos; -spline; -print_info; -accurate_rnd; +mmx; +mmx2; -3dnow; -altivec; -bfin; -full_chroma_int; -full_chroma_inp; -bitexact; ); type=PROPERTY_FLAGS;
help for sws_flags: scaler/cpu flags

Note: You may need to add /usr/local/xuggler/bin to the path.

Converting the Tomcat startup service script to allow Xuggler to integrate with liferay

Now that Xuggler is working, Tomcat will need to be configured to allow Xuggler to run under it in daemon mode. It is assumed here that you are running a relatively standard service script similar to the following:

#!/bin/sh
TOMCAT_HOME=/opt/service/tomcat-7.0.25
TARGET_USER=liferayusercase "$1" in
start)
echo "Starting Tomcat 7/Liferay 6.1…"
sudo -u ${TARGET_USER} sh ${TOMCAT_HOME}/startup.sh >${TOMCAT_HOME}/logs/startup.log 2>&1 &
;;
stop)
echo "Stopping Tomcat 7/Liferay 6.1..."
sudo -u ${TARGET_USER} sh ${TOMCAT_HOME}/bin/shutdown.sh
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;; esac
exit 0

NOTE: There is an additional stipulation that Liferay 6.1 must be started from its $TOMCAT_HOME/bin directory for everything to work correctly, or you will get JRuby gems SASS errors if you are running Kaleo, for instance. So here is the service script:

#!/bin/sh
TOMCAT_HOME=/opt/service/tomcat-7.0.25
TARGET_USER=liferayusercase "$1" in
start)
echo "Starting Tomcat 7/Liferay 6.1..."
sudo -u ${TARGET_USER} sh /etc/init.d/start-tomcat-liferay.sh ${TOMCAT_HOME} >> ${TOMCAT_HOME}/logs/service.log 2>&1
;;
stop)
echo "Stopping Tomcat 7/Liferay 6.1..."
sudo -u ${TARGET_USER} sh ${TOMCAT_HOME}/bin/shutdown.sh
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;; esac
exit 0

which starts the Tomcat/Liferay bundle via start-tomcat-liferay.sh:

#!/bin/sh
export TOMCAT_HOME=$1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/xuggler/lib:${TOMCAT_HOME}/shared/lib
export PATH=$PATH:/usr/local/xuggler/bin:${TOMCAT_HOME}/shared/lib
cd ${TOMCAT_HOME}/bin
sh ./startup.sh >${TOMCAT_HOME}/logs/startup.log 2>&1

Enabling Xuggler support on Liferay

Once the Liferay server comes up, go to the Control Panel->Server Administration, and select the “External Services” Tab. Check the “Enabled” box in the “Enabling XUggler provides video conversion functionality” Section, and Save. This should kick off a thumbnail and conversion process. You can also upload a new video into the Documents and Media portlet, and upon success, should also see a note that “Thumbnail and Preview generation should be completed shortly”.

Share This