Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Installs latest ffmpeg on Centos 6
# source: https://trac.ffmpeg.org/wiki/CentosCompilationGuide
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
curl -O 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
. ~/.bash_profile
cd ~/ffmpeg_sources
git clone --depth 1 https://git.videolan.org/git/x264.git
cd x264
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static
make
make install
make distclean
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
cd ~/ffmpeg_sources
curl -L -O 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" --bindir="$HOME/bin" --disable-shared --enable-nasm
make
make install
make distclean
cd ~/ffmpeg_sources
curl -O 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
cd ~/ffmpeg_sources
curl -O http://downloads.xiph.org/releases/ogg/libogg-1.3.1.tar.gz
tar xzvf libogg-1.3.1.tar.gz
cd libogg-1.3.1
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean
cd ~/ffmpeg_sources
curl -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
tar xzvf libvorbis-1.3.3.tar.gz
cd libvorbis-1.3.3
./configure --prefix="$HOME/ffmpeg_build" --with-ogg="$HOME/ffmpeg_build" --disable-shared
make
make install
make distclean
cd ~/ffmpeg_sources
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx
cd libvpx
./configure --prefix="$HOME/ffmpeg_build" --disable-examples
make
make install
make clean
cd ~/ffmpeg_sources
curl -O http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz
tar xzvf libtheora-1.1.1.tar.gz
cd libtheora-1.1.1
./configure --prefix="$HOME/ffmpeg_build" --with-ogg="$HOME/ffmpeg_build" --disable-examples --disable-shared --disable-sdltest --disable-vorbistest
make
make install
make distclean
yum -y install freetype-devel speex-devel
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-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libfreetype --enable-libspeex --enable-libtheora
make
make install
make distclean
hash -r
. ~/.bash_profile
cd ~/ffmpeg_sources/ffmpeg/tools
make qt-faststart
cp qt-faststart /usr/bin
ldconfig
cd
@gkteck

This comment has been minimized.

Copy link

@gkteck gkteck commented Dec 27, 2015

git clone --depth 1 http://git.chromium.org/webm/libvpx.git is NOT working

git clone --depth 1 https://chromium.googlesource.com/webm/libvpx is working

@gkteck

This comment has been minimized.

Copy link

@gkteck gkteck commented Dec 27, 2015

Worked fine in CentOS 7 (PVHVM) .
Took close to 1 hr in 512 MB machine.

@arsanto

This comment has been minimized.

Copy link

@arsanto arsanto commented Feb 11, 2016

ERROR: libvpx decoder version must be >=0.9.1

ffmpeg --version
-bash: ffmpeg: command not found

@bfisher313

This comment has been minimized.

Copy link

@bfisher313 bfisher313 commented Mar 9, 2016

gkteck's comment solves the problem mentioned above.

Thanks for the script, it is saving me a LOT of time!

@hdml

This comment has been minimized.

Copy link

@hdml hdml commented Mar 15, 2016

Thanks for this, saved lots of time. I created a fork with the corrections highlighted above.

@dig

This comment has been minimized.

Copy link

@dig dig commented Mar 26, 2016

sweet, thanks for this script!

@bagynathpg

This comment has been minimized.

Copy link

@bagynathpg bagynathpg commented Apr 7, 2016

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
not working

@tiagoafelipe

This comment has been minimized.

@Pleskan

This comment has been minimized.

Copy link

@Pleskan Pleskan commented Apr 7, 2016

Correct code for libvpx is:

git clone https://chromium.googlesource.com/webm/libvpx.git
cd libvpx
git checkout tags/v.1.5.0

Yeah!

@easytarget

This comment has been minimized.

Copy link

@easytarget easytarget commented May 3, 2016

@Pleskan: small error in the checkout command, the tag is v1.5.0 not v.1.5.0 eg

git checkout tags/v1.5.0

Also, if you already have yasm>1.2 on the system, so are skipping the install for it in this script, but the configure script for libvpx says it can't find yasm. Your issue may be that you dont have 'which' installed.

  • this can happen in very minimally installed images (Docker, in my case) and was really confusing.. until I saw that configure used 'which' to test for yasm.
@shvets-alex

This comment has been minimized.

Copy link

@shvets-alex shvets-alex commented May 6, 2016

in lines 61-77 installs libvorbis-1.3.3 twice?

@webdbapps

This comment has been minimized.

Copy link

@webdbapps webdbapps commented May 13, 2016

Thanks so much!! Most helpful.

@mpvasilis

This comment has been minimized.

Copy link

@mpvasilis mpvasilis commented Jun 13, 2016

Worked great on Centos 7!
Thanks!

@Tanete

This comment has been minimized.

Copy link

@Tanete Tanete commented Jul 15, 2016

On Centos 6.8 64bit
Meet ERROR: libvpx decoder version must be >=0.9.1
So, compile libvpx v1.5.0, error found: nasm -Ox -f elf64 does not support section alignment (nasm <=2.08?)
Install nasm-2.12.02 from this
Continue compile libvpx v1.5.0

Works for me.

@hasanlsn

This comment has been minimized.

Copy link

@hasanlsn hasanlsn commented Oct 6, 2016

git clone https://chromium.googlesource.com/webm/libvpx.git
cd libvpx
git checkout tags/v1.3.0
./configure --prefix="$HOME/ffmpeg_build" --disable-examples
make
make install

Works for me.

@tareqy

This comment has been minimized.

