使用 Media Foundation 进行 mp4-h264 视频解码
我正在测试如何使用 MS Media Foundation SDK 集成 libavcodec (http://en.wikipedia.org/wiki/Libavcodec),以便将 h264 无损格式视频解码为 YUV/RGB 原始数据
我有 2 个问题:
- < p>我在将使用 h264/AVC(常规,非无损格式)编码的 mp4 视频加载到 MFPlayer(从 MF SDK 示例在 VS2010 中编译)时遇到问题,错误代码是:错误的字节流。 当我尝试加载相同的视频作为流时,发生了同样的错误(源阅读器代码取自 http://msdn.microsoft.com/en-us/library/dd389281%28v=VS.85%29.aspx) 或作为使用转码示例的会话。 可能有人可以分享如何使用 Media Foundation 加载 mp4-h264 视频的经验。
我应该将第三方编解码器集成到基于媒体基础的解码中。 根据 MSDN,媒体基金会对第三方编解码器有一些支持,但是我没有找到使用第三方编解码器进行解码的示例。 也许有人这么做了?或者可以参考可用的示例如何做到这一点。
提前致谢, 泽夫
I'm testing how to integrate libavcodec (http://en.wikipedia.org/wiki/Libavcodec) using MS Media Foundation SDK, in order to decode h264-lossless format video to YUV/RGB raw data
I have 2 question:
I have had issues to load mp4 video encoded with h264/AVC (in regular, not lossless format) into MFPlayer (compiled in VS2010 from MF SDK examples), the error code was: bad byte stream.
The same error occurred, when I tried to load the same video as stream (source reader code taken from http://msdn.microsoft.com/en-us/library/dd389281%28v=VS.85%29.aspx) or as session using trans-codding example.
May be anyone may share experience how to use Media Foundation to load mp4-h264 video.I should to integrate third-party codec to Media Foundation based decoding.
According to MSDN, Media Foundation has some support to third-party codecs, however I didn't find example that does decoding using third-party codec.
May be someone did that ? or may reference to usable example how to do that.
Thanks in advance,
Ze'ev
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是可能的。基本上,它涉及编写 Media第三方解码器的基础变换。查看您的 SDK 安装目录。转到 Microsoft SDK -> v7.0->样品->多媒体->媒体基金会 ->解码器。它包含一个示例 MPEG1 解码器 MFT。您需要做的是适当继承
IMFTransform
接口并实现其方法。例如,媒体客户端将调用 ProcessInput() 方法来为解码器 MFT 提供媒体样本。类似地,它将调用 ProcessOutput() 来获取解码的输出。简而言之,MFT 充当第三方解码器的包装器。This is possible. Basically, it involves writing a Media Foundation Transform for the third party decoder. Look into your SDK installation directory. Go to
Microsoft SDKs -> v7.0 -> Samples -> Multimedia -> Mediafoundation -> Decoder
. It contains a sample MPEG1 decoder MFT. What you need to do is appropriately inheritIMFTransform
interface and implement its methods. For example, a media client will callProcessInput()
method to provide your decoder MFT with media samples. Similarly it will callProcessOutput()
to get the decoded output. In short, MFT acts as a wrapper for the third party decoder.