Solved

get .wmv video file duration

Posted on 2004-09-17
4
1,888 Views
Last Modified: 2009-07-29
Hi,

Can anyone show me how to get .wmv video files duration (length of the movie) programmatically?
Windows Explorer can display duration of video/audio file, so I think there should be Win32 api dll that do the job.  It's even better if you can suggest how to do that using .Net class library without using Win32 api.  

Is it even possible to read the duration info using javascript? And if anyone already knew a solution. Please let me know too. Thanks.
0
Comment
Question by:mediaproxy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 8

Accepted Solution

by:
Razzie_ earned 500 total points
ID: 12082529
I'm quite sure you'll need the Media Format SDK for it:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmform95/htm/introducingwindowsmediaformat.asp

The MSDN has an example to read ASF files http://msdn.microsoft.com/library/en-us/wmform95/htm/readingasffiles.asp so WMV might not be too different.

Doubt there is an easier way to accomplish this.

hth,

Razzie

0
 
LVL 18

Expert Comment

by:armoghan
ID: 12091055
This may help
http://www.dotnet247.com/247reference/msgs/45/228037.aspx


>>Is it even possible to read the duration info using javascript?
I dont think so it could be done with javascript
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12366816
I found another solution, would like to share here
if you are using Window Media Player SDK

IWMPMedia media = axPlayer.newMedia(mediaFilePath);
endTime = (int)Math.Floor(media.duration);

these lines can help find the duration of of any media being played in media player
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need a simple RegEx to search for two words 27 88
Dictionary and array of [N] size - performance tuned 12 42
C# XML Get Values 4 37
Problem to copy file 14 54
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question