Codec Guide
Would you like to react to this message? Create an account in a few clicks or log in to continue.

can't make DirectShow to use dxva2n decoder (uses avcodec instead) with HEVC video

Go down

can't make DirectShow to use dxva2n decoder (uses avcodec instead) with HEVC video Empty can't make DirectShow to use dxva2n decoder (uses avcodec instead) with HEVC video

Post by eae on Sun Nov 08, 2020 6:57 am

Hi all,

I'm trying to watch a particular 180 sbs video in VR, I think it's the heaviest I've got so far. I'm adding MediaInfo for the video track at the end of the post.
I've installed K-Lite Codec Pack and MPC-HC that comes with it pretty much supports this video out of the box (I selected madVR renderer in MPC-HC Options): LavSplitter gets launched and LavVideo Properties Hardware Acceleration say:
- Hardware Decoder DXVA2 (native), Active Decoder: dxva2n, Active Hardware Accelerator: NVIDIA GeForce RTX 2070.
This configuration uses ~30% CPU and ~70% GPU video decoding capabilities and plays the video at my 3440x1440 screen just fine.

Now, when I try to play the same video through any VR video player that supports DirectShow rendering (such as DeoVR or Whirligig 4.8+), I get a different set of options in LavVideo Properties:
- Hardware Decoder DXVA2 (native), Active Decoder: avcodec, Active Hardware Accelerator: <none>.

The lack of hardware acceleration obviously makes the video almost unvieweable, immediately bringing CPU usage to 100% while GPU video decoding stays at 0.

An interesting thing to mention is that I get the same avcodec active decoder outside of VR when viewing the video in both x86 WMP but x64 WMP version plays the video in the same way MPC-HC does, via dxva2n with active 2070 RTX acceleration. So it looks like for some reason the VR players prefer... 32-bit codecs for DirectShow? I'm guessing at this point, I don't understand the codec system enough to make an educated guess.

The only things I have changed in the Codec Tweak Tool at the moment are disabling 64-bit MS codecs and selecting LAV Video as preferred directshow decoding filter for every 64-bit option in there.
Last week though when I was desperate I tried more harsh options, including things like disabling Media Foundation for all the formats, both 32-bit and 64bit & installing only 64-bit codecs from the very beginning. VR players in DirectShow mode keep falling back to avcodec for some reason. I also tried renaming the video from .mp4 to .video since I read that can lead directshow off the trail and make it use a different codec, to no avail.

Sooo TL;DR is how do I force DirectShow to use dxva2n with hw acceleration in VR?

One last thing to mention is the specifics of my hardware configuration. I've got a laptop with an external GPU, as in, plugged in via Thunderbolt. Both VR DisplayPort and the main display HDMI are plugged into the external GPU box, the USB end of the VR rig is plugged into the laptop's USB slot. I've been running SW: Squadrons lately in this configuration with no problems whatsoever so I don't believe either the configuration itself or the throughput/performance are the issue.

- Laptop is Lenovo T480, Intel Core i7-8550U
- External GPU is Aorus RTX 2070 Gaming Box
- VR rig is Oculus Rift S
- Windows 10 v2004 OS build 19041.572
- K-Lite Codec Pack 15.8.7 Mega

Thanks in advance!

MediaInfo for the video:

Code:
Video
ID                             : 1
Format                         : HEVC
Format/Info                    : High Efficiency Video Coding
Format profile                 : Main@L6.1@Main
Codec ID                       : hvc1
Codec ID/Info                  : High Efficiency Video Coding
Duration                       : 48 min 47 s
Bit rate                       : 27.7 Mb/s
Width                          : 6 144 pixels
Height                         : 3 072 pixels
Display aspect ratio           : 2.000
Frame rate mode                : Constant
Frame rate                     : 60.000 FPS
Color space                    : YUV
Chroma subsampling             : 4:2:0
Bit depth                      : 8 bits
Bits/(Pixel*Frame)             : 0.024
Stream size                    : 9.43 GiB (99%)
Language                       : English
Encoded date                   : UTC 2018-08-21 20:32:22
Tagged date                    : UTC 2018-08-21 20:32:22
Color range                    : Full
Color primaries                : BT.709
Transfer characteristics       : BT.709
Matrix coefficients            : BT.709
Codec configuration box        : hvcC

klcp_codec_log:

Code:
Codec Tweak Tool | Log file | Generated at 2020-11-08 14:12:09

