本文介绍了directshow“色彩空间转换器”过滤器配置问题(VMR无窗口渲染器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VMR将位图与视频流混合。我在无窗口模式下运行渲染器。

I'm using VMR to mix a bitmap with a video stream. I run the renderer in windowless mode.

由于我需要在渲染器上拥有多个流,因此我首先将渲染器添加到图形中,然后使用IFilterGraph2 ::

Since I need to have more than 1 stream on the renderer, I add the renderer to the graph first and then use IFilterGraph2::RenderEx with AM_RENDEREX_RENDERTOEXISTINGRENDERERS.

大多数情况下,一切正常,但是我有一个.avi文件可以使用RenderFile很好地渲染,但是最终在渲染时显示为黑色我的图。我在graphedit中比较了两个图形,它们是相同的:

Everything works fine most of the time, but I have one .avi file that will render fine with RenderFile, but ends up displaying all black when rendered in my graph. I compared the two graphs in graphedit, and they're the same:

capture.avi -> AVI Splitter -> Color Space Converter -> Video Renderer

图形之间的唯一区别是颜色空间渲染器的设置不同:graphedit显示图表中的以下设置有效:

The only difference between the graphs is that the Color Space Renderer is setup differently: graphedit shows that the following settings in the graph that works:

Input:
    Major Type:  Video
    Sub Type: ARGB32
    ...
XForm Out:
    Major Type: Video
    Sub Type: RGB32

在我的图形中显示为:

Input:  (same)
XForm Out:
    Major Type: Video
    Sub Type: ARGB32

所以看起来转换器基本上什么也没做。我环顾四周,无法找到Color Space Converter滤镜的任何配置界面。我还尝试了在VMR输入引脚和色彩空间转换器输出引脚上使用IPin :: QueryAccept和IFilterGraph2 :: ReconnectEx尝试不同的方法,以尝试将转换器滤镜的输出强制为RGB32,但运气不佳。希望这里的人可以指出正确的方向!

So it looks like the converter is basically doing nothing. I have looked around and was not able to find any configuration interface for the Color Space Converter filter. I've also tried different things with IPin::QueryAccept and IFilterGraph2::ReconnectEx on the VMR input pin and the Color Space Converter output pin to try and force the output of the Converter filter to RGB32, but I haven't had much luck. Hopefully somebody here can point me in the right direction!

推荐答案

据我所知,Color Space Converter滤镜没有界面,但您也不需要它。您可以通过插入仅接受RGB32的滤镜来强制Color Space Converter滤镜转换为RGB32。 RGBFilters示例中的TransNull32确实做到了这一点。您的图形将如下所示:

As far as I know the Color Space Converter filter does not have an interface, but you don't need it either. You can force the Color Space Converter filter to convert to RGB32 by inserting a filter which only accepts RGB32. The TransNull32 from the RGBFilters example does exaclty this. Your graph will look like this:

capture.avi -> AVI Splitter -> Color Space Converter -> TransNull32 -> Video Renderer

另请参见,我在其中解释了如何使用TransNull24过滤器。

See also Regarding the scope of Sample Grabber in DirectShow where I explaind how to use the TransNull24 filter.

这篇关于directshow“色彩空间转换器”过滤器配置问题(VMR无窗口渲染器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 22:52