Solved

get .wmv video file duration

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why, and when, to use Windows Workflow 1 32
Memory Usage 2 50
Angular JS Route 3 54
C# HTTP GET method sample code 3 41
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

896 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