c#编程快速获得视频时长

想利用c#编程求出视频的时长(视频格式是MP4,但没有带视频信息),自己调用ffmpeg可以得到,但是一次获得多个时长的时候花的时间太长了,想知道大家有没有什么好的方法

http://www.cnblogs.com/futao/archive/2012/05/31/2528724.html

你是WPF 的不 是的话 用MediaElement 控件加载视频 可以获取视频长度

var ts = mediaPlayerMain.NaturalDuration.TimeSpan;
txtTotleTime.Text = string.Format("{0:00}:{1:00}:{2:00}", ts.Hours, ts.Minutes, ts.Seconds);

public static class GetVideoLength
{
public static string GetMediaTimeLen(string path)
{
try
{
Shell32.Shell shell = new Shell32.Shell();
//文件路径

Shell32.Folder folder = shell.NameSpace(path.Substring(0, path.LastIndexOf("\")));
//文件名称

Shell32.FolderItem folderitem = folder.ParseName(path.Substring(path.LastIndexOf("\") + 2));
if (Environment.OSVersion.Version.Major >= 6)
{
return folder.GetDetailsOf(folderitem, 27);
}
else
{
return folder.GetDetailsOf(folderitem, 21);
}
}
catch (Exception ex) { return null; }
}

    public static int GetMediaTimeLenSecond(string path)
    {
        try
        {
            Shell32.Shell shell = new Shell32.Shell();
            //文件路径               
            Shell32.Folder folder = shell.NameSpace(path.Substring(0, path.LastIndexOf("\\")));
            //文件名称             
            Shell32.FolderItem folderitem = folder.ParseName(path.Substring(path.LastIndexOf("\\") + 2));
            string len;
            if (Environment.OSVersion.Version.Major >= 6)
            {
                len =  folder.GetDetailsOf(folderitem, 27);
            }
            else
            {
                len = folder.GetDetailsOf(folderitem, 21);                    
            }

            string[] str = len.Split(new char[] { ':' });
            int sum = 0;
            sum = int.Parse(str[0]) * 60 * 60 + int.Parse(str[1]) * 60 + int.Parse(str[2]);

            return sum;
        }
        catch (Exception ex) { return 0; }
    }
}