Hardware video acceleration in DirectShow / WinForms

It is currently prototyping a Windows.NET application that should play high definition WMV and H264 videos. My test files are full 1080p.

The target hardware has weak Atom processors, but a high NVidia 9400 graphics card. I know the graphics are integrated, but I understand that they are good for video playback.

Testing in Windows 7, if I play my test files in WPF using the MediaElement control, my CPU usage is 0.

However, the target OS is Windows XP, and we may not have .NET 3.0. Therefore, the application must run in WinForms. For various reasons, Windows Media Player ActiveX is not an option. So, we are looking at DirectShow.

I compiled a player using DirectShow.NET by playing the video in full screen using VMR9. Using this approach, my WMV files consume somewhere between 20-30% of the CPU. I had to install muxer / demuxer mp4 to even get H264 files, and then they consumed 40-50% of the CPU.

  • I know that Windows 7 supports H264 out of the box. However, it seems this is not a DirectShow filter?
  • Why is my video accelerated using WPF, but not when using DirectShow? I understand that DirectShow supports DXvA.

TL; DR: how can I achieve hardware acceleration of video playback in WMV and H264 in WinForms?

Thanks!

+6
hardware directshow wmv
source share
3 answers

There are many commercial hardware accelerated h264 directshow filters available there. Some use DXVA, some use Cuda. None of them are free, but most of them are not expensive. Ffdshow and its related ffmpeg projects are great, but they absolutely won't make HD h264 on an Atom processor. (If someone can prove the opposite, I would like to hear from you.)

I am doing HD h264 playback on the same Ion platform that you described using DirectShow in XP. It borders on 1080p performance, but can control it if you can limit the data transfer speed and do not need to do many other CPUs or GPUs at the same time. 720p is much more convenient, especially if you can manage with 24 or 30 frames per second instead of 60.

At the top of my head, the codecs that worked best on Ion for h264 were MainConcept, CoreAVC, and Cyberlink.

I would also suggest trying VMR7 instead of VMR9 if this is an option for you. Some DXVA codecs are more reliable and have better performance with VMR7.

+4
source share

You do not have a direct answer, but the DXVA verification utility has helped me debug DXVA problems in the past. Here is the download link: http://bluesky23.hp.infoseek.co.jp/en/index.html

+2
source share

I checked some validation with the DXVA utility recommended by Jeremiah Morill.

I have a pretty good idea of ​​what is happening now.

  • I think that H264 support on Windows 7 is provided by MediaFoundation, which explains why my DirectShow application cannot use it!
  • Running WMV video using the DirectShow filter on Windows 7 provides different levels of performance depending on the rendering (VMR7 / VMR9 / EVR). VMR7 is the least intensive processor (6-7% CPU), but the worst quality, EVR (8-12% CPU) is slightly more efficient than VMR9 (12-13% CPU), but both of them look the same. However, the kicker is a MediaFoundation filter, which is obviously fully accelerated and uses 0% CPU. So I would suggest that in Windows 7 MediaElement uses MediaFoundation?

So, the bottom line is that I need to test on a Windows XP box with 9400 graphics. It seems that full hardware acceleration will not be possible (since we don’t have MediaFoundation, and therefore we don’t have DXvA2) ...

Thanks again for your help!

+2
source share

All Articles