Last active
January 11, 2018 10:35
-
-
Save renepardon/4e7533a54117c50e50e7351b8c836ffe to your computer and use it in GitHub Desktop.
Install ffmpeg on Ubuntu 16.04 - http://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
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 | |
# Usage example: | |
# /usr/local/bin/ffmpeg -i test.mp4 -acodec aac -strict experimental -ac 2 -ab 128k -vcodec libx264 -preset slow -f mp4 -s 640x480 test-out.mp4 | |
mkdir -p ~/ffmpeg_sources ~/bin | |
rm -rf ~/ffmpeg_build ~/bin/{ffmpeg,ffprobe,ffplay,ffserver,x264,x265 | |
apt-get update -qq && apt-get -y install \ | |
autoconf \ | |
automake \ | |
build-essential \ | |
cmake \ | |
git \ | |
libass-dev \ | |
libfreetype6-dev \ | |
libsdl2-dev \ | |
libtheora-dev \ | |
libtool \ | |
libva-dev \ | |
libvdpau-dev \ | |
libvorbis-dev \ | |
libxcb1-dev \ | |
libxcb-shm0-dev \ | |
libxcb-xfixes0-dev \ | |
mercurial \ | |
pkg-config \ | |
texinfo \ | |
wget \ | |
zlib1g-dev | |
cd ~/ffmpeg_sources && \ | |
wget http://www.nasm.us/pub/nasm/releasebuilds/2.13.02/nasm-2.13.02.tar.bz2 && \ | |
tar xjvf nasm-2.13.02.tar.bz2 && \ | |
cd nasm-2.13.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 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 | |
cd ~/ffmpeg_sources && \ | |
git -C x264 pull 2> /dev/null || git clone --depth 1 http://git.videolan.org/git/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 && \ | |
PATH="$HOME/bin:$PATH" make && \ | |
make install | |
cd ~/ffmpeg_sources && \ | |
if cd x265 2> /dev/null; then hg pull && hg update; 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:bool=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 http://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 && \ | |
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 && \ | |
wget -O ffmpeg-snapshot.tar.bz2 http://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 -lm" \ | |
--bindir="$HOME/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="$HOME/bin:$PATH" make && \ | |
make install | |
hash -r | |
cd ~/bin | |
cp * /usr/local/bin/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment