Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hardware accelerated video in DirectShow / WinForms

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!

like image 269
TheNextman Avatar asked Jan 26 '10 14:01

TheNextman


People also ask

What is hardware accelerated video?

Hardware video acceleration makes it possible for the video card to decode/encode video, thus offloading the CPU and saving power.

What is hardware accelerated window?

Hardware acceleration is the process by which application offloads computing tasks onto specialized components. It allows greater efficiency on the system than it's when using a general-purpose CPU.

What does enable GPU accelerated video encoding mean?

GPU Acceleration reduces the stress that video editing software apply on CPU and improve the speed and efficiency of these software. Enabling GPU acceleration for video rendering, playback saves you from waiting and improve the playback quality.


2 Answers

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.

like image 84
Alan Avatar answered Sep 23 '22 17:09

Alan


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

like image 26
Jeremiah Morrill Avatar answered Sep 24 '22 17:09

Jeremiah Morrill