FFmpeg编译记录

  • Post author:
  • Post category:其他


参照官方wiki编译,链接为:

http://trac.ffmpeg.org/wiki/UbuntuCompilationGuide


一、Copy and paste the whole code box for each step.

sudo apt-get update
sudo apt-get -y install autoconf automake build-essential git libass-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


二、Compilation&Installation


2.1Yasm


Yasm is an assembler used by x264 and FFmpeg.

cd ~/ffmpeg_sources
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 --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install
make distclean
. ~/.profile


2.2 x264


H.264 video encoder. See the

x264 Encoding Guide

for more information and examples.

cd ~/ffmpeg_sources
git clone --depth 1 git://git.videolan.org/x264.git
cd x264
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static
make
make install
make distclean

ps:make时遇到错误

If you really want to compile without asm, configure with –disable-asm.

解决方法

回到yasm-1.2.0目录下

./configure –prefix=/usr –enable-shared

重新编译


2.3 fdk-aac


AAC audio encoder. See the

AAC Encoding Guide

for more information and examples.

cd ~/ffmpeg_sources
git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
cd fdk-aac
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean


2.4 libmp3lame


MP3 audio encoder.

sudo apt-get install libmp3lame-dev
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


2.5 libopus


Opus audio decoder and encoder.

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


2.6 libvpx


VP8/VP9 video encoder and decoder. See the

vpx (WebM) Encoding Guide

for more information and examples.

cd ~/ffmpeg_sources
git clone --depth 1 http://git.chromium.org/webm/libvpx.git
cd libvpx
./configure --prefix="$HOME/ffmpeg_build" --disable-examples
make
make install
make clean


2.7 ffmpeg

cd ~/ffmpeg_sources
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig"
export PKG_CONFIG_PATH
./configure --prefix="$HOME/ffmpeg_build" \
  --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
  --bindir="$HOME/bin" --extra-libs="-ldl" --enable-gpl --enable-libass --enable-libfdk-aac \
  --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx \
  --enable-libx264 --enable-nonfree --enable-x11grab
make
make install
make distclean
hash -r

完成后可执行文件位于~/bin目录下

官方wiki建议使用gcc4.2 ,已尝试使用gcc-4.2.3在编译libvpx时出错,故放弃

现已测试编译环境为:

ubuntu11.04 bit64 、gcc4.5.2

ubuntu12.04 bit32、gcc-4.6

ubuntu12.04 bit64、gcc-4.6(待测试)



版权声明:本文为Gremorse原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。