FFmpeg

Last modified: November 21, 2009 - 14:13

For Blue Droplet Video to play videos in the browser, it needs to covert them into a format that is compatible with Flash. It can also be necessary to scale down and reduce the bandwidth requirements of the video. This process is called transcoding.

To transcode your videos locally on your server, Blue Droplet Video uses FFmpeg. This is free software, like Drupal.

If you are using the transcoder at bluedroplet.com (paid service), then you do not require FFmpeg.

Installation

These instructions are specific to unix systems like Linux / OS X. It is recommend that Blue Droplet Video (and Drupal in general) be deployed on a unix system.

The important thing when installing FFmpeg is ensuring that it supports the codecs you require. The FFmpeg packaged with your distro may have poor codec support. It is therefore recommend that FFmpeg be compiled from source.

Installing x264

FFmpeg needs external libraries for some of its codec support. Most of these can normally be provided by your distribution. The exception is x264 support for encoding H.264, which should be the very latest version.

Make sure you have Git installed. If you are using Linux, your distro will be able to provide it for you.

git clone git://git.videolan.org/x264.git
cd x264
./configure --prefix=/usr --enable-shared
make
sudo make install
cd ..

Installing FFmpeg

You need Subversion installed. Use your distro's package manager to install it (if using Linux). Then checkout FFmpeg from its repository:

svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg

You then need to configure FFmpeg. Below is the recommend configure command. However, it will probably detect that you do not have all the specified libraries in place. Try to install them using your distro's package manager. You will need the 'dev' or 'devel' packages.

./configure --prefix=/usr --enable-gpl --enable-version3 --enable-nonfree --disable-ffplay --disable-ffserver --enable-postproc --enable-avfilter --enable-avfilter-lavf --disable-network --disable-devices --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libdirac --enable-libfaac --enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --disable-debug

Some libraries are non-essential. The following harder-to-get libraries can be left out of the configure options if they cannot be installed successfully:

  • libopencore-amrnb / libopencore-amrwb / libgsm - these are typically used for decoding audio from mobile phones
  • libdirac - decoding of video in the BBC's dirac format
  • libmp3lame - encoding of MP3 audio is only necessary for the older FLV format.

Check the 'enabled encoders' section of the output from configure. If 'png' is not present, then the zlib dev package must be installed and configure re-run.

You then need to build FFmpeg and install it:

make
sudo make install

Installing qt-faststart

FFmpeg also comes with a utility that needs to be installed separately:

make tools/qt-faststart
sudo cp tools/qt-faststart /usr/bin/

Testing

Administer › Site configuration › Blue Droplet Video will interrogate your FFmpeg installation to determine if it is installed correctly.

Missing a step...

ezpnet-ss - January 11, 2010 - 20:09

The author appears to have missed the step to reload the shared library configuration. So if you are seeing an error like this after following these instructions:

-----
# ffmpeg
ffmpeg: error while loading shared libraries: libx264.so.80: cannot open shared object file: No such file or directory
-----

Try running:

-----
# ldconfig
-----

Then you should see:

-----
# ffmpeg
FFmpeg version SVN-r21134, Copyright (c) 2000-2010 Fabrice Bellard, et al.
built on Jan 11 2010 01:32:43 with gcc 4.1.2 20080704 (Red Hat 4.1.2-46)
configuration: --prefix=/usr --enable-gpl --enable-version3 --enable-nonfree --disable-ffplay --disable-ffserver --enable-postproc --enable-avfilter --enable-avfilter-lavf --disable-network --enable-libx264 --disable-debug
libavutil 50. 7. 0 / 50. 7. 0
libavcodec 52.47. 0 / 52.47. 0
libavformat 52.46. 0 / 52.46. 0
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.15. 0 / 1.15. 0
libswscale 0. 8. 0 / 0. 8. 0
libpostproc 51. 2. 0 / 51. 2. 0
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'
-----

At which point, ffmpeg should be running (with any luck).

Shane Simpson
http://ezp.net
Shared, VPS & Dedicated Hosting

 
 

Drupal is a registered trademark of Dries Buytaert.