SKrV

How do I get the duration of mpeg1(audio/video), mpeg2(audio/video), mp4/m4v and their other metadata



Re: Media Foundation Development Duration of mpeg1(audio/video), mpeg2(audio/video), mp4 m4v

Matthew Howard - MSFT

Since you're asking this in the Media Foundation forum, the way to get the duration of a clip in MF is to query for the MF_PD_DURATION attribute from the IMFPresentationDescriptor interface that you get from the media source. In order to get access to metadata, you would query the media source for IMFGetService interface, then query for the MF_METADATA_PROVIDER_SERVICE which will give you an IMFMetadataProvider interface.

However, since Media Foundation does not ship with mpeg1, mpeg2, mp4, or m4v media sources in box, you're probably asking this in the context of a DirectShow environment. You may want to post your question to the DirectShow forum:

http://forums.microsoft.com/MSDN/ShowForum.aspx ForumID=129&SiteID=1