Solved

get .wmv video file duration

Posted on 2004-09-17
4
1,886 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
  • 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

829 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