Skip to content

Instantly share code, notes, and snippets.

@sparanoid
Created March 31, 2021 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sparanoid/9eebc5d721d935f3d9d41f8d18200c21 to your computer and use it in GitHub Desktop.
Save sparanoid/9eebc5d721d935f3d9d41f8d18200c21 to your computer and use it in GitHub Desktop.
Installs ffmpeg with libaom and libx265 enabled for av1 and hevc encoding (tested on Ubuntu 16.04)
#!/usr/bin/env bash
# Installs ffmpeg from source (HEAD) with libaom and libx265, as well as a few
# other common libraries
# binary will be at $BASE_DIR/bin/ffmpeg
apt update && apt upgrade -y
BASE_DIR="/openbayes/home"
mkdir -p "$BASE_DIR/ffmpeg_sources" "$BASE_DIR/bin"
export PATH="$BASE_DIR/bin:$PATH"
apt -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 \
yasm \
libvpx-dev \
libopus-dev \
libx264-dev \
libmp3lame-dev \
libfdk-aac-dev
# Install libaom from source.
mkdir -p "$BASE_DIR/ffmpeg_sources/libaom" && \
cd $BASE_DIR/ffmpeg_sources/libaom && \
git clone https://aomedia.googlesource.com/aom && \
cmake ./aom && \
make && \
make install
# Install libx265 from source.
cd "$BASE_DIR/ffmpeg_sources" && \
hg clone https://bitbucket.org/multicoreware/x265 && \
cd x265/build/linux && \
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$BASE_DIR/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source && \
make && \
make install
cd "$BASE_DIR/ffmpeg_sources" && \
wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && \
tar xjvf ffmpeg-snapshot.tar.bz2 && \
cd ffmpeg && \
PKG_CONFIG_PATH="$BASE_DIR/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$BASE_DIR/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$BASE_DIR/ffmpeg_build/include" \
--extra-ldflags="-L$BASE_DIR/ffmpeg_build/lib" \
--extra-libs="-lpthread -lm" \
--bindir="$BASE_DIR/bin" \
--enable-gpl \
--enable-libass \
--enable-libfdk-aac \
--enable-libmp3lame \
--enable-libx264 \
--enable-libx265 \
--enable-libtheora \
--enable-libfreetype \
--enable-libvorbis \
--enable-libopus \
--enable-libvpx \
--enable-libaom \
--enable-nonfree && \
make && \
make install && \
hash -r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment