简体   繁体   中英

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_SourceWidth 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 - eg 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM