-
-
Save xiopt/872533e3fa0712a20f4eadda3cf5c6b5 to your computer and use it in GitHub Desktop.
Build ffmpeg and all needed codecs from latest git revisions
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 | |
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 | |
mkdir -p ~/ffmpeg_sources ~/bin | |
cd ~/ffmpeg_sources && \ | |
wget https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.bz2 && \ | |
tar xjvf nasm-2.14.02.tar.bz2 && \ | |
cd nasm-2.14.02 && \ | |
./autogen.sh && \ | |
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" && \ | |
make && \ | |
make install | |
cd ~/ffmpeg_sources && \ | |
wget -O yasm-1.3.0.tar.gz https://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 | |
cd ~/ffmpeg_sources && \ | |
git -C x264 pull 2> /dev/null || git clone --depth 1 https://code.videolan.org/videolan/x264 && \ | |
cd x264 && \ | |
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static --enable-pic --disable-opencl && \ | |
PATH="$HOME/bin:$PATH" make && \ | |
make install | |
sudo apt-get install mercurial libnuma-dev && \ | |
cd ~/ffmpeg_sources && \ | |
if cd x265 2> /dev/null; then hg pull && hg update && cd ..; else hg clone https://bitbucket.org/multicoreware/x265; fi && \ | |
cd x265/build/linux && \ | |
PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED=off ../../source && \ | |
PATH="$HOME/bin:$PATH" make && \ | |
make install | |
cd ~/ffmpeg_sources && \ | |
git -C libvpx pull 2> /dev/null || git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \ | |
cd libvpx && \ | |
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm && \ | |
PATH="$HOME/bin:$PATH" make && \ | |
make install | |
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="$HOME/ffmpeg_build" --disable-shared && \ | |
make && \ | |
make install | |
cd ~/ffmpeg_sources && \ | |
wget -O lame-3.100.tar.gz https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz && \ | |
tar xzvf lame-3.100.tar.gz && \ | |
cd lame-3.100 && \ | |
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm && \ | |
PATH="$HOME/bin:$PATH" make && \ | |
make install | |
cd ~/ffmpeg_sources && \ | |
wget -O fdk-aac.tar.gz https://github.com/mstorsjo/fdk-aac/tarball/master && \ | |
tar xzvf fdk-aac.tar.gz && \ | |
cd mstorsjo-fdk-aac* && \ | |
autoreconf -fiv && \ | |
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared | |
PATH="$HOME/bin:$PATH" make && \ | |
make install | |
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="$HOME/ffmpeg_build" --disable-shared && \ | |
make && \ | |
make install | |
cd ~/ffmpeg_sources && \ | |
hg clone http://hg.libsdl.org/SDL && \ | |
cd ~/ffmpeg_sources/SDL && \ | |
./autogen.sh -ivf && \ | |
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --with-x --with-pic=yes \ | |
--disable-alsatest --enable-pthreads --enable-static=yes --enable-shared=no && \ | |
make -j$(nproc) VERBOSE=1 && \ | |
make -j$(nproc) install VERBOSE=1 && \ | |
make -j$(nproc) clean VERBOSE=1 | |
cd ~/ffmpeg_sources && \ | |
wget -O ffmpeg-snapshot.tar.bz2 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:/opt/intel/mediasdk/lib/pkgconfig" ./configure \ | |
--pkg-config-flags="--static" \ | |
--enable-static --disable-shared \ | |
--prefix="$HOME/ffmpeg_build" \ | |
--bindir="$HOME/bin" \ | |
--extra-cflags="-I$HOME/ffmpeg_build/include" \ | |
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \ | |
--extra-cflags="-I/opt/intel/mediasdk/include" \ | |
--extra-ldflags="-L/opt/intel/mediasdk/lib" \ | |
--extra-ldflags="-L/opt/intel/mediasdk/plugins" \ | |
--enable-libmfx \ | |
--enable-vaapi \ | |
--enable-opencl \ | |
--disable-debug \ | |
--enable-libvorbis \ | |
--enable-libvpx \ | |
--enable-libdrm \ | |
--enable-gpl \ | |
--enable-runtime-cpudetect \ | |
--enable-libfdk-aac \ | |
--enable-libx264 \ | |
--enable-libx265 \ | |
--enable-openssl \ | |
--enable-pic \ | |
--extra-libs="-lpthread -lm -lz -ldl" \ | |
--enable-nonfree | |
PATH="$HOME/bin:$PATH" make -j$(nproc) | |
make -j$(nproc) install | |
make -j$(nproc) distclean | |
hash -r |
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
wget https://gist.githubusercontent.com/talkingnews/3a2ba82a18ccfd2b38eadcb1cbf78757/raw/65fb12dd6ca19cf85455c012de573995c0472266/ffmpeg_build.sh | |
chmod a+x ffmpeg_build.sh | |
./ffmpeg_build.sh | |
Updated for 2019 - see https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment