catchpoint / WebPageTest.visual-metrics

Calculate visual performance metrics from a video (Speed Index, Visual Complete, Incremental progress, etc)
BSD 3-Clause "New" or "Revised" License
153 stars 45 forks source link

visualmetrics

Calculate visual performance metrics from a video (Speed Index, Perceptual Speed Index, Visual Complete, Incremental progress, etc). This is a command-line port of the WebPagetest mobile video processing and metrics code.

Requirements

visualmetrics requires several image processing tools be installed and available in the path:

The dependencies can be verified by running:

$python visualmetrics.py --check
ffmpeg:   OK
convert:  OK
compare:  OK
Pillow:   OK
SSIM:     OK

Command Line

Help

$ python visualmetrics.py -h

Options

Examples

$ python visualmetrics.py --video video.mp4 --dir frames -q 75 --histogram histograms.json.gz --orange --viewport
First Visual Change: 1806
Last Visual Change: 1955
Visually Complete: 1955
Speed Index: 1835
Visual Progress: 0=0%, 1806=45%, 1827=48%, 1844=53%, 1861=99%, 1879=99%, 1901=98%, 1922=99%, 1938=99%, 1955=100%
$ python visualmetrics.py --video tests/data/lemons/video.mp4 --dir frames --histogram histograms.json.gz --orange --viewport
First Visual Change: 768
Last Visual Change: 2884
Speed Index: 1840
Visual Progress: 0=0%, 768=23%, 785=24%, 1510=61%, 1545=61%, 1981=61%, 2015=61%, 2033=61%, 2069=61%, 2086=61%, 2105=61%, 2140=61%, 2175=61%, 2572=61%, 2589=61%, 2606=62%, 2623=62%, 2641=63%, 2658=57%, 2676=58%, 2694=58%, 2713=57%, 2731=58%, 2749=58%, 2770=89%, 2789=87%, 2809=87%, 2828=87%, 2884=100%
$ python visualmetrics.py --video tests/data/lemons/video.mp4 --dir frames --histogram histograms.json.gz --orange --viewport --perceptual
First Visual Change: 768
Last Visual Change: 2884
Speed Index: 1840
Perceptual Speed Index: 892
Visual Progress: 0=0%, 768=23%, 785=24%, 1510=61%, 1545=61%, 1981=61%, 2015=61%, 2033=61%, 2069=61%, 2086=61%, 2105=61%, 2140=61%, 2175=61%, 2572=61%, 2589=61%, 2606=62%, 2623=62%, 2641=63%, 2658=57%, 2676=58%, 2694=58%, 2713=57%, 2731=58%, 2749=58%, 2770=89%, 2789=87%, 2809=87%, 2828=87%, 2884=100%