How to Compile FFMPEG with H.264 and LAME in Ubuntu And Debian

ffmpeg-logo This guide will provide the latest FFmpeg code and enable several external encoding and decoding libraries:fdk-aac (AAC encoder), libfaac (AAC encoder), libmp3lame (MP3 encoder), libopencore-amr (AMR encoder/decoder), librtmp (for additional RTMP protocols), libtheora (Theora encoder), libvorbis (Vorbis encoder), libvpx (VP8 encoder/decoder), and libx264 (H.264 encoder). These are optional and may be omitted if desired. This guide will also install many filters, including the subtitles filter for hardcoding subtitles (see the filter list in the Filtering Guide).


If necessary, uninstall x264, libx264-dev, and ffmpeg:
$ sudo apt-get remove ffmpeg x264 libx264-dev yasm

Get the dependencies (Ubuntu Desktop users):
$ sudo apt-get update
$ sudo apt-get -y install autoconf build-essential checkinstall git libass-dev libfaac-dev libgpac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev librtmp-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev
 
Get the dependencies (Ubuntu Server or headless users):

$ sudo apt-get update
$ sudo apt-get -y install autoconf build-essential checkinstall git libass-dev libfaac-dev libgpac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev librtmp-dev libtheora-dev libtool libvorbis-dev pkg-config texi2html zlib1g-dev

Compilation & Installation

1. Yasm

Yasm is an assembler used by x264 and FFmpeg.
$wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
$ tar xzvf yasm-1.2.0.tar.gz
$ cd yasm-1.2.0
$ ./configure
$ make
$ sudo checkinstall --pkgname=yasm --pkgversion="1.2.0" --backup=no --deldoc=yes --default

2. Install x264

H.264 video encoder. The following commands will get the current source files, compile, and install x264. See the x264 Encoding Guide for some usage examples.
$ git clone git://git.videolan.org/x264
$ cd x264
$ ./configure --enable-static --enable-shared --enable-debug --enable-gprof
$ make
$ sudo checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | \
    awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \
    --fstrans=no --default

3. fdk-aac

AAC audio encoder. See the AAC Encoding Guide for more information and examples.
$ git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
$ cd fdk-aac
$ autoreconf –fiv
$ ./configure --disable-shared
$ make
$ sudo checkinstall --pkgname=fdk-aac --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no \
  --deldoc=yes --fstrans=no --default

4. libmp3lame

MP3 audio encoder.
$ sudo apt-get remove libmp3lame-dev
$ sudo apt-get install nasm   
$ wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
$ tar xzvf lame-3.99.5.tar.gz
$ cd lame-3.99.5
$ ./configure --enable-nasm --disable-shared
$ make
$ sudo checkinstall --pkgname=lame-ffmpeg --pkgversion="3.99.5" --backup=no --default --deldoc=yes

5. libopus

Opus audio decoder and encoder.
$ git clone --depth 1 git://git.xiph.org/opus.git
$ cd opus
$ ./autogen.sh
$ ./configure --disable-shared
$ make
$ sudo checkinstall --pkgname=libopus --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no \
  --deldoc=yes --fstrans=no --default

6. libvpx

VP8/VP9 video encoder and decoder. See the vpx (WebM) Encoding Guide for more information and examples.
$ git clone --depth 1 http://git.chromium.org/webm/libvpx.git
$ cd libvpx
$ ./configure --disable-examples --disable-unit-tests
$ make
$ sudo checkinstall --pkgname=libvpx --pkgversion="1:$(date +%Y%m%d%H%M)-git" --backup=no \
  --deldoc=yes --fstrans=no --default

7. ffmpeg

Note: Server users should remove --enable-x11grab from the following command:
$ git clone --depth 1 git://source.ffmpeg.org/ffmpeg
$ cd ffmpeg
$ ./configure --enable-gpl --enable-libass --enable-libfaac --enable-libfdk-aac --enable-libmp3lame \
  --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora \
  --enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree --enable-version3
$ make
$ sudo checkinstall --pkgname=ffmpeg --pkgversion="7:$(date +%Y%m%d%H%M)-git" --backup=no \
  --deldoc=yes --fstrans=no --default
$ hash -r

Finish

Installation is now complete and ffmpeg is now ready for use. Check to see if you’re using your new ffmpeg:
$ ffmpeg 2>&1 | head -n1
ffmpeg version git-2013-05-18-5918b7a Copyright (c) 2000-2013 the FFmpeg developers
Terima kasih telah membaca artikel tentang How to Compile FFMPEG with H.264 and LAME in Ubuntu And Debian di blog Tutorial Opensource and Linux jika anda ingin menyebar luaskan artikel ini di mohon untuk mencantumkan link sebagai Sumbernya, dan bila artikel ini bermanfaat silakan bookmark halaman ini di web browser anda, dengan cara menekan Ctrl + D pada tombol keyboard anda.

Artikel terbaru :