#####  System Information  #####

OS:           Windows 10 Enterprise (10.00.19041) (x64)
CPU name:     Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
CPU details:  1992 MHz | 8 core(s) | Family 6 Model 142 Stepping 10
Memory:       32640 MB
Screen size:  3440x1440 (32bits) (60Hz) (114%), 1920x1080 (32bits) (60Hz) (114%)
GPU 1:        NVIDIA GeForce RTX 2070
              VendorID: 10de, DeviceID: 1f02
GPU memory:   8192 MB
GPU driver:   nvldumdx.dll (Version 27.21.14.5671) (9-30-2020) (NV 456.71)
GPU 2:        Intel(R) UHD Graphics 620
              VendorID: 8086, DeviceID: 5917, SubSys: 225e17aa
GPU memory:   1024 MB
GPU driver:   igdumdim64.dll (Version 27.20.100.8476) (7-8-2020)
Audio device: Oculus Virtual Audio Device
Audio driver: oculusvad.sys (Version 0.12.6.503) (6-17-2020)

#####  K-Lite Codec Pack  #####

KLCP version: 15.8.7
KLCP type:    mega

Speaker conf: 2.0

MPC renderer: madVR
MPC subs:     ISR
MPC audio:    Internal Audio Renderer

#####  Decoder Settings #####

LAV Video:
H264=DXVA2N HEVC=DXVA2N VP9=DXVA2N VC1=0 MPEG2=1 MPEG4=1 WMV3=0

LAV Audio:
MP3=1 AC3=1 DTS=1 DTSHD=1 EAC3=1 TRUEHD=1 AAC=1 Vorbis=1 LPCM=1 WMA=0

#####  DirectShow Filters (32-bit)  #####

(A total of 82 filters, 0 shown, 82 hidden)

#####  DirectShow Filters (64-bit)  #####

Description:  Microsoft DTV-DVD Video Decoder
File name:    c:\windows\system32\msmpeg2vdec.dll
CLSID:        {212690FB-83E5-4526-8FD7-74478B7939CD}
Merit:        005FFFFF = MERIT_NORMAL - 1
Status:       This filter has been disabled

Description:  Microsoft DTV-DVD Audio Decoder
File name:    c:\windows\system32\msmpeg2adec.dll
CLSID:        {E1F1A0B8-BEEE-490D-BA7C-066C40B5E2B9}
Merit:        005FFFFF = MERIT_NORMAL - 1
Status:       This filter has been disabled

(A total of 76 filters, 2 shown, 74 hidden)

#####  ICM Class Manager (32-bit)  #####

(A total of 3 filters, 0 shown, 3 hidden)

#####  ICM Class Manager (64-bit)  #####

(A total of 3 filters, 0 shown, 3 hidden)

#####  Default source filters (32-bit)  #####

.avs    {D3588AB0-0781-11CE-B03A-0020AF0BA770}  AVI/WAV File Source

(A total of 65 default source filters, 1 shown, 64 hidden)

#####  Default source filters (64-bit)  #####

.avs    {D3588AB0-0781-11CE-B03A-0020AF0BA770}  AVI/WAV File Source

(A total of 57 default source filters, 1 shown, 56 hidden)

#####  ACM and VFW Codecs (32-bit)  #####

(A total of 22 codecs, 0 shown, 22 hidden)

#####  ACM and VFW Codecs (64-bit)  #####

(A total of 19 codecs, 0 shown, 19 hidden)

eae

Posts : 3
Join date : 2020-11-05

Back to top Go down

can't make DirectShow to use dxva2n decoder (uses avcodec instead) with HEVC video Empty Re: can't make DirectShow to use dxva2n decoder (uses avcodec instead) with HEVC video

Post by Admin on Sun Nov 08, 2020 3:31 pm

The tricks to rename to .video and to disable Media Foundation are useful for WMP only. That is the only player that dynamically chooses between DirectShow and Media Foundation.

It is weird that DXVA2 isn't working in 32-bit WMP the same way as with 64-bit. Might be due to differences in your preferred filter settings ("Use Merit" vs "LAV"). Does the file have subtitles? VSFilter will disable use of DXVA2 native when it gets used for subtitles.

