如何从硬件覆盖(而不是从我的应用程序)获取视频帧?

发布于 2024-12-16 11:30:35 字数 554 浏览 0 评论 0原文

我一直在寻找一种从当前硬件覆盖中的视频中抓取帧的方法,但我还没有找到任何可靠的东西。我找到的所有内容要么是从您正在播放的视频中抓取帧(在您的应用程序中),要么是创建一个过滤器,我找不到一个很好的例子来说明如何在我的应用程序中实际抓取帧(或者该应用程序可以是不需要在播放器中“安装”和选择的内存过滤器?)。

所以,我的问题是我该如何去做呢?我知道使用过滤器是可能的,我已经看到它完成了,我只是还没有看到它是如何完成的。有没有一个很好的例子来说明如何在过滤器中抓取帧并将它们发送到我的应用程序? 或者有没有一种方法,比如挂钩一些过程调用并以某种方式从那里获取框架?

我见过 DirectX 的挂钩来获取所有 DirectX 信息,但是,硬件覆盖层不是 DirectX,不是吗?或者我可以直接连接到 DirectX 并从那里获取前端缓冲区什么的吗?

我一直在寻找有关此问题的资源,但我一直在兜圈子,事实上有人想要将叠加层放在 DirectX 表面上并没有帮助,很多结果都与该主题有关。

如果相关的话,我更喜欢 C++ 中的解决方案(我的应用程序是 C++ 中的,目前使用“常规”方式从屏幕抓取屏幕截图,这当然会为硬件覆盖留下黑色矩形)。

I've been looking for a way to grab a frame from a video currently in the hardware overlay, and I've not found anything solid. Everything I find is either for grabbing frames from a video you are playing (in your app) or creating a filter to which I can't find a good example on how I would actually grab the frames in my app (or can the app be an in-memory filter that doesn't need to be "installed" and chosen in player?).

So, my question is how would I go about doing this? I know it's possible with a filter, I've seen it done, I just haven't seen how it's done. Is there a good example somewhere of how to grab frames in a filter and send them to my app?
Or is there a way like, hook into some procedure call and get the frame from there somehow?

I've seen hooking done for DirectX to get all the DirectX info, but, hardware overlays are not DirectX, are they? Or can I just hook into DirectX and grab the front buffer from there or something?

I've been searching for resources on this issue but I keep going around in circles and the fact that there are people who want to put the overlays on DirectX surfaces doesn't help, a lot of the results are on that topic.

If it's relevant, I would prefer a solution in C++ (the app I have is in C++ and currently uses the "regular" way of grabbing screenshots from screen, which ofcourse leaves black rectangles for the hardware overlay).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

╄→承喏 2024-12-23 11:30:35

我知道如何使用 directshow 抓取帧有两种方法。第一个是使用 SampleGrabber 过滤器,互联网上有很多示例。第二个是使用自定义视频渲染器,在这种情况下,您必须实现自己的过滤器,您可以使用平台 sdk 中的 baceclasses 项目,以便从 cbasevideorenderer 派生并实现您的渲染方法。

There are two ways I know how to grab frames using directshow. The first one is with using the SampleGrabber filter there are many examples available in internet. The second one is with using your custom videorenderer in this case you have to implement your own filter you can use baceclasses project from platform sdk in order to derive from cbasevideorenderer and implement your render method.

氛圍 2024-12-23 11:30:35

如果您首先需要应用程序的图像,并且硬件覆盖是获取快照的障碍,也许最简单的方法是制作一个简单的应用程序,通过覆盖开始视频播放(您不需要流式传输真实样本!只需暂停图就足够了)并在运行您感兴趣的应用程序之前运行您的应用程序。

通过这种方式,您可以锁定覆盖层,这通常是一种有限的资源,例如每个视频适配器一个,并且感兴趣的应用程序将无法使用它。

If you need the app's image in first place and hardware overlay is an obstacle to obtain the snapshot, perhaps the easiest would be to make a simple application which starts video playback through overlay (you don't need to stream real samples! just pausing the graph would be suffucuent) and run your application prior to running application of your interest.

This way you would lock the overlay, which is typically a limited resource, e.g. one per video adapter, and the application of interest will be unable to use it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文