1. Source downloading

The first step is to download the source code for the components needed.

The external software used is:

  • ffmpeg latest revision
  • x264 latest revision
  • mp4v2 latest revision
  • xml-rpc-c version 1.16
  • Speex version 1.2
  • latest VP8 encoder
  • libgsm
  • libsrtp
  • libopenssl
  • [optional] Google WebRTC code to enable VAD support

The following script downloads and decompresses the source code in the directories for installing.

#
# Install devel libraries Red Hat 5/CentOs
#
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
yum install curl-devel gsm-devel git yasm subversion gcc gcc-c++ automake libtool
 
 
#
# Install devel libraries in Debian/Ubuntu
#
apt-get install libgsm1-dev g++ make libtool yasm subversion git automake autobuild subversion yasm autoconf libsrtp-dev
 

#
# External source code checkout
#
mkdir -p /usr/local/src
cd /usr/local/src

wget http://downloads.sourceforge.net/project/xmlrpc-c/Xmlrpc-c%20Super%20Stable/1.16.35/xmlrpc-c-1.16.35.tgz
tar xvzf xmlrpc-c-1.16.35.tgz
wget http://downloads.xiph.org/releases/speex/speex-1.2rc1.tar.gz
tar xvzf speex-1.2rc1.tar.gz
wget http://downloads.xiph.org/releases/opus/opus-1.0.2.tar.gz
tar xvzf opus-1.0.2.tar.gz

svn checkout svn://svn.code.sf.net/p/mcumediaserver/code/trunk medooze
svn checkout http://mp4v2.googlecode.com/svn/trunk/ mp4v2
git clone git://git.videolan.org/ffmpeg.git
git clone git://git.videolan.org/x264.git
git clone http://git.chromium.org/webm/libvpx.git

2. x264 library

To configure, compile and install x264 encoder library run the following script in the source directory.

Script:

 

#
# Compiling X264
#

cd /usr/local/src/x264
./configure --enable-debug --enable-shared --enable-pic
make
make install
cd ..

3. FFMPEG

To configure, compile and install ffmpeg and libavcodec libraries run the following script in the source directory.

Script:

#
# Compiling FFMPEG
#

cd /usr/local/src/ffmpeg
./configure --enable-shared --enable-gpl --enable-nonfree --disable-stripping --enable-zlib --enable-avresample --enable-decoder=png
make
make install
cd ..

4. XMLRPC-C

To configure, compile and install xmlrpc-c library run the following script in the source directory. The precompiled version could also be used instead.

Script:

#
# Compiling XMLRPC-C
#

cd /usr/local/src/xmlrpc-c-1.16.35
./configure
make 
make install
cd ..

4. mp4v2 Library

To configure, compile and install mp4v2 library run the following script in the source directory.

Script:

#
# Compiling mp4v2
#

cd /usr/local/src/mp4v2
autoreconf -fiv
./configure
make
make install
make install-man
make dist

5. VP8

To configure, compile and install vp8codec run the following script in the source directory.

Script:

#
# Compiling Speex
#

cd /usr/local/src/libvpx
./configure --enable-shared
make
make install

6. Speex library

To configure, compile and install speex codec run the following script in the source directory.

Script:

#
# Compiling Speex
#

cd /usr/local/src/speex-1.2rc1
./configure
make
make install

7. Opuslibrary

To configure, compile and install speex codec run the following script in the source directory.

Script:

#
# Compiling Opus
#

cd /usr/local/src/opus-1.0.2
./configure
make
make install

8. Enabling VAD

To suppoort VAD based positioning, some libraries from the Goolge WebRTC implementation are needed. Below is are the basic instructions on how to compile them, full documentation can be found at the oficial Google WebRTC site.

Download and install prerequisites:

#
# Install depot_tools, you shall use an account different than root
#
svn co http://src.chromium.org/chrome/trunk/tools/depot_tools
export PATH="$PATH":/usr/local/src/depot_tools

Download and setup Google WebRTC code:

#
# Retreive Google WebRTC code
#

mkdir webrtc
cd webrtc
gclient config http://webrtc.googlecode.com/svn/trunk
gclient sync --force
gclient runhooks --force
cd trunk

Build required libraries

#
# Compile WebRTC VAD and signal processing libraries
#
ninja -C out/Release/ common_audio

9. MCU Media Mixer Server

Go to the media mixer source directory /usr/local/src/medooze/mcu and edit config file config.mk as this:

#################################
# Config file
##################################
LOG             = yes
DEBUG           = yes
FLASHSTREAMER   = no
VADWEBRTC       = no
WEBRTCINCLUDE   = /usr/local/src/webrtc/trunk/third_party/webrtc/
WEBRTDIROBJ     = /usr/local/src/webrtc/trunk/out/Debug/obj.target/third_party/webrtc
SRCDIR          = /usr/local/src/medooze/mcu
TARGET          = /usr/local

If you want to enable the VAD positioning you have to set the VADWEBRTC to yes.

And compile it:

#
# Compiling MCU Media Mixer Server 
#
cd /usr/local/src/medooze/mcu
make 

The binaries will be located at /usr/local/src/medooze/mcu/bin/debug Once installed, we will add a start script. Create a new mediamixer file under /etc/init.d and copy the following:

#! /bin/sh
### BEGIN INIT INFO
# Provides:          mcu
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: MCU Videomixer
# Description:       Starts and stops mcu Video Mixer
### END INIT INFO

# Do NOT "set -e"

# Media Mixer installation directory
MCU="/usr/local/src/medooze/mcu/bin/debug"
# Username to run application server
USER="root"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="MCU Video Media Mixing Server"
DAEMON="${MCU}/mcu"
DAEMONPARAMS=""
SCRIPTNAME="mcu"

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

#
# Function that starts the daemon/service
#
do_start()
{
        echo -n "Starting $DESC:"
        cd $MCU && nohup $DAEMON $DAEMONPARAMS > /var/log/mcu 2>&1 &
        echo "Done"
}

#
# Function that stops the daemon/service
#
do_stop()
{
        echo -n "Stopping $DESC:"
        killall -9 mcu
        echo "Done"
}


case "$1" in
  start)
        do_start
        ;;
  stop)
        do_stop
        ;;
  restart|force-reload)
        echo -n "Restarting $DESC"
        do_stop
        do_start
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
        exit 3
        ;;
esac

:

Let’s configure the service to start automatically at the desired runlevels and start the mixer in the default port:

chmod 777 /etc/init.d/mediamixer
/sbin/chkconfig --level 35 mediamixer on
service  mediamixer start