Install FFmpeg on CentOS

Discussion in 'Server Management' started by Zeen, Feb 13, 2014.

  1. Zeen

    Zeen Administrator Staff Member

    First check if FFmpeg is already installed:
    which ffmpeg

    Run
    Code:
    yum remove libvpx libogg libvorbis libtheora libx264 x264 ffmpeg
    if you find an old instance of FFmpeg.

    Get the dependencies:
    Code:
    yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel
    Make a directory to put all of the source code into:
    Code:
    mkdir ~/ffmpeg_sources
    Turn off the firewall before using git.

    Yasm is an assembler used by x264 and FFmpeg.

    Code:
    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="/usr/local/src/ffmpeg_build" --bindir="/usr/bin"
    make
    make install
    make distclean
    export "PATH=$PATH:/usr/bin"
    H.264 video encoder.
    Code:
    cd ~/ffmpeg_sources
    git clone --depth 1 git://git.videolan.org/x264
    cd x264
    ./configure --prefix="/usr/local/src/ffmpeg_build" --bindir="/usr/bin" --enable-static
    make
    make install
    make distclean
    libfdk_aac AAC audio encoder
    Code:
    cd ~/ffmpeg_sources
    git clone --depth 1 git://git.code.sf.net/p/opencore-amr/fdk-aac
    cd fdk-aac
    autoreconf -fiv
    ./configure --prefix="/usr/local/src/ffmpeg_build" --disable-shared
    make
    make install
    make distclean
    You might get an error about /tmp when running configure. Then you create another temp directory:
    mkdir /temp
    export TMPDIR=/temp

    FFmpeg
    Code:
    cd ~/ffmpeg_sources
    git clone --depth 1 git://source.ffmpeg.org/ffmpeg
    cd ffmpeg
    PKG_CONFIG_PATH="/usr/local/src/ffmpeg_build/lib/pkgconfig"
    export PKG_CONFIG_PATH
    ./configure --prefix="/usr/local/src/ffmpeg_build" --extra-cflags="-I/usr/local/src/ffmpeg_build/include" --extra-ldflags="-L/usr/local/src/ffmpeg_build/lib" --bindir="/usr/bin" --extra-libs="-ldl" --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libx264
    make
    make install
    make distclean
    hash -r
    . ~/.bash_profile
    qt-faststart

    cd ~/ffmpeg_sources/ffmpeg/tools
    make qt-faststart
    cp qt-faststart /usr/local/bin
    ldconfig
    cd

    Remember to turn on the firewall again.

    Check installation:

    which convert
    which ffmpeg
    which qt-faststart

    add this line to cron (crontab -e)
    * * * * * cd /home/convert1/public_html/convert && /usr/local/bin/php remote_cron.php > /dev/null 2>&1
     
    Last edited by a moderator: Oct 6, 2015

Share This Page