Skip to content

Instantly share code, notes, and snippets.

@jordicenzano
Last active May 1, 2018 03:25
Show Gist options
  • Save jordicenzano/38d324b4b4e7fa2cb9cebf13a8fa65f6 to your computer and use it in GitHub Desktop.
Save jordicenzano/38d324b4b4e7fa2cb9cebf13a8fa65f6 to your computer and use it in GitHub Desktop.
Compile ffmpeg in EC2 (no vpx, no HEVC, YES SRT)
!/bin/sh
#Prerequirsites
sudo yum update
sudo yum install autoconf automake bzip2 cmake freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel tcl openssl-devel
#prepare/cleanup environment
cd ~
rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffserver,lame,vsyasm,x264,yasm,ytasm}
mkdir ~/ffmpeg_sources
#Nasm
cd ~/ffmpeg_sources
curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.bz2
tar xjvf nasm-2.13.01.tar.bz2
cd nasm-2.13.01
./autogen.sh
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install
#compile yasm (needed by dependencies)
cd ~/ffmpeg_sources
curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar xzvf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install
#compile x264
cd ~/ffmpeg_sources
git clone --depth 1 git://git.videolan.org/x264
cd x264
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --enable-static
make
make install
make distclean
#libfdk_aac
cd ~/ffmpeg_sources
git clone --depth 1 https://github.com/mstorsjo/fdk-aac
cd fdk-aac
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
#libopus
cd ~/ffmpeg_sources
curl -O -L https://archive.mozilla.org/pub/opus/opus-1.2.tar.gz
tar xzvf opus-1.2.tar.gz
cd opus-1.2
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
#libogg
cd ~/ffmpeg_sources
curl -O -L http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
tar xzvf libogg-1.3.2.tar.gz
cd libogg-1.3.2
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install
#libvorbis
cd ~/ffmpeg_sources
curl -O -L http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz
tar xzvf libvorbis-1.3.5.tar.gz
cd libvorbis-1.3.5
./configure --prefix="$HOME/ffmpeg_build" --with-ogg="$HOME/ffmpeg_build" --disable-shared
make
make install
#SRT (NOT TESTED)
cd ~/ffmpeg_sources
curl -O -L https://github.com/Haivision/srt/archive/v1.3.0.tar.gz
tar xzvf v1.3.0.tar.gz
cd srt-1.3.0
./configure
make
#Install FFMEG
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 \
--bindir="$HOME/bin" \
--enable-gpl \
--enable-libfdk_aac \
--enable-libfreetype \
--enable-libopus \
--enable-libvorbis \
--enable-libx264 \
--enable-nonfree \
--enable-libsrt
make
make install
hash -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment