6Dec/094
ffmpeg and x264
How to install ffmpeg with x264 codec support on Debian Lenny (5.0)?Why is this useful? By using x264 codec rather than a FLV video format you will gain on video and audio quality.
1. We need to remove any previous ffmpeg installations.
2. Add additional repository to /etc/apt/sources.list
Open file with nano editor:
nano /etc/apt/sources.list
and add following line on the end of the file:
deb http://www.debian-multimedia.org stable main
3. Install needed libraries:
apt-get install build-essential subversion git-core checkinstall yasm texi2html libfaac-dev libfaad-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libx11-dev libxfixes-dev libxvidcore4-dev zlib1g-dev libogg-dev
4. Install x264
git clone git://git.videolan.org/x264.git
cd x264
./configure
make
sudo checkinstall --pkgname=x264 --pkgversion "1:0.svn`date +%Y%m%d`" --backup=no --default
5. Install libtheora
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz
tar xzvf libtheora-1.1.1.tar.gz
cd libtheora-1.1.1
./configure
make
sudo checkinstall --pkgname=libtheora --pkgversion "1.1.1" --backup=no --default
6. Install ffmpeg
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-x11grab
make
sudo checkinstall --pkgname=ffmpeg --pkgversion "4:0.5+svn`date +%Y%m%d`" --backup=no --default
7. Install qt-faststart
Normal mp4 file needs to be fully downloaded before it can be played by Flash Player. qt-faststart fixes this.
Type following command from ffmpeg source directory:
make tools/qt-faststart
Example:
ffmpeg -i input.mov -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre hq -crf 22 -threads 0 output.mp4
./tools/qt-faststart output.mp4 output2.mp4
Now you can play output2.mp4 by any Flash player. LongTail's freeware JW Player is quite good, has many options and can play both mp4 and flv.
Now you can use ffmpeg to compress videos with x264 codec. Read more about converting video with PHP
Warning: Latest ffmpeg version has some problems with FLV format and it's impossible to convert video to .flv with it! If you need flv support try installing older version of ffmpeg (if you install it by apt-get install ffmpeg you will be able to convert to FLV but there is no x264 support).
Source: http://ubuntuforums.org/showthread.php?t=786095
January 9th, 2010 - 18:37
Thanks, it's working great! :D
January 20th, 2010 - 19:55
When installing ffmpeg , after command make I get this error:
/tmp/ffmpeg/libavcodec/libavcodec.a(libx264.o): In function `X264_init':
/tmp/ffmpeg/libavcodec/libx264.c:286: undefined reference to `x264_encoder_open_83'
collect2: ld returned 1 exit status
make: *** [ffmpeg_g] Error 1
rm ffmpeg.o
May 3rd, 2010 - 20:09
apt-get --purge remove libx264-dev
then try again ;)
May 12th, 2010 - 19:10
NVM, your problem is with your symlinks. You need to update your symlinks after the installation by running the command: ldconfig.