Created
May 10, 2022 15:53
-
-
Save mjdargen/727bd1fef838b75bcced61885ff3b133 to your computer and use it in GitHub Desktop.
Installs ffmpeg with libaom and libx265 enabled for av1 and hevc encoding
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
#!/usr/bin/env bash | |
# Copied from sparrc: https://gist.github.com/sparrc/026ed9958502072dda749ba4e5879ee3 | |
# Installs ffmpeg from source (HEAD) with libaom and libx265, as well as a few | |
# other common libraries | |
# binary will be at ~/bin/ffmpeg | |
sudo apt update && sudo apt upgrade -y | |
mkdir -p ~/ffmpeg_sources ~/bin | |
export PATH="$HOME/bin:$PATH" | |
sudo apt install -y \ | |
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 \ | |
nasm \ | |
yasm \ | |
libvpx-dev \ | |
libopus-dev \ | |
libx264-dev \ | |
libmp3lame-dev \ | |
libfdk-aac-dev | |
# Install libaom from source. | |
mkdir -p ~/ffmpeg_sources/libaom && \ | |
cd ~/ffmpeg_sources/libaom && \ | |
git clone https://aomedia.googlesource.com/aom && \ | |
cmake ./aom && \ | |
make && \ | |
sudo make install | |
# Install libx265 from source. | |
cd ~/ffmpeg_sources && \ | |
git clone https://github.com/videolan/x265 && \ | |
cd x265/build/linux && \ | |
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source && \ | |
make && \ | |
make install | |
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 && \ | |
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-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