Here is the issue I found using IMVMotionDetection filter. There is the simple filter graph consits of CaptureFilter -> MotionDetectionFilter -> VideoRenderer and is composed using standard RenderStream method.

I have the function which changes video resolution using standard IAMStreamConfig filter the following way:

void VideoCamera::SetResolution(long width, long height)

HRESULT hr = captureGraphBuilder->FindInterface(NULL, &MEDIATYPE_Video, captureFilter, IID_IAMStreamConfig, (void**) & streamConfig);

AM_MEDIA_TYPE* mediaType = NULL;
hr = streamConfig->GetFormat( &mediaType );

videoHeader = reinterpret_cast<VIDEOINFOHEADER*>(mediaType->pbFormat);

videoHeader->bmiHeader.biWidth = width; // new with
videoHeader->bmiHeader.biHeight = height; // new height
videoHeader->bmiHeader.biSizeImage = DIBSIZE(videoHeader->bmiHeader);

streamConfig->SetFormat( mediaType );


It works fine when I don't use the IMVMotionDetection filter, I mean there is no the filter in the filter graph.

When IMVMotionDetection is in the filter graph then after the method SetResolution() has been called no frames go through the filter graph (no video is displayed on the screen just black background).

I found also if SetResolution() is called before RenderStream then IMVMotionDetection works properly with corresponding video size. If SetResolution() is called after RenderStream then no image and black background only is visible in the screen.

Could you please help with this? Is there workaround how to reinitialize IMVMotionDetection filter after video resolution has been changed without to rebuild the whole graph?