Community Documentation

FFmpeg

Last updated March 31, 2011. Created by jbrown on April 3, 2009.
Edited by PeterNSteinmetz. Log in to edit this page.

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.

Note: if you have multiple cores, compilation times can be reduced by using the make -j parameter, e.g. for a dual-core processor:

make -j2

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 --disable-avs --disable-lavf --disable-ffms --disable-gpac --disable-swscale --enable-shared
make
sudo make install
cd ..

Installing FFmpeg

Checkout FFmpeg from its repository:

git clone git://git.videolan.org/ffmpeg.git
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 --disable-network --disable-devices --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --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
  • libmp3lame - encoding audio to MP3 is only necessary for the older FLV format
  • libvpx - encoding to the new VP8 codec

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.

Comments

Missing a step...

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

I don't find this is

I don't find this is necessary myself, but do whatever it takes to get it working.

--
Jonathan Brown

Blue Droplet Media
http://bluedroplet.com/

x264 git version

After installing x264, as per instructions, ffmpeg configure would fail, unable to find libx264.

I found that installing an older snapshot of libx264 - by going to the videolan site and downloading one, configure passed without errors. Maybe the current git version is broken?

Whenever x264 increases the

Whenever x264 increases the ABI revision number there is a short delay while FFmpeg is updated to match. You were just unlucky.

At the time of writing, the latest x264 works great with the latest FFmpeg.

--
Jonathan Brown

Blue Droplet Media
http://bluedroplet.com/

and module FFmpeg Wrapper ?

No use of this module http://drupal.org/project/FFmpeg_Wrapper ??!

Seems not that simple, like installing a module and a plug-in and that's it; seems to need a lot of adjustments?

Regardless of whether you are

Regardless of whether you are using FFmpeg wrapper or BD Video, you need FFmpeg installed locally on your server.

--
Jonathan Brown

Blue Droplet Media
http://bluedroplet.com/

integration, overlap, or..?

I'll understand now (as my error messages showed me...). Then can't/shouldn't they be integrated into one single module that does it all? Or the Blue Droplet as an add-on ? Maybe there is a huge overlap between this modules, or isn't there?

outdated guide

This guide is outdated. For example, you don't need any of those ./configure options for x264. See HOWTO: Install and use the latest FFmpeg and x264 for a more complete and up to date guide. It's designed for Ubuntu, but it will help with just about any distro.

This guide is completely

This guide is completely up-to-date.

That link is also very useful, however.

--
Jonathan Brown

Blue Droplet Media
http://bluedroplet.com/

packages for ubuntu 10.04

For a fresh install of Ubuntu 10.04 (Lucid Lynx) I needed the following packages:

sudo apt-get install git-core, g++, yasm
sudo apt-get install libfaac-dev libgsm1-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libspeex-dev lib-theora-dev libvorbis-dev libvpx-dev

Here is the detailed guide how to install ffmpeg on your VPS or Dedicated server. The guide is for CentOS users:
http://cumulusclips.org/docs/install-ffmpeg-x264-on-centos/

Danilo

Page status

No known problems

Log in to edit this page

About this page

Audience
Site administrators

Site Building Guide

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.
nobody click here