Thursday, May 17, 2007

FFmpeg Compilation

How to compile ffmpeg with all almost all possible codecs.

Library Versions

  • a52dec-0.7.4.tar.gz
  • amrnb-6.1.0.3.tar.bz2
  • amrwb-7.0.0.0.tar.bz2
  • faac-1.24.tar.gz
  • faad2-2.0.tar.gz
  • lame-3.97.tar.gz
  • libogg-1.1.3.tar.gz
  • libvorbis-1.1.2.tar.gz
  • libtheora-mmx-1.0alpha5.zip
  • x264-snapshot-20070515-2245.tar.bz2 (with yasm-0.6.0.tar.gz )
  • xvidcore-1.1.2.tar.bz2
  • ffmpeg-checkout-snapshot.tar.bz2 (snapshort from 2007-05-09)

Actually the latest versions of all the libraries was got. Excluding faad and faac. The given pair is the only combination which I was able to compile and make work with ffmpeg.

Compilation Process

Suggestion: it is very useful to start ldconfig after every library compilation.

  • faad2 must be compiled (with option --with-mp4v2) before faac
    • Possible problem 1: when doing make it fails with error about missing separator. Fix: remove the target rpm at the bottom of Makefile, after editing the bottom of the file must look like that:
      ...
      # Tell versions [3.59,3.63) of GNU make to not export all variables.
      # Otherwise a system limit (for SysV at least) may be exceeded.
      .NOEXPORT:
    • Possible problem 2: invalid initializer for virtual method when compiling. Fix: in files mp4property.h and rtphint.h fix all virtual methods defined with NULL. Example:
      virtual void SetCount(u_int32_t count) = NULL;

      replace to

      virtual void SetCount(u_int32_t count) = 0;

      There are several methods in the files defines in such style, fix them all.

  • faac ensure that it’ll be build with mp4v2 from compiled faad. After configuration complete, check:
    cat config.log | grep 'with MP4'

    it must found string *** Building with MP4 support ***

  • libogg must be compiled before vorbis, ensure that vorbis config found libogg
  • libtheora-mmx must be compiled after libogg and vorbis
  • x264 must be compiled with --enable-shared
  • ffmpeg
    ./configure --enable-shared --enable-libfaad \
    --enable-libfaadbin --enable-libfaac \
    --enable-libvorbis --enable-libogg \
    --enable-libtheora --enable-xvid \
    --enable-libmp3lame --enable-liba52 \
    --enable-liba52bin --enable-libamr-nb \
    --enable-libamr-wb --enable-gpl --enable-x264
  • a52 it is not a mistake that the library is listed after ffmpeg.
    • Possible problem: If I configure a52 with the flag --enable-shared before ffmpeg compilation, then the ffmpeg compilation failed. If I do not recompile a52 after, ffmpeg can’t open shared a52 library because it is compiled as static by default. The way I was able to make it work:
      1. compile a52 without flags and install
      2. compile and install ffmpeg (see above)
      3. AGAIN configure a52 with flag --enable-shared, compile and install

0 comments: