views:

573

answers:

3

Currently prototyping a Windows .NET app that needs to play back high definition WMV and H264 video. My test files are full 1080p.

The target hardware has weak Atom processors but strong NVidia 9400 graphics. I know the graphics are integrated but my understanding is that they are good for video playback.

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

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

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

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

tldr: how can I achieve hardware accelerated WMV and H264 video playback in WinForms?

Thanks!

+1  A: 

Don't have a direct answer for you, but the DXVA checker utility has helped me debug DXVA issues in the past. Here is a download link: http://bluesky23.hp.infoseek.co.jp/en/index.html

Jeremiah Morrill
Thanks! This is an awesome tool. It lets me specify the DirectShow / MediaFoundation filter to use as well as select the video renderer to playback my files.
TheNextman
+1  A: 

I have done some checking with the DXVA utility recommended by Jeremiah Morill.

I have a pretty good idea of what's going on now....

  • I think the H264 support in Windows 7 is provided by MediaFoundation, which explains why my DirectShow app can't use it!
  • Running a WMV video using the DirectShow filter in Windows 7 provides different levels of performance depending on the renderer (VMR7 / VMR9 / EVR). The VMR7 is the least processor intensive (6 - 7% CPU) but worst quality, the EVR (8 - 12% CPU) is a little more efficient than the VMR9 (12 - 13% CPU) however they both look similar. However, the kicker is the MediaFoundation filter - which is obviously full accelerated and uses 0% CPU. Therefore I would guess that on Windows 7, the MediaElement uses MediaFoundation?

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

Thanks again for the help!

TheNextman
Sounds about right! On Vista and 7, Windows Media Player will pick either the MediaFoundation path or DirectShow path based on the file-type. The WPF MediaElement uses the Windows Media Player OCX internally, so WMP and MediaElement should have similar performance characteristics.
Jeremiah Morrill
Is that 0% measurement coming from the standard task manager, or from Process Explorer? I suspect that task manager may simply not be reporting cpu time spent in system code.
Alan
Thanks guys! And yes - the measurement is coming from TM. I appreciate it may not be strictly accurate, but it just served as a kind of 'yardstick' to compare the different pipelines...
TheNextman
+2  A: 

There are many commercial hardware accelerated h264 directshow filters available out there. Some use DXVA, some use Cuda. None of them are free, but most of them aren't expensive. Ffdshow and the related ffmpeg projects are great, but they will absolutely not do HD h264 on an Atom cpu. (If anyone can prove otherwise, I'd love to hear from you.)

I've been doing HD h264 playback on the same Ion platform that you described, using DirectShow in XP. It's borderline in performance for 1080p, but can manage it if you can limit the bitrate and don't need to do much other CPU or GPU work at the same time. 720p is a lot more comfortable, especially if you can get by with 24 or 30 fps instead of 60.

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

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

Alan
It's great to hear you've had success with DShow on the Ion platform, even if you do need a commercial decoder!I'm going to set up my test hardware with XP and try some of your recommendations. Thanks!
TheNextman