CLI - On the command line
It is possible to run all transcoding and all measurements locally on the command line. To do so, we must first make sure we have all the required software installed.
Prerequisites
Node.js v14 or higher
Make sure you have Node.js version 14 or later installed. Either download the installer (or source) from the official website. Other popular ways to install Node includes package managers and version managers (such as nvm
, nodenv
or asdf
)
Python v3.6 or higher
You will also need to have Python version 3.6 or higher installed and available on your PATH
. This too can be installed with package- or version managers.
ffmpeg v5.0 or higher
The indispensable tool ffmpeg is (of course) needed too. It needs to be at least version 5.0, and it must be compiled with libvmaf
. This is the default when installing with homebrew
or apt
.
easyVmaf v1.3 or higher
Finally we need easyVmaf to be installed, and its required package, ffmpeg-progress-yield. You may need to edit config.py
in easyVmaf to point to your installation of ffmpeg
and python3
.
Installation
To make the autovmaf
command available in your path, we need to install it globally using npm
. We can achieve this by passing the -g
or --global
flag.
Environment variables
Finally we will have to set one or more environment variables.
EASYVMAF_PATH
- needs to point to the fileeasyVmaf.py
from your easyVmaf installation.FFMPEG_PATH
- (optional) needs to be set if ffmpeg is not in your path.PYTHON_PATH
- (optional) needs to be set if python is not in your path.
Command line options
We are now ready to run autovmaf
😍 By default it will transcode a predefined number of resolutions and bitrates, and run the vmaf measurements on all of them. We can change the default behavior by passing along some optional flags.
Available command line options can be listed with the --help
argument.
--help Show help [boolean]
--version Show version number [boolean]
--resolutions List of resolutions, ie 1920x1080,1280x720... [string]
--bitrates List of bitrates, ie 800k,1000k,... [string]
--name Name for this autovmaf run
[string] [default: "MyVMAFMeasurements"]
--models List of VMAF Models to use [string] [default: "HD"]
Output files will be stored in a folder corresponding to the argument given to the --name
option.
Generate VMAF measurements
Let's run some measurements! We will call this run my-autovmaf-test
and we will be using my-source-video.mp4
as the source reference file.
autovmaf --resolutions 1920x1080,1280x720,960x540\
--bitrates 500k,800k,1200k,1600k,2000k\
--name my-autovmaf-test my-source-video.mp4
Results
With the above command, when the run is finished transcoded files will be available in the folder my-autovmaf-test
, and vmaf result data in the folder my-autovmaf-test/HD
.
my-autovmaf-test
├── 1280x720_1200000.mp4
├── 1280x720_1500000.mp4
├── 1280x720_1600000.mp4
├── 1280x720_2000000.mp4
├── 1280x720_500000.mp4
├── 1280x720_800000.mp4
├── 1920x1080_1200000.mp4
├── 1920x1080_1600000.mp4
├── 1920x1080_2000000.mp4
├── 1920x1080_500000.mp4
├── 1920x1080_800000.mp4
├── 960x540_1200000.mp4
├── 960x540_1600000.mp4
├── 960x540_2000000.mp4
├── 960x540_500000.mp4
├── 960x540_800000.mp4
└── HD
├── 1280x720_1200000_vmaf.json
├── 1280x720_1500000_vmaf.json
├── 1280x720_1600000_vmaf.json
├── 1280x720_2000000_vmaf.json
├── 1280x720_500000_vmaf.json
├── 1280x720_800000_vmaf.json
├── 1920x1080_1200000_vmaf.json
├── 1920x1080_1600000_vmaf.json
├── 1920x1080_2000000_vmaf.json
├── 1920x1080_500000_vmaf.json
├── 1920x1080_800000_vmaf.json
├── 960x540_1200000_vmaf.json
├── 960x540_1600000_vmaf.json
├── 960x540_2000000_vmaf.json
├── 960x540_500000_vmaf.json
└── 960x540_800000_vmaf.json
Towards the end of each file, you will find "harmonic_mean"
and this is the overall vmaf score we are looking for.