Oliver Darvall

Hi All,

I'm compressing a range of bitmaps using the VCM and the ICCompress function that has been opened on the MP42 codec (Microsoft Mpeg4 V2). The compression of the bitmaps work just fine, but I am battling to set when the next keyframe should be delivered from the compression.

DWORD dwInFlags = 0, dwOutFlags = 0;

if (various check to set a key frame)


DWORD dwSuccess = ICCompress(m_hIC, dwInFlags, (LPBITMAPINFOHEADER)m_pVideoOut, m_pFrame, (LPBITMAPINFOHEADER)m_pVideoIn, pFrame, NULL, &dwOutFlags, m_lFrameCount, 0, 0, NULL, NULL);

if (dwSuccess == ERROR_SUCCESS)
if (dwOutFlags & AVIIF_KEYFRAME)
m_lFrameCount = 1;
TRACE("\nKEYFRAME %d", m_pVideoOut->bmiHeader.biSizeImage);

// etc, etc, etc

Basically only the first frame is a keyframe, and there after every 100'th frame (which seems to be the default of the codec). Whenever I set it with dwInFlags = ICCOMPRESS_KEYFRAME it seems to have no effect on the codec as the returned frame is NOT a keyframe.

Any ideas as to what may be wrong in my code, or is there another way to accomplish that

Thanks !

Re: DirectShow Development ICCompress MP42 KeyFrames

Geraint Davies

It's been a lot time, but as far as I remember, this flag is optional -- the encoder is at liberty to ignore the "request" and make its own decisions.


Re: DirectShow Development ICCompress MP42 KeyFrames

Oliver Darvall

It is SO ironic to me that one Microsoft technology (MP42 compressor) would completely ignore a flag set in another Microsoft technology that is supposed to interface to it (VFW).
Go figure !!!!