Links:
Ubuntu tutorial
2011-11-21 update: NEVER blow out your old ffmpeg when compiling a new ffmpeg until you first determine if you need to update your x264 to compile the newer ffmpeg version (during ./configure). x264 requires that ffmpeg (eg. your old version) already be installed to provide lavf support during x264 assembly, a mind-bendingly stupid developer Catch-22. Without lavf, ffmpeg is as useful as a text editor when it comes to AV files. After updating the x264 SUCCESSFULLY, then you can blow-out your old ffmpeg version.2011-09-01 update: mencoder will not open without libdirac present. That's the BBC one I talk about below. A good time to build it is when doing the ffmpeg compile. Then both ffmeg and mencoder can use it. For this, add "--enable-libdirac" to the stuff I have below in the ffmpeg configure line.
I recently upgraded/replaced an installed
ffmpeg package. The idea was cell phone interoperability. The previously installed
ffmpeg package wasn't apparently compiled with
amr, 3gp, or 3gpp file support, so that I couldn't translate these files generated by my cellphone. Upgrading
ffmpeg turned-out to be a trip down the rabbit hole, so posting here for posterity.
Note: Zenwalk installs lib modules in
/usr/lib. The newly compiled libs installed to the standard
/usr/local/lib. Solution: I left the old Zenwalk modules in
/usr/lib but removed softlinks in
/usr/lib. I then made new softlinks in
/usr/lib, but these one point to the new modules in
/usr/local/lib. To restore the original Zenwalk installation, just recreate softlinks in
/usr/lib that point to the old modules in
/usr/lib and delete the ones pointing to
/usr/local/lib.
libx264 VideoLan's
libx264 is the backbone of
ffmpeg. When compiling
ffmpeg, if
ffmpeg doesn't detect a recent version of
libx264, it will exit and request that a more recent version be built. Daily
libx264 builds are available for download at the
VideoLan site. The difference between
libx264 (and
libxvidcore below) and most other modules is in being assembled, rather than compiled. Assembly takes advantage of machine-level instruction efficiency when encoding video. Accordingly, I
downloaded and installed the
yasm assembler before configuring
libx264 . My configure line for
libx264 then looked something like:
$ ./configure --mandir=/usr/man --enable-yasm --enable-visualize --enable-shared
libxvidcoreLibxvidcore is a codec with similar importance to
libx264. The source for it was easily located at
xvid.org, and then downloaded. After untarring on my drive, I located Linux source a couple directories from the top, in
build -> generic. Googling around, I found conflicting information about whether or not
libxvidcore could be assembled or compiled. Running
$ ./compile --help also did not provide a solid answer. Eventually, I just compiled it without any selected configuration options, though I would have preferred to assemble it, if it had been clear how to do so.
libschroedingerThis is for the BBC's Dirac encoder. Even though I was using the most recent
ffmpeg from an svn repository, I couldn't get
ffmpeg to properly recognize libschroedinger. Eventually, I took
libschroedinger out of my
ffmpeg configure line.
other updates During configuration of
ffmpeg, prior to the
make phase, other updates were also requested by
ffmpeg. These were the
libtheora open-source encoder,
swscale, and
opencoreamr.
Opencoreis a
downloadable Sourceforge project,
swscale comes inside
ffmpeg source, and
libtheora source is found in the
downloads portion of their site. It appeared that I didn't need to update
libspeex during this particular
ffmpeg upgrade. Another nice thing is that
libfaad and
libfaad-bin are nowadays incorporated into
ffmpeg and no longer need to be separately compiled.
ffmpeg & configure line Finally, after completing all updates to supporting modules above, I located the
svn URL at the
the ffmpeg download page, and retrieved the most recent
ffmpeg source code:
$ svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
The final
configure line, the configuration which resulted in a working
ffmpeg installation, is below. It's long and will wrap several lines in this blog, but it's actually a single terminal command:
$ ./configure --mandir=/usr/man --enable-shared --disable-static --enable-pthreads --enable-x11grab --enable-swscale --enable-libfaac --enable-libmp3lame --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-gpl --enable-postproc --disable-ssse3 --enable-libopencore-amrwb --enable-libopencore-amrnb --enable-yasm --enable-version3 --enable-nonfree --arch=i686 --cpu=i486
updated library listI had to manually link these to
/usr/local/lib.
Ffmpeg sought them in
/usr/liblibpostproc
libavcodec
libavcore
libavdevice
libavfilter
libavformat
libavutil
libpostproc
libspeex
libswscale
libtheoradec
libtheoraenc
libx264
libxvidcore
Edit: this easily could have been avoided by adding a line in /etc/ld.so.config.d and then running ldconfig, or by adding --prefix=/usr to the $ ./configure of ffmpegfinal tallyThe entire
ffmpeg update process took most of a weekend, but
ffmpeg seemed to work without a hitch following completion. In fact, it seemed to run faster, perhaps due to using an assembler for
libx264. After the update, I quickly converted a
.3gpp cell phone file to a
.wav:
$ ffmpeg -i recording36180.3gpp -vn -acodec pcm_s16le -ar 44100 -ac 1 lecture_03.wav
A list of the required actions to update
ffmpeg:
- yasm - download, compile, install
- libx264 - download, assemble, install
- libxvidcore - download, compile, install
- libopencore - download, compile, install
- libtheora - download, compile, install
- ffmpeg - svn download, compile, install
- library linking (likely avoidable for those with "ld" knowledge)