Skip to content

Instantly share code, notes, and snippets.

@mustafaturan
Last active October 25, 2022 20:14
Show Gist options
  • 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
@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