Setting up your server for hwdVideoShare
From HwdMediaShare Documentation
hwdVideoShare requires FFMPEG, FLVTOOL2 and MENCODER to run correctly. If you are using a shared host then you should try to use a hosting company that has these installed already.
However, if you need to install the software yourself we have tutorials to help you do this. To install these programs on your server you need to have permission to execute commands via a suitable network protocol such as SSH. FFMPEG and MENCODER depend on other programs being installed first therefore, we have prepared this recommended installation sequence for all the software required to run hwdVideoShare.
Install development tools
To compile most of the required software, the GNU C and C++ compilers and other development utilities must been installed first
Installing Using YUM
For Red Hat/Fedora/CentOS systems, type these commands into SSH:
# yum groupinstall "Development Tools" -y
Installing Using APT-GET
For Debian/Ubuntu systems, type these commands into SSH:
#apt-get update #apt-get install build-essential
Common Problems
- No resources available yet
External Resources
- http://www.cyberciti.biz/faq/debian-linux-install-gnu-gcc-compiler/
- http://www.cyberciti.biz/faq/centos-linux-install-gcc-c-c-compiler/
Install RUBY
Ruby is a dynamic, reflective, general purpose object-oriented programming language. Originating in Japan in the mid 1990s, Ruby was initially developed and designed by Yukihiro "Matz" Matsumoto and combines syntax inspired by Perl with Smalltalk-like object-oriented features.
Installing Using YUM
Type these commands into SSH:
#yum update #yum install ruby
Installing Using APT-GET
Type these commands into SSH:
#apt-get update #apt-get install ruby
Common Problems
WHM/Cpanel
WHM setup may prevent that Ruby can be installed using a package manager. To easily install Ruby in a WHM/cpanel server use the provided script
#/scripts/installruby
External Resources
- http://www.ruby-lang.org/
- http://users.drew.edu/bburd/RubyOnRails/InstallingRoRinLinux.pdf
- http://www.digitalmediaminute.com/howto/fc4rails/
- http://www.linuxweblog.com/ruby-on-rails-install
- http://www.urbanpuddle.com/articles/2006/12/07/install-ruby-rails-on-ubuntu-edgy-eft
- http://twiki.cpanel.net/twiki/bin/view/AllDocumentation/RubyonRails/WebHome
Dynamic Linked Libraries Path
Linux uses a system of shared libraries, similar to Windows dlls, for the efficient use of space and resources, and modularity. The search path for dynamic libraries is configured globally in /etc/ld.so.conf.
Type these commands into SSH:
#grep /usr/local/lib /etc/ld.so.conf
If the previous command shows nothing add the /usr/local/lib to /etc/ld.so.conf
#echo "/usr/local/lib" >> /etc/ld.so.conf #ldconfig
Common Problems
- No resources available yet
External Resources
- http://www.ibm.com/developerworks/linux/library/l-shlibs.html
- http://it.toolbox.com/blogs/locutus/exploring-the-etc-directory-ldso-files-and-directories-16785
Install LIBOGG
Ogg is a free, open standard container format maintained by the Xiph.Org Foundation. The Ogg format is unrestricted by software patents and is designed to provide for efficient streaming and manipulation of high quality digital multimedia.
The Installation Process
Type these commands into SSH:
# mkdir /usr/local/src # cd /usr/local/src # wget http://downloads.xiph.org/releases/ogg/libogg-1.2.2.tar.gz # tar zxvf libogg-1.2.2.tar.gz # cd /usr/local/src/libogg-1.2.2 # make distclean #./configure && make clean && make && make install # ldconfig
Check
If the installation process finished ok the compiled libraries will be placed at /usr/local/lib
# ls /usr/local/lib/libogg* /usr/local/lib/libogg.a /usr/local/lib/libogg.so /usr/local/lib/libogg.so.0.5.3 /usr/local/lib/libogg.la /usr/local/lib/libogg.so.0 /usr/local/lib/libogg.so.0.6.0
Common Problems
- No resources available yet
External Resources
Install LIBVORBIS
Ogg is a free, open standard container format maintained by the Xiph.Org Foundation. The Ogg format is unrestricted by software patents and is designed to provide for efficient streaming and manipulation of high quality digital multimedia.
The Installation Process
Type these commands into SSH:
# mkdir /usr/local/src # cd /usr/local/src # wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.gz # tar zxvf libvorbis-1.3.2.tar.gz # cd /usr/local/src/libvorbis-1.3.2 # make distclean # ./configure && make clean && make && make install
Check
If the installation process finished ok the compiled libraries will be placed at /usr/local/lib
# ls /usr/local/lib/libvorbis* /usr/local/lib/libvorbis.a /usr/local/lib/libvorbisfile.so /usr/local/lib/libvorbisenc.a /usr/local/lib/libvorbisfile.so.3 /usr/local/lib/libvorbisenc.la /usr/local/lib/libvorbisfile.so.3.3.2 /usr/local/lib/libvorbisenc.so /usr/local/lib/libvorbis.la /usr/local/lib/libvorbisenc.so.2 /usr/local/lib/libvorbis.so /usr/local/lib/libvorbisenc.so.2.0.6 /usr/local/lib/libvorbis.so.0 /usr/local/lib/libvorbisfile.a /usr/local/lib/libvorbis.so.0.4.3 /usr/local/lib/libvorbisfile.la
Common Problems
- No resources available yet
External Resources
Install LIBX264
x264 is a free software library for encoding video streams into the H.264/MPEG-4 AVC format. It is released under the terms of the GNU General Public License.
The Installation Process
Type these commands into SSH:
# mkdir /usr/local/src # cd /usr/local/src # wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-`date -d "-1 days" +%Y%m%d`-2245-stable.tar.bz2 # tar jxf x264-snapshot-`date -d "-1 days" +%Y%m%d`-2245-stable.tar.bz2 # cd /usr/local/src/x264-snapshot-`date -d "-1 days" +%Y%m%d`-2245-stable # make distclean # ./configure --enable-shared && make clean && make && make install
The x264 project creates a daily snapshot with the format x264-snapshot-yyyymmdd-2245.tar.bz2 . We recommend to use the last available snapshot.
Check
If the installation process finished ok the compiled libraries will be placed at /usr/local/lib (the actual version number after libx264.so.* may vary)
# ls /usr/local/lib/libx264* /usr/local/lib/libx264.a /usr/local/lib/libx264.so /usr/local/lib/libx264.so.114
Common Problems
No suitable assembler found. Install 'yasm' to get MMX/SSE optimized code. If you really want to compile without asm, configure with --disable-asm.
- If you get this error, then you should use the disable asm option, or install yasm (version 0.6.1) using your distribution package manager (apt-get,yum.etc) or compiling it from the source. We do not recommend compiling the x264 libraries without yasm, as it noticeably reduces the HD decoding and decoding speed.
External Resources
Install AMR (for 3gp conversion)
3GP is a simplified version of the MPEG-4 Part 14 (MP4) container format, designed to decrease storage and bandwidth requirements in order to accommodate mobile phones. It stores video streams as MPEG-4 Part 2 or H.263 or MPEG-4 Part 10 (AVC/H.264), and audio streams as AMR-NB, AMR-WB, AMR-WB+, AAC-LC or HE-AAC. A 3GP file is always big-endian, storing and transferring the most significant bytes first. It also contains descriptions of image sizes and bitrate.
Opencore-amr is a free implementation of the of AMR-NB and AMR-WB codecs
The Installation Process
Type these commands into SSH:
#mkdir /usr/local/src #cd /usr/local/src # wget http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/0.1.2/opencore-amr-0.1.2.tar.gz # tar zxf opencore-amr-0.1.2.tar.gz # cd /usr/local/src/opencore-amr-0.1.2 # make distclean # ./configure && make clean && make && make install
Check
If the installation process finished ok the compiled libraries will be placed at /usr/local/lib
# ls /usr/local/lib/libopencore* /usr/local/lib/libopencore-amrnb.a /usr/local/lib/libopencore-amrwb.a /usr/local/lib/libopencore-amrnb.la /usr/local/lib/libopencore-amrwb.la /usr/local/lib/libopencore-amrnb.so /usr/local/lib/libopencore-amrwb.so /usr/local/lib/libopencore-amrnb.so.0 /usr/local/lib/libopencore-amrwb.so.0 /usr/local/lib/libopencore-amrnb.so.0.0.2 /usr/local/lib/libopencore-amrwb.so.0.0.2
Common Problems
- No resources available yet
External Resources
Install FAAC
FAAC is an MPEG-4 and MPEG-2 AAC encoder.
The Installation Process
Type these commands into SSH:
# mkdir /usr/local/src # cd /usr/local/src # wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz # tar zxvf faac-1.28.tar.gz # cd /usr/local/src/faac-1.28 # ./configure && make clean && make && make install
Check
If the installation process finished ok the compiled libraries will be placed at /usr/local/lib
# ls /usr/local/lib/libfaac* /usr/local/lib/libfaac.a /usr/local/lib/libfaac.so /usr/local/lib/libfaac.so.0.0.0 /usr/local/lib/libfaac.la /usr/local/lib/libfaac.so.0
Common Problems
- In some servers the compilation may fail with the following error
In file included from mp4common.h:29, from 3gp.cpp:28:mpeg4ip.h:126: error: new declaration ‘char* strcasestr(const char*, const char*)’
That is because the C function strcasestr declared in the libfaac sources is already declared in a system-wide library. To solve it: Edit the file /usr/local/src/faac-1.28/common/mp4v2/mpeg4ip.h and delete the following line (around line 126)
char *strcasestr(const char *haystack, const char *needle);
Then run
make clean && ./configure && make && make install
External Resources
Install LAME
LAME is an open source application used to encode audio into the MP3 file format. The name LAME is a recursive acronym for LAME Ain't an MP3 Encoder, reflecting LAME's early history when it was not actually an encoder, but merely a set of patches against the freely available ISO demonstration source code.
The Installation Process
Type these commands into SSH:
# mkdir /usr/local/src # cd /usr/local/src # wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz # tar zxvf lame-3.98.4.tar.gz # cd lame-3.98.4 # make distclean # ./configure && make clean && make && make install
Check
If the installation process finished ok the compiled libraries will be placed at /usr/local/lib
# ls /usr/local/lib/libmp3lame* /usr/local/lib/libmp3lame.a /usr/local/lib/libmp3lame.so /usr/local/lib/libmp3lame.so.0.0.0 /usr/local/lib/libmp3lame.la /usr/local/lib/libmp3lame.so.0
Common Problems
- No resources available yet
External Resources
Install FLVTOOL2
FLVTOOL2 can calculate a lot of meta data and insert a onMetaData tag. It can cut FLV files and add cue Points (onCuePoint).
The Installation Process
Type these commands into SSH:
# mkdir /usr/local/src # cd /usr/local/src # wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz # tar zxvf flvtool2-1.0.6.tgz # cd /usr/local/src/flvtool2-1.0.6/ # ruby setup.rb config && ruby setup.rb setup && ruby setup.rb install
Common Problems
- No resources available yet
External Resources
Install FFMPEG
FFMPEG is a computer program that can record, convert and stream digital audio and video in numerous formats.[1] FFMPEG is a command line tool that is composed of a collection of free software / open source libraries. It includes libavcodec, an audio/video codec library used by several other projects, and libavformat, an audio/video container mux and demux library. The name of the project comes from the MPEG video standards group, together with "FF" for "fast forward".
The Installation Process
Type these commands into SSH:
# mkdir /usr/local/src # cd /usr/local/src # mkdir /usr/local/src/tmp # chmod 777 /usr/local/src/tmp # export TMPDIR=/usr/local/src/tmp # wget http://ffmpeg.org/releases/ffmpeg-0.7.11.tar.gz # tar xzf ffmpeg-0.7.11.tar.gz # cd ffmpeg-0.7.11 # make distclean # ./configure --enable-gpl --enable-version3 --enable-nonfree --enable-shared --enable-libmp3lame --enable-libx264 --enable-libfaac --enable-libvorbis --enable-libopencore-amrnb --enable-libopencore-amrwb # make clean && make && make install # make tools/qt-faststart # cp tools/qt-faststart /usr/local/bin/ # ldconfig
Common Problems
- No resources available yet
External Resources
Install MPLAYER (MENCODER)
MENCODER is a free command line video decoding, encoding and filtering tool released under the GNU General Public License. It is a close sibling to MPlayer and can convert all the formats that MPlayer understands into a variety of compressed and uncompressed formats using different codecs.
The Installation Process
Type these commands into SSH:
# mkdir /usr/local/src # cd /usr/local/src # wget http://www.mplayerhq.hu/MPlayer/releases/codecs/all-20110131.tar.bz2 # tar jxvf all-20110131.tar.bz2 # mv /usr/local/src/all-20110131 /usr/local/lib/codecs/ # chmod -R 755 /usr/local/lib/codecs/ # mkdir /usr/local/src/tmp # chmod 777 /usr/local/src/tmp # export TMPDIR=/usr/local/src/tmp # wget http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc4.tar.bz2 # tar jxf MPlayer-1.0rc4.tar.bz2 # cd MPlayer-1.0rc4 # make clean #./configure && make && make install && ldconfig
External Resources
Install FFMPEG-PHP
FFMPEG-PHP is an extension for PHP that adds an easy to use, object-oriented API for accessing and retrieving information from video and audio files. It has methods for returning frames from movie files as images that can be manipulated using PHP's image functions. This works well for automatically creating thumbnail images from movies. ffmpeg-php is also useful for reporting the duration and bitrate of audio files (mp3, wma...). ffmpeg-php can access many of the video formats supported by ffmpeg (mov, avi, mpg, wmv...)
The Installation Process
Type these commands into SSH:
# mkdir /usr/local/src # cd /usr/local/src # wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2 # tar jxf ffmpeg-php-0.6.0.tbz2
Change to the ffmpeg-php extension directory and run phpize (included with your PHP installation) to build configuration files. NOTE: if your php installation does not include phpize, you may have to install a php-dev package for your distro (usually named: php-dev, php-devel, php5-dev or similar). You may be able to use the command yum install php-devel. Once phpize is installed then you can continue with the installation of ffmpeg-php:
# cd ffmpeg-php-0.6.0 # perl -i -p -e "s/PIX_FMT_RGBA32/PIX_FMT_RGBA/g;" ffmpeg_frame.c # phpize # ./configure && make clean && make && make install
The output of the make install step will show the path where the compiled library is saved.
Once the extension has been compiled, it must be added to php, for example by adding the following line at the end of the php.ini file
extension=ffmpeg.so
You can know where the system php.ini file by checking the output of phpinfo().
If the folder /etc/php.d exists, don't add the aformentioned line to php.ini but execute this command instead
echo "extension=ffmpeg.so" > /etc/php.d/zffmpeg.ini
You must then reload your apache server:
# /etc/init.d/httpd reload (/etc/init.d/apache2 reload for Ubuntu/Debian)
Notice that the ffmpeg-php extension must be loaded after the GD extension.
Check
If ffmpeg-php was correctly installed in you server, a ffmpeg section will appear on the output of PHP phpinfo()
Common Problems
Errors during the configure step
ffmpeg-php configure step will fail if ffmpeg is not installed correctly, or if it was compiled without the --enable-shared option during ffmpeg's configure step. Double check that the installation of ffmpeg was performed correctly
Extension compiled but not shows on phpinfo()
If ffmpeg-php is not showing after being compiled , added to php.ini and Apache restart probably the correct php.ini was not edited, or the compiled library is not in the correct path for your PHP version. One of the most common issues is that the ffmpeg-php is not loaded AFTER the gd extension in the php.ini file.
External Resources
Install H264 Streaming Module
The H264 Streaming Module allows pseudostreaming of HD encoded videos. While it is not a strict requirements for the operation of hwdVideoShare, it is recommended to install if it you host long videos, so it enables viewer to jump to any part of the video without waiting for the complete video to load.
The Installation Process
H264 Streaming Module provides detailed instructions for installing and testing the module in the most popular webservers,
Appendix: Other ways of installing the tools
The installation method described in this document is not the only alternative. Most of the codecs and conversion tools may be installed using the package manager tools included in most Linux distributions (apt-get for Debian/Ubuntu, yum for Red Hat/CentOS/Fedora). While this later method may be easier and faster, it has some important drawbacks :
- Some important codecs are usually not included in the official repositories because of licensing restrictions. Sometimes repositories created by volunteers may have a more complete set of packages, but they are not always stable and recommended for a production server.
- Binary packages usually have older version of the software.
- By compiling the source code in your server the tools are optimized for running in that specific processor, taking advantage of CPU optimizations. In the binary packages code is compiled with more conservative options in order to be compatible with every existing processor, from Pentium I to Quad Core.
About mixing the two methods
While it is technicaly possible to mix the two methods for installing the required software (compiling from source code and installing from binary packages), it is also a source of conflicts. Avoid doing so unless you know exactly what you are doing.