且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获取MP4流的长度

更新时间:2023-01-25 17:07:51

不幸的是, DirectShow不包含MP4解析器,即使在Windows 7中。在Win7中,MP4功能已添加到媒体基金会。

Unfortunately, DirectShow does not contain an MP4 parser, even in Windows 7. In Win7, the MP4 functionality was added to media foundation.

因此,您有几个选项。您可以购买或构建一个directshow过滤器,实现MP4 demux和将其与mp4文件扩展名相关联,这样应该允许IMediaDet正确地对文件进行解复用。或者你可以使用Media Foundation,它应该能够返回这个信息。或者,您可以使用单独的库完全用于MP4文件,像MP4v2 。 (注意,如果您想直接使用DirectShow而不是MP4v2,也可以使用MP4v2实现MP4 demux过滤器)

So you have a few options. You can buy or build a directshow filter that implements an MP4 demux and associate it with the "mp4" file extension, which should allow IMediaDet to properly demux the file. Or you can use Media Foundation, which should be able to return this info. Or you could use a separate library entirely for MP4 files, like MP4v2. (note you could also implement an MP4 demux filter with MP4v2, if you want to use DirectShow instead of MP4v2 directly)