When using DXVA2 Native the video decoder (LAV) needs to be connected directly to the video renderer. And that video renderer must also support DXVA2. From the 3 standard renderers that are included with Windows, only "Enhanced Video Renderer" is compatible. However, most DirectShow applications use the old "Video Mixing Renderer 7" as that is the system default renderer (for backwards compatibility reasons).

So the first solution that you can try is to use DXVA2 Copyback instead of Native. Copyback works with all renderers. Only downside is that the video data must be copied back and forth to the GPU, which costs a bit of performance. With very high resolution video, the amount of data is very large, so some systems have performance issues. CPU and memory bandwidth can be a bottleneck.

If that doesn't work, then we can use a trick to change the renderer. But test the above first.

Is DeoVR 32-bit or 64-bit?

Admin
Admin

Posts : 5542
Join date : 2011-06-17

https://codecs.forumotion.net

Back to top Go down

can't make DirectShow to use dxva2n decoder (uses avcodec instead) with HEVC video Empty Re: can't make DirectShow to use dxva2n decoder (uses avcodec instead) with HEVC video

Post by eae on Sun Nov 08, 2020 4:40 pm

I gave it a try and unfortunately DXVA2 copy-back decoder (active decoder dxva2cb direct) performance is worse to the point that even MPC-HC itself stutters & freezes. Same story for NVIDIA CUVID.

I get interesting results with D3D11 though. Its active decoder is "d3d11 cb direct" and it actually uses RTX 2070 for rendering, and it plays the video just fine in MPC-HC, just as good as DXVA2 native does! In VR though I see GPU usage at 100%, video decode usage at ~70% and CPU at ~50%, yet playback is too slow - I guess I hit the GPU limits, although that is a bit surprising, to say the least.

I get approximately the same load values for GPU and CPU when using either DXVA2 native or D3D11 in MPC-HC, so I assume I'd have the same performance problem in VR even if managed to force directshow to use DXVA2 native in VR.

DeoVR is 64-bit, sorry I forgot to mention it earlier.

I guess the answer to my original post is "use D3D11 decoder". I'd like to try that trick to change the directshow default renderer that you've mentioned just to make sure I've covered all bases. How do I do that?

eae

Posts : 3
Join date : 2020-11-05

Back to top Go down

can't make DirectShow to use dxva2n decoder (uses avcodec instead) with HEVC video Empty Re: can't make DirectShow to use dxva2n decoder (uses avcodec instead) with HEVC video

Post by Admin on Sun Nov 08, 2020 10:00 pm

D3D11 can automatically switch to native mode when used together with madvr/mpcvr as renderer. So that is why it is smooth in MPC-HC. In DeoVR it will use copyback.

If you enable the internal decoders in MPC-HC settings, which use exact same LAV Decoders, then you can use different settings for MPC-HC compared to other players.

You can change system default renderer this way:
GraphStudioNext > Menu > Graph > Insert Filter > Enhanced Video Renderer > Set Merit > 0x00800001 (preferred + 1)

This with the assumption that DeoVR uses the default renderer. It might actually be using its own custom renderer. You will have to ask DeoVR developers for details and ask about compatibility with DXVA2 native.

Another option is to use Media Foundation for playback if DeoVR supports that. In that case you need to install the HEVC codec from the Windows 10 store. You can also find an installer for it here:
https://free-codecs.com/hevc_video_extension_download.htm

Admin
Admin

Posts : 5542
Join date : 2011-06-17

https://codecs.forumotion.net

eae likes this post

Back to top Go down

can't make DirectShow to use dxva2n decoder (uses avcodec instead) with HEVC video Empty Re: can't make DirectShow to use dxva2n decoder (uses avcodec instead) with HEVC video

Post by eae on Mon Nov 09, 2020 4:27 am

Thank you!

I first tried changing the GraphStudioNext approach (also made sure that MERIT is chosen as the preferred way in both preferred decoders and preferred splitters in the Codec Tweak Tool) but I was still getting avcodec with no hw acceleration in DeoVR and Whirligig.

I then installed the HEVC codec via a link you provided and used Whirligig player to play the video using Media Foundation path... and it works! It actually works! No stuttering or freezes, it just works!

Thank you so much for your help, this was a month-long quest for me.

eae

Posts : 3
Join date : 2020-11-05

Back to top Go down

can't make DirectShow to use dxva2n decoder (uses avcodec instead) with HEVC video Empty Re: can't make DirectShow to use dxva2n decoder (uses avcodec instead) with HEVC video

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum