Solved

get .wmv video file duration

Posted on 2004-09-17
4
1,878 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now