我有一个用于生成无声视频的DirectShow应用程序,其过滤图是
my video frame generator -> selectable video compressor -> AVI mux -> file writer或者只是
my video frame generator -> AVI mux -> file writer这在很大程度上如预期的那样工作,除非所选的压缩器是DMO,在这种情况下,从源到压缩程序的pFilterGraph->Connect()调用失败--通常使用VFW_E_TYPE_NOT_ACCEPTED或VFW_E_CANNOT_CONNECT。我也想让DMO发挥作用。我找到了一个不推荐的示例(AVIEncoderDShow),可以通过WMV9 DMO对输入的AVI文件进行压缩,这在这方面似乎很有希望。它的过滤图是
pFilterGraph->AddSourceFilter(AVI file) -> AVI splitter -> DMO wrapper for WMV -> AVI mux -> file writer所以我想我可以换掉我的过滤器的源代码过滤器(或者它所基于的弹跳球DirectShow样本)。但是,尝试这样做只会导致同样的连接失败。我提供的源是32位RGB,WMV9应该接受它。它可能会绊倒什么呢?
编辑:我喜欢的媒体类型的详细信息如下:
majortype: MEDIATYPE_Video
subtype: MEDIASUBTYPE_RGB32
bFixedSizeSamples: 1
bTemporalCompression: 0
lSampleSize: 3145728
formattype: CLSID_KsDataTypeHandlerVideo
pUnk: NULL
cbFormat: 1128
pbFormat: 0x12ce4bf0VFW_E_TYPE_NOT_ACCEPTED的确切故障点是
hr = pReceivePin->ReceiveConnection((IPin *)this, pmt);
CBasePin::AttemptConnection(IPin * pReceivePin, const CMediaType * pmt) Line 1796 C++
CBasePin::AgreeMediaType(IPin * pReceivePin, const CMediaType * pmt) Line 1939 C++
CBasePin::Connect(IPin * pReceivePin, const _AMMediaType * pmt) Line 1728 C++
CFilterGraph::ConnectDirectInternal(struct IPin *,struct IPin *,struct _AMMediaType const *) Unknown
CFilterGraph::ConnectDirect(struct IPin *,struct IPin *,struct _AMMediaType const *) Unknown
ConnectFilters(IBaseFilter * pUpstream, IBaseFilter * pDownstream, IGraphBuilder * pGraph, _AMMediaType * pmt) Line 332 C++我的媒体类型的pbFormat被设置为VIDEOINFO,它似乎具有与VIDEOINFOHEADER相同的结构,但在其末尾添加了其他数据。看起来是这样的:
rcSource {LT(0, 0) RB(0, 0) [0 x 0]} tagRECT
rcTarget {LT(0, 0) RB(0, 0) [0 x 0]} tagRECT
dwBitRate 0 unsigned long
dwBitErrorRate 0 unsigned long
AvgTimePerFrame 0 __int64
bmiHeader {biSize=40 biWidth=1024 biHeight=768 ...} tagBITMAPINFOHEADER
biSize 40 unsigned long
biWidth 1024 long
biHeight 768 long
biPlanes 1 unsigned short
biBitCount 32 unsigned short
biCompression 0 unsigned long
biSizeImage 3145728 unsigned long
biXPelsPerMeter 0 long
biYPelsPerMeter 0 long
biClrUsed 0 unsigned long
biClrImportant 0 unsigned long
bmiColors 0x0d381c60 {{rgbBlue=0 '\0' rgbGreen=0 '\0' rgbRed=0 '\0' ...}, {rgbBlue=0 '\0' rgbGreen=0 '\0' rgbRed=...}, ...} tagRGBQUAD[256]
dwBitMasks 0x0d381c60 {0, 0, 0} unsigned long[3]
[0] 0 unsigned long
[1] 0 unsigned long
[2] 0 unsigned long
TrueColorInfo {dwBitMasks=0x0d381c60 {0, 0, 0} bmiColors=0x0d381c6c {{rgbBlue=0 '\0' rgbGreen=0 '\0' rgbRed=0 '\0' ...}, ...} }发布于 2015-10-23 10:12:15
有些过滤器,特别是复用器和编码器,要求您指定视频流的帧速率。否则,媒体类型将被拒绝使用泛型错误代码,而没有提到帧率是造成这种情况的原因。
WMV9编码器DMO确实在输入上接受32位RGB,所以您应该在媒体类型的VIDEOINFOHEADER结构中使用一个正的AvgTimePerFrame值来尝试它:

https://stackoverflow.com/questions/33283096
复制相似问题