Compile FFmpeg on CentOS 6 with H.264 support
This guide is based on a minimal CentOS installation and will install FFmpeg with several external encoding libraries. This guide is kept relatively up to date with FFmpeg development and library sources (see the page history for changelog), and should also work for recent Red Hat Enterprise Linux (RHEL) and Fedora.
Note: The # indicates that the command should be executed as superuser or root.
Preparation ¶
Remove any existing packages:
Code:
Get the dependencies:
Code:
Make a source directory:
Code:
Installation ¶
Yasm ¶
Yasm is an assembler used by x264 and FFmpeg.
Code:
Note: 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 libvorbis is not needed, then skip that section and then remove --enable-libvorbis from the Install FFmpeg section.
x264 ¶
H.264 video encoder.
Code:
LAME ¶
MP3 audio encoder.
Code:
libogg ¶
Required for libvorbis.
Code:
libvorbis ¶
Vorbis audio encoder.
Code:
libvpx ¶
VP8 video encoder.
Code:
FFmpeg ¶
Code:
Compilation is now complete and ffmpeg should now be ready to use. The rest of this guide shows how to update or remove FFmpeg.
Note: Keep the ffmpeg-source directory and all contents if you intend to update or uninstall as shown below.
Updating x264, libvpx, and FFmpeg ¶
First uninstall x264, libvpx, and FFmpeg:
Code:
Update x264 ¶
Code:
Then run ./configure, make, and make install as shown in the Install x264 section.
Update libvpx ¶
Code:
Then run ./configure, make, and make install as shown in the Install libvpx section.
Update FFmpeg ¶
Code:
Then run ./configure, make, and make install as shown in the Install FFmpeg section.
Reverting changes made by this guide ¶
Code:
Note: The # indicates that the command should be executed as superuser or root.
Preparation ¶
Remove any existing packages:
Code:
Code:
# yum erase ffmpeg x264 x264-devel
Get the dependencies:
Code:
Code:
# yum install gcc git make nasm pkgconfig wget zlib-devel
Make a source directory:
Code:
Code:
mkdir ~/ffmpeg-source
Installation ¶
Yasm ¶
Yasm is an assembler used by x264 and FFmpeg.
Code:
Code:
cd ~/ffmpeg-sourcewget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gztar xzvf yasm-1.2.0.tar.gzcd yasm-1.2.0./configuremake# make install
Note: 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 libvorbis is not needed, then skip that section and then remove --enable-libvorbis from the Install FFmpeg section.
x264 ¶
H.264 video encoder.
Code:
Code:
cd ~/ffmpeg-sourcegit clone git:/git.videolan.org/x264cd x264./configure --enable-staticmake# make install
LAME ¶
MP3 audio encoder.
Code:
Code:
cd ~/ffmpeg-sourcewget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gztar xzvf lame-3.99.5.tar.gzcd lame-3.99.5./configure --disable-shared --enable-nasmmake# make install
libogg ¶
Required for libvorbis.
Code:
Code:
cd ~/ffmpeg-sourcewget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gztar xzvf libogg-1.3.0.tar.gzcd libogg-1.3.0./configure --disable-sharedmake# make install
libvorbis ¶
Vorbis audio encoder.
Code:
Code:
cd ~/ffmpeg-sourcewget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gztar xzvf libvorbis-1.3.3.tar.gzcd libvorbis-1.3.3./configure --disable-sharedmake# make install
libvpx ¶
VP8 video encoder.
Code:
Code:
cd ~/ffmpeg-sourcegit clone http://git.chromium.org/webm/libvpx.gitcd libvpx./configuremake# make install
FFmpeg ¶
Code:
Code:
cd ~/ffmpeg-sourcegit clone git:/source.ffmpeg.org/ffmpegcd ffmpeg./configure --enable-gpl --enable-libmp3lame --enable-libvorbis --enable-libvpx --enable-libx264make# make install
Compilation is now complete and ffmpeg should now be ready to use. The rest of this guide shows how to update or remove FFmpeg.
Note: Keep the ffmpeg-source directory and all contents if you intend to update or uninstall as shown below.
Updating x264, libvpx, and FFmpeg ¶
First uninstall x264, libvpx, and FFmpeg:
Code:
Code:
cd ~/ffmpeg-source/x264# make uninstallcd ~/ffmpeg-source/ffmpeg# make uninstallcd ~/ffmpeg-source/libvpx# make uninstall
Update x264 ¶
Code:
Code:
cd ~/ffmpeg-source/x264make distcleangit pull
Then run ./configure, make, and make install as shown in the Install x264 section.
Update libvpx ¶
Code:
Code:
cd ~/ffmpeg-source/libvpxmake cleangit pull
Then run ./configure, make, and make install as shown in the Install libvpx section.
Update FFmpeg ¶
Code:
Code:
cd ~/ffmpeg-source/ffmpegmake distcleangit pull
Then run ./configure, make, and make install as shown in the Install FFmpeg section.
Reverting changes made by this guide ¶
Code:
Code:
cd ~/ffmpeg-source/yasm-1.2.0# make uninstallcd ../x264# make uninstallcd ../lame-3.99.5# make uninstallcd ../libogg-1.3.0# make uninstallcd ../libvorbis-1.3.3# make uninstallcd ../libvpx# make uninstallcd ../ffmpeg# make uninstallrm -rf ~/ffmpeg-source# yum erase gcc git make nasm pkgconfig wget
No comments:
Post a Comment