问问xvid编码器的用法?

ralphchen 2006-01-17 10:01:46
编译得到xvidvfw.dll,安装也成功了。但是不会用。请高人指点!
...全文
389 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
lserlohn 2006-04-28
就是写一个播放器,构建一个Graph,中间加入这个Filter,很基础,SDK中有很多源码
回复
张友邦 2006-04-28
答非所问,只想赚分。有病!
回复
yyhzpk 2006-01-22
这是利用xvid解码库解视频画面存为bmp图片的代码

xvid_dec_stats_t stats;
int length;

// m_create.width = 720;
// m_create.height = 480;


memset(&stats, 0, sizeof(stats));
stats.version = XVID_VERSION;

if (m_create.handle == NULL)
{
if (xvid_decore_func == NULL)
AfxMessageBox("FAil");

if (xvid_decore_func(0, XVID_DEC_CREATE, &m_create, 0) < 0)
{
AfxMessageBox("FAil");
}
}
AM_MEDIA_TYPE mtOut;
// mtOut.majortype = MEDIATYPE_Stream;
mtOut.subtype = /*MEDIASUBTYPE_RGB32;//*/MEDIASUBTYPE_RGB24;
mtOut.formattype = FORMAT_VideoInfo;

VIDEOINFOHEADER format;
format.bmiHeader.biHeight = 288;
format.bmiHeader.biWidth = 352;
format.bmiHeader.biBitCount = 24;
mtOut.pbFormat = (BYTE*)&format;
ChangeColorspace(mtOut.subtype, mtOut.formattype, mtOut.pbFormat);
// ChangeColorspace(MEDIASUBTYPE_RGB24,FORMAT_VideoInfo,);


BYTE *pbuffer = new BYTE[20*1024*1024];
BYTE *pbufferout = new BYTE[20*1024*1024];
memset(pbuffer,0,20*1024*1024);
memset(pbufferout,0,20*1024*1024);
CFile bmpFile("D:\\1.dbt",CFile::modeReadWrite);
bmpFile.Read(pbuffer,2*1024*1024);
bmpFile.Close();
m_frame.length = 2*1024*1024;
m_frame.bitstream = pbuffer;
m_frame.output.plane[0] = pbufferout;


m_frame.general = XVID_LOWDELAY;

m_frame.general |= XVID_DISCONTINUITY;

m_frame.brightness = g_config.nBrightness;

m_frame.output.csp &= ~XVID_CSP_VFLIP;
m_frame.output.csp |= rgb_flip^(g_config.nFlipVideo ? XVID_CSP_VFLIP : 0);

//////////////////////////////////////////////////////////////////////////
repeat :

// memset(pbuffer,0,20*1024*1024);
// memset(pbufferout,0,20*1024*1024);

length = xvid_decore_func(m_create.handle, XVID_DEC_DECODE, &m_frame, &stats);

// if (length < 0)
// {
// return ;
// }
// else if (g_config.aspect_ratio == 0 || g_config.aspect_ratio == 1 && forced_ar == false)
// {
// }
if(stats.type == XVID_TYPE_BVOP)
AfxMessageBox("BBB");

if(stats.type == XVID_TYPE_IVOP || stats.type == XVID_TYPE_BVOP || stats.type == XVID_TYPE_PVOP)
{
BITMAPFILEHEADER hdr;
BITMAPINFOHEADER bi;
memset(&hdr,0,sizeof(BITMAPFILEHEADER));
memset(&bi,0,sizeof(BITMAPINFOHEADER));
bi.biPlanes = 1;
bi.biCompression = BI_RGB;
bi.biBitCount = 24;
bi.biHeight = 288;
bi.biWidth = 352;
bi.biSize = sizeof(BITMAPINFOHEADER);
bi.biSizeImage = 0;

hdr.bfType = ((WORD)('M'<<8)|'B');
hdr.bfSize = 3*352*288 + sizeof(hdr)+sizeof(bi);
hdr.bfReserved1 = 0;
hdr.bfReserved2 = 0;
CFile outFile("D:\\out.bmp",CFile::modeCreate|CFile::modeReadWrite);
outFile.Write(&hdr,sizeof(BITMAPFILEHEADER));
outFile.Write(&bi,sizeof(BITMAPINFOHEADER));
outFile.Write(pbufferout,3*352*288);
outFile.Close();
}
delete[] pbuffer;
delete []pbufferout;
回复
发帖
多媒体/流媒体开发
创建于2007-08-27

2442

社区成员

专题开发/技术/项目 多媒体/流媒体开发
申请成为版主
帖子事件
创建了帖子
2006-01-17 10:01
社区公告
暂无公告