Skip to content

Instantly share code, notes, and snippets.

@faroncoder
Last active May 15, 2020 05:18
Show Gist options
  • Save faroncoder/7935868 to your computer and use it in GitHub Desktop.
Save faroncoder/7935868 to your computer and use it in GitHub Desktop.
This is based on https://trac.ffmpeg.org/wiki/UbuntuCompilationGuide and this script is revised a little bit so it'd recompile h246 into libav before compiling FFMPEG.
Bash shell script
Ubuntu 12.04 12.10 13.04 13.10
x64 = success
x32 = debugging
Location of build: /home/yourhome/ffmpeg_src
Compiling FFMPEG on host. Listed below is in order of compiling process:
YASM 1.2.0 (http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz)
FDK-AAC (git://github.com/mstorsjo/fdk-aac.git)
LIBVPX (http://git.chromium.org/webm/libvpx.git)
THEORA 1.1.1 (http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2)
LAME 3.99.5 (http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz)
OPUS 1.0.3 (http://downloads.xiph.org/releases/opus/opus-1.0.3.tar.gz)
FAAC 1.28 (http://downloads.sourceforge.net/faac/faac-1.28.tar.bz2)
## I included this even though I had FDK-AAC earlier
## but it seemed to solve issues I was having without this ##
xH264 (git://git.videolan.org/x264.git) ## compile with all of libs above ##
LIBAV (git://git.libav.org/libav.git) ## compile with xH264 (it has rest of libs from earlier) ##
xH264 (same as previous) ## recompile LIBAV with xH264
FFMPEG (clone git://source.ffmpeg.org/ffmpeg) compile with xH264/LIBAV
#!/bin/bash
BUILD="$HOME/ffmpeg-src"
PREFIX="/usr/local"
mkdir -p $BUILD
cd $BUILD
##GET YASM
cd $BUILD
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz
rm yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure --prefix="$PREFIX" --enable-shared
sudo make && sudo make install && sudo make clean && sudo make distclean
. ~/.profile
bash
##GET FDK-AAC
cd $BUILD
git clone git://github.com/mstorsjo/fdk-aac.git
cd fdk-aac
autoreconf -fiv
./configure --prefix="$PREFIX" --enable-shared
sudo make && sudo make install && sudo make clean && sudo make distclean
## GET LIBVPX
cd $BUILD
git clone http://git.chromium.org/webm/libvpx.git
cd libvpx
./configure --prefix="$PREFIX" --enable-shared --enable-vp8 --enable-pic
sudo make && sudo make install && sudo make clean && sudo make distclean
## GET THEORA
cd $BUILD
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
tar -xjf libtheora-1.1.1.tar.bz2
rm libtheora-1.1.1.tar.bz2
cd libtheora-1.1.1
./configure --prefix="$PREFIX" --enable-shared
sudo make && sudo make install && sudo make clean && sudo make distclean
## GET LAME
cd $BUILD
wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar xzvf lame-3.99.5.tar.gz
rm lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --prefix="$PREFIX" --enable-nasm --disable-shared
sudo make && sudo make install && sudo make clean && sudo make distclean
## GET OPUS
cd $BUILD
wget http://downloads.xiph.org/releases/opus/opus-1.0.3.tar.gz
tar xzvf opus-1.0.3.tar.gz
rm opus-1.0.3.tar.gz
cd opus-1.0.3
./configure --prefix="$PREFIX" --disable-shared
sudo make && sudo make install && sudo make clean && sudo make distclean
## GET FAAC
cd $BUILD
wget http://downloads.sourceforge.net/faac/faac-1.28.tar.bz2
tar -xjf faac-1.28.tar.bz2
rm faac-1.28.tar.bz2
cd faac-1.28
./configure --prefix="$PREFIX" --enable-shared
sudo make && sudo make install && sudo make clean && sudo make distclean
### x264 with libraries from above
cd $BUILD
git clone git://git.videolan.org/x264.git
cd x264
./configure --prefix="$PREFIX" --enable-pic --enable-shared --disable-lavf
sudo make && sudo make install && sudo make clean && sudo make distclean
## GET LIBAV
cd $BUILD
sudo ldconfig
git clone git://git.libav.org/libav.git
cd libav
./configure --prefix="$PREFIX" --enable-libmp3lame --enable-libx264 --enable-libfaac --enable-libvorbis --enable-pic --enable-shared --enable-gpl --enable-nonfree --enable-libtheora --enable-libvpx
sudo make && sudo make install && sudo make clean && sudo make distclean
sudo ldconfig
# REBUIKD x264 final
cd $BUILD
cd x264
./configure --prefix="$PREFIX" --enable-static --enable-shared --enable-pic
sudo make && sudo make install && sudo make clean && sudo make distclean
# FFMPEG TIME!
cd $BUILD
git clone git://source.ffmpeg.org/ffmpeg
cd ffmpeg
PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig"
export PKG_CONFIG_PATH
./configure --extra-cflags="-I$PREFIX/include" --extra-ldflags="-L$PREFIX/lib" --bindir="$PREFIX/bin" --extra-libs="-ldl" --enable-gpl --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-version3 --enable-libass --enable-libx264 --enable-libfdk_aac --enable-nonfree --enable-libopus
sudo make && sudo make install && sudo make clean && sudo make distclean
hash -r
ffmpeg 2>&1 | head -n1
rm -R $BUILD
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment