开发者

Get native video resolution of a video file

I'm currently writing some custom EVR for a Media Foundation player.

So far everything work, but i'm in need of finding the native resolution of the video file i'm rendering.

I try to use the IBasicFilter2 Interface to use the getVideoSize, get_VideoHeight or other get_SourceWidt开发者_运维知识库h etc... but it always return me a E_NOINTERFACE...

So do someone have an esay way of getting resolution of a video file? Even if it's with a nice light library...just the size nothing else...Windows manage to find it inside the file browser, but i'm totally unable to get it from code...

Thanks!


You can use IMediaDet in DirectShow to get information on the streams in a media file including the resolution of video streams.

There are come caveats though so you might want a backup method.

You need suitable DirectShow filters registered which understand the media file being examined. It's possible that you may have a filter installed that gives wrong results - e.g. an audio only filter is registered for a media type that ignores any video streams in the file.

It's currently deprecated with no indication on the MSDN reference page of what is replacing this functionality. It can also be a pain to build as the headers have been removed from the Windows SDK.

Here's one case in point where that method doesn't work... Get MP4 stream lengths

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