Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get framerate from *.wmv file

319 views
Skip to first unread message

Zinetz Victor

unread,
Feb 28, 2006, 8:24:46 AM2/28/06
to
Hi all

If IMediaDet::get_FrameRate = 0 - how get framerate?

And how to get frames count? If IMediaDet::get_FrameRate <> 0 i calculate
frames count as

IMediaDet::get_StreamLength / IMediaDet::get_FrameRate - is it correct?

wbr, Victor


The March Hare [MVP]

unread,
Feb 28, 2006, 8:58:50 AM2/28/06
to
On Tue, 28 Feb 2006 15:24:46 +0200, Zinetz Victor wrote:

> If IMediaDet::get_FrameRate = 0 - how get framerate?

You can try using the WM Format SDK 9.5. There are attributes Duration and
NumberOfFrames.



> And how to get frames count? If IMediaDet::get_FrameRate <> 0 i calculate
> frames count as
>
> IMediaDet::get_StreamLength / IMediaDet::get_FrameRate - is it correct?

Wouldn't it be '*' and not '/'?


--
Please read this before replying:
1. Dshow & posting help: http://tmhare.mvps.org/help.htm
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others: follow up if you are helped or you found a solution

Zinetz Victor

unread,
Feb 28, 2006, 10:06:19 AM2/28/06
to

"The March Hare [MVP]" <ph...@ndsm.maps> wrote in message
news:fc15cqsntj3x.1ey36lu01f7m7$.dlg@40tude.net...

> On Tue, 28 Feb 2006 15:24:46 +0200, Zinetz Victor wrote:
>
>> If IMediaDet::get_FrameRate = 0 - how get framerate?
>
> You can try using the WM Format SDK 9.5. There are attributes Duration
> and
> NumberOfFrames.
>
>> And how to get frames count? If IMediaDet::get_FrameRate <> 0 i calculate
>> frames count as
>>
>> IMediaDet::get_StreamLength / IMediaDet::get_FrameRate - is it correct?
>
> Wouldn't it be '*' and not '/'?

Misprint - of course count_of_secunds * count_of_frames_per_second

Mark Essien

unread,
Mar 1, 2006, 5:00:45 AM3/1/06
to
Hello,

WMV files do not always have constant framerates, so even if you do this, it
is not actually the frames per second you are retrieving, but an average
frames per second over the entire movie.

Regards,
Mark.
---
DirectEncode MPEG Encoder
Essien Research & Development
http://www.essien.de


DVBPortal

unread,
Mar 1, 2006, 5:44:41 PM3/1/06
to
> WMV files do not always have constant framerates, so even if you do this, it
> is not actually the frames per second you are retrieving, but an average
> frames per second over the entire movie.

Could it be that you are confusing framerate with bitrate? The encoded
framerate is constant. The playback framerate however can vary, when
the PC is under heavy load (frame drops).

Thore Karlsen [DShow MVP]

unread,
Mar 1, 2006, 6:01:40 PM3/1/06
to

Frames could also be dropped on recording, so the actual frames in the
file wouldn't be spaced uniformly and the framerate would not be
constant.

--
New to newsgroups? Read: http://dev.6581.com/newsgroups.html

Mark Essien

unread,
Mar 2, 2006, 10:38:36 AM3/2/06
to
Hello,

No, I believe the WMV standard allows for variable framerate.

Alessandro Angeli [MVP::DS/MF]

unread,
Mar 2, 2006, 1:12:37 PM3/2/06
to
Mark Essien wrote:

> No, I believe the WMV standard allows for variable
> framerate.

Let's be precise: the ASF container format, of which WMV is
just a re-branding, doesn't even know what a frame rate is.

Samples just have a timestamp that says when they need to be
displayed and timestamp intervals can be different for each
sample, which has the result of producing a variable frame
rate.

Of course, most of the time the intervals are the same
throughout the file and thus the frame rate happens to stay
constant.

The frame rate value in the *optional* extension header is
only the average rate computed from the average interval and
it is both optional and unreliable. There is also no way to
know whether this average comes from a constant rate or is
an actual average of a variable rate, so the value is mostly
useless unless you scan the file to see for yourself.


--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// a dot angeli at psynet dot net


Iain

unread,
Mar 2, 2006, 1:26:35 PM3/2/06
to
On Thu, 2 Mar 2006 19:12:37 +0100, Alessandro Angeli [MVP::DS/MF] wrote:

> Mark Essien wrote:
>
>> No, I believe the WMV standard allows for variable
>> framerate.
>
> Let's be precise: the ASF container format, of which WMV is
> just a re-branding, doesn't even know what a frame rate is.
>
> Samples just have a timestamp that says when they need to be
> displayed and timestamp intervals can be different for each
> sample, which has the result of producing a variable frame
> rate.

Just for interest, the WM screen codec set to (say) 10 fps can easily have
10 seconds and more between frames - when nothing changes.


Iain
--
Iain Downs (DirectShow MVP)
Commercial Software Therapist
www.idcl.co.uk

0 new messages