DirectShow / WinForms 中的硬件加速视频
目前正在对需要播放高清 WMV 和 H264 视频的 Windows .NET 应用程序进行原型设计。我的测试文件是完整的 1080p。
目标硬件具有较弱的 Atom 处理器,但具有强大的 NVidia 9400 显卡。我知道图形是集成的,但我的理解是它们有利于视频播放。
在 Windows 7 上进行测试,如果我使用 MediaElement 控件在 WPF 中播放测试文件,我的 CPU 使用率为 0。
但是,目标操作系统是 Windows XP,我们可能没有 .NET 3.0。因此该应用程序需要在 WinForms 中运行。由于各种原因,Windows Media Player ActiveX 不是一个选项。所以我们正在研究 DirectShow。
我使用 DirectShow.NET 组装了一个播放器,使用 VMR9 全屏播放视频。使用这种方法,我的 WMV 文件消耗了 20 - 30% 的 CPU。我必须安装 mp4 复用器/解复用器才能播放 H264 文件,然后它们消耗了 40 - 50% 的 CPU。
- 我知道 Windows 7 开箱即用地支持 H264。不过,它似乎不是 DirectShow 过滤器?
- 为什么我的视频使用 WPF 可以加速,但使用 DirectShow 时却不能?我的理解是DirectShow支持DXvA。
tldr:如何在 WinForms 中实现硬件加速 WMV 和 H264 视频播放?
谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有许多商业硬件加速的 h264 directshow 过滤器可用。有些使用 DXVA,有些使用 Cuda。它们都不是免费的,但大多数并不昂贵。 Ffdshow 和相关的 ffmpeg 项目很棒,但它们绝对不会在 Atom cpu 上执行 HD h264。 (如果有人能证明并非如此,我很乐意听取您的意见。)
我一直在您所描述的同一 Ion 平台上使用 XP 中的 DirectShow 进行高清 h264 播放。对于 1080p,它的性能处于临界点,但如果您可以限制比特率并且不需要同时执行太多其他 CPU 或 GPU 工作,则可以管理它。 720p 更舒服,尤其是如果您可以使用 24 或 30 fps 而不是 60 fps。
我突然想到,在 Ion for h264 上效果最好的编解码器是 MainConcept、CoreAVC 和 Cyberlink。
如果您可以选择的话,我还建议您尝试使用 VMR7 而不是 VMR9。一些 DXVA 编解码器在使用 VMR7 时更可靠且性能更好。
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.
我们无法为您提供直接答案,但 DXVA 检查实用程序过去曾帮助我调试 DXVA 问题。以下是下载链接:http://bluesky23.hp.infoseek.co。 jp/en/index.html
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 Morill 推荐的 DXVA 实用程序进行了一些检查。
我很清楚现在发生了什么......
所以底线是我需要在带有 9400 显卡的 Windows XP 机器上进行测试。看起来完全硬件加速是不可能的(因为我们没有 MediaFoundation,因此我们没有 DXvA2)...
再次感谢您的帮助!
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....
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!