How to compile FFmpeg on CentOS – part 2


Part 1: How to compile FFmpeg on CentOS

This part guide how to install more library for ffmpeg

Step 13: Install harfbuzz (If you use CentOS < 7)

yum install -y gtk-doc
yum install -y gtk2-devel-docs
cd ~/ffmpeg_sources
git clone https://github.com/harfbuzz/harfbuzz
cd harfbuzz
./autogen.sh
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install

If you get error:

error: #pragma GCC diagnostic not allowed inside functions

You must build your custom GCC (Version 4.2.0)

Then change:

./configure --prefix="$HOME/ffmpeg_build" --disable-shared

To

CC=/root/gcc/bin/gcc ./configure --prefix="$HOME/ffmpeg_build" --disable-shared

Step 14: install libtheora

cd ~/ffmpeg_sources
wget --no-check-certificate https://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.xz
tar -xvf libtheora-1.1.1.tar.xz
cd libtheora-1.1.1
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" CPPFLAGS="-I/$HOME/ffmpeg_build/include" ./configure --prefix="$HOME/ffmpeg_build" --disable-shared --disable-static
make
make install

Result:

...
mkdir -p -- /root/ffmpeg_build/share/doc/libtheora-1.1.1/html
mkdir -p -- /root/ffmpeg_build/share/doc/libtheora-1.1.1/latex
/bin/sh ../mkinstalldirs /root/ffmpeg_build/share/doc/libtheora-1.1.1
 /usr/bin/install -c -m 644 vp3-format.txt /root/ffmpeg_build/share/doc/libtheora-1.1.1/vp3-format.txt
 /usr/bin/install -c -m 644 color.html /root/ffmpeg_build/share/doc/libtheora-1.1.1/color.html
 /usr/bin/install -c -m 644 draft-ietf-avt-rtp-theora-00.xml /root/ffmpeg_build/share/doc/libtheora-1.1.1/draft-ietf-avt-rtp-theora-00.xml
 /usr/bin/install -c -m 644 draft-ietf-avt-rtp-theora-00.txt /root/ffmpeg_build/share/doc/libtheora-1.1.1/draft-ietf-avt-rtp-theora-00.txt
 /usr/bin/install -c -m 644 doxygen-build.stamp /root/ffmpeg_build/share/doc/libtheora-1.1.1/doxygen-build.stamp
