ubuntu下ffmpeg的编译与安装

说明:由于英文的翻译水平有限,而且现在的翻译工具也非常强大,因此就没有做具体的翻译工作。转过来的原因是自己解决了一些包依赖不足,但是或许在其他的ubuntu版本上不会遇到包的依赖的问题吧,我目前使用的ubuntu 12.04.4

Get the Dependencies

Copy and paste the whole code box for each step.

sudo apt-get update
sudo apt-get -y install autoconf automake build-essential libass-dev libfreetype6-dev libgpac-dev \
  libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev libx11-dev \
  libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev
mkdir ~/ffmpeg_sources

Notes:

  • Server users can omit the ffplay and x11 dependencies: libsdl1.2-dev libva-dev libvdpau-dev libx11-dev libxext-dev libxfixes-dev.
  • Lucid lacks the package libva-dev. This can be ignored.

Compilation & Installation

You can compile ffmpeg to your liking. If you do not require certain encoders you may skip the relevant section and then remove the appropriate ./configure option in FFmpeg. For example, if libopus is not needed, then skip that section and then remove --enable-libopus from the Install FFmpeg section.

This guide is designed to be non-intrusive and will create several directories in your home directory:

  • ffmpeg_sources – Where the source files will be downloaded.
  • ffmpeg_build – Where the files will be built and libraries installed.
  • bin – Where the resulting binaries (ffmpeg, ffplay, ffserver, x264, and yasm) will be installed.

You can easily undo any of this as shown in Reverting Changes Made by This Guide.

Yasm

An assembler for x86 optimizations used by x264 and FFmpeg. Highly recommended or your resulting build may be very slow.

If your repository offers a yasm package ≥ 1.3.0 then you can install that instead of compiling:

sudo apt-get install yasm

Otherwise you can compile:

cd ~/ffmpeg_sources
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xzvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install
make distclean

libx264

H.264 video encoder. See the H.264 Encoding Guide for more information and usage examples.

Requires ffmpeg to be configured with --enable-gpl --enable-libx264.

cd ~/ffmpeg_sources
wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
tar xjvf last_x264.tar.bz2
cd x264-snapshot*
PATH="$PATH:$HOME/bin" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static --disable-opencl
PATH="$PATH:$HOME/bin" make
make install
make distclean

libfdk-aac

AAC audio encoder. See the AAC Encoding Guide for more information and usage examples.

Requires ffmpeg to be configured with --enable-libfdk_aac (and --enable-nonfree if you also included --enable-gpl).

sudo apt-get install unzip
cd ~/ffmpeg_sources
wget -O fdk-aac.zip https://github.com/mstorsjo/fdk-aac/zipball/master
unzip fdk-aac.zip
cd mstorsjo-fdk-aac*
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean

libmp3lame

MP3 audio encoder.

Requires ffmpeg to be configured with --enable-libmp3lame.

If your repository offers a libmp3lame-dev package ≥ 3.98.3 then you can install that instead of compiling:

sudo apt-get install libmp3lame-dev

Debian 6 "Squeeze" users must compile:

sudo apt-get install nasm
cd ~/ffmpeg_sources
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 --prefix="$HOME/ffmpeg_build" --enable-nasm --disable-shared
make
make install
make distclean

libopus

Opus audio decoder and encoder.

Requires ffmpeg to be configured with --enable-libopus.

If your repository offers a libopus-dev package ≥ 1.1 then you can install that instead of compiling:

sudo apt-get install libopus-dev

注解:我是ubuntu 12.04上面编译的,但是会遇到包依赖不足,无法安装。我的解决方案是手动的去下载。
具体的下载网址和相关的做法,都可以找的到。
网址:http://packages.ubuntu.com/zh-tw/utopic/libopus-dev

Otherwise you can compile:

cd ~/ffmpeg_sources
wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz
tar xzvf opus-1.1.tar.gz
cd opus-1.1
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean

libvpx

VP8/VP9 video encoder and decoder. See the vpx (WebM) Encoding Guide for more information and usage examples.

Requires ffmpeg to be configured with --enable-libvpx.

cd ~/ffmpeg_sources
wget http://webm.googlecode.com/files/libvpx-v1.3.0.tar.bz2
tar xjvf libvpx-v1.3.0.tar.bz2
cd libvpx-v1.3.0
./configure --prefix="$HOME/ffmpeg_build" --disable-examples
make
make install
make clean

ffmpeg

Note: Server users can omit --enable-x11grab (this option is for x11 screen grabbing).

cd ~/ffmpeg_sources
wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
PATH="$PATH:$HOME/bin" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
  --prefix="$HOME/ffmpeg_build" \
  --extra-cflags="-I$HOME/ffmpeg_build/include" \
  --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
  --bindir="$HOME/bin" \
  --enable-gpl \
  --enable-libass \
  --enable-libfdk-aac \
  --enable-libfreetype \
  --enable-libmp3lame \
  --enable-libopus \
  --enable-libtheora \
  --enable-libvorbis \
  --enable-libvpx \
  --enable-libx264 \
  --enable-nonfree \
  --enable-x11grab
PATH="$PATH:$HOME/bin" make
make install
make distclean
hash -r

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值