Last active
January 30, 2020 20:57
-
-
Save thenadz/6c0584d42fb007582fbc to your computer and use it in GitHub Desktop.
Downloads & builds FFmpeg along with all dependencies in parallel, enabling all features
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# Distro: Amazon Linux AMI release 2015.03 | |
# Derived from https://trac.ffmpeg.org/wiki/CompilationGuide/Centos | |
# Builds the dependencies in parallel prior to starting FFmpeg build. | |
sudo yum update -y | |
sudo yum install -y autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel yasm libogg libvorbis-devel libvpx-devel | |
SOURCES="$HOME/ffmpeg/sources" | |
BUILD="$HOME/ffmpeg/build" | |
BIN="$HOME/bin" | |
mkdir -p "$SOURCES" | |
mkdir -p "$BUILD" | |
mkdir -p "$BIN" | |
pushd "$SOURCES" | |
# libx264 | |
{ | |
git clone --depth 1 git://git.videolan.org/x264 | |
pushd x264 | |
./configure --prefix="$BUILD" --bindir="$BIN" --enable-static | |
make | |
make install | |
make distclean | |
} & | |
# libx265 | |
{ | |
hg clone --insecure https://bitbucket.org/multicoreware/x265 | |
pushd x265/build/linux | |
PATH="$BIN:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$BUILD" -DENABLE_SHARED:bool=off ../../source | |
make | |
make install | |
make distclean | |
} & | |
# libfdk-aac | |
{ | |
wget -O fdk-aac.zip https://github.com/mstorsjo/fdk-aac/zipball/master | |
unzip fdk-aac.zip | |
pushd mstorsjo-fdk-aac* | |
autoreconf -fiv | |
./configure --prefix="$BUILD" --disable-shared | |
make | |
make install | |
make distclean | |
} & | |
# libmp3lame | |
{ | |
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 | |
pushd lame-3.99.5 | |
./configure --prefix="$BUILD" --bindir="$BIN" --disable-shared --enable-nasm | |
make | |
make install | |
make distclean | |
} & | |
# libopus | |
{ | |
git clone git://git.opus-codec.org/opus.git | |
pushd opus | |
autoreconf -fiv | |
./configure --prefix="$BUILD" --disable-shared | |
make | |
make install | |
make distclean | |
} & | |
# ffmpeg download & extract | |
{ | |
wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 | |
tar xjvf ffmpeg-snapshot.tar.bz2 | |
} & | |
# join all dependant jobs before starting ffmpeg | |
wait | |
# ffmpeg | |
pushd ffmpeg | |
PATH="$BIN:$PATH" PKG_CONFIG_PATH="$BUILD/lib/pkgconfig" ./configure \ | |
--prefix="$BUILD" \ | |
--pkg-config-flags="--static" \ | |
--extra-cflags="-I$BUILD/include" \ | |
--extra-ldflags="-L$BUILD/lib" \ | |
--bindir="$BIN" \ | |
--enable-gpl \ | |
# --enable-libass \ | |
--enable-libfdk-aac \ | |
--enable-libfreetype \ | |
--enable-libmp3lame \ | |
--enable-libopus \ | |
#--enable-libtheora \ | |
--enable-libvorbis \ | |
--enable-libvpx \ | |
--enable-libx264 \ | |
--enable-libx265 \ | |
--enable-nonfree | |
PATH="$BIN:$PATH" make | |
make install | |
make distclean | |
hash -r |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment