Saturday, 19 May 2012

Installing ViMP Video CMS

ViMP provide a very good installation guide. I am documenting some points that may be helpful for running ViMP successfully.
I used Ubuntu 12.04 and  ViMP Community 2.5.4 version in this example.
I am assuming Apache, PHP and MySQL are already installed in the system otherwise it can be installed easily using apt-get. For the hardware and software requirements of ViMP, please see the Installation guide of ViMP.
Install gcc compiler
$ sudo apt-get install gcc
If make is not installed, install make
$ sudo apt-get install make

I will install the required PHP extensions:
$ sudo apt-get install php5-gd
$ sudo apt-get install php5-curl
$ sudo apt-get install php5-xsl
Also we need to install SourceGuardian module for PHP.
Check the PHP extensions directory
$ php -i | grep extension_dir extension_dir => /usr/lib/php5/20090626+lfs => /usr/lib/php5/20090626+lfs
My PHP extensions directory is /usr/lib/php5/20090626+lfs , go to this directory
$ cd /usr/lib/php5/20090626+lfs
Download the PHPShield loader into PHP extensions directory.
pranabs@ubuntu:/usr/lib/php5/20090626+lfs$ sudo wget
We have to add this new extension to PHP configuration file
$ cd /etc/php5/conf.d/
Create a new file ixed.5.3.ini
$ sudo pico ixed.5.3.ini
Add the line extension=ixed.5.3 to the new file and save it.

Enable apache mod_rewrite:
$ sudo a2enmod rewrite

Restart Apache.
$ sudo service apache2 restart

Install Ruby
$ sudo apt-get install ruby

Now we have to install the tools required for video encoding. ViMP document describes for debian installation. For Ubuntu we can get the required tools and codec from Medibuntu repository. You can find document for Medibuntu in the link .

Add Medibuntu repository:
$ sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update
Install the transcoding tools
$ sudo apt-get install mplayer mencoder ffmpeg flvtool2

Install the codec package:
$ sudo apt-get install w32codecs
Note: I am installing it for 32bit system, for 64bit it is w64codecs

Pre-requisite installation part is complete now, for configuration and installation of ViMP you can refer to ViMP installation manual.


Even after installing the required tools I got the following error in the transcoding process
>> transcode media 5687762ac90946a84dfb015a19d677bc [1]
>> transcode    + move 5112de7fe0d8b45d87fa5...2d9e899bb28fb1c7348ad79a042.flv
>> rename    /var/www/mediaserver/data/web/u...4dfb015a19d677bc_1336642858.flv
>> chmod 775 /var/www/mediaserver/data/web/i...4dfb015a19d677bc_1336642858.flv
>> chown www-data.www-data /var/www/mediaserver/dat...a19d677bc_1336642858.flv
>> exec      "mplayer" -vo null -ao null -fr...87762ac90946a84dfb015a19d677bc"
>> exec      cat /tmp/info_output_5687762ac9...a19d677bc | grep ID_VIDEO_WIDTH
>> exec      cat /tmp/info_output_5687762ac9...19d677bc | grep ID_VIDEO_HEIGHT
>> exec      cat /tmp/info_output_5687762ac9...fb015a19d677bc | grep ID_LENGTH
>> file-     /tmp/info_output_5687762ac90946a84dfb015a19d677bc
>> file+     /var/www/mediaserver/data/web/i...4dfb015a19d677bc_1336642858.flv
>> chmod 775 /var/www/mediaserver/data/web/i...4dfb015a19d677bc_1336642858.flv
>> chown www-data.www-data /var/www/mediaserver/dat...a19d677bc_1336642858.flv
>> exec      nice -n 19 "ffmpeg" -i /var/www...4dfb015a19d677bc_1336642858.m4v
>> transcode    + Problem executing command. (error 1)
For transcoding errors we can view the framework.convert.log file located inside the log folder in ViMP application’s data  directory.

After lots of trial and failure, I have decided to remove ffmpeg and compile it from latest source

$ sudo git clone git://
$ cd ffmpeg

$ sudo ./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab

The configure script may give some dependent library error (if it is already not present), these libraries can be installed easily using apt-get install command. Run apt-cache search command to find the exact library name and then install it.  
$ sudo make
$ sudo make install

Manually compiling ffmpeg may install it in /usr/local/bin/ffmpeg, so create a symbolic link /usr/bin/ffmpeg pointing to /usr/local/bin/ffmpeg

