Skip to content

Instantly share code, notes, and snippets.

@mustafaturan
Last active October 25, 2022 20:14
Show Gist options
  • Star 86 You must be signed in to star a gist
  • Fork 65 You must be signed in to fork a gist
  • Save mustafaturan/7053900 to your computer and use it in GitHub Desktop.
Save mustafaturan/7053900 to your computer and use it in GitHub Desktop.
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
@dig
Copy link

dig commented Mar 26, 2016

sweet, thanks for this script!

@bagynathpg
Copy link

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

@Pleskan
Copy link

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
Copy link

@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
Copy link

in lines 61-77 installs libvorbis-1.3.3 twice?

@webdbapps
Copy link

Thanks so much!! Most helpful.

@mpvasilis
Copy link

Worked great on Centos 7!
Thanks!

@Tanete
Copy link

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
Copy link

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
Copy link

tareqy commented Nov 30, 2016

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

@arminmx
Copy link

arminmx commented Dec 17, 2016

Thank a lot.

@bfsong
Copy link

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
Copy link

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

@TurkCraf
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

kindly add flag :: --enable-shared

@Nirjonadda
Copy link

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

@rovizon
Copy link

rovizon commented Jul 25, 2017

Works for me. CentOS 7. Thank you!

@vanucci
Copy link

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
Copy link

candyan commented Sep 1, 2017

curl -L

need -L option, some url has moved

@Swoy
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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

@whoim2
Copy link

whoim2 commented Jun 6, 2021

libvpx enabled but no supported decoders found
centos 6 i386

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment