Monday, November 26, 2012

Getting ffmpeg to work with libfaac on Fedora

You got your fancy Fedora 17 working.  And then you try to use ffmpeg to encode something only to see the dreaded Unknown Encoder 'libfaac' message.

When you've accepted the fact that you need to compile from source for licensing reasons, here's a cheat sheet for fc17 based on (easier) instructions by Doran L. Barton, Recompiling ffmpeg for Fedora 12 to add faac support.

$ uname -a
Linux *** 3.6.7-4.fc17.x86_64 #1 SMP Tue Nov 20 19:40:01 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

$ yumdownloader --source ffmpeg

$ rpm -ivh ffmpeg-0.10.6-1.fc17.src.rpm

# update the Release label
$ vi ~/rpmbuild/SPECS/ffmpeg.spec


# get dependencies
$ yum install \
    celt-devel libass-devel libcdio-devel libmodplug-devel libv4l-devel \
    libXvMC-devel openal-soft-devel openjpeg-devel pulseaudio-libs-devel

$ rpmbuild -ba ~/rpmbuild/SPECS/ffmpeg.spec --with faac

$ ls ~/rpmbuild/RPMS/x86_64/ffmpeg-*
ffmpeg-0.10.6-1.fc17_nrh.x86_64.rpm        ffmpeg-devel-0.10.6-1.fc17_nrh.x86_64.rpm
ffmpeg-debuginfo-0.10.6-1.fc17_nrh.x86_64.rpm  ffmpeg-libs-0.10.6-1.fc17_nrh.x86_64.rpm

$ rpm -Uvh ~/rpmbuild/RPMS/x86_64/ffmpeg-*
...

$ ffmpeg
ffmpeg version 0.10.6 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 26 2012 17:48:46 with gcc 4.7.2 20120921 (Red Hat 4.7.2-2)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg 
   --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man 
   --arch=x86_64 --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 
   -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' 
   --enable-bzlib --disable-crystalhd --enable-gnutls --enable-libass --enable-libcdio 
   --enable-libcelt --enable-libdc1394 --enable-libfaac --enable-nonfree --disable-indev=jack
   --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal 
   --enable-libopenjpeg --enable-libpulse --enable-librtmp --enable-libschroedinger 
   --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 
   --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab 
   --enable-avfilter --enable-postproc --enable-pthreads --disable-static 
   --enable-shared --enable-gpl --disable-debug --disable-stripping 
   --shlibdir=/usr/lib64 --enable-runtime-cpudetect
  libavutil      51. 35.100 / 51. 35.100
  libavcodec     53. 61.100 / 53. 61.100
  libavformat    53. 32.100 / 53. 32.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 61.100 /  2. 61.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    52.  0.100 / 52.  0.100
Hyper fast Audio and Video encoder

Enjoy!