在播放H264编码的视频期间,Resizer MFT无法处理输出

时间:2016-02-18 12:21:57

标签: video ms-media-foundation mft

我正在实施应该播放视频的应用程序(某种视频播放器)。我使用MediaFoundation进行视频播放,它适用于大多数视频,但未能通过某些视频。

我创建了以下MF拓扑:MF_TOPOLOGY_SOURCESTREAM_NODE - > MF_TOPOLOGY_TRANSFORM_NODE(Microsoft H264视频解码器MFT) - > MF_TOPOLOGY_TRANSFORM_NODE(Resizer MFT) - > MF_TOPOLOGY_TRANSFORM_NODE(Color Converter MFT) - > MF_TOPOLOGY_OUTPUT_NODE(SampleGrabberSink)。

当我在我的应用程序中播放某些视频时,会发生以下情况(通过mftrace工具从MF跟踪中获取):

  1. MF为Resizer MFT创建变换节点,MFTransform和MEdiaObject:

    COle32ExportDetours :: CoCreateInstance @ Created {1EA1EA14-48F4-4054-AD1A-E8AEE10AC805} Resizer DMO(C:\ Windows \ SysWOW64 \ vidreszr.dll)@ 0561F060 - 跟踪接口:IMFTransform @ 0561F060,IMediaObject @ 0561F078

  2. MF设置缩放器变换的输入类型和输出类型:

    CMFTransformDetours :: SetInputType @ 0561F060成功MT: MF_MT_MAJOR_TYPE = MEDIATYPE_Video; MF_MT_SUBTYPE = MFVideoFormat_YV12; MF_MT_FRAME_SIZE = 3092376453526(720,406); MF_MT_FRAME_RATE = 107374182401(25,1); MF_MT_PIXEL_ASPECT_RATIO = 1743756722581(406405); MF_MT_INTERLACE_MODE = 7; MF_MT_AVG_BITRATE = 639540; MF_MT_DEFAULT_STRIDE = 720; MF_MT_ALL_SAMPLES_INDEPENDENT = 1; MF_MT_FIXED_SIZE_SAMPLES = 1; MF_MT_SAMPLE_SIZE = 438480

    CMFTransformDetours :: SetOutputType @ 0561F060成功MT: MF_MT_MAJOR_TYPE = MEDIATYPE_Video; MF_MT_SUBTYPE = MFVideoFormat_YV12; MF_MT_FRAME_SIZE = 3092376453526(720,406); MF_MT_FRAME_RATE = 42949672960400000(10000000,400000); MF_MT_GEOMETRIC_APERTURE = 00 00 00 00 00 00 00 00 d0 02 00 00 96 01 00 00; MF_MT_PIXEL_ASPECT_RATIO = 1743756722581(406405); MF_MT_INTERLACE_MODE = 7; MF_MT_DEFAULT_STRIDE = 720; MF_MT_ALL_SAMPLES_INDEPENDENT = 1; MF_MT_FIXED_SIZE_SAMPLES = 1; MF_MT_SAMPLE_SIZE = 438480

  3. 用户开始播放视频。

  4. MF再次设置缩放器变换的输入类型和输出类型:

    CMFTransformDetours :: SetInputType @ 0561F060成功MT: MF_MT_MAJOR_TYPE = MEDIATYPE_Video; MF_MT_SUBTYPE = MFVideoFormat_YV12; MF_MT_FRAME_SIZE = 3092376453536(720,416); MF_MT_FRAME_RATE = 107374182401(25,1); MF_MT_GEOMETRIC_APERTURE = 00 00 00 00 00 00 00 00 d0 02 00 00 96 01 00 00; MF_MT_MINIMUM_DISPLAY_APERTURE = 00 00 00 00 00 00 00 00 d0 02 00 00 96 01 00 00; MF_MT_PAN_SCAN_APERTURE = 00 00 00 00 00 00 00 00 d0 02 00 00 96 01 00 00; MF_MT_PIXEL_ASPECT_RATIO = 1743756722581(406,405); MF_MT_VIDEO_PRIMARIES = 2; MF_MT_INTERLACE_MODE = 7; MF_MT_VIDEO_NOMINAL_RANGE = 2; MF_MT_TRANSFER_FUNCTION = 5; MF_MT_YUV_MATRIX = 1; MF_MT_AVG_BITRATE = 639540; MF_MT_DEFAULT_STRIDE = 720; MF_MT_ALL_SAMPLES_INDEPENDENT = 1; MF_MT_FIXED_SIZE_SAMPLES = 1; MF_MT_SAMPLE_SIZE = 449280; MF_MT_COMPRESSED = 0; MF_MT_AVG_BIT_ERROR_RATE = 0

    CMFTransformDetours :: SetOutputType @ 0561F060成功MT: MF_MT_MAJOR_TYPE = MEDIATYPE_Video; MF_MT_SUBTYPE = MFVideoFormat_YV12; MF_MT_FRAME_SIZE = 3092376453526(720,406); MF_MT_FRAME_RATE = 42949672960400000(10000000,400000); MF_MT_GEOMETRIC_APERTURE = 00 00 00 00 00 00 00 00 d0 02 00 00 a0 01 00 00; MF_MT_MINIMUM_DISPLAY_APERTURE = 00 00 00 00 00 00 00 00 d0 02 00 00 96 01 00 00; MF_MT_PAN_SCAN_APERTURE = 00 00 00 00 00 00 00 00 d0 02 00 00 96 01 00 00; MF_MT_PIXEL_ASPECT_RATIO = 1743756722581(406,405); MF_MT_VIDEO_PRIMARIES = 2; MF_MT_INTERLACE_MODE = 7; MF_MT_VIDEO_NOMINAL_RANGE = 2; MF_MT_TRANSFER_FUNCTION = 5; MF_MT_YUV_MATRIX = 1; MF_MT_DEFAULT_STRIDE = 720; MF_MT_ALL_SAMPLES_INDEPENDENT = 1; MF_MT_FIXED_SIZE_SAMPLES = 1; MF_MT_SAMPLE_SIZE = 438480

  5. 调整器转换器的MediaObject无法处理输出:

    CMFTransformDetours :: ProcessInput @ 0561F060流ID 0,样本@ 056F74C8,时间80ms,持续时间40ms,缓冲区1,大小449280B,{B4DD4A8C-0BEB-44C4-8B75-B02B913B04F0} = 0; MFSampleExtension_Discontinuity = 1; MFSampleExtension_CleanPoint = 1 ; MFSampleExtension_Interlaced = 0; MFSampleExtension_Token = @ 00000000 CMediaObjectDetours :: ProcessInput @ 0561F078 MediaBuffer @ 0567AFE8,标志0x00000007,时间80ms,持续时间40ms,大小449280B CMediaObjectDetours :: ProcessOutput @ 0561F078失败hr = 0x80004005 E_FAIL CMFTransformDetours :: ProcessOutput @ 0561F060失败hr = 0x80004005 E_FAIL

  6. 在第二次设置输入和输出类型后,ResizerMFT无法处理输出的原因是什么?它是关于输出类型属性的东西吗?有没有办法获得有关此失败的更多信息?

    任何答案都将不胜感激。

1 个答案:

答案 0 :(得分:1)

我不确定,因为hr = 0x80004005表示"未指定错误",这是一个非常有用的信息......

查看您的问题,在Set(输入/输出)类型中,MF_MT_INTERLACE_MODE等于7:MFVideoInterlace_MixedInterlaceOrProgressive。

当流是隔行扫描时,也许你有这个错误。

在ProcessInput中,MF_MT_INTERLACE_MODE等于0:MFVideoInterlace_Unknown。也许问题来自这里。