Zhiguo Yang

I need to do the following:
(1)Get each frame of the WMV file, analyze the frames and tries to find the first frame that has a human face - remember the frame index or the reference time;
(2)Use the frame index or the reference time, seek to the exact frame that a human face first appeared in the video.

So, I need to seek to a certain place in the video accurately. Whether to seek by frame or reference time, it doesn't matter.

Now I have a WMV video.
I use function IMediaSeeking:Tongue TiedetPositions to seek, but if I specify any value ranging from 105200000 to 116400000, the seeking result is the same: it goes to the 105200000 frame.

If I use the DSSeekFm sample in Windows Media Format SDK 9 to seek, it says: "The selected ASF file isn't frame seekable."

What can I do to such a WMV video Which is not seekable.

How can I fix it To make it frame-seekable, or at least accurately time-seekable.
That is, how to turn a frame-unseekable WMV video to a frame-seekable WMV video
After all, what makes the difference between a frame-seekalbe video and a frame-unseekable video

Thanks in advance. Any help appreciated!


Re: DirectShow Development WMV accurate seeking problem: to reindex a video?

Chris P.

With WMV seeking is by way of the index (seeking without an index is possible but slow). The default DirectShow ASF wrapper only seeks to keyframes and doesn't appropriately mark the frames as pre-roll.

A work around is to use a parser that is a little smarter and will mark the frames between the keyframe and the desired location as pre-roll so that they get discarded at the decoder.

Geraint's ASF Parser should fit the bill.

http://www.gdcl.co.uk/downloads.htm#WMFDemux






Re: DirectShow Development WMV accurate seeking problem: to reindex a video?

Zhiguo

Thanks a lot. I am trying WMFDemux now.

Another strange problem is: (Using default directshow graph)
For video sample.wmv, there is a keyframe at time 10.52sec, and the next keyframe is at 11.68sec. If I try to seek to time 11.64sec, it goes to the keyframe at 10.52sec. But this is not the strangest thing.
After this inaccurate seeking, if I try to get the current time using IMediaSeeking:: GetCurrentPosition, it returns 11.64. And since then, the time counts from 11.64...

It is really strange!

////////////////////

I am also trying to use Window Media Format SDK. Does any one know how to build a new(perhaps better) index structure for WMV video file To make it frame-seekable, or easier to seek using reference time.

Thanks again!





Re: DirectShow Development WMV accurate seeking problem: to reindex a video?

Chris P.

You can only effectively index key-frames, so unless you were storing uncompressed video or frame compressed video a change in the index wouldn't do you much good.

However test out the WMFDemux, it may solve all your problems.