开发者

Hardware accelerated video in DirectShow / WinForms

开发者 https://www.devze.com 2022-12-18 07:24 出处:网络
Currently prototyping a Windows .NET app that needs to play back high definition WMV and H264 video. My test files are full 1080p.

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. 开发者_如何学CUsing 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!


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.


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


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消