最新消息:非无江海志,潇洒送日月

Ubuntu下安装与升级FFmpeg 详细教程

编程开发 江海志 8825浏览 0评论

Install FFmpeg on Ubuntu

Actually it is very easy to install FFmpeg under Ubuntu with the apt-get command. Unfortunately, the default FFmpeg installation doesn’t let you include the latest codecs which are needed by Razuna. Thus you have to compile FFmpeg yourself. Just follow the steps below. It is very easy!

Ubuntu Versions

All the below has been tested and is know to work with Ubuntu 10.04, 12.04 and 14.04 LTS.

Install the Dependencies

Uninstall x264, libx264-dev, and ffmpeg if they are already installed.

sudo apt-get remove ffmpeg x264 libx264-dev

Next, get all of the packages you will need to install FFmpeg and x264 (you may need to enable the universe and multiverse repositories):

sudo apt-get update

Ubuntu 10.04 LTS

sudo apt-get install build-essential subversion git-core checkinstall texi2html libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev libavcodec-dev

Ubuntu 9.10

sudo apt-get install build-essential subversion git-core checkinstall yasm texi2html libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev libavcodec-unstripped-52

Install x264

Get the most current source files, compile, and install. You can run “./configure –help” to see what additional features you can enable/disable.

Ubuntu 10.04 LTS

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

Ubuntu 9.10

cd /opt
sudo git clone git://git.videolan.org/x264.git
cd x264
sudo ./configure
sudo make
sudo checkinstall --pkgname=x264 --pkgversion "1:0.svn`date +%Y%m%d`+`git rev-list HEAD -n 1 | head -c 7`" --backup=no --default

Troubleshooting

If the configure complains about yasm requiring version 1.2.x, then you need to download and build yasm with the latest build. Follow these instructions to do so (each line is a command!):

sudo apt-get install build-essential checkinstall
sudo apt-get build-dep yasm
cd /opt
sudo wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
sudo tar xzfv yasm-1.2.0.tar.gz
cd yasm-1.2.0
sudo ./configure
sudo make
sudo checkinstall --pakdir "$HOME/Desktop" --pkgname yasm --pkgversion 1.2.0 --backup=no --default

Now try to configure X264 again.

Install libvpx

This is used to encode and decode VP8 video (WebM).

cd /opt
sudo git clone http://git.chromium.org/webm/libvpx.git
cd libvpx
sudo ./configure
sudo make
sudo checkinstall --pkgname=libvpx --pkgversion="`date +%Y%m%d%H%M`-git" --backup=no --default --deldoc=yes

Install lame

Used for MP3.

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

Install libtheora (only needed on Ubuntu 9.10)

This is used to encode to Theora, the video type usually found in OGG/OGV files. The repository libtheora is too old, so it must be compiled.

sudo apt-get install libogg-dev
cd /opt
sudo wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz
sudo tar xzvf libtheora-1.1.1.tar.gz
cd libtheora-1.1.1
sudo ./configure --disable-shared
sudo make
sudo checkinstall --pkgname=libtheora --pkgversion "1.1.1" --backup=no --default

Install FFMpeg

Get the most current source files from the official FFmpeg SVN, compile, and install.

Ubuntu 10.04/12.04/14/04 LTS

cd /opt
sudo git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
sudo git checkout release/2.5
sudo ./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-x11grab --enable-libvpx --enable-libmp3lame
sudo make
sudo checkinstall --pkgname=ffmpeg --pkgversion="5:$(./version.sh)" --backup=no --deldoc=yes --default
hash x264 ffmpeg ffplay ffprobe

Ubuntu 9.10

cd /opt
sudo git clone git://source.ffmpeg.org/ffmpeg.git
cd ffmpeg
sudo git checkout release/2.5
sudo ./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab
sudo make
sudo checkinstall --pkgname=ffmpeg --pkgversion "4:0.5+svn`date +%Y%m%d`" --backup=no --default
hash x264 ffmpeg ffplay

Updating FFmpeg and x264

Development of FFmpeg and x264 is active and an occasional update can give you new features and bug fixes. To update FFmpeg and x264 you will need to remove the packages, make distclean, update the source, recompile, and install.

To update x264:

sudo apt-get remove ffmpeg x264 libx264-dev libvpx
cd /opt/x264
make distclean
git pull

Now compile x264 as shown earlier in the guide starting with the x264 ./configure line. You can update libvpx if you installed that too:

cd /opt/libvpx
make clean
git pull

Now continue with the installation starting with the libvpx ./configure line. Now update FFmpeg:

cd /opt/ffmpeg
make distclean
git pull

Finish the installation starting with the FFmpeg ./configure line from above.

转载请注明:江海志の博客 » Ubuntu下安装与升级FFmpeg 详细教程

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址