[FFmpeg-trac] #8328(undetermined:new): QSV gives much worse PSNR/SSIM for HEVC transcode than VA-API or MediaSDK

FFmpeg trac at avcodec.org
Tue Oct 22 18:54:23 EEST 2019

#8328: QSV gives much worse PSNR/SSIM for HEVC transcode than VA-API or MediaSDK
             Reporter:  eero-t       |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
 Summary of the bug:

 PSNR & SSIM values for transcoded HEVC files are much worse with QSV than
 when the same transcoding is done with VA-API or MediaSDK sample

 (I haven't seen any significant difference in PSNR & SSIM between QSV and
 VA-API / MediaSDK with 8-bit AVC transcode.)

 * Ubuntu 18.04
 * drm-tip kernel
 * yesterday's git build of FFmpeg, MediaSDK and media-driver

 How to reproduce:

 * Transcode 4K 10-bit HEVC file [1] to smaller bitrate with QSV:
 $ ffmpeg -hwaccel qsv -qsv_device /dev/dri/renderD128 -c:v hevc_qsv -i
 Netflix_FoodMarket_4096x2160_10bit_420_100mbs_600.h265 -c:v hevc_qsv -b:v
 20M -frames 300 output.h265

 * with VA-API:
 $ ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128
 -hwacel_output_format vaapi -i
 Netflix_FoodMarket_4096x2160_10bit_420_100mbs_600.h265 -c:v hevc_vaapi
 -b:v 20M -frames 300 output.h265
 * And with MediaSDK:
 $ sample_multi_transcode -i::h265
 Netflix_FoodMarket_4096x2160_10bit_420_100mbs_600.h265 -o::h265
 output.h265 -b 20000 -u 4 -n 300 -async 4 -hw

 * Calculate PSNR & SSIM for each of the output files with FFmpeg:
 $ ffmpeg -i Netflix_FoodMarket_4096x2160_10bit_420_100mbs_600.h265 -i
 output.h265 -lavfi 'ssim;[0:v][1:v]psnr' -frames 300 -f null -

 * QSV: PSNR = 25
 * VA-API: PSNR = 40.7
 * MediaSDK: PSNR = 40.7

 * Above QSV HEVC transcode has had bad PSNR at least since April (didn't
 try any older Media stacks), so if it's a regression, it's not a recent
 * I've downloaded few other HEVC videos from net, and see similar PSNR
 value differences with them too
 * Unlike with VA-API, changing bitrate doesn't change PSNR/SSIM for QSV
 significantly with the above given transcode

 [1] I'm using this, converted to 100Mbit/s with libx265 2-pass ABR:

 PS. FFmpeg PSNR calculation has a huge memory leak / loop with some input
 files.  When doing above metrics calculation with problematic input
 videos, somewhat after passing halfway frame, frame number output freezes
 and FFmpeg starts eating GBs of memory until kernel OOM-kills it.

Ticket URL: <https://trac.ffmpeg.org/ticket/8328>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list