domenica 30 novembre 2008

[Basics How-To] How i installed/built ffmpeg with mp3, amr, x264, theora, vorbis, xvid support on Kubuntu Hardy Heron 64-bit


Due to license restrictions the ffmpeg binary/package in K/X/Ubuntu repositories the encoding in restricted formats (such as mp3) is not possible by default. Googling around i found out a lot of different guides for ffmpeg installation, but focusing on one format at a time, or enabling only some of ffmpeg features. Here's a (tested) synthesis of all the guides i found. Credits after the howto.

Be warned that i started from a long-time installation, so some more libraries than stated may need to be installed.

Said this, here we go.

We need to remove the repository package and then to install (or compile) the dependencies needed

First a bit of cleansing

$ sudo apt-get remove ffmpeg

Then some utilities & libraries
$ sudo apt-get install git-core checkinstall build-essential subversion liblame-dev libfaad-dev libfaac-dev libxvidcore4-dev libx264-dev libdts-dev libgsm1-dev libtheora-dev libvorbis-dev libdc1394-13-dev libraw1394-dev

Now we have to create a dir to download the source code for ffmpeg and related dependencies
$ mkdir src

Move inside the newly created dir
$ cd src

Now we have to get all of the needed code through subversion, git and wget
$ svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
$ git clone git://git.videolan.org/x264.git
$ wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-7.0.0.2.tar.bz2
$ wget http://ftp.penguin.cz/pub/users/utx/amr/amrwb-7.0.0.3.tar.bz2
$ wget http://www.tortall.net/projects/yasm/releases/yasm-0.7.2.tar.gz

Untar the tarballs
$ tar -xjvf amrnb-7.0.0.2.tar.bz2
$ tar -xjvf amrwb-7.0.0.3.tar.bz2
$ tar -xzvf yasm-0.7.2.tar.gz

Now some compile&install using checkinstall.
Checkinstall is an application meant to replace the 'make install' final command in the process of software installation, by building and installing a .deb (or .rpm or .tgz) package, thus allowing the tracking of the change made, easing software removal.
The output of the process will be a bunch of installed binary packages, removable through dpkg ($sudo dpkg -r [package_name])

Yasm is a modular assembler that will optimize x264 code for MMX/SSE, thus improving encoding speed. The package in Hardy repository is not-so-up-to-date so let's build it.
$ cd yasm-0.7.2
$ ./configure
$ make
$ sudo checkinstall
$ cd ..

Libamr is the audio encoder/decoder for 3gp format (don't know why, checkinstall isn't successful with these)
$ cd amrnb-7.0.0.2
$ ./configure --prefix=/usr
$ make
$ sudo make install
$ cd ..

$ cd amrwb-7.0.0.3
$ ./configure --prefix=/usr
$ make
$ sudo make install
$ cd ..

From Wikipedia: x264 is a free software library for encoding H.264/MPEG-4 AVC video streams
$ cd x264
$ ./configure --prefix=/usr --enable-shared
$ make
$ sudo checkinstall --pkgname=x264 --pkgversion "1:0.svn`date +%Y%m%d`-0.0ubuntu1"
$ sudo ldconfig
$ cd ..

At last, here we go with ffmpeg km-long configuration line, then the usual make && checkinstall
$ cd ffmpeg
$ ./configure --enable-gpl --enable-swscale --enable-pthreads --enable-libvorbis --enable-libtheora --enable-libvorbis --enable-libgsm --enable-libdc1394 --disable-debug --enable-shared --enable-libmp3lame --enable-libfaad --enable-libfaac --disable-vhook --enable-libxvid --enable-libx264 --enable-postproc --enable-libamr-nb --enable-libamr-wb --enable-avfilter --enable-nonfree --prefix=/usr
$ make
$ sudo checkinstall

And that's it!

Credits to:
http://symbiotix.net/articles/compiling-ffmpeg-mp3-ubuntu-revised-ubuntu-gutsy-server
http://po-ru.com/diary/up-to-date-ffmpeg-on-ubuntu-hardy/
http://ubuntuforums.org/showthread.php?t=491885

http://ubuntuforums.org/showthread.php?t=786095&highlight=libx264
FFMpeg Documentation & http://howto-pages.org/ffmpeg/ for software usage help

Don't forget myself...... ^^

venerdì 21 novembre 2008

OdfConverter [with libtiff4] on Kubuntu Gutsy - Howto

Steps to install odf-converter (software that converts MS OpenXML formats in ODF)

1. Download odf-converter-1.1-7.i586.rpm (for x86_32) or odf-converter-1.1-7.x86_64.rpm (for x86_64)
2. Install alien and rpm --> In a terminal just type $sudo apt-get install rpm alien
3. Move to the folder in which the rpm has been downloaded. Convert the .rpm package to a .deb package --> In a terminal $cd /folder/in/which/is/rpm/ - then - $sudo alien -dv odf-converter-1.1-7.x86_64.rpm (or odf-converter-1.1-7.i586.rpm if on 32-bit hardware)
4. Install the newly built .deb package --> $sudo dpkg -i odf-converter_1.1-8_amd64.deb
5. Copy the binary to the binaries folder --> $sudo cp /usr/lib/ooo-2.0/program/OdfConverter /usr/bin
6. Try running Odfconverter --> $OdfConverter
6.b [to do only if the previous command returned "OdfConverter: error while loading shared libraries: libtiff.so.3: cannot open shared object file: No such file or directory"] Create a symlink named libtiff.so.3 pointing to libtiff.so.4 and update libraries cache --> $sudo ln -s /usr/lib/libtiff.so.4 /usr/lib/libtiff.so.3 && sudo ldconfig
7. Start using software --> OdfConverter /I file.to.convert.docx

Credits:
http://www.oooninja.com/2008/01/convert-openxml-docx-etc-in-linux-using.html

http://linux.derkeiler.com/Mailing-Lists/Ubuntu/2006-04/msg02897.html for the libtiff trick