ffmpeg

Revision 50 as of 2009-07-07 05:13:51

Clear message

Fixing FFmpeg on Ubuntu

For a litany of legal reasons, FFmpeg does not come with all of the necessary things enabled for you to encode video for the iPod Video by default. Therefore, we need to build it from source and install some other libraries and programs, as well. Make sure you have the Multiverse and Universe repositories enabled.

Unstripped build of FFmpeg for Ubuntu 8.10 Intrepid

In the terminal, run:

sudo apt-get install libavcodec-unstripped-51 libavdevice-unstripped-52 libavformat-unstripped-52 libavutil-unstripped-49 libpostproc-unstripped-51 libswscale-unstripped-0

Also those packages are from Multiverse repository. To be sure you have enter the correct format name, please run "ffmpeg -formats" to find the correct names (it seems they have changed).

Compiling FFmpeg from version in the repositories

In the terminal, run:

sudo apt-get build-dep ffmpeg

On pre-8.04:

sudo apt-get install liblame-dev libfaad2-dev libfaac-dev libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev libdts-dev checkinstall

On 8.04:

sudo apt-get install liblame-dev libfaad-dev libx264-dev libfaac-dev libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev libdts-dev checkinstall

On 8.10:

sudo apt-get install libmp3lame-dev libfaad-dev libx264-dev libfaac-dev libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev libdts-dev checkinstall

As there is only a dummy package with libfaad2-dev, it is now replaced with libfaad-dev.

apt-get source ffmpeg

cd ffmpeg-*/

if you are using and x86_64 or AMD64 architecture (aka 64 bits) you must execute the next commands :

cp configure configure.bkp
sed -e "s/-ldts /-ldts_pic /" configure.bkp > configure

For a full explanation on the inner workings about this, take a look here

In pre-7.10 releases (these should be all on one line):

./configure --enable-gpl --enable-pp --enable-vorbis --enable-libogg --enable-a52 --enable-dts --enable-dc1394 --enable-libgsm --disable-debug --enable-mp3lame --enable-faad --enable-faac --enable-xvid --enable-shared

Or, on 7.10:

./configure --enable-gpl --enable-pp --enable-libvorbis --enable-libogg --enable-liba52 --enable-libdts --enable-dc1394 --enable-libgsm --disable-debug --enable-libmp3lame --enable-libfaad --enable-libfaac --enable-xvid --enable-shared

On 8.04:

./configure --enable-liba52 --disable-debug --enable-libfaad --enable-libfaac --enable-gpl --enable-amr_nb --enable-amr_wb --enable-x264 --enable-xvid --enable-libdts --enable-pthreads --enable-libvorbis --enable-pp --enable-libtheora --enable-libogg --enable-libgsm --disable-debug --enable-shared --prefix=/usr

On 8.10:

./configure --enable-liba52 --disable-debug --enable-libfaad --enable-libfaac --enable-gpl --enable-libamr-nb --enable-libamr-wb --enable-nonfree --enable-libx264 --enable-libxvid --enable-pthreads --enable-libvorbis --enable-pp --enable-libtheora --enable-libgsm --enable-swscaler --disable-debug --enable-shared --prefix=/usr

Because you enabled amr (using switches --enable-amr_nb and --enable-amr_wb) and the source code for is not distributed in Kubuntu then you need to download both source code and copy them inside the FFmpeg source tree. Let's suppose you have the FFmpeg source code in the folder ffmpeg-0.cvs20070307, then you need to do this :

  • Download the latest amr nb float version from this link

  • unzip it
  • copy the source code inside the folder ffmpeg-0.cvs20070307/libavcodec/amr_float
  • Download the latest amr wb float version from this link

  • unzip it
  • copy the source code inside the folder ffmpeg-0.cvs20070307/libavcodec/amrwb_float

On later versions of 8.04:

./configure --enable-liba52 --disable-debug --enable-libfaad --enable-libfaac --enable-gpl --enable-x264 --enable-xvid --enable-pthreads --enable-libvorbis --enable-pp --enable-libtheora --enable-libogg --enable-libgsm --enable-swscaler --disable-debug --enable-shared --prefix=/usr

AMR requires codecs available in Medibuntu repositories.

Then compile:

make

sudo checkinstall -D make install

*Only!!! If the above command doesn't work try this (reasons are explained below):

sudo make install

*If you get these errors in 8.04:

install:`cannot stat 'doc/ffmpeg.1' No such file or directory
.. ffplay.1 ..
.. ffserver.1..
make: *** Error 1
**** Installation failed. Aborting package creation
Cleaning up...OK
Bye.

Then you should run this command:

sudo apt-get install libx264-dev checkinstall

And then repeat the steps above preceeding the error message.

It will go through a bunch of stuff and prompt you on the last command for a few things. First, hit y to create docs, then just hit enter at the EOF question. Next, it will take you to the name and version. Edit #2 (name) to be ffmpeg, then edit #3 (version) to be something newer than what it is...so, either 1.cvsxxxxxx or some other way. If your installation fails because it claims that it was downgrading FFmpeg, you may use "sudo make install" instead of "sudo checkinstall -D make install", but you will not have a dpkg for it. If you go thise route, you can always uninstall by returning to this directory and typing "sudo make uninstall". If you don't mind not having a dpkg for it, then I'd recommend going straight to a sudo make install. Now, FFmpeg is fixed, time to move onto gtkpod's abilities.

Compiling FFmpeg from upstream svn snapshots

  • Warning /!\ September 2008: Compiling from upstream may currently be broken if you choose to compile in encoding support for H264 (--enable-x264 option). libx264-dev shipped with Ubuntu 8.04 Hardy Heron is too old to compile FFmpeg. See this http://article.gmane.org/gmane.comp.video.mplayer.user/56828. The error message you might see includes "'X264_ME_TESA' undeclared (first use in this function)",

For up to date instructions on installing the latest FFmpeg and x264 see HOWTO: Install and use the latest FFmpeg and x264 at the Ubuntu Forums.

please note that x264 is an *encoder*. FFmpeg does not need this library for playback. In fact, the ffmpeg version in ubuntu main has no problem with h264 playback.

Remove FFmpeg

sudo apt-get remove ffmpeg

Get pre-requisites

sudo apt-get install libgsm1-dev libvorbis-dev libxvidcore4-dev libdc1394-dev libfaac-dev libmp3lame-dev libx264-dev libfaad-dev libtheora-dev libsdl1.2-dev 

Grab the FFmpeg source

wget http://ffmpeg.mplayerhq.hu/ffmpeg-export-snapshot.tar.bz2
tar jxvf ffmpeg-export-snapshot.tar.bz2
cd ffmpeg-export-*

or checkout the latest version from svn

sudo apt-get install SVN
svn co svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
cd ffmpeg

Configure

./configure --enable-gpl --enable-postproc --enable-swscale --enable-pthreads --enable-x11grab --enable-libdc1394 --enable-libfaac --enable-libfaad --enable-libgsm --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid

Compile

make

Install

sudo checkinstall --fstrans=no --install=yes --pkgname=ffmpeg --pkgversion "3:0.svn`date +%Y%m%d`-12ubuntu3" --default

Issues

Check here if you get one of these error messages: "ffplay: symbol lookup error: /usr/local/lib/libavcodec.so.52: undefined symbol: av_gcd" or "ffmpeg: error while loading shared libraries: libavformat.so.52: cannot open shared object file: No such file or directory".

Medibuntu

Another option for Hardy users is to enable the Medibuntu repository and install FFmpeg from there.


CategoryDocumentation