Video Compression

VideoNerd

There is a free VQMT tool, slightly “ancient” from 2013, you can find the link to windows binaries  at http://mmspg.epfl.ch/vqmt or take my binaries .

VQMT computes such video quality metrics as PSNR, SSIM, MSSSIM (Multi-Scale SSIM), VIFP (Visual Information Fidelity), PSNRHVS (Peak Signal-to-Noise Ratio taking into account Contrast Sensitivity Function).  Notice that  PSNR is a poor measure of the perceived image and video distortion because it does not consider the human visual system aspects (spatial frequency sensitivity, luminance masking, texture masking, temporal frequency sensitivity, short-term memory effects etc).

 

Usage of VQMT:

 

vqmt        orig-yuv       rec-yuv    height      width      nframes      chroma-format   prefix-result-file          metric

where

chroma-format   1 for 420p

metric    –  PSNR, SSIM, MSSSIM, VIFP, PSNRHVS , PSNRHVSM

 

Example [ computing SSIM for first 100 frames ]:

vqmt     test_1920x1080.yuv              test.yuv        1080            1920            100          1          test       SSIM

The test result is stored at   test_ssim.csv:

frame,value

0,0.818585

1,0.811870

2,0.835329

3,0.833186

4,0.818619

5,0.797380

6,0.787106

7,0.771512

8,0.766709

9,0.798561

10,0.797234

96,0.816976

97,0.905966

98,0.907430

99,0.885043

average,0.865557

 

Note:

  • To get decoded yuv from h264 file i use ffmpeg [ decode 100 frames]:

ffmpeg -i crowd.h264 -c:v rawvideo -y -frames 100 crowd_rec.yuv

 

  • MS-SSIM metric requires both image width and height to be divisible by 16, however 1080p format images are 1920×1080 and the height 1080 is not divisible by 16.  i use ffmpeg to crop 1920×1080 to 1920×1072 (crop top-left), in the following example 200 frames are processed (-vframes 200 ):

ffmpeg -pix_fmt yuv420p -s 1920×1080 -i crowdrun1080p50fps.yuv -vframes 200 -filter:v “crop=1920:1072:0:0” -y crowndrun1920x1072.yuv

        Then you can encode the cropped yuv-sequence (the bitrate 5Mbps):

  ffmpeg -y -s 1920×1072 -i crowndrun1920x1072.yuv -c:v libx264 -x264opts aud=1 -threads 4 -b:v 5M -preset veryslow -g 50 -keyint_min 50 -sc_threshold 0 -tune ssim crowndrun1920x1072.h264

Decode crowndrun1920x1072.h264 , 100 frames

       ffmpeg -i crowndrun1920x1072.h264  -c:v rawvideo -y -frames 100 crowd1920x1072_rec.yuv

     MS-SSIM scores:

       vqmt             crowndrun1920x1072.yuv                     crowd1920x1072_rec.yuv              1072            1920                100            1        crowd       MSSSIM

 

the output csv-file is crowd_msssim.csv :

frame,value
0,0.996936
1,0.988548
2,0.989447
3,0.987934
4,0.992297
5,0.985796
6,0.984467
7,0.979413
8,0.979678
9,0.969361
10,0.965400
11,0.950417
12,0.939732
13,0.943691
14,0.931987
15,0.931162
16,0.930976

         ….

 

2 Responses

Leave a Reply

Your email address will not be published. Required fields are marked *