User42
User42

Reputation: 83

DirectShow-IMediaDet only extracts the first frame

I experienced a weird effect concerning DirectShow and splitters. I was not able to track it, so maybe somebody can help?

In my application I extract a few frames from movies. I do this by DirectShow's IMediaDet interface. (BTW: It's XP SP3, DirectShow 9.0).

Everything works fine, as long as there is no media splitter involved (this is the case for mp4, mkv, flv, ...). Concerning codecs I use the K-Lite distribution. Since some time there are two splitters: LAV and Haali. The Gabest splitter has been removed since some time. But only with the latter activated everything worked fine!

OK - the effect:

It's about IMediaDet.GetBitmapBits: Some (most) medias that uses splitters always extract the very first frame. And with some other medias with splitters this effect is only when I used get_StreamLength before. (Although GetBitmapBits should switch back to BitmapGrab mode, as the docu says.). As said - everything works fine as far as no splitter is involved (mpg, wmv, ...).

Does someone experienced a similar effect?

Where may be the bug: In DShow, in the splitters, in my code?

Any help appreciated ... :-)

Upvotes: 1

Views: 551

Answers (1)

Roman Ryltsov
Roman Ryltsov

Reputation: 69662

Your assumption is not quite correct. IMediaDet::GetBitmapBits builds a filter graph internally, and attempts to navigate playback to position of interest. Then starts streaming to get a valid image onto its Sample Grabber filter "BitBucket".

It does not matter if splitter is a separate filter or it is combined with source. Important part is the ability of the graph to seek, a faulty filter might be an obstacle there, even though the snapshot is taken. This is the symptom you are describing.

For instance the internal graph might be like this:

enter image description here

There is a dedicated multiplexer there, and snapshot is taken from correct position.

Upvotes: 2

Related Questions