Copy link

@tareqy tareqy commented Nov 30, 2016

Worked for me on CentOS 6, without any modifications.
Thanks.

@arminmx

This comment has been minimized.

Copy link

@arminmx arminmx commented Dec 17, 2016

Thank a lot.

@bfsong

This comment has been minimized.

Copy link

@bfsong bfsong commented Dec 26, 2016

for libvpx, on make error, add --disable-unit-tests to configure

./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests

works for me.

@simplesunny

This comment has been minimized.

Copy link

@simplesunny simplesunny commented Jan 10, 2017

getting this while running the command make on ffmpeg
libavformat/movenc.c:1943: warning: ‘codec’ is deprecated (declared at libavformat/avformat.h:893)

@TurkCraf

This comment has been minimized.

Copy link

@TurkCraf TurkCraf commented Jan 11, 2017

Merhaba video yükleniyor ama video ön izlemesi çıkmıyor eskiden yapabiliyordum ama şimdi hatırlamıyorum video önizleme resmi nasıl çıkabilir yardım edermisiniz?

@Nirjonadda

This comment has been minimized.

Copy link

@Nirjonadda Nirjonadda commented Jan 14, 2017

Ffmpeg-php will not compile.

I get to ./configure && make and it gives me the error:

checking for ffmpeg headers...
configure: error: ffmpeg headers not found. Make sure ffmpeg is compiled as shared libraries using the --enable-shared option

Please let me know the fix, I am using CENTOS 7.3 x86_64 kvm – na WHM 62.0 (build 2)

@spanishgum

This comment has been minimized.

Copy link

@spanishgum spanishgum commented Feb 16, 2017

Thanks so much. I was stuck forever trying to add repos and rpms that don't exist anymore and was not looking forward to compiling. Saved me lots of time!

@michelmbem

This comment has been minimized.

Copy link

@michelmbem michelmbem commented Feb 19, 2017

Thank you very much, your script helped me a lot. However I could not run it as a whole (unless I ran it as root). I had to split it in several parts and run some of them as root. Those include the calls to yum as well as the two last commands (cp qt-faststart /usr/bin; ldconfig). I also had to initially create a .tmp folder in my home directory and bind it to an environment variable named TMPDIR. After those few adjustments, everything worked fine. My environment is a CentOS 6.7 64 bits server.

@darkworks

This comment has been minimized.

Copy link

@darkworks darkworks commented Mar 3, 2017

kindly add flag :: --enable-shared

@Nirjonadda

This comment has been minimized.

Copy link

@Nirjonadda Nirjonadda commented Mar 3, 2017

How To Install FFmpeg and FFmpeg-PHP Extension on CentOS 7?

@rovizon

This comment has been minimized.

Copy link

@rovizon rovizon commented Jul 25, 2017

Works for me. CentOS 7. Thank you!

@vanucci

This comment has been minimized.

Copy link

@vanucci vanucci commented Aug 12, 2017

My Nasm is out of date 2.10 cant find on google how to update to latest which is 2.14

@candyan

This comment has been minimized.

Copy link

@candyan candyan commented Sep 1, 2017

curl -L

need -L option, some url has moved

@Swoy

This comment has been minimized.

Copy link

@Swoy Swoy commented Sep 8, 2017

If you see similar errors as shown below when compiling libvpx:

vp9/common/x86/vp9_subpixel_8t_ssse3.asm:1002: error: invalid combination of opcode and operands
make[1]: *** [vp9/common/x86/vp9_subpixel_8t_ssse3.asm.o] Error 1
make: *** [.DEFAULT] Error 2

It's because NASM is complaining about some problematic mnemounics, instead use yasm:

cd ~/ffmpeg_sources
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx
cd libvpx
PATH="$PATH:$HOME/bin" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples
PATH="$PATH:$HOME/bin" make
PATH="$PATH:$HOME/bin" make install
PATH="$PATH:$HOME/bin" make clean

However, even after I've managed to compile everything, and followed the entire script down to the last bit using new URLs for some of the libs (both make and make install worked on ffmpeg)
I still cannot run ffmpeg, it says command not found, any ideas?

@PercyP

This comment has been minimized.

Copy link

@PercyP PercyP commented Oct 5, 2017

Hi,

can I ask if this will update ffmpeg to version 2.8 and higher? I have 2.5x and need to have at least 2.8.
Secondly, do I just paste the entire code above into Putty SSH and it will install? If not, is there any kind of 'idiots guide' for upgrading?

Kind regards

@sriapu

This comment has been minimized.

Copy link

@sriapu sriapu commented Oct 25, 2017

Hi,
I am getting this error
ERROR: libmp3lame >= 3.98.3 not found

I tried "&& require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame -lm" at the end of the config string.
Please help me.
regards

@hpez

This comment has been minimized.

Copy link

@hpez hpez commented Dec 11, 2017

This is not available:
git clone --depth 1 git://git.videolan.org/x264
Use this:
git clone --depth 1 http://git.videolan.org/git/x264

@stigersh

This comment has been minimized.

Copy link

@stigersh stigersh commented Jul 11, 2018

Thanks a lot for the script.

I have the following error after running it:
ERROR: opus not found using pkg-config
Would really appreciate some help..

@RomanStone

This comment has been minimized.

Copy link

@RomanStone RomanStone commented Mar 16, 2019

Please change "curl -O " to "wget " and "tar xzvf" to "tar -xvf"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.