A few reference links:
This is building on linux & wsl. I am running on Ubuntu 20.04 in both cases.
First, ensure various tools are updated and ensure that you have build-essentials
installed. Install python3
and pip3
for Cython
and numpy
.
I have installed meson
myself rather than going thru pip3
, somehow system was not able to find it where it was install during building libvmaf
. It shouldn’t matter which way you install as long as it is found during build.
1
2
3
4
| sudo apt update
sudo apt install python3 python3-pip python3-setuptools python3-wheel ninja-build nasm
sudo apt install meson
sudo apt install zip unzip
|
Next, I downloaded latest vmaf
from github repo and extracted in a directory, say ~\source\vmaf
.
1
2
3
| libvmaf:
get vmaf from github repo (wget https://github.com/Netflix/vmaf/archive/v1.5.2.tar.gz)
extract it locally to a directory
|
To build and make & install vmaf:
1
2
3
4
5
| cd vmaf
sudo make
sudo make install
// it is installed in location /usr/local/lib/x86_64-linux-gnu
|
Once, libvmaf
is built and installed, it is now time to build ffmpeg
and it will include the libvmaf.a
file generated earlier.
First get all dependencies built and installed, we are going to various encoders and their dev-packages to be linked in ffmpeg:
1
2
3
4
5
6
7
8
| sudo apt -y install autoconf automake build-essential cmake git-core
sudo apt -y install libass-dev libfreetype6-dev libgnutls28-dev libsdl2-dev
sudo apt -y install libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev
sudo apt -y install libxcb-shm0-dev libxcb-xfixes0-dev meson ninja-build
sudo apt -y install pkg-config texinfo wget yasm zlib1g-dev nasm
sudo apt -y install libx264-dev libx265-dev libnuma-dev libopus-dev
sudo apt -y install libvpx-dev libfdk-aac-dev libmp3lame-dev
|
Next, create couple of directories in to extract source and build:
1
| mkdir -p ~/ffmpeg_sources ~/bin
|
Now to build ffmpeg with various support encoders and filters execute below command. It will configure our build and list various filters and encoders it is going to build with:
1
2
3
4
5
6
7
8
| 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"
./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" --ld="g++" --bindir="$HOME/bin" --enable-gpl --enable-gnutls --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-nonfree
|
It prints a ton of stuff on terminal:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
| install prefix /home/sarang/ffmpeg_build
source path .
C compiler gcc
C library glibc
ARCH x86 (generic)
big-endian no
runtime cpu detection yes
standalone assembly yes
x86 assembler nasm
MMX enabled yes
MMXEXT enabled yes
3DNow! enabled yes
3DNow! extended enabled yes
SSE enabled yes
SSSE3 enabled yes
AESNI enabled yes
AVX enabled yes
AVX2 enabled yes
...
makeinfo supports HTML yes
External libraries:
...
External libraries providing hardware acceleration:
...
Libraries:
avcodec avfilter avutil swresample
avdevice avformat postproc swscale
Programs:
ffmpeg ffplay ffprobe
Enabled decoders:
aac bmp iac pcm_f24le stl
...
Enabled encoders:
a64multi dnxhd magicyuv pcm_s64be speedhq
...
Enabled hwaccels:
...
Enabled parsers:
...
Enabled demuxers:
...
Enabled muxers:
...
Enabled protocols:
...
Enabled filters:
...
Enabled bsfs:
...
Enabled indevs:
...
Enabled outdevs:
...
License: nonfree and unredistributable
|
To continue with build and installation, this will take a bit but it will build and install in local user’s directory:
1
2
3
4
| PATH="$HOME/bin:$PATH"
make -j4
make install
hash -r
|
For me, it installed it in directory: /home/sarangb/bin/ffmpeg
. Now, it gets fancy if you had installed ffmpeg
thru apt install
command earlier. In such case sourcing the ~/.profile
helped with command source ~/.profile
Checking with the newly built ffmpeg
, I can see that it has libvmaf
support. Of course it is a non distributable build for my local consumption.
1
2
3
4
5
6
7
8
9
10
11
12
13
| ffmpeg version N-101868-g557953a Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
configuration: --prefix=/home/sarangb/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/sarangb/ffmpeg_build/include --extra-ldflags=-L/home/sarangb/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/sarangb/bin --enable-gpl --enable-gnutls --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libvmaf --enable-nonfree
libavutil 56. 72.100 / 56. 72.100
libavcodec 58.135.100 / 58.135.100
libavformat 58. 78.100 / 58. 78.100
libavdevice 58. 14.100 / 58. 14.100
libavfilter 7.111.100 / 7.111.100
libswscale 5. 10.100 / 5. 10.100
libswresample 3. 10.100 / 3. 10.100
libpostproc 55. 10.100 / 55. 10.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
|
Now all of above was due to non availability of linux ffmpeg build with vmaf support. On windows, I found that builds from https://github.com/BtbN/FFmpeg-Builds/releases
include vmaf support and didn’t had to jump thru hoops on windows..