vc++实现avi格式视频载入 用Directshow吧,GetCurrentImage就可以截图 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我可以 给你一个有关AVI的源程序 你的 QQ? DWORD fccHandler = mmioFOURCC('d','i','v','x'); int biBitCount = 24; int m_sizeimage = width * height * (biBitCount / 8); BITMAPINFOHEADER bih; bih.biSize = sizeof(BITMAPINFOHEADER); bih.biBitCount = (WORD)biBitCount; bih.biWidth = width; bih.biHeight = height; bih.biSizeImage = m_sizeimage; bih.biCompression = fccHandler; bih.biPlanes = 1; bih.biXPelsPerMeter = 0; bih.biYPelsPerMeter = 0; bih.biClrUsed = 0; bih.biClrImportant = 0; WAVEFORMATEX waveFormatEx; memset(&waveFormatEx, 0, sizeof(WAVEFORMATEX)); waveFormatEx.wFormatTag = WAVE_FORMAT_PCM; waveFormatEx.cbSize = 0; waveFormatEx.nChannels = 1; //声道 waveFormatEx.nSamplesPerSec = 16000; //采样频率 waveFormatEx.wBitsPerSample = 16; //样本大小 waveFormatEx.nBlockAlign = waveFormatEx.nChannels * (waveFormatEx.wBitsPerSample / 16); waveFormatEx.nAvgBytesPerSec = waveFormatEx.nBlockAlign * waveFormatEx.nSamplesPerSec; //每秒数据量 m_AVIRec = new CAVIRec(); if (NULL == m_AVIRec) return false; HRESULT hr; hr = AVIFileOpen(&m_aviFile, lpFilename, OF_WRITE | OF_CREATE, NULL); if (hr != 0) { DiagMsg(hr); return FALSE; } if(!CreateVideoStream(m_aviFile,fccHandler,pbih,&m_strmVideo, uRate))m_strmVideo=NULL; if (pwfx) { if(!CreateAudioStream(m_aviFile, pwfx, &m_strmAudio)) m_strmAudio=NULL; } if(!CreateTextStream (m_aviFile,&m_strmCaption, uRate))m_strmCaption=NULL; if(m_strmVideo==NULL){ if(m_strmCaption)AVIStreamRelease(m_strmCaption); if(m_strmAudio)AVIStreamRelease(m_strmAudio); AVIFileRelease(m_aviFile); return FALSE; } m_bOpened = TRUE; BOOL CreateVideoStream(PAVIFILE aviFile,FOURCC fccHandler,BITMAPINFOHEADER* pbih,PAVISTREAM * ppavi, ULONG uRate){ if(pbih==NULL)return FALSE; AVISTREAMINFO strmInfoVideo; HRESULT hr; ZeroMemory(&strmInfoVideo, sizeof(strmInfoVideo)); strmInfoVideo.fccType = streamtypeVIDEO; strmInfoVideo.fccHandler = fccHandler; strmInfoVideo.dwScale = 100; strmInfoVideo.dwRate = uRate; strmInfoVideo.dwStart = 0; strmInfoVideo.dwLength = 0; strmInfoVideo.dwInitialFrames = 0; strmInfoVideo.dwSuggestedBufferSize = 0; strmInfoVideo.dwQuality = -1; strmInfoVideo.dwSampleSize = 0; strmInfoVideo.dwEditCount = 0; strmInfoVideo.dwFormatChangeCount = 0; strmInfoVideo.dwSampleSize = 0; SetRect(&strmInfoVideo.rcFrame, 0, 0, (int)pbih->biWidth, (int)pbih->biHeight); PAVISTREAM strmVideo; hr = AVIFileCreateStream(aviFile, &strmVideo, &strmInfoVideo); if (hr != 0) { AVIFileRelease(aviFile); return FALSE; } hr = AVIStreamSetFormat(strmVideo, 0, pbih,pbih->biSize); if (hr != 0) { AVIStreamRelease(strmVideo); return FALSE; } *ppavi=strmVideo; return TRUE;} 能否也给我一个?谢谢[email protected] 你好,能否给我发一个AVI视频载入程序,411804732,谢谢了 界面重绘问题2 dll导出类中new和delete的使用问题 ShowContextMenu自定义浏览器上下文菜单返回菜单命令的疑惑 使用sscanf格式化输出一段字符串求助 如何设置列表框的高度 大哥们!!直接给一个能操纵网页里面按钮的例子吧!!(模拟单击按钮)越简单越好啊,我模拟按键快疯了 关于IO完成端口的疑问。另附其它,求见解。高分相赠 关于栈溢出 怎样使一个自定义控件按指定的位置和大小显示? 请问LoadImage()函数怎么用? 关于鲁大师,现在的360硬件大师问题,困惑已久。 我用MFC写的一段写防火墙注册表的代码,为什么debug版本可以用,而Release版本不可以用
int m_sizeimage = width * height * (biBitCount / 8); BITMAPINFOHEADER bih;
bih.biSize = sizeof(BITMAPINFOHEADER);
bih.biBitCount = (WORD)biBitCount;
bih.biWidth = width;
bih.biHeight = height;
bih.biSizeImage = m_sizeimage;
bih.biCompression = fccHandler;
bih.biPlanes = 1;
bih.biXPelsPerMeter = 0;
bih.biYPelsPerMeter = 0;
bih.biClrUsed = 0;
bih.biClrImportant = 0; WAVEFORMATEX waveFormatEx;
memset(&waveFormatEx, 0, sizeof(WAVEFORMATEX));
waveFormatEx.wFormatTag = WAVE_FORMAT_PCM;
waveFormatEx.cbSize = 0;
waveFormatEx.nChannels = 1; //声道
waveFormatEx.nSamplesPerSec = 16000; //采样频率
waveFormatEx.wBitsPerSample = 16; //样本大小
waveFormatEx.nBlockAlign = waveFormatEx.nChannels * (waveFormatEx.wBitsPerSample / 16);
waveFormatEx.nAvgBytesPerSec = waveFormatEx.nBlockAlign * waveFormatEx.nSamplesPerSec; //每秒数据量 m_AVIRec = new CAVIRec();
if (NULL == m_AVIRec) return false;
HRESULT hr;
hr = AVIFileOpen(&m_aviFile, lpFilename, OF_WRITE | OF_CREATE, NULL);
if (hr != 0) {
DiagMsg(hr);
return FALSE;
} if(!CreateVideoStream(m_aviFile,fccHandler,pbih,&m_strmVideo, uRate))m_strmVideo=NULL;
if (pwfx) {
if(!CreateAudioStream(m_aviFile, pwfx, &m_strmAudio)) m_strmAudio=NULL;
}
if(!CreateTextStream (m_aviFile,&m_strmCaption, uRate))m_strmCaption=NULL;
if(m_strmVideo==NULL){
if(m_strmCaption)AVIStreamRelease(m_strmCaption);
if(m_strmAudio)AVIStreamRelease(m_strmAudio);
AVIFileRelease(m_aviFile);
return FALSE;
} m_bOpened = TRUE;
{
if(pbih==NULL)return FALSE; AVISTREAMINFO strmInfoVideo;
HRESULT hr; ZeroMemory(&strmInfoVideo, sizeof(strmInfoVideo));
strmInfoVideo.fccType = streamtypeVIDEO;
strmInfoVideo.fccHandler = fccHandler;
strmInfoVideo.dwScale = 100;
strmInfoVideo.dwRate = uRate;
strmInfoVideo.dwStart = 0;
strmInfoVideo.dwLength = 0;
strmInfoVideo.dwInitialFrames = 0;
strmInfoVideo.dwSuggestedBufferSize = 0;
strmInfoVideo.dwQuality = -1;
strmInfoVideo.dwSampleSize = 0;
strmInfoVideo.dwEditCount = 0;
strmInfoVideo.dwFormatChangeCount = 0;
strmInfoVideo.dwSampleSize = 0;
SetRect(&strmInfoVideo.rcFrame, 0, 0, (int)pbih->biWidth, (int)pbih->biHeight); PAVISTREAM strmVideo;
hr = AVIFileCreateStream(aviFile, &strmVideo, &strmInfoVideo);
if (hr != 0) {
AVIFileRelease(aviFile);
return FALSE;
} hr = AVIStreamSetFormat(strmVideo, 0, pbih,pbih->biSize);
if (hr != 0) {
AVIStreamRelease(strmVideo);
return FALSE;
}
*ppavi=strmVideo;
return TRUE;
}
能否也给我一个?谢谢
[email protected]