How to install an up-to-date ffmpeg in Debian Squeeze from debian-multimedia.org

It's really not that difficult, requires only a few tries with various repositories and APT configurations. First of all let's make something clear: when I say "up-to-date", I mean the latest release. To get this, we've to install ffmpeg from the sid (aka. unstable) packages of www.debian-multimedia.org.

Update (2011.12.23): I've added a few corrections to this post after applying it to a number of Debian Squeeze servers.

First remove all ffmpeg related packages that you've currently installed. It doesn't hurt if you purge these packages ... just to start with a clean slate.

Now set up the new APT sources (yes, there'll be two).
Create a new file at /etc/apt/sources.list.d/debian-multimedia.list:
deb http://www.debian-multimedia.org/ sid main non-free
deb-src http://www.debian-multimedia.org/ sid main non-free

Then create another at /etc/apt/sources.list.d/debian-sid.list:
deb http://ftp.us.debian.org/debian/ sid main contrib non-free
deb-src http://ftp.us.debian.org/debian/ sid main contrib non-free

Now create (or add the following to) /etc/apt/preferences:
Package: *
Pin: origin "www.debian-multimedia.org"
Pin-Priority: 101

Package: *
Pin: release n=sid*
Pin-Priority: 100

Package: libasound2 libjpeg8 libpulse0 libva1 libvpx0
Pin: release n=sid*
Pin-Priority: 999

Package: ffmpeg libavcodec53 libavformat53 libavutil51 libavfilter2 libavdevice53 libmp3lame0 libpostproc51 libswscale2 libxvidcore4
Pin: origin "www.debian-multimedia.org"
Pin-Priority: 999

Update your package cache, install the keyring package (so the installations after it are authenticated and won't give a warning), install ffmpeg (and optionally gpac + x264 ... I used to install these together) and you're all set:
$ apt-get update
$ apt-get --allow-unauthenticated install debian-multimedia-keyring
$ apt-get install ffmpeg gpac x264

Check your package dependencies, etc:
$ apt-get check
$ apt-get install
$ apt-get remove

And verify the new ffmpeg:
$ ffmpeg
ffmpeg version 0.9, Copyright (c) 2000-2011 the FFmpeg developers
  built on Dec 13 2011 14:52:13 with gcc 4.6.2
  configuration: --prefix=/usr (...)

In the end you'll have installed the following packages from the Sid archive of the Debian Multimedia repository:
  • debian-multimedia-keyring
  • ffmpeg
  • gpac
  • libaacplus2
  • libavcodec53
  • libavdevice53
  • libavfilter2
  • libavformat53
  • libavutil51
  • libfaac0
  • libgpac0.4.6
  • libmp3lame0
  • libpostproc51
  • libswresample0
  • libswscale2
  • libx264-120
  • libxvidcore4
  • x264
And the following packages from the Sid archive of the official Debian repository (in case of an amd64 architecture):
  • libasound2
  • libjpeg8
  • libmozjs8d
  • libopencv-core2.3
  • libopencv-imgproc2.3
  • libpulse0
  • libssl1.0.0
  • libva1
  • libvo-aacenc0
  • libvo-amrwbenc0
  • libvpx0
  • multiarch-support
Once you've verified that the current version of ffmpeg from the Debian Multimedia repository works for you, you might want to put these packages on hold:
for pkg in ffmpeg gpac libaacplus2 libavcodec53 libavdevice53 libavfilter2 libavformat53 libavutil51 libfaac0 libgpac0.4.6 libmp3lame0 libpostproc51 libswresample0 libswscale2 libx264-120 libxvidcore4 x264; do echo "$pkg hold"; done | dpkg --set-selections

This way you won't get surprised by a potentially broken update messing up your workflow/app/service/etc. Ffmpeg is continuously under development and there's always a risk that something breaks in the "cutting edge" version. If you're really paranoid, you can even download the given package versions (optionally both the sources and the binary DEBs) so you can always revert back to a known stable state. Or another approach: after you're all set, just rename /etc/apt/sources.list.d/debian-multimedia.list into eg. /etc/apt/sources.list.d/debian-multimedia.list.bak so there'll be no updates at all. Smile

Imho upgrading to v0.9 is worth the trouble. It contains tons of bug-fixes compared to the v0.7.8 package that is available for Squeeze in the Debian-Multimedia repo. Eg. the quite old "Application provided invalid, non monotonically increasing dts to muxer in stream" error got fixed (which bugged a lot of people who tried to convert/copy AC3 sound into a file with an MP4 container). And the new version is a lot faster too: I converted an 1080p video to 720p (and reduced frame rate from 50 to 25 fps) with both the older v0.7.8 and the new v0.9 and the difference is quite remarkable. The old one processed 10s of the input in 53s (the conversion took 5 times the duration of the stream), while the new one did the same in 16s! I'm quite satisfied so far. Hopefully all the previously working video/image/audio conversions will keep working with the new version as well. Smile

P.S.: and of course the new version has tons of new codecs in the supported list. Check out the output of ffmpeg -codecs.

P.S.: for the armhf and i386 architectures (the latter might affect quite some people) the Sid multiarch-support package has a stronger dependecy on libc6, namely >= 2.13-5. This is unfortunate since it cannot be met easily. You could include half of Sid in your preferences file (upgrading libc always means tons of packages) or you could do as I did: compile multiarch-support from source and change the libc6 dependency. For the latter you'll have to include dpkg-dev and libdpkg-perl in your preferences (in the sid section), then install the build dependencies of multiarch-support (apt-get build-dep multiarch-support), alter eglic-2.13/debian/control and eglibc-2.13/debian/control.in/main so the multiarch-support package has a Squeeze-compatible dependecy on libc6 (changing the dep. line to "libc6 (>= 2.11.2-10) [armhf i386]" will do), then build (debuild -uc -us -b) and finally install the package. Be prepared for the compile to run for a very long time (~2 hours) and it'll require tons of free disk space too (~2.7G). To make life easier I've attached a modded and compiled version of multiarch-support (you can download and install it with dpkg -i multiarch-support_2.13-23b_i386.deb).
Also beware that hacking the version dependency of multiarch-support means some things might break! If you run a single-architecture Debian setup, you should be pretty safe with the hack though and ffmpeg will install and work without any problems.

P.S.: note that on different architectures the package dependencies might differ from what I've experienced above on amd64. Eg. on the i386 platform the libavdevice53 package has a dependency on libroar-compat1, which depends on libroar1, which depends on libdnet, which suggests dnet-common. By default Squeeze will install suggested packages, thus dnet-common gets installed. The configuration of dnet-common will pop up a few alarming questions (which you should be worried about indeed) like setting the MAC address of your NIC, etc. I guess you don't want to mess around with your network config just to use an up-to-date ffmpeg. Wink So I suggest you do not install dnet-common. One way to do this is to disable automatic installation of "Recommends" (and "Suggests") packages, which is what I did. Another way is to kill dnet-common configuration while it installs and remove/purge it afterwards. Or you could just prevent it's installation in your /etc/apt/preferences.

P.S.: installing this ffmpeg on an i386 architecture server will put the various ffmpeg libs into the /usr/lib/i386-linux-gnu directory which is (by default) not in the dynamic loader path. To fix this create a file at /etc/ld.so.conf.d/i386-linux-gnu.conf with the following contents:
/lib/i386-linux-gnu
/usr/lib/i386-linux-gnu
And execute ldconfig to update the dynamic loader cache. Of course you should test things by executing ffmpeg. If it's not complaining about missing libraries, then you're all set.

AttachmentSize
multiarch-support_2.13-23b_i386.deb140.27 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Thank you! (especially for

Thank you! (especially for the i386 notes)

Update for ffmpeg 0.11

The dependency tree grew a little: now libavformat54 depends on a recent version of the libx11-6 package which you must put into the list of packages in your /etc/apt/preferences to be fetched from Debian Sid.

Furthermore if you'd like to use the x264 Sid package from the Debian Multimedia repo, then you'll need libffms2-2, which won't install from the Debian Sid repo, because it depends on a recent libstdc++6. To get around this issue, you've to compile libffms2-2 from the source of the Sid package. However you'll run into a few problems:
  1. First of all: you'll need all the dev packages so put these into your Debian Multimedia repo preferred list in your /etc/apt/preferences too (ie. libavutil-dev libavformat-dev libavcodec-dev libswscale-dev libpostproc-dev)
  2. Second: you'll have to manually specify on the debuild commandline the path to the pkg-config files of the dev packages' *.pc files, ie. debuild --set-envvar PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig -uc -us -b
  3. Third: the package build process will still fail with the following error message:
    configure: error: in `/root/temp/ffms2-2.17':
    configure: error: cannot link with FFmpeg
    See `config.log' for more details
    And in the references config.log you'll find something like this:
    configure:15051: checking whether FFmpeg works
    configure:15075: gcc -o conftest -g -O2    -D__STDC_CONSTANT_MACROS -Wl,--as-needed conftest.c  -L/usr/lib/i386-linux-gnu -lavformat -lavcodec -lswscale -lavutil   >&5
    /tmp/ccSzg74M.o: In function `main':
    /root/temp/ffms2-2.17/conftest.c:34: undefined reference to `avcodec_init'
    collect2: ld returned 1 exit status
    To work around the problem, open the configure.in file in the package source, search for the "avcodec_init()" function call and replace it with "avcodec_register_all()" (or just simply delete the call, but it's not too elegant).
Now running the previously described debuild command should build the package for you.

P.S.: I also suggest to change the libffms2-2 package version from the Sid default (it's 2.17-1 at the time I write this and I added a new entry to the debian/changelog file with a version of 2.17-2) or else APT will get confused and complain that some libav*53 packages have to be installed (but actually they are needed only by the factory version of the libffms2-2 2.17-1 package and not the one we compiled ... this is probably an APT bug).

multiarch-support

I needed to install multiarch-support for some other package and I couldn’t do it… Thank you very much for this fixed version!

does not work when i install ffmpeg

sudo apt-get install ffmpeg gpac x264
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
ffmpeg : Depends: libavcodec54 but it is not going to be installed
Depends: libavdevice54 but it is not going to be installed
Depends: libavfilter3 but it is not going to be installed
Depends: libavformat54 but it is not going to be installed
Depends: libavutil51 but it is not going to be installed
Depends: libpostproc52 but it is not going to be installed
Depends: libswresample0 but it is not going to be installed
Depends: libswscale2 but it is not going to be installed
gpac : Depends: gpac-modules-base (= 1:0.5.0-dmo3) but it is not going to be installed
Depends: libgpac2 (>= 1:0.5.0) but it is not going to be installed
x264 : Depends: libavutil51 (>= 7:0.11.1) but it is not going to be installed
Depends: libffms2-2 but it is not going to be installed
Depends: libswscale2 (>= 7:0.11.1) but it is not going to be installed
Depends: libx264-128 but it is not going to be installed
E: Broken packages