当前位置: 代码迷 >> 多媒体/流媒体开发 >> wince上的AVI Mux Filter
  详细解决方案

wince上的AVI Mux Filter

热度:4403   发布时间:2013-02-26 00:00:00.0
wince下的AVI Mux Filter
请问哪里有wince下的AVI Mux Filter??之前用wm asf writer filter 做过视频捕获压缩生成wmv格式文件,现在压缩算法换成H246,但wince下没有AVI Mux Filter,不能生成avi格式文件,各位大侠,请提供帮助,谢谢!

------解决方案--------------------------------------------------------
兄弟啊,跟你一样的需求,也不会,哪个高人指点一下
------解决方案--------------------------------------------------------
自己写吧,呵呵,参考avi文件格式,调试mpc的avi splitter来知道各个段的写法
这是我写头的代码,呵呵,草稿,将就看吧
int curPos = 0;
if(m_Avifp)
{
fclose(m_Avifp);
m_Avifp = NULL;
}
m_Avifp = fopen(fileName, "wb");
if(m_Avifp == NULL)
{
return E_FAIL;
}
fwrite("RIFF", 4, 1, m_Avifp);
DWORD totalsize = 0;
fwrite(&totalsize, 4, 1, m_Avifp);
m_RiffLenPos = ftell(m_Avifp);

fwrite("AVI ", 4, 1, m_Avifp);

fwrite("LIST", 4, 1, m_Avifp);
totalsize = 0;
fwrite(&totalsize, 4, 1, m_Avifp);
DWORD LIST1Pos = ftell(m_Avifp);
fwrite("hdrl", 4, 1, m_Avifp);
AVIMAINHEADER mainHeader;
memset(&mainHeader, 0, sizeof(AVIMAINHEADER));
mainHeader.fcc = MAKEFOURCC('a', 'v', 'i', 'h');
mainHeader.cb = sizeof(AVIMAINHEADER) - 8;
mainHeader.dwMicroSecPerFrame = 1E6 / mEncodeX264Fps;
mainHeader.dwFlags = 0x00000810;
mainHeader.dwStreams = 2;
mainHeader.dwWidth = mEncodeX264Width;
mainHeader.dwHeight = mEncodeX264Height;
fwrite(&mainHeader, sizeof(AVIMAINHEADER), 1, m_Avifp);

// 下面写视频LIST
fwrite("LIST", 4, 1, m_Avifp);
totalsize = 0;
fwrite(&totalsize, 4, 1, m_Avifp);
DWORD LIST2Pos = ftell(m_Avifp);
fwrite("strl", 4, 1, m_Avifp);
AVISTREAMHEADER videoStreamHeader;
memset(&videoStreamHeader, 0, sizeof(AVISTREAMHEADER));
videoStreamHeader.fcc = MAKEFOURCC('s', 't', 'r', 'h');
videoStreamHeader.cb = sizeof(AVISTREAMHEADER) - 8;
videoStreamHeader.fccType = streamtypeVIDEO;
videoStreamHeader.fccHandler = MP4MEDIA_TYPE_AVC1;
videoStreamHeader.dwFlags = 0;
videoStreamHeader.wPriority = 0;
videoStreamHeader.wLanguage = 0;
videoStreamHeader.dwScale = 1;
videoStreamHeader.dwRate = mEncodeX264Fps; //上传的视频是每秒18帧。
videoStreamHeader.dwStart = 0;
m_AviVideoStrHdr.dwLength = 0;
videoStreamHeader.dwSuggestedBufferSize = mEncodeX264Width*mEncodeX264Height*3;
videoStreamHeader.dwQuality = 0;
videoStreamHeader.dwSampleSize = 0;
videoStreamHeader.rcFrame.left = 0;
videoStreamHeader.rcFrame.top = 0;
videoStreamHeader.rcFrame.right = mEncodeX264Width;
videoStreamHeader.rcFrame.bottom = mEncodeX264Height;
//videoStreamHeader.dwCaps = 0;
//videoStreamHeader.dwInitialFrames = 0;
//videoStreamHeader.dwEditCount = 0;
//videoStreamHeader.dwFormatChangeCount = 0;
//strcpy((char *)videoStreamHeader.szName, "avc1");
fwrite(&videoStreamHeader, sizeof(AVISTREAMHEADER), 1, m_Avifp);

fwrite("strf", 4, 1, m_Avifp);
totalsize = sizeof(BITMAPINFOHEADER);
fwrite(&totalsize, 4, 1, m_Avifp);
BITMAPINFO videoBitMapInfo;
memset(&videoBitMapInfo, 0, sizeof(BITMAPINFO));
videoBitMapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
videoBitMapInfo.bmiHeader.biWidth = mEncodeX264Width;
videoBitMapInfo.bmiHeader.biHeight = mEncodeX264Height;
videoBitMapInfo.bmiHeader.biBitCount = 24;//image1.GetBPP();
videoBitMapInfo.bmiHeader.biCompression = MP4MEDIA_TYPE_AVC1;//0x34363248;//BI_RGB;
videoBitMapInfo.bmiHeader.biSizeImage = 0;
videoBitMapInfo.bmiHeader.biClrImportant = 0;
videoBitMapInfo.bmiHeader.biClrUsed = 0;
videoBitMapInfo.bmiHeader.biXPelsPerMeter = 0;
videoBitMapInfo.bmiHeader.biYPelsPerMeter = 0;
videoBitMapInfo.bmiHeader.biPlanes = 1;
fwrite(&videoBitMapInfo, sizeof(BITMAPINFOHEADER), 1, m_Avifp);
  相关解决方案