views:

375

answers:

1

Any library in C# that allows me to do that?

+1  A: 

google result for http://johndyer.name/post/2005/07/22/Retreiving-the-duration-of-a-WMV-in-C.aspx

using WMPLib; // this file is called Interop.WMPLib.dll

WindowsMediaPlayerClass wmp = new WindowsMediaPlayerClass();
IWMPMedia mediaInfo = wmp.newMedia("myfile.wmv"); 

// write duration
Console.WriteLine("Duration = " + mediaInfo.duration);

// write named attributes
for (int i=0; i<mediaInfo.attributeCount; i++)
{
Console.WriteLine(mediaInfo.getAttributeName(i) + " = " +  mediaInfo.getItemInfo(mediaInfo.getAttributeName(i)) );
}
runrunraygun
Where do I find Interop.WMPLib.dll? Can I use the above for files other than wmv? I was just quoting an eg, i need more files of different format.
yeeen
I'd assume you could use this for any file format your installed version of windows media player will open, but you'd have to test it. I doubt you'll find a library which will handle EVERY format.Look at the bottom of this link for instruction on how to wrap wmp.dll if it's not on your system...http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework.windowsforms/topic62074.aspx
runrunraygun