1

我正在尝试编写一个能够用文本和图像覆盖视频的视频播放器。现在我正在使用 driectshow 样本采集器过滤器来捕获视频并将其呈现在我的软件上。它运行良好,但在 Atom 等功能较弱的系统上运行速度很慢。我还尝试按照其他人的建议使用 EVR Presenter。我在 Managed DirectX 9 Graphics and Game Programming 上使用了代码项目中的 EVR Presenter(纯 C# 中的 EVR Presenter 和 Direct3D 视频渲染)代码示例,Kick Start 将帧转换为纹理并将转换后的纹理保存到屏幕上,示例代码如下所示:

    lock (m_csLock)
{
    if (systemSurface == null)
        systemSurface = Surface.CreateOffscreenPlain(m_Device, _surface.Description.Width, _surface.Description.Height, _surface.Description.Format, Pool.SystemMemory);

    if (texture == null)
        texture = new Texture(m_Device, systemSurface.Description.Width, systemSurface.Description.Height, 1, Usage.Dynamic, systemSurface.Description.Format, Pool.Default);

    using (Surface texturesurface = texture.GetSurfaceLevel(0))
    {
        m_Device.GetRenderTargetData(_surface, systemSurface);
        m_Device.UpdateSurface(systemSurface, texturesurface);
    }
}

但是渲染速度仍然很慢,并且需要大量的 cpu 功率。我可以知道是否有一种方法可以更快地捕获视频或将视频帧复制到纹理?

4

0 回答 0