-
-
Save sparrc/026ed9958502072dda749ba4e5879ee3 to your computer and use it in GitHub Desktop.
#!/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 ~/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 |
--extra-libs="-lpthread -lm"
has made my day, thank you !
How can I build x265 which supports 10 bit and HDR10 plus ? I tried to add -DENABLE_HDR10_PLUS='TRUE' and -DHIGH_BIT_DEPTH='TRUE' but it didn't work
I believe that the correct option to pass to cmake is "-DHIGH_BIT_DEPTH:bool=on" or simply "-DHIGH_BIT_DEPTH=ON". But even more importantly, nasm must be installed before launching cmake (a step which is missing from this gist), otherwise x265 will be built without any assembler optimizations!
You prob wan't to install nasm aswell otherwise x265/x264 will prompt “using cpu capabilities: none!” like @LukeRoss00 mentioned.
apt-install nasm
./x265 --version
x265 [info]: HEVC encoder version 3.2+38-fdbd4e4a2aff
x265 [info]: build info [Linux][GCC 7.4.0][64 bit] 10bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
thanks everyone, I added nasm and fixed the "apt install -y" typo ;)
The libx265 repo seems to not work for me today. I ended up using https://github.com/videolan/x265.git
thanks @feiyeung, that repo seems to have vanished, I have updated it to do a git clone of github.com/videolan/x265
so to add hdr10 ability, I have to add -DHIGH_BIT_DEPTH:bool=on to the cmake section of x265.
is this in place of or along with the -DENABLE_SHARED:bool=off instruction
sorry I am a new to this and want to continue with Linux and this has been a major headache trying to get the hdr10 opt available in x265.
only found this page the other day and has helped lots.
I'm getting some error like this.
How to resolve it? Thx...
`ffmpeg/libpostproc/postprocess.h
ffmpeg/libpostproc/postprocres.rc
ffmpeg/libpostproc/version_major.h
ffmpeg/libpostproc/version.h
ERROR: SvtAv1Enc >= 0.9.0 not found using pkg-config
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
[email protected] mailing list or IRC #ffmpeg on irc.libera.chat.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
Makefile:2: ffbuild/config.mak: No such file or directory
Makefile:42: /tools/Makefile: No such file or directory
Makefile:43: /ffbuild/common.mak: No such file or directory
Makefile:113: /libavutil/Makefile: No such file or directory
Makefile:113: /ffbuild/library.mak: No such file or directory
Makefile:115: /fftools/Makefile: No such file or directory
Makefile:116: /doc/Makefile: No such file or directory
Makefile:117: /doc/examples/Makefile: No such file or directory
Makefile:184: /tests/Makefile: No such file or directory
make: *** No rule to make target '/tests/Makefile'. Stop.
Makefile:2: ffbuild/config.mak: No such file or directory
Makefile:42: /tools/Makefile: No such file or directory
Makefile:43: /ffbuild/common.mak: No such file or directory
Makefile:113: /libavutil/Makefile: No such file or directory
Makefile:113: /ffbuild/library.mak: No such file or directory
Makefile:115: /fftools/Makefile: No such file or directory
Makefile:116: /doc/Makefile: No such file or directory
Makefile:117: /doc/examples/Makefile: No such file or directory
Makefile:184: /tests/Makefile: No such file or directory
make: *** No rule to make target '/tests/Makefile'. Stop.
`
sudo apt -y install => sudo apt install -y
Tcho !