[LINUX] Static build ffmpeg (CentOS6)

ffmpeg

--disable-ffserver --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libx264 --enable-libvpx --enable-librtmp --enable-libfdk_aac --enable-openssl --enable-runtime-cpudetect --enable-libspeex --enable-libfreetype --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-filter=movie --enable-frei0r --enable-libxvid --arch=x86_64 --enable-static --disable-shared --disable-debug

Procedure when statically building with options such as.

Preparation

Prepare the development environment with rpm as shown below.

python


# yum groupinstall -y "Development Tools"
# yum install -y zlib-devel git subversion opencv-devel openssl-devel gnutls-devel
# yum install -y glibc-static openssl-static zlib-static

Also, here we will work with the ffmpeg user, so create that user.

# useradd ffmpeg
# su - ffmpeg
$ mkdir src

Build and install peripheral modules

frei0r

It was OK even if I put it in rpm, so install it with the following command

# rpm -ivh http://pkgrepo.linuxtech.net/el6/release/x86_64/frei0r-devel-1.3-3.el6.x86_64.rpm \
http://pkgrepo.linuxtech.net/el6/release/x86_64/frei0r-plugins-1.3-3.el6.x86_64.rpm \
http://pkgrepo.linuxtech.net/el6/release/x86_64/libgavl-1.2.0-2.el6.x86_64.rpm \
http://pkgrepo.linuxtech.net/el6/release/x86_64/libgdither-0.6-3.el6.x86_64.rpm

From now on, all work with the ffmpeg user.

yasm

$ cd ~/src
$ wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
$ tar zxf yasm-1.2.0.tar.gz
$ cd yasm-1.2.0
$ ./configure --prefix=$HOME
$ make
$ make install 

keyutils

$ cd ~/src
$ wget http://people.redhat.com/~dhowells/keyutils/keyutils-1.5.8.tar.bz2
$ tar xjf keyutils-1.5.8.tar.bz2
$ cd keyutils-1.5.8

Describe DESTDIR of Makefile as follows.

DESTDIR         := /home/ffmpeg
$ make 
$ make install  

kerberos

$ cd ~/src
$ wget http://web.mit.edu/kerberos/dist/krb5/1.11/krb5-1.11.3-signed.tar
$ tar xf krb5-1.11.3-signed.tar
$ tar xzf krb5-1.11.3.tar.gz
$ cd krb5-1.11.3/src
$ ./configure --prefix=$HOME --disable-shared  --enable-static
$ make
$ make install

openjpeg

$ cd ~/src
$ wget https://openjpeg.googlecode.com/files/openjpeg-1.5.1.tar.gz
$ tar xzf openjpeg-1.5.1.tar.gz 
$ cd openjpeg-1.5.1 
$ ./configure --prefix=$HOME --disable-shared
$ make
$ make install

librtmp

$ cd ~/src
git clone git://git.ffmpeg.org/rtmpdump
cd rtmpdump

Change the prefix described at the beginning of Makfile and librtmp / Makefile as follows.

prefix=/home/ffmpeg

And build

$ make SHARED=
$ make install

faac

$ cd ~/src
$ wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz
$ tar zxf faac-1.28.tar.gz
$ cd faac-1.28

