Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DXVA2 #24

Closed
ASantos007 opened this issue Oct 27, 2016 · 10 comments
Closed

DXVA2 #24

ASantos007 opened this issue Oct 27, 2016 · 10 comments

Comments

@ASantos007
Copy link

Hi all :)

I'm a little confused how the DXVA2 works!! I just need to run the Test Application inside WPFMediaKit solution or need I do some configuration to work whit DXVA2?

I am asking because when I play a video (4k) with WPFMediaKit application it is consuming more than 80% of CPU and just consume about 20% of GPU. I want to render the video with GPU not CPU and I can do that programmatically.

Anyone can help me please??

@xmedeko
Copy link
Collaborator

xmedeko commented Nov 10, 2016

AFAIK you have to use EvrPresenter if you want to use DXVA2: compile the EvrPresenter from the source code and set the VideoRenderer property.

@ASantos007
Copy link
Author

ASantos007 commented Nov 11, 2016

Yes.. I forgot this issue, but I had already found the solution!

So, I can leave here some steps to work with WPF-MediaKit:
1- Install, for example, K-Lite Codec Pack
2- Open "Lav Video" tool and change "Hardware Decoder to use" field to DXVA2
3- Open EvrPresenter solution and compile it
4- Open WPF-MediaKit solution and replace the EvrPresenter.ddl on "Test Application" project to EvrPresenter.ddl generated in the previous step
5- In MainWindow.xaml add VideoRenderer="EnhancedVideoRenderer" in controls:MediaUriElement tag: controls:MediaUriElement x:Name="mediaUriElement" VideoRenderer="EnhancedVideoRenderer" ...controls:MediaUriElement>; .... Or you can simple change the default value in VideoRendererProperty property to VideoRendererType.EnhancedVideoRenderer
6- Compile and start the "Test Application"
7- Enjoy!!

You can use DXVA Checker to see if your graphic card support DXVA and if you are using DXVA to render the video!!

@xmedeko
Copy link
Collaborator

xmedeko commented Nov 11, 2016

What happen if the video card has no DXVA and the EvrPrenter is used? Will be video still visible? I do not have a machine with such video card to test it. Thanks.

@ASantos007
Copy link
Author

The video will work well, but it will not use the GPU to render the video!

You can test render a video with or without DXVA with the same graphic card. You just need to change the "Hardware Decoder to use" field to DXVA2 or NONE value on Lav Video Tool.

The results of my tests are:

Without DXVA

  • a 4K video used +-68.81% CPU and +-26.78% GPU.

With DXVA

  • the same 4K video used +-4% CPU and +-50% GPU

With VMR9 instead EVR:

  • the same 4k video used +-40% CPU and +-26% GPU

My purpose is only to use GPU to render the video and leave CPU free to do other things!

@xmedeko
Copy link
Collaborator

xmedeko commented Nov 11, 2016

Thanks for the info. It's pity EVR without DXVA takes more CPU than VMR9. We distribute a public app and also want to use GPU if possible. But since DXVA is disabled by default and EVR takes more CPU then VMR9 without EVR, I think we keep using VMR9.

@ASantos007
Copy link
Author

Yes, make sense!

I was searching how we can user DXVA automatically and I have 2 option:

  • When we install the K-Lite Codec pack, there is an option we can change to use DXVA for default, but if we forgot to change it on installation, we will not use DXVA.. Of course, we can change this option later, but if we have 100000 machines running a WPF application is a little bit complicated to do this!!
  • We have this project (https://github.com/Nevcairiel/LAVFilters) where we can try to change it to use DXVA and then we can create our own installer. After, when we will deploy our solution, it can install the LAV Filter Codecs automatically using DXVA.

If you have more option, please share with us :)

@xmedeko
Copy link
Collaborator

xmedeko commented Nov 12, 2016

LAV DXVA should be configurable at runtime, e.g. see
http://forum.doom9.org/archive/index.php/t-156191-p-69.html search the code lavVideoSettings. I have not tried that yet. I am still a newbie in this Window video stuff so I will have to figure out if and how it's possible to plug this code into the WPF-MediaKit. (Hint: a C# code example is at Emby.Theater.Windows ).

@ASantos007
Copy link
Author

I am also a newbie with this stuff..

I found that the WPF can use MediaElement to render videos.
So, if we are using WPF, why we need WPF-MediaKit? We can use MediaElment directly on our project. It is easier and faster to implement!

There is any reason to use WPF-MediaKit instead of MediaElement?

@jluisestrada
Copy link

jluisestrada commented Nov 13, 2016

MediaElement is very limited. With the WpfMediaKit you can control the video source at really low level.

Sent from my HAL 9000 terminal.
Excuse the typos and/or any trapped astronauts in the airlock

@xmedeko
Copy link
Collaborator

xmedeko commented Jan 18, 2017

@ASantos007 closing this issue, if you need something more, reopen it, please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants