Compile FFmpeg on Ubuntu

Compile FFmpeg on Ubuntu

This guide supports Ubuntu 12.10 (Quantal Quetzal)Ubuntu 12.04 (Precise Pangolin), and Ubuntu 11.10 (Oneiric Ocelot). Separate guides are available forUbuntu 10.04 (Lucid Lynx) and Ubuntu 8.04 (Hardy Heron). 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).

Note: Copy and paste the whole code box for each step.




Preparation

Remove any existing packages:

1
sudo  apt-get remove ffmpeg x264 libav-tools libvpx-dev libx264-dev yasm
 
 

Note: The multiverse repository must be enabled in order to install the libfaac-dev package. See  more details on adding repositories.

Get the dependencies (Ubuntu Desktop users):

1
2
3
4
5
sudo  apt-get update
sudo  apt-get -y  install  autoconf automake 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 libspeex-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):

1
2
3
4
sudo  apt-get update
sudo  apt-get -y  install  autoconf automake build-essential checkinstall git libass-dev libfaac-dev \
   libgpac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev librtmp-dev libspeex-dev \
   libtheora-dev libtool libvorbis-dev pkg-config texi2html zlib1g-dev
 
 

InstallationYasm

Yasm is an assembler and is recommended for x264 and FFmpeg.

1
2
3
4
5
6
7
8
cd
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  --fstrans=no --default
 
 

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.

1
2
3
4
5
6
7
8
cd
git clone --depth 1 git: //git .videolan.org /x264 .git
cd  x264
. /configure  -- enable -static
make
sudo  checkinstall --pkgname=x264 --pkgversion="3:$(. /version .sh | \
   awk  -F '[" ]'  '/POINT/{print $4"+git"$5}' )" --backup=no --deldoc= yes  \
   --fstrans=no --default
 
 

Note: You can download the nightly  as an alternative to using git.

fdk-aac

AAC audio encoder.

1
2
3
4
5
6
7
8
cd
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
 
 

Note: You can download a  fdk-aac source snapshot as an alternative to using git.


libvpx

VP8 video encoder and decoder.

1
2
3
4
5
6
7
cd
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
 
 

Note: You can download a  libvpx source snapshot as an alternative to using git.

opus (optional)

Opus audio encoder and decoder. Add --enable-libopus to your ffmpeg ./configure line if you want to use this.

1
2
3
4
5
6
7
8
cd
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
 
 

FFmpeg

Note: Ubuntu Server users should remove --enable-x11grab from the following command:

1
2
3
4
5
6
7
8
9
10
cd
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 -libspeex -- 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
 
 

Note: You can download the nightly FFmpeg source snapshot as an alternative to using git.

Finish

Installation is now complete and FFmpeg is now ready for use. You can keep the x264, libvpx, and ffmpeg directories in your home directory if you plan on updating later. See Updating FFmpeg below for more details. Some optional steps are next followed by instructions on updating FFmpeg and finally instructions on reverting all changes made by this guide.


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值