1 Preliminary Note
In this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100. These settings might differ for you, so you have to replace them where appropriate.
We need a lighttpd installation with PHP support, as shown in this tutorial: Installing Lighttpd With PHP5 And MySQL Support On Debian Etch. I won't cover this here, so please refer to this tutorial if you haven't already set up lighttpd with PHP support.
2 Installing LAME
LAME is an MPEG Audio Layer III (MP3) encoder. We need this so that our videos don't lose their sound while they are being converted to FLV. Unfortunately, LAME isn't available as an official Debian Etch package, so we must compile it manually. First, we install the tools we need for the compilation:
apt-get install build-essential
Then we go to the /tmp directory and download the latest LAME version from SourceForge, e.g. like this:
cd /tmp
wget http://mesh.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
Then we unpack and compile LAME:
tar xvfz lame-3.97.tar.gz
cd lame-3.97
./configure --enable-shared --prefix=/usr
make
make install
3 Installing ffmpeg
We will use ffmpeg to convert our video files to the FLV format. First, we install ffmpeg and a few plugins like this:
apt-get install ffmpeg libavcodec0d libavformat0d libavifile-0.7c2 libpostproc0d libasound2-plugins avifile-player avifile-utils avifile-mad-plugin avifile-mjpeg-plugin avifile-vorbis-plugin
The problem with Debian's ffmpeg package is that is doesn't come with MP3 encoding support, which means that our FLV videos will lose their sound after the conversion. Therefore we will recompile Debian's ffmpeg source package with mp3lame support (which is why we had to install LAME in the previous chapter).
First we download the ffmpeg source package to /usr/src:
cd /usr/src/
apt-get source ffmpeg
Then we change to the ffmpeg source directory:
cd ffmpeg-0.cvs20060823
and edit the file debian/rules. Towards the beginning of that file, you will find two confflags lines. Add the configuration switch --enable-mp3lame to one of them and save the file:
vi debian/rules
[...] |
Now we can build our new ffmpeg package:
dpkg-buildpackage
dpkg-buildpackage will most likely complain about missing packages that it needs to build the new ffmpeg .deb package:
server1:/usr/src/ffmpeg-0.cvs20060823# dpkg-buildpackage
dpkg-buildpackage: source package is ffmpeg
dpkg-buildpackage: source version is 0.cvs20060823-8
dpkg-buildpackage: source changed by Sam Hocevar (Debian packages) <sam+deb@zoy.org>
dpkg-buildpackage: host architecture i386
dpkg-buildpackage: source version without epoch 0.cvs20060823-8
dpkg-checkbuilddeps: Unmet build dependencies: debhelper (>= 4.0) quilt libogg-dev libvorbis-dev liba52-dev libdts-dev zlib1g-dev libsdl1.2-dev libfreetype6-dev libimlib2-dev texi2html libraw1394-dev libdc1394-13-dev libtheora-dev (>> 0.0.0.alpha4) libgsm1-dev
dpkg-buildpackage: Build dependencies/conflicts unsatisfied; aborting.
dpkg-buildpackage: (Use -d flag to override.)
server1:/usr/src/ffmpeg-0.cvs20060823#
If you see an error like this, install the missing packages, e.g. like this:
apt-get install debhelper quilt libogg-dev libvorbis-dev liba52-dev libdts-dev zlib1g-dev libsdl1.2-dev libfreetype6-dev libimlib2-dev texi2html libraw1394-dev libdc1394-13-dev libtheora-dev libgsm1-dev
Afterwards, run dpkg-buildpackage again:
dpkg-buildpackage
The dpkg-buildpackage command should now compile ffmpeg again and create new .deb packages (ffmpeg plus some plugins) in the /usr/src directory. This can take some time, so please be patient. It's possible that you get some warnings about signatures at the end - you can ignore them.
Afterwards, we go to the /usr/src directory and install our new .deb packages:
cd ..
dpkg -i *.deb
That's it for ffmpeg.
4 Installing flvtool2
When we convert videos to the FLV format, we need to add some metadata such as the duration of the video to the FLV file so that FlowPlayer can properly display the length of the video. We can add this metadata with flvtool2. flvtool2 is written in Ruby, so we must install Ruby first:
apt-get install ruby
Then we download the latest version of flvtool2 to the /tmp directory, e.g. like this:
cd /tmp
wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz
Afterwards, we install it:
tar xvfz flvtool2-1.0.6.tgz
cd flvtool2-1.0.6
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install
No comments:
Post a Comment