Last active
January 6, 2019 17:36
-
-
Save pmdevita/1a672c49e003bd1ca93a9aa3f47f5c7a to your computer and use it in GitHub Desktop.
Debian/Ubuntu FFMPEG Build
This file contains hidden or 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
FFMPEG_BASE="$(pwd)" | |
FFMPEG_SOURCES="$FFMPEG_BASE/ffmpeg_sources" | |
FFMPEG_BUILD="$FFMPEG_BASE/ffmpeg_build" | |
FFMPEG_BIN="$FFMPEG_BASE/ffmpeg_bin" | |
echo $FFMPEG_BASE | |
mkdir $FFMPEG_BIN | |
mkdir $FFMPEG_SOURCES | |
mkdir $FFMPEG_BUILD | |
install_deps () { | |
sudo apt-get update -qq && sudo apt-get -y install \ | |
autoconf \ | |
automake \ | |
build-essential \ | |
cmake \ | |
git-core \ | |
libass-dev \ | |
libfreetype6-dev \ | |
libsdl2-dev \ | |
libtool \ | |
libva-dev \ | |
libvdpau-dev \ | |
libvorbis-dev \ | |
libxcb1-dev \ | |
libxcb-shm0-dev \ | |
libxcb-xfixes0-dev \ | |
pkg-config \ | |
texinfo \ | |
wget \ | |
zlib1g-dev | |
} | |
build_nasm () { | |
NASM_URL=https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.xz | |
NASM_PKG=$(basename $NASM_URL) | |
NASM_FOLDER="${NASM_PKG%.*}" | |
NASM_FOLDER="${NASM_FOLDER%.*}" # Two file extensions | |
cd $FFMPEG_SOURCES && \ | |
wget -nc $NASM_URL && \ | |
tar xf $NASM_PKG && \ | |
cd $NASM_FOLDER && \ | |
./autogen.sh && \ | |
PATH="$FFMPEG_BIN:$PATH" ./configure --prefix="$FFMPEG_BUILD" --bindir="$FFMPEG_BIN" && \ | |
make && \ | |
make install | |
} | |
build_yasm () { | |
sudo apt-get install yasm | |
} | |
build_libx264 () { | |
X264_URL=https://git.videolan.org/git/x264.git | |
cd $FFMPEG_SOURCES && \ | |
git -C x264 pull 2> /dev/null || git clone --depth 1 $X264_URL && \ | |
cd x264 && \ | |
PATH="$FFMPEG_BIN:$PATH" PKG_CONFIG_PATH="$FFMPEG_BUILD/lib/pkgconfig" ./configure --prefix="$FFMPEG_BUILD" --bindir="$FFMPEG_BIN" --enable-static --enable-pic && \ | |
PATH="$FFMPEG_BIN:$PATH" make && \ | |
make install | |
} | |
build_libvpx () { | |
cd $FFMPEG_SOURCES && \ | |
git -C libvpx pull 2> /dev/null || git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \ | |
cd libvpx && \ | |
PATH="$FFMPEG_BIN:$PATH" ./configure --prefix="$FFMPEG_BUILD" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm && \ | |
PATH="$FFMPEG_BIN:$PATH" make && \ | |
make install | |
} | |
build_libfdk-aac () { | |
cd $FFMPEG_SOURCES && \ | |
git -C fdk-aac pull 2> /dev/null || git clone --depth 1 https://github.com/mstorsjo/fdk-aac && \ | |
cd fdk-aac && \ | |
autoreconf -fiv && \ | |
./configure --prefix="$FFMPEG_BUILD" --disable-shared && \ | |
make && \ | |
make install | |
} | |
build_libmp3lame () { | |
LAME_URL=https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz | |
LAME_PKG=$(basename $LAME_URL) | |
LAME_FOLDER="${LAME_PKG%.*}" | |
LAME_FOLDER="${LAME_FOLDER%.*}" # Two file extensions | |
cd $FFMPEG_SOURCES && \ | |
wget -nc $LAME_URL && \ | |
tar xf $LAME_PKG && \ | |
cd $LAME_FOLDER && \ | |
PATH="$FFMPEG_BIN:$PATH" ./configure --prefix="$FFMPEG_BUILD" --bindir="$FFMPEG_BIN" --disable-shared --enable-nasm && \ | |
PATH="$FFMPEG_BIN:$PATH" make && \ | |
make install | |
} | |
build_libopus () { | |
cd $FFMPEG_SOURCES && \ | |
git -C opus pull 2> /dev/null || git clone --depth 1 https://github.com/xiph/opus.git && \ | |
cd opus && \ | |
./autogen.sh && \ | |
./configure --prefix="$FFMPEG_BUILD" --disable-shared && \ | |
make && \ | |
make install | |
} | |
build_ffmpeg () { | |
FFMPEG_URL=https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 | |
FFMPEG_PKG=$(basename $FFMPEG_URL) | |
FFMPEG_FOLDER="${FFMPEG_PKG%.*}" | |
FFMPEG_FOLDER="${FFMPEG_FOLDER%.*}" # Two file extensions | |
cd $FFMPEG_SOURCES && \ | |
wget $FFMPEG_URL && \ | |
tar xf $FFMPEG_PKG && \ | |
cd $FFMPEG_FOLDER && \ | |
PATH="$FFMPEG_BIN:$PATH" PKG_CONFIG_PATH="$FFMPEG_BUILD/lib/pkgconfig" ./configure \ | |
--prefix="$FFMPEG_BUILD" \ | |
--pkg-config-flags="--static" \ | |
--extra-cflags="-I$FFMPEG_BUILD/include" \ | |
--extra-ldflags="-L$FFMPEG_BUILD/lib" \ | |
--extra-libs="-lpthread -lm" \ | |
--bindir="$FFMPEG_BIN" \ | |
--enable-gpl \ | |
`--enable-libaom` \ | |
--enable-libass \ | |
--enable-libfdk-aac \ | |
--enable-libfreetype \ | |
--enable-libmp3lame \ | |
--enable-libopus \ | |
--enable-libvorbis \ | |
--enable-libvpx \ | |
--enable-libx264 \ | |
`--enable-libx265` \ | |
--enable-nonfree && \ | |
PATH="$FFMPEG_BIN:$PATH" make && \ | |
make install && \ | |
hash -r | |
} | |
install_deps | |
build_nasm | |
build_yasm | |
build_libx264 | |
build_libfdk-aac | |
build_libvpx | |
build_libmp3lame | |
build_libopus | |
build_ffmpeg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Script made from https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu