No HEVC (H265) 4K hardware decoding on GTX 1050

I’ve recently started using a 4K monitor with a nvidia GTX 1050 and the proprietary blob version 390.87-10.1 (G04).

According to https://developer.nvidia.com/video-encode-decode-gpu-support-matrix the 1050 card can do hardware decoding of h265 videos up to 8K.

However, although h264 4K videos play smoothly with very little CPU utilization, h265 4K videos stutter with high CPU utilization (~50% of a quad core i5).

I’m using smplayer frontend to mpv, and video decoder is set to vdpau. All other options are the old ones (xv, opengl, etc) except for a wayland entry. None mentions HEVC/h265.

Any suggestions on how to decode h265 by hardware?

Obs: I see there’s a new (for me) G05 driver package, and the G04 I’m using actually show a downgrade to version 290.87-7.1 in yast software manager.

Obs 2: mpv version 0.27.2-13.8.1 from repo openSUSE-LEAP-42.3-Update.

mpv log:

  Playing: ~/sample-Elysium.2013.2160p.mkv

  (+) Video --vid=1 (*) 'Elysium (2013) - Release for ULTRAHDCLUB' (hevc 3840x1608 23.976fps)
  (+) Audio --aid=1 --alang=eng (*) 'DTS-HD MA 7.1 - Blu-ray CEE' (dts 8ch 48000Hz)
 File tags:
  Title: Elysium (2013)
 [ffmpeg/video] hevc: Invalid default display window
 [ffmpeg/video] hevc: Invalid default display window
 AO: [pulse] 48000Hz 7.1 8ch float
 VO: [opengl] 3840x1606 yuv420p10
 INFO_VIDEO_DSIZE=3840x1606
 MPV_VERSION=mpv 0.27.2
 INFO_VIDEO_WIDTH=3840
 INFO_VIDEO_HEIGHT=1606
 INFO_VIDEO_ASPECT=2.391034
 INFO_VIDEO_FPS=23.976025
 INFO_VIDEO_FORMAT=hevc
 INFO_VIDEO_CODEC=hevc (HEVC (High Efficiency Video Coding))
 INFO_AUDIO_FORMAT=dts
 INFO_AUDIO_CODEC=dca (DCA (DTS Coherent Acoustics))
 INFO_AUDIO_RATE=48000
 INFO_AUDIO_NCH=8
 INFO_LENGTH=62.730000
 INFO_DEMUXER=mkv
 INFO_SEEKABLE=yes
 INFO_TITLES=
 INFO_CHAPTERS=1
 INFO_TRACKS_COUNT=2
 METADATA_TITLE=Elysium (2013)
 METADATA_ARTIST=
 METADATA_ALBUM=
 METADATA_GENRE=
 METADATA_DATE=
 METADATA_TRACK=
 METADATA_COPYRIGHT=
 INFO_MEDIA_TITLE=Elysium (2013)
 INFO_STREAM_PATH=~/sample-Elysium.2013.2160p.mkv

 INFO_CHAPTER_0_NAME=00:00:00.000
 INFO_TRACK_0: video 1 'eng' 'Elysium (2013) - Release for ULTRAHDCLUB' yes
 INFO_TRACK_1: audio 1 'eng' 'DTS-HD MA 7.1 - Blu-ray CEE' yes
 Audio/Video desynchronisation detected! Possible reasons include too slow
 hardware, temporary CPU spikes, broken drivers, and broken files. Audio
 position will not match to the video (see A-V status field).


Hmm…

Installed libva-vdpau-driver from openSUSE repo, no change.

But setting smplayer preferences>performance>hardware decoding to vdpau, vaapi or cuda give smooth playback, although still with 50% CPU usage.

Curiously, setting it back to auto still gives smooth playback, when at first it was jerky.:question:

what does vdpauinfo say about your GFX
it’s not just the compression format it’s the level used in the file for example level 4.2 might be supported but your file might use level 4.3 etc or it could be a driver issue
so try running both vdpauinfo to see what your gpu can do and mediainfo to see what the file is

vdpauinfo
mediainfo /path/to/file

edit
afaik libva-vdpau-driver is the vdpau backend for VA-api if you’re on nvidia you should prefer vdpau or cude
if that’s an optimus rig you could be using the intel driver make sure you’re using nvida with optirun I don’t have an optimus so I might be wrong about that as I don’t have an optimus

Thanks, I_A!

:~> vdpauinfo
display: :0   screen: 0
API version: 1
Information string: NVIDIA VDPAU Driver Shared Library  390.87  Tue Aug 21 16:15:12 PDT 2018

Video surface:

name   width height types
-------------------------------------------
420     8192  8192  NV12 YV12 
422     8192  8192  UYVY YUYV 

Decoder capabilities:

name                        level macbs width height
----------------------------------------------------
MPEG1                           0 65536  4096  4096
MPEG2_SIMPLE                    3 65536  4096  4096
MPEG2_MAIN                      3 65536  4096  4096
H264_BASELINE                  41 65536  4096  4096
H264_MAIN                      41 65536  4096  4096
H264_HIGH                      41 65536  4096  4096
VC1_SIMPLE                      1  8190  2048  2048
VC1_MAIN                        2  8190  2048  2048
VC1_ADVANCED                    4  8190  2048  2048
MPEG4_PART2_SP                  3  8192  2048  2048
MPEG4_PART2_ASP                 5  8192  2048  2048
DIVX4_QMOBILE                   0  8192  2048  2048
DIVX4_MOBILE                    0  8192  2048  2048
DIVX4_HOME_THEATER              0  8192  2048  2048
DIVX4_HD_1080P                  0  8192  2048  2048
DIVX5_QMOBILE                   0  8192  2048  2048
DIVX5_MOBILE                    0  8192  2048  2048
DIVX5_HOME_THEATER              0  8192  2048  2048
DIVX5_HD_1080P                  0  8192  2048  2048
H264_CONSTRAINED_BASELINE      41 65536  4096  4096
H264_EXTENDED                  41 65536  4096  4096
H264_PROGRESSIVE_HIGH          41 65536  4096  4096
H264_CONSTRAINED_HIGH          41 65536  4096  4096
H264_HIGH_444_PREDICTIVE       41 65536  4096  4096
**HEVC_MAIN                      153** 262144  8192  8192                                                                
HEVC_MAIN_10                   --- not supported ---                                                                 
HEVC_MAIN_STILL                --- not supported ---                                                                 
HEVC_MAIN_12                   --- not supported ---                                                                 
HEVC_MAIN_444                  --- not supported ---                                                                 
                                                                                                                     
Output surface:

name              width height nat types
----------------------------------------------------
B8G8R8A8         32768 32768    y  Y8U8V8A8 V8U8Y8A8 A4I4 I4A4 A8I8 I8A8 
R10G10B10A2      32768 32768    y  Y8U8V8A8 V8U8Y8A8 A4I4 I4A4 A8I8 I8A8 

Bitmap surface:

name              width height
------------------------------
B8G8R8A8         32768 32768
R8G8B8A8         32768 32768
R10G10B10A2      32768 32768
B10G10R10A2      32768 32768
A8               32768 32768

Video mixer:

feature name                    sup
------------------------------------
DEINTERLACE_TEMPORAL             y
DEINTERLACE_TEMPORAL_SPATIAL     y
INVERSE_TELECINE                 y
NOISE_REDUCTION                  y
SHARPNESS                        y
LUMA_KEY                         y
HIGH QUALITY SCALING - L1        y
HIGH QUALITY SCALING - L2        -
HIGH QUALITY SCALING - L3        -
HIGH QUALITY SCALING - L4        -
HIGH QUALITY SCALING - L5        -
HIGH QUALITY SCALING - L6        -
HIGH QUALITY SCALING - L7        -
HIGH QUALITY SCALING - L8        -
HIGH QUALITY SCALING - L9        -

parameter name                  sup      min      max
-----------------------------------------------------
VIDEO_SURFACE_WIDTH              y         1     8192
VIDEO_SURFACE_HEIGHT             y         1     8192
CHROMA_TYPE                      y  
LAYERS                           y         0        4

attribute name                  sup      min      max
-----------------------------------------------------
BACKGROUND_COLOR                 y  
CSC_MATRIX                       y  
NOISE_REDUCTION_LEVEL            y      0.00     1.00
SHARPNESS_LEVEL                  y     -1.00     1.00
LUMA_KEY_MIN_LUMA                y  
LUMA_KEY_MAX_LUMA                y
:~> mediainfo sample-Elysium.2013.2160p.mkv 
General
Unique ID                                : 244804084757816204855115167798920787201 (0xB82B8D3E762DB6C2B03DD5426EB8B501)
Complete name                            : sample-Elysium.2013.2160p.mkv
Format                                   : Matroska
Format version                           : Version 4 / Version 2
File size                                : 401 MiB
Duration                                 : 1 min 2 s
Overall bit rate                         : 53.6 Mb/s
Movie name                               : Elysium (2013)
Encoded date                             : UTC 2016-01-05 22:30:41
Writing application                      : mkvmerge v8.7.0 ('All of the above') 64bit
Writing library                          : libebml v1.3.3 + libmatroska v1.4.4

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Codec ID                                 : V_MPEGH/ISO/HEVC
Duration                                 : 1 min 2 s
Bit rate                                 : 51.0 Mb/s
Width                                    : 3 840 pixels
Height                                   : 1 608 pixels
Display aspect ratio                     : 2.40:1
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Bits/(Pixel*Frame)                       : 0.345
Stream size                              : 381 MiB (95%)
Title                                    : Elysium (2013) - Release for ULTRAHDCLUB
Language                                 : English
Default                                  : Yes
Forced                                   : No

Audio
ID                                       : 2
Format                                   : DTS
Format/Info                              : Digital Theater Systems
Format profile                           : MA / Core
Mode                                     : 16
Format settings, Endianness              : Big
Codec ID                                 : A_DTS
Duration                                 : 1 min 2 s
Bit rate mode                            : Variable / Constant
Bit rate                                 : 2 707 kb/s / 1 509 kb/s
Channel(s)                               : 8 channels / 6 channels
Channel positions                        : Front: L C R, Side: L R, Back: L R, LFE / Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 93.750 FPS (512 spf)
Bit depth                                : 16 bits
Compression mode                         : Lossless / Lossy
Delay relative to video                  : 169 ms
Stream size                              : 20.2 MiB (5%)
Title                                    : DTS-HD MA 7.1 - Blu-ray CEE
Language                                 : English
Default                                  : Yes
Forced                                   : No

Menu
00:00:00.000                             : en:00:00:00.000

Its a desktop, with a discrete GFX 1050.

FWIW, I re-encoded the DTS audio to AC3 stereo, but performance is the same (50% CPU).

Another 4K HEVC video use less CPU, 25-30%:

:~> mediainfo Jurassic\ World\ Fallen\ Kingdom.2018.4K.BluRay.x265-ESub.mkv 
General
Unique ID                                : 286858051839701084585654948817296147465 (0xD7CED9E71B741C47DF33054E3603C409)
Complete name                            : Jurassic World Fallen Kingdom.2018.4K.BluRay.x265-ESub.mkv
Format                                   : Matroska
Format version                           : Version 4 / Version 2
File size                                : 6.31 GiB
Duration                                 : 2 h 8 min
Overall bit rate                         : 7 046 kb/s
Writing application                      : Lavf57.71.100
Writing library                          : Lavf57.71.100
ErrorDetectionType                       : Per level 1

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L5.1@High
Codec ID                                 : V_MPEGH/ISO/HEVC
Duration                                 : 2 h 8 min
Bit rate                                 : 6 778 kb/s
Width                                    : 3 840 pixels
Height                                   : 1 608 pixels
Display aspect ratio                     : 2.40:1
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0 (Type 2)
Bit depth                                : 10 bits
Bits/(Pixel*Frame)                       : 0.046
Stream size                              : 6.07 GiB (96%)
Writing library                          : x265 2.8+66-88ee12651e30:[Windows][GCC 6.3.0][64 bit] 10bit
Encoding settings                        : cpuid=1111039 / frame-threads=4 / numa-pools=20 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=3840x1608 / interlace=0 / total-frames=184560 / level-idc=51 / high-tier=1 / uhd-bd=0 / ref=4 / no-allow-non-conformance / repeat-headers / annexb / aud / hrd / info / hash=0 / no-temporal-layers / no-open-gop / min-keyint=1 / keyint=24 / gop-lookahead=0 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=25 / lookahead-slices=4 / scenecut=40 / radl=0 / no-intra-refresh / ctu=64 / min-cu-size=8 / rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=2 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / no-strong-intra-smoothing / max-merge=3 / limit-refs=3 / limit-modes / me=3 / subme=3 / merange=57 / temporal-mvp / weightp / no-weightb / no-analyze-src-pics / deblock=-3:-3 / no-sao / no-sao-non-deblock / rd=4 / no-early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=1.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=17.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / vbv-maxrate=160000 / vbv-bufsize=160000 / vbv-init=0.9 / crf-max=0.0 / crf-min=0.0 / ipratio=1.40 / pbratio=1.30 / aq-mode=1 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=9 / transfer=16 / colormatrix=9 / chromaloc=1 / chromaloc-top=2 / chromaloc-bottom=2 / display-window=0 / master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1) / max-cll=1000,153 / min-luma=0 / max-luma=1023 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / hdr / hdr-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=5 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-mv-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                 : SMPTE ST 2084
Matrix coefficients                      : BT.2020 non-constant
DURATION                                 : 02:08:17,773000000
Mastering display color primaries        : R: x=0.680000 y=0.320000, G: x=0.265000 y=0.690000, B: x=0.150000 y=0.060000, White point: x=0.312700 y=0.329000
Mastering display luminance              : min: 0.0001 cd/m2, max: 1000.0000 cd/m2
Maximum Content Light Level              : 1000 cd/m2
Maximum Frame-Average Light Level        : 153 cd/m2

Audio
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Duration                                 : 2 h 8 min
Bit rate mode                            : Constant
Bit rate                                 : 128 kb/s
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 spf)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Delay relative to video                  : -83 ms
Stream size                              : 117 MiB (2%)
Language                                 : English
Service kind                             : Complete Main
Default                                  : Yes
Forced                                   : No
DURATION                                 : 02:08:17,632000000

your GPU does not support Main 10 so decoding is done in software by the cpu aside from re-encoding the video to a lover 8 bit level (and loosing a lot of detail) there is nothing you can do as you can see from vdpauingo
your GPU only supports HEVC MAIN

**HEVC_MAIN                      153** 262144  8192  8192                                                                
HEVC_MAIN_10                   --- not supported ---                                                                 
HEVC_MAIN_STILL                --- not supported ---                                                                 
HEVC_MAIN_12                   --- not supported ---                                                                 
HEVC_MAIN_444                  --- not supported ---

Ah, thanks. Next GPU upgrade will have to wait, anyway.

It’s interesting to note that the sample that use more CPU (elysium) has a different profile:

Format                                   : DTS
Format/Info                              : Digital Theater Systems
Format profile                           : MA / Core