问题
I'm trying to connect an Alax.Info IP camera source filter to a capture and a preview renderer.
I add the source filter to a graph, and render the pin. This produces a direct connection to a VMR, and it works. GraphEdit
shows the camera filter's output pin type is RGB32
.
When I connect the output of the camera source filter to a tee (either a Smart Tee
filter, or an Infinite Tee
filter), rendering the output from the tee causes an AVI Decompressor
filter to be inserted between the tee and the VMR. In the MS GraphEdit
application, I get one frame of video, nothing more. In GraphEditPlus, I just get a black render window.
I've tried connecting a Null Renderer
to the preview pin of the Smart Tee
, and to a second pin of the Infinite Tee
, this made no difference.
When the camera filter is connected to a tee, GraphEdit
reports its output pin type has been changed to YUY2, 16 bits
. I strongly suspect this is the root of the problem.
Are there logs I can look at to figure out what's going on?
Is there a way to control the camera's output pin type in these "tool" applications, and thereby the selection of downstream filters?
Should I be using a different type of tee filter that expects RGB32
video?
回答1:
The likely problem is that attempts to connect to video renderer involve re-negotiations of media type suitable for video renderer. As tee filter is unable to arrange such media type, it attempts to re-negotiate upstream connection and/or supply a conversion filter, which eventually results in pipeline which is built, as it seems, but once real video starts going through there is a mismatch in certain formats or resolutions and real video frames are dropped on the way.
The problem might be specific to this IP source filter because by design it is limited to specific decoder and it is also taking initialization without knowing actual M-JPEG feed expecting to resolve the formats while streaming.
When building filter graph interactively, make sure to review media types and check that resolutions and pixel formats make sense. When building graph programmatically, also make sure you build the pipeline sequentially knowing connection media types (in GraphStudioNext you can Ctrl+Shift+M so that each connection prompts you for a specific media type to use), and you also want to add adapter filters explicitly when necessary (tee output won't connect to video renderer, so insert Color Space Converter or similar yourself without expecting Intelligent Connect do it for you).
When pin connection properties match, video goes through, for example:
or
来源:https://stackoverflow.com/questions/43418884/c-sharp-directshow-net-tee-filter-render-fails