I tried transcoding again, but got the same error. After some searching I found the solution in ViMP support forum
I have to copy the ffmpeg-presets which can be downloaded from
Download and extract the ffmpeg.presets.tar.gz file. Put all the extracted files into /usr/local/share/ffmpeg directory (I have compiled ffmpeg, so I have this folder otherwise it is /usr/share/ffmpeg)
It didn’t resolve my problem, so another solution was provided in
Open the /usr/local/share/ffmpeg/libx264-slow.ffpreset file and delete the following lines:

Note: It is better to copy the presets in the ffmpeg's source (including the modified libx264-slow.ffpreset file) and recompile ffmpeg again.

After that I recompiled ffmpeg and this error was gone but I started getting another error.

>> chmod 775 /var/www/mediaserver/data/web/i...380eebfd1c44f67_1336646839.webm
>> chown www-data.www-data /var/www/mediaserver/dat...d1c44f67_1336646839.webm
>> exec      "flvtool2" -UP "/var/www/medias...033b6005d51c6f4380eebfd1c44f67"
>> exec      cat /tmp/duration_output_13033b...380eebfd1c44f67 | grep duration
>> transcode    + Problem executing command. (error 1)

I checked the duration_output_13033b… file mentioned in the error log. The content of the file was as follows:

root@ubuntu:~/flvtool2-1.0.6# cat /tmp/duration_output_13033b6005d51c6f4380eebfd1c44f67 ERROR: EOFError
ERROR: /usr/local/lib/site_ruby/1.8/flv/amf_string_buffer.rb:37:in `read'
ERROR: /usr/local/lib/site_ruby/1.8/flv/video_tag.rb:80:in `read_header'
ERROR: /usr/local/lib/site_ruby/1.8/flv/video_tag.rb:47:in `after_initialize'
ERROR: /usr/local/lib/site_ruby/1.8/flv/tag.rb:56:in `initialize'
ERROR: /usr/local/lib/site_ruby/1.8/flv/stream.rb:449:in `new'
ERROR: /usr/local/lib/site_ruby/1.8/flv/stream.rb:449:in `read_tags'
ERROR: /usr/local/lib/site_ruby/1.8/flv/stream.rb:58:in `initialize'
ERROR: /usr/local/lib/site_ruby/1.8/flvtool2/base.rb:272:in `new'
ERROR: /usr/local/lib/site_ruby/1.8/flvtool2/base.rb:272:in `open_stream'
ERROR: /usr/local/lib/site_ruby/1.8/flvtool2/base.rb:238:in `process_files'
ERROR: /usr/local/lib/site_ruby/1.8/flvtool2/base.rb:225:in `each'
ERROR: /usr/local/lib/site_ruby/1.8/flvtool2/base.rb:225:in `process_files'
ERROR: /usr/local/lib/site_ruby/1.8/flvtool2/base.rb:44:in `execute!'
ERROR: /usr/local/lib/site_ruby/1.8/flvtool2.rb:168:in `execute!'
ERROR: /usr/local/lib/site_ruby/1.8/flvtool2.rb:228
ERROR: /usr/bin/flvtool2:2:in `require'
ERROR: /usr/bin/flvtool2:2

After lots of searching I found the solution in the forum:

I changed the audio_tag.rb file:


         def after_initialize(new_object)
         @tag_type = AUDIO

         def after_initialize(new_object)
         @tag_type = AUDIO
         if data_size > 0

and changed the video_tag.rb file


   bit_sequence ='B72').to_s


    if @codec_id == H263VIDEOPACKET || @codec_id == SCREENVIDEOPACKET
           bit_sequence ='B72').to_s

These two files located in prefix/site_ruby/1.8/flv folder (prefix will change depending on your installation), in my case it is in /usr/local/lib/site_ruby/1.8/flv folder.

It worked for me without reinstalling flvtool2.

If it doesn’t work, you may have to download flvtool2 from , change the audio_tag.rb and video_tag.rb files, rebuild and install it again.


$ wget

$ tar xzvf flvtool2-1.0.6.tgz

$ cd flvtool2-1.0.6/lib/flv

Edit audio_tag.rb and video_tag.rb files

$ cd ../..

$ sudo ruby setup.rb config

$ sudo ruby setup.rb setup

$ sudo ruby setup.rb install

That’s it and enjoy ViMP.