获取视频文件的本机视频分辨率 [英] Get native video resolution of a video file

查看:349
本文介绍了获取视频文件的本机视频分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为Media Foundation播放器编写一些自定义EVR.

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.

我尝试使用IBasicFilter2接口使用getVideoSize,get_VideoHeight或其他get_SourceWidth等...,但是它总是返回我一个E_NOINTERFACE ...

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...

那么有人可以通过简单的方法来获取视频文件的分辨率吗?即使它有一个不错的光源库...大小也没有其他... Windows设法在文件浏览器中找到它,但是我完全无法从代码中获取它...

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...

谢谢!

推荐答案

您可以在DirectShow中使用IMediaDet获取有关媒体文件中流的信息,包括视频流的分辨率.

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.

您需要注册适当的DirectShow过滤器,以了解正在检查的媒体文件.您可能安装了过滤器,但结果不正确-例如仅音频过滤器已注册为忽略文件中任何视频流的媒体类型.

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.

它已被弃用,MSDN参考页上没有任何替代该功能的指示.由于标头已从Windows SDK中删除,因此构建起来也很麻烦.

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.

在一种情况下,该方法不起作用... 获取MP4流长度

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

这篇关于获取视频文件的本机视频分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