0
votes

I wrote a MJPEG compressor DirectShow filter, it works without problems for color images. But when i try to support 8bit greyscale images i'm not able to connect my filter to the Microsoft AVI muxer filter. It will always fail in ReceiveConnection. I basically copy the BITMAPINFOHEADER of the input image and change biCompression to MJPG and reduce biSizeImage.

Does the Microsoft AVI Muxer has any requirements for it's allocator? I use the size of the output BITMAPINFOHEADER and don't care for prefix or alignment currently.

Thei BITMAPINFOHEADER looks as follows: biSize 1064 biWidth 640 biHeight -480 biPlanes 1 biBitCount 8 biCompression 1196444237 biSizeImage 184320 biXPelsPerMeter 0 biYPelsPerMeter 0 biClrUsed 0 biClrImportant 0

Changing the height to a positive value has no effect. The biSize is bigger than normal as we use the header so save additional information for the encoding. In color mode we have the same BITMAPINFOHEADER except of the biBitCount beeing 24.

1
Why don't you include the full printout of the media type and VIDEOINFOHEADER here in your question? The way you see it in debugger as late as possible before the error comes up. - Roman R.
Cause there is not much interesting to see expcept the size of the image. biSize 1064 biWidth 640 biHeight -480 biPlanes 1 biBitCount 8 biCompression 1196444237 biSizeImage 184320 biXPelsPerMeter 0 biYPelsPerMeter 0 biClrUsed 0 biClrImportant 0 - bazz-dee
The quoted VIDEOINFOHEADER does not not look valid for MJPG. - Roman R.
What looks wrong? The only change to the working color mode is the bit count - bazz-dee

1 Answers

0
votes

AVI Mux filter is rejecting media types which are ill-formed. Even though it is not the only possible cause, in this case it looks the most probable (the question really lacks detail).

To find out a valid sample media type, one should build a filter graph that renders into a valid playable MJPG AVI file, such as with the help of GraphStudioNext, and review the media type fields with care.

enter image description here

The bits of data attached to the original question suggest that at the very least biSize and biHeight need a fix.