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 # Note that google webrtc requires python 2.7 not available on red hat 5 # rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm yum install curl-devel gsm-devel git subversion gcc gcc-c++ automake libtool bzip2 # # Install devel libraries in Debian/Ubuntu # apt-get install libgsm1-dev g++ make libtool subversion git automake subversion autoconf libgcrypt11-dev libjpeg8-dev libssl-dev echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf ldconfig # # Needed by webrtc # apt-get install bzip2 pkg-config libgtk2.0-dev libnss3-dev libxtst-dev libxss-dev libdbus-1-dev libdrm-dev libgconf2-dev libgnome-keyring-dev libpci-dev libudev-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 wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz tar xvzf yasm-1.2.0.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 git clone https://github.com/cisco/libsrtp
2. x264 library
To configure, compile and install x264 encoder library run the following script in the source directory.
Script:
# # Compiling yasm 1.2 # cd yasm-1.2.0 ./configure make make install cd .. # # 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
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. Opus library
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. SRTP library
To configure, compile and install latest libsrtp code run the following script in the source directory.
Script:
# # Compiling libsrtp # cd /usr/local/src/libsrtp ./configure make make install
9. Enabling VAD
To suppoort VAD based positioning, some libraries from the Goolge WebRTC implementation are needed. To avoid having to download and compile all the required dependencies, we have cloned them into the ext directory.
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
Build required libraries
# # Compile WebRTC VAD and signal processing libraries # cd /usr/local/src/medooze/mcu/ext 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 = no STATIC = no VADWEBRTC = no WEBRTCINCLUDE = /usr/local/src/webrtc/trunk/ WEBRTDIROBJ = /usr/local/src/webrtc/trunk/out/Release/obj/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/release. 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