x264vfw.dll和avcodec.dll等等几个都已经安装成功,用ICInfo也可以正确得到x264编码器信息。下面是我使用的代码: ZeroMemory(&m_AviStreamInfo,sizeof(AVISTREAMINFO));
m_AviStreamInfo.fccType = streamtypeVIDEO;
m_AviStreamInfo.fccHandler = 0;//m_dwFCCHandler;
m_AviStreamInfo.dwScale = 1;
m_AviStreamInfo.dwRate = m_dwFrameRate; // Frames Per Second;
m_AviStreamInfo.dwQuality = -1; // Default Quality
m_AviStreamInfo.dwSuggestedBufferSize = nMaxWidth*nMaxHeight*4;
    SetRect(&m_AviStreamInfo.rcFrame, 0, 0, nFrameWidth, nFrameHeight);
_tcscpy(m_AviStreamInfo.szName, _T("Video Stream")); if(FAILED(AVIFileCreateStream(m_pAviFile,&m_pAviStream,&m_AviStreamInfo)))
{
SetErrorMessage(_T("Unable to Create Video Stream in the Movie File"));
return E_FAIL;
}
ZeroMemory(&m_AviCompressOptions,sizeof(AVICOMPRESSOPTIONS));
m_AviCompressOptions.fccType=streamtypeVIDEO;
m_AviCompressOptions.fccHandler= mmioFOURCC('X','2','6','4');//m_dwFCCHandler;
m_AviCompressOptions.dwFlags=AVICOMPRESSF_KEYFRAMES | AVICOMPRESSF_VALID;//|AVICOMPRESSF_DATARATE;
m_AviCompressOptions.dwKeyFrameEvery=1;
m_AviCompressOptions.cbParms = 0x000001d0;
//m_AviCompressOptions.dwBytesPerSecond=1000/8;
//m_AviCompressOptions.dwQuality=100;
if(FAILED(AVIMakeCompressedStream(&m_pAviCompressedStream,m_pAviStream,&m_AviCompressOptions,NULL)))
{
// One reason this error might occur is if you are using a Codec that is not 
// available on your system. Check the mmioFOURCC() code you are using and make
// sure you have that codec installed properly on your machine.
SetErrorMessage(_T("Unable to Create Compressed Stream: Check your CODEC options"));
return E_FAIL;
} BITMAPINFO bmpInfo;
ZeroMemory(&bmpInfo,sizeof(BITMAPINFO));
bmpInfo.bmiHeader.biPlanes = 1;
bmpInfo.bmiHeader.biWidth = nFrameWidth;
bmpInfo.bmiHeader.biHeight = nFrameHeight;
bmpInfo.bmiHeader.biCompression = BI_RGB;
bmpInfo.bmiHeader.biBitCount = nBitsPerPixel;
bmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmpInfo.bmiHeader.biSizeImage = bmpInfo.bmiHeader.biWidth*bmpInfo.bmiHeader.biHeight*bmpInfo.bmiHeader.biBitCount/8;
bmpInfo.bmiHeader.biXPelsPerMeter = 15;
bmpInfo.bmiHeader.biYPelsPerMeter = 15; COMPVARS cv = {0};

cv.cbSize = sizeof(cv); HRESULT hr = AVIStreamSetFormat(m_pAviCompressedStream,0,(LPVOID)&bmpInfo, bmpInfo.bmiHeader.biSize); if(FAILED(hr))
{
// One reason this error might occur is if your bitmap does not meet the Codec requirements.
// For example, 
//   your bitmap is 32bpp while the Codec supports only 16 or 24 bpp; Or
//   your bitmap is 274 * 258 size, while the Codec supports only sizes that are powers of 2; etc...
// Possible solution to avoid this is: make your bitmap suit the codec requirements,
// or Choose a codec that is suitable for your bitmap.
SetErrorMessage(_T("Unable to Set Video Stream Format"));
return E_FAIL;
}
结果运行到 AVIStreamSetFormat 时,总是返回 0x80044068 AVIERR_INTERNAL错误,各位老大有没有知道是怎么回事的?