[[CentOS] faac library compilation error](http://fkob.net/blog/2012/02/centos-faac%E3%83%A9%E3%82%A4%E3%83%96%E3%83 % A9% E3% 83% AA% E3% 81% AE% E3% 82% B3% E3% 83% B3% E3% 83% 91% E3% 82% A4% E3% 83% AB% E3% 82% A8 Comment out the definition of strcasestr according to the contents of% E3% 83% A9% E3% 83% BC /).

And build.

$ ./configure --prefix=$HOME --disable-shared 
$ make
$ make install

fdk_aac

$ cd ~/src
$ git clone https://github.com/mstorsjo/fdk-aac.git
$ cd fdk-aac/
$ autoreconf -fiv
$ ./configure --prefix=$HOME --disable-shared 
$ make
$ make install

libpng

$ cd ~/src
$ wget "http://prdownloads.sourceforge.net/libpng/libpng-1.6.6.tar.gz?download"
$ tar xzf libpng-1.6.6.tar.gz
$ cd libpng-1.6.6
$ ./configure --prefix=$HOME --disable-shared
$ make
$ make install

bzip2

$ cd ~/src
$ wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
$ tar xzf bzip2-1.0.6.tar.gz
$ cd bzip2-1.0.6
$ make
$ make install PREFIX=$HOME

freetype2

$ cd ~/src
$ wget "http://downloads.sourceforge.net/project/freetype/freetype2/2.5.0/freetype-2.5.0.1.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Ffreetype%2Ffiles%2Ffreetype2%2F2.5.0%2F&ts=1382454119&use_mirror=jaist"
$ tar xjf freetype-2.5.0.1.tar.bz2
$ cd freetype-2.5.0.1  
$ CFLAGS="-I$HOME/include" LDFLAGS="-L$HOME/lib" ./configure --prefix=$HOME --disable-shared 
$ make
$ make install

lame

$ cd ~/src
$ wget "http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flame%2Ffiles%2Flame%2F3.99%2F&ts=1365466294&use_mirror=jaist" 
$ tar xzf lame-3.99.5.tar.gz
$ cd lame-3.99.5
$ ./configure --prefix=$HOME --enable-nasm --disable-shared 
$ make
$ make install

opencore-amr

$ cd ~/src
$ wget "http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fopencore-amr%2Ffiles%2Fopencore-amr%2F&ts=1366120785&use_mirror=jaist"
$ tar xzf opencore-amr-0.1.3.tar.gz
$ cd opencore-amr-0.1.3
$ ./configure --prefix=$HOME --disable-shared
$ make
$ make install

libogg

$ cd ~/src
$ wget http://downloads.xiph.org/releases/ogg/libogg-1.3.1.tar.gz
$ tar xzf libogg-1.3.1.tar.gz
$ cd libogg-1.3.1
$ ./configure --prefix=$HOME --disable-shared
$ make
$ make install

libtheora

$ cd ~/src
$ wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
$ tar xjf libtheora-1.1.1.tar.bz2
$ cd libtheora-1.1.1
$ ./configure --prefix=$HOME --disable-shared --with-ogg=$HOME
$ make
$ make install

speex

$ cd ~/src
$ wget http://downloads.xiph.org/releases/speex/speex-1.2rc1.tar.gz
$ tar xzf speex-1.2rc1.tar.gz
$ cd speex-1.2rc1
$ ./configure --prefix=$HOME --disable-shared
$ make
$ make install

vo-aacenc

$ cd ~/src
$ wget "http://downloads.sourceforge.net/project/opencore-amr/vo-aacenc/vo-aacenc-0.1.3.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fopencore-amr%2Ffiles%2Fvo-aacenc%2F&ts=1382764016&use_mirror=jaist"
$ tar xzf vo-aacenc-0.1.3.tar.gz
$ cd vo-aacenc-0.1.3
$ ./configure --prefix=$HOME --disable-shared
$ make
$ make install

vo-amrwbenc

$ cd ~/src
$ wget "http://downloads.sourceforge.net/project/opencore-amr/vo-amrwbenc/vo-amrwbenc-0.1.3.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fopencore-amr%2Ffiles%2Fvo-amrwbenc%2F&ts=1382764197&use_mirror=jaist"  
$ tar xzf vo-amrwbenc-0.1.3.tar.gz
$ cd vo-amrwbenc-0.1.3
$ ./configure --prefix=$HOME --disable-shared
$ make
$ make install

libvorbis

$ cd ~/src
$ wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
$ tar xzf libvorbis-1.3.3.tar.gz
$ cd libvorbis-1.3.3
$ ./configure --prefix=$HOME --disable-shared
$ make
$ make install

libvpx

$ cd ~/src
$ git clone http://git.chromium.org/webm/libvpx.git
$ cd libvpx/
$ ./configure --prefix=$HOME --disable-shared
$ make
$ make install

x264

$ cd ~/src
$ git clone git://git.videolan.org/x264.git
$ cd x264
$ ./configure --prefix=$HOME --enable-static
$ make
$ make install

xvid

$ cd ~/src
$ wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
$ tar xzf xvidcore-1.3.2.tar.gz
$ cd xvidcore
$ cd build/generic
$ ./configure --prefix=$HOME
$ make
$ make install   

ffmpeg body

If you can build the peripheral module, you can build it by the following procedure.

$ cd ~/src
$ wget http://www.ffmpeg.org/releases/ffmpeg-2.0.2.tar.bz2
$ tar xjf ffmpeg-2.0.2.tar.bz2
$ cd ffmpeg-2.0.2
$ PKG_CONFIG_PATH=$HOME/lib/pkgconfig ./configure --prefix=$HOME \
--disable-ffserver --enable-gpl --enable-version3 --enable-nonfree \
--enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame \
--enable-libvorbis --enable-libtheora --enable-libx264 --enable-libvpx \
--enable-librtmp --enable-libfdk_aac --enable-openssl \
--enable-runtime-cpudetect --enable-libspeex --enable-libfreetype \
--enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray \
--enable-libopenjpeg --enable-libopencore-amrnb --enable-libopencore-amrwb \
--enable-filter=movie --enable-frei0r --enable-libxvid \
--arch=x86_64 --enable-static --disable-shared --disable-debug \
--extra-cflags="-I$HOME/include -I$HOME/usr/include --static" \
--extra-libs='-static -lpng -lbz2 -lm -lz -lkrb5 -lkrb5support -lk5crypto -lcom_err -lkeyutils -lresolv -L/usr/lib -L$HOME/lib  -L$HOME/usr/lib64'
$ make
$ make install 

You now have / home / ffmpeg / bin / ffmpeg.

$ cd ~/bin/
$ ldd ffmpeg
	not a dynamic executable

If so, static build is possible.

Recommended Posts

Static build ffmpeg (CentOS6)
Build CentOS8 LAMP
CentOS 7 + ffmpeg installation
Build a LAMP environment [CentOS 7]
Build a python3 environment on CentOS7
Build WordPress on CentOS 8 in LAMP environment
Build jupyter notebook on remote server (CentOS)
Build static library (.a) together with waf
Build CentOS 8 on ESXi 6.7 with minimal configuration