hi I have implemented as following: UINT_PTR test = (UINT_PTR)processedJpegData; //This is the data to be written into AVI LPVOID p = reinterpret_cast<LPVOID>(test); if(!g_bCreated) { AVISTREAMINFO streamInfo; memset(&streamInfo, 0, sizeof(streamInfo)); streamInfo.fccType = streamtypeVIDEO; streamInfo.fccHandler = mmioFOURCC('M', 'J', 'P', 'G'); //streamInfo.fccHandler = mmioFOURCC('X', 'V', 'I', 'D'); streamInfo.dwScale = 1001; streamInfo.dwRate = 30000; streamInfo.dwSampleSize = 0; streamInfo.dwSuggestedBufferSize = 0 ; SetRect(&streamInfo.rcFrame, 0, 0,0,0);/* 720, 480,frameInfo.m_width, frameInfo.m_height*/ HRESULT hrCreate = AVIFileCreateStream(m_pAVIFile, &m_pVideoStream, &streamInfo); if (hrCreate!=AVIERR_OK) return ; BITMAPINFOHEADER *bi = new BITMAPINFOHEADER(); bi->biSize = sizeof(BITMAPINFOHEADER); bi->biWidth = 720; bi->biHeight = 480; bi->biPlanes = 1; bi->biBitCount = 16; bi->biCompression = mmioFOURCC('M', 'J', 'P', 'G'); // 0 = BI_RGB bi->biSizeImage = size; bi->biXPelsPerMeter= 0; bi->biYPelsPerMeter= 0; bi->biClrUsed = 0; bi->biClrImportant = 0; HRESULT hrSetformat = AVIStreamSetFormat(m_pVideoStream, 0,&bi, 40); if(hrSetformat != 0) return; g_nIndex = AVIStreamLength(m_pVideoStream); g_bCreated=true; } HRESULT hrStreamWrite = AVIStreamWrite(m_pVideoStream, g_nIndex++, 1, p,size, AVIIF_KEYFRAME, 0, 0); if (hrStreamWrite!=AVIERR_OK) return ; This executes successfully and creates the AVI file also.But the problem is in playing that AVI file.