make[3]: Leaving directory `/root/ffmpeg_sources/libtheora-1.1.1/doc'
make[2]: Leaving directory `/root/ffmpeg_sources/libtheora-1.1.1/doc'
make[1]: Leaving directory `/root/ffmpeg_sources/libtheora-1.1.1/doc'
Making install in tests
make[1]: Entering directory `/root/ffmpeg_sources/libtheora-1.1.1/tests'
make[2]: Entering directory `/root/ffmpeg_sources/libtheora-1.1.1/tests'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/root/ffmpeg_sources/libtheora-1.1.1/tests'
make[1]: Leaving directory `/root/ffmpeg_sources/libtheora-1.1.1/tests'
Making install in m4
make[1]: Entering directory `/root/ffmpeg_sources/libtheora-1.1.1/m4'
make[2]: Entering directory `/root/ffmpeg_sources/libtheora-1.1.1/m4'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/root/ffmpeg_sources/libtheora-1.1.1/m4'
make[1]: Leaving directory `/root/ffmpeg_sources/libtheora-1.1.1/m4'
Making install in examples
make[1]: Entering directory `/root/ffmpeg_sources/libtheora-1.1.1/examples'
make[2]: Entering directory `/root/ffmpeg_sources/libtheora-1.1.1/examples'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/root/ffmpeg_sources/libtheora-1.1.1/examples'
make[1]: Leaving directory `/root/ffmpeg_sources/libtheora-1.1.1/examples'
make[1]: Entering directory `/root/ffmpeg_sources/libtheora-1.1.1'
make[2]: Entering directory `/root/ffmpeg_sources/libtheora-1.1.1'
make[2]: Nothing to be done for `install-exec-am'.
/bin/sh ./mkinstalldirs /root/ffmpeg_build/lib/pkgconfig
 /usr/bin/install -c -m 644 theora.pc /root/ffmpeg_build/lib/pkgconfig/theora.pc
 /usr/bin/install -c -m 644 theoradec.pc /root/ffmpeg_build/lib/pkgconfig/theoradec.pc
 /usr/bin/install -c -m 644 theoraenc.pc /root/ffmpeg_build/lib/pkgconfig/theoraenc.pc
make[2]: Leaving directory `/root/ffmpeg_sources/libtheora-1.1.1'
make[1]: Leaving directory `/root/ffmpeg_sources/libtheora-1.1.1'

Step 15: install libspeex

cd ~/ffmpeg_sources
git clone https://github.com/xiph/speex.git
cd speex
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install

Step 16: install ladspa

yum install ladspa-devel

Step 17: install libfreetype

cd ~/ffmpeg_sources
wget https://download.savannah.gnu.org/releases/freetype/freetype-2.9.tar.gz
tar -xvf freetype-2.9.tar.gz
cd freetype-2.9
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install

Step 17: install ffmpeg

cd ~/ffmpeg_sources
curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
  --prefix="$HOME/ffmpeg_build" \
  --pkg-config-flags="--static" \
  --extra-cflags="-I$HOME/ffmpeg_build/include" \
  --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
  --extra-libs=-lpthread \
  --extra-libs=-lm \
  --bindir="$HOME/bin" \
  --enable-gpl \
  --enable-libfdk_aac \
  --enable-libfreetype \
  --enable-libmp3lame \
  --enable-libopus \
  --enable-libvorbis \
  --enable-libvpx \
  --enable-libx264 \
  --enable-libx265 \
  --enable-nonfree \
  --enable-openssl \
  --enable-libspeex \
  --enable-libtheora \
  --enable-ladspa \
  --enable-muxer=segment \
  --enable-muxer=stream_segment
make
make install
hash -r

Result:

...
bmp                        h261                       sipr
cavsvideo                  h263                       tak
cook                       h264                       vc1
dca                        hevc                       vorbis
dirac                      mjpeg                      vp3
dnxhd                      mlp                        vp8
dpx                        mpeg4video                 vp9
dvaudio                    mpegaudio                  xma
dvbsub                     mpegvideo

Enabled demuxers:
aa                         ea                         iss
aac                        ea_cdata                   iv8
ac3                        eac3                       ivf
acm                        epaf                       ivr
act                        ffmetadata                 jacosub
adf                        filmstrip                  jv
adp                        fits                       live_flv
ads                        flac                       lmlm4
adx                        flic                       loas
aea                        flv                        lrc
afc                        fourxm                     lvf
aiff                       frm                        lxf
aix                        fsb                        m4v
amr                        g722                       matroska
amrnb                      g723_1                     mgsts
amrwb                      g726                       microdvd
anm                        g726le                     mjpeg
apc                        g729                       mjpeg_2000
ape                        gdv                        mlp
apng                       genh                       mlv
aptx                       gif                        mm
aptx_hd                    gsm                        mmf
aqtitle                    gxf                        mov
asf                        h261                       mp3
asf_o                      h263                       mpc
ass                        h264                       mpc8
ast                        hevc                       mpegps
au                         hls                        mpegts
avi                        hnm                        mpegtsraw
avr                        ico                        mpegvideo
avs                        idcin                      mpjpeg
avs2                       idf                        mpl2
bethsoftvid                iff                        mpsub
bfi                        ilbc                       msf
bfstm                      image2                     msnwc_tcp
bink                       image2_alias_pix           mtaf
bintext                    image2_brender_pix         mtv
bit                        image2pipe                 musx
bmv                        image_bmp_pipe             mv
boa                        image_dds_pipe             mvi
brstm                      image_dpx_pipe             mxf
c93                        image_exr_pipe             mxg
caf                        image_gif_pipe             nc
cavsvideo                  image_j2k_pipe             nistsphere
cdg                        image_jpeg_pipe            nsp
cdxl                       image_jpegls_pipe          nsv
cine                       image_pam_pipe             nut
codec2                     image_pbm_pipe             nuv
codec2raw                  image_pcx_pipe             ogg
concat                     image_pgm_pipe             oma
data                       image_pgmyuv_pipe          paf
daud                       image_pictor_pipe          pcm_alaw
dcstr                      image_png_pipe             pcm_f32be
dfa                        image_ppm_pipe             pcm_f32le
dhav                       image_psd_pipe             pcm_f64be
dirac                      image_qdraw_pipe           pcm_f64le
dnxhd                      image_sgi_pipe             pcm_mulaw
dsf                        image_sunrast_pipe         pcm_s16be
dsicin                     image_svg_pipe             pcm_s16le
dss                        image_tiff_pipe            pcm_s24be
dts                        image_webp_pipe            pcm_s24le
dtshd                      image_xpm_pipe             pcm_s32be
dv                         image_xwd_pipe             pcm_s32le
dvbsub                     ingenient                  pcm_s8
dvbtxt                     ipmovie                    pcm_u16be
dxa                        ircam                      pcm_u16le
pcm_u24be                  sds                        ty
pcm_u24le                  sdx                        v210
pcm_u32be                  segafilm                   v210x
pcm_u32le                  ser                        vag
pcm_u8                     shorten                    vc1
pcm_vidc                   siff                       vc1t
pjs                        sln                        vivo
pmp                        smacker                    vmd
pva                        smjpeg                     vobsub
pvf                        smush                      voc
qcp                        sol                        vpk
r3d                        sox                        vplayer
rawvideo                   spdif                      vqf
realtext                   srt                        w64
redspark                   stl                        wav
rl2                        str                        wc3
rm                         subviewer                  webm_dash_manifest
roq                        subviewer1                 webvtt
rpl                        sup                        wsaud
rsd                        svag                       wsd
rso                        swf                        wsvqa
rtp                        tak                        wtv
rtsp                       tedcaptions                wv
s337m                      thp                        wve
sami                       threedostr                 xa
sap                        tiertexseq                 xbin
sbc                        tmv                        xmv
sbg                        truehd                     xvag
scc                        tta                        xwma
sdp                        tty                        yop
sdr2                       txd                        yuv4mpegpipe

Enabled muxers:
a64                        hevc                       pcm_s24le
ac3                        hls                        pcm_s32be
adts                       ico                        pcm_s32le
adx                        ilbc                       pcm_s8
aiff                       image2                     pcm_u16be
amr                        image2pipe                 pcm_u16le
apng                       ipod                       pcm_u24be
aptx                       ircam                      pcm_u24le
aptx_hd                    ismv                       pcm_u32be
asf                        ivf                        pcm_u32le
asf_stream                 jacosub                    pcm_u8
ass                        latm                       pcm_vidc
ast                        lrc                        psp
au                         m4v                        rawvideo
avi                        matroska                   rm
avm2                       matroska_audio             roq
avs2                       md5                        rso
bit                        microdvd                   rtp
caf                        mjpeg                      rtp_mpegts
cavsvideo                  mkvtimestamp_v2            rtsp
codec2                     mlp                        sap
codec2raw                  mmf                        sbc
crc                        mov                        scc
dash                       mp2                        segafilm
data                       mp3                        segment
daud                       mp4                        singlejpeg
dirac                      mpeg1system                smjpeg
dnxhd                      mpeg1vcd                   smoothstreaming
dts                        mpeg1video                 sox
dv                         mpeg2dvd                   spdif
eac3                       mpeg2svcd                  spx
f4v                        mpeg2video                 srt
ffmetadata                 mpeg2vob                   stream_segment
fifo                       mpegts                     sup
fifo_test                  mpjpeg                     swf
filmstrip                  mxf                        tee
fits                       mxf_d10                    tg2
flac                       mxf_opatom                 tgp
flv                        null                       truehd
framecrc                   nut                        tta
framehash                  oga                        uncodedframecrc
framemd5                   ogg                        vc1
g722                       ogv                        vc1t
g723_1                     oma                        voc
g726                       opus                       w64
g726le                     pcm_alaw                   wav
gif                        pcm_f32be                  webm
gsm                        pcm_f32le                  webm_chunk
gxf                        pcm_f64be                  webm_dash_manifest
h261                       pcm_f64le                  webp
h263                       pcm_mulaw                  webvtt
h264                       pcm_s16be                  wtv
hash                       pcm_s16le                  wv
hds                        pcm_s24be                  yuv4mpegpipe

Enabled protocols:
async                      httpproxy                  rtmpte
cache                      https                      rtmpts
concat                     icecast                    rtp
crypto                     md5                        srtp
data                       mmsh                       subfile
ffrtmpcrypt                mmst                       tcp
ffrtmphttp                 pipe                       tee
file                       prompeg                    tls
ftp                        rtmp                       udp
gopher                     rtmpe                      udplite
hls                        rtmps                      unix
http                       rtmpt

Enabled filters:
abench                     astreamselect              drawbox
abitscope                  atadenoise                 drawgraph
acompressor                atempo                     drawgrid
acontrast                  atrim                      drawtext
acopy                      avectorscope               drmeter
acrossfade                 avgblur                    dynaudnorm
acrossover                 bandpass                   earwax
acrusher                   bandreject                 ebur128
acue                       bass                       edgedetect
adeclick                   bbox                       elbg
adeclip                    bench                      entropy
adelay                     biquad                     eq
aderivative                bitplanenoise              equalizer
adrawgraph                 blackdetect                erosion
aecho                      blackframe                 extractplanes
aemphasis                  blend                      extrastereo
aeval                      bm3d                       fade
aevalsrc                   boxblur                    fftdnoiz
afade                      bwdif                      fftfilt
afftdn                     cellauto                   field
afftfilt                   channelmap                 fieldhint
afifo                      channelsplit               fieldmatch
afir                       chorus                     fieldorder
aformat                    chromahold                 fifo
agate                      chromakey                  fillborders
agraphmonitor              chromashift                find_rect
ahistogram                 ciescope                   firequalizer
aiir                       codecview                  flanger
aintegral                  color                      floodfill
ainterleave                colorbalance               format
alimiter                   colorchannelmixer          fps
allpass                    colorkey                   framepack
allrgb                     colorlevels                framerate
allyuv                     colormatrix                framestep
aloop                      colorspace                 freezedetect
alphaextract               compand                    fspp
alphamerge                 compensationdelay          gblur
amerge                     concat                     geq
ametadata                  convolution                gradfun
amix                       convolve                   graphmonitor
amovie                     copy                       greyedge
amplify                    cover_rect                 haas
amultiply                  crop                       haldclut
anequalizer                cropdetect                 haldclutsrc
anoisesrc                  crossfeed                  hdcd
anull                      crystalizer                headphone
anullsink                  cue                        hflip
anullsrc                   curves                     highpass
apad                       datascope                  highshelf
aperms                     dcshift                    hilbert
aphasemeter                dctdnoiz                   histeq
aphaser                    deband                     histogram
apulsator                  deblock                    hqdn3d
arealtime                  decimate                   hqx
aresample                  deconvolve                 hstack
areverse                   dedot                      hue
aselect                    deflate                    hwdownload
asendcmd                   deflicker                  hwmap
asetnsamples               dejudder                   hwupload
asetpts                    delogo                     hysteresis
asetrate                   deshake                    idet
asettb                     despill                    il
ashowinfo                  detelecine                 inflate
asidedata                  dilation                   interlace
asplit                     displace                   interleave
astats                     doubleweave                join
kerndeint                  premultiply                smptebars
ladspa                     prewitt                    smptehdbars
lenscorrection             pseudocolor                sobel
life                       psnr                       spectrumsynth
limiter                    pullup                     split
loop                       qp                         spp
loudnorm                   random                     sr
lowpass                    readeia608                 ssim
lowshelf                   readvitc                   stereo3d
lumakey                    realtime                   stereotools
lut                        remap                      stereowiden
lut1d                      removegrain                streamselect
lut2                       removelogo                 super2xsai
lut3d                      repeatfields               superequalizer
lutrgb                     replaygain                 surround
lutyuv                     reverse                    swaprect
mandelbrot                 rgbashift                  swapuv
maskedclamp                rgbtestsrc                 tblend
maskedmerge                roberts                    telecine
mcdeint                    rotate                     testsrc
mcompand                   sab                        testsrc2
mergeplanes                scale                      threshold
mestimate                  scale2ref                  thumbnail
metadata                   select                     tile
midequalizer               selectivecolor             tinterlace
minterpolate               sendcmd                    tlut2
mix                        separatefields             tmix
movie                      setdar                     tonemap
mpdecimate                 setfield                   tpad
mptestsrc                  setparams                  transpose
negate                     setpts                     treble
nlmeans                    setrange                   tremolo
nnedi                      setsar                     trim
noformat                   settb                      unpremultiply
noise                      showcqt                    unsharp
normalize                  showfreqs                  uspp
null                       showinfo                   vaguedenoiser
nullsink                   showpalette                vectorscope
nullsrc                    showspectrum               vflip
oscilloscope               showspectrumpic            vfrdet
overlay                    showvolume                 vibrance
owdenoise                  showwaves                  vibrato
pad                        showwavespic               vignette
pal100bars                 shuffleframes              vmafmotion
pal75bars                  shuffleplanes              volume
palettegen                 sidechaincompress          volumedetect
paletteuse                 sidechaingate              vstack
pan                        sidedata                   w3fdif
perms                      signalstats                waveform
perspective                signature                  weave
phase                      silencedetect              xbr
pixdesctest                silenceremove              xstack
pixscope                   sinc                       yadif
pp                         sine                       yuvtestsrc
pp7                        smartblur                  zoompan

Enabled bsfs:
aac_adtstoasc              hapqa_extract              null
av1_metadata               hevc_metadata              prores_metadata
chomp                      hevc_mp4toannexb           remove_extradata
dca_core                   imx_dump_header            text2movsub
dump_extradata             mjpeg2jpeg                 trace_headers
eac3_core                  mjpega_dump_header         truehd_core
extract_extradata          mov2textsub                vp9_metadata
filter_units               mp3_header_decompress      vp9_raw_reorder
h264_metadata              mpeg2_metadata             vp9_superframe
h264_mp4toannexb           mpeg4_unpack_bframes       vp9_superframe_split
h264_redundant_pps         noise

Enabled indevs:
alsa                       lavfi                      v4l2
fbdev                      oss                        xcbgrab

Enabled outdevs:
alsa                       oss                        v4l2
fbdev                      sdl2                       xv

License: nonfree and unredistributable
...

1 Comment

Leave a Reply