directshow 加载视频前的那段黑场有没有办法屏蔽 如题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 贴图弄个GIF 就像网站视频缓冲的那个一样。。 我不清楚你怎么弄的我以前用的ffmpeg来做的,directshow我觉得开发过程应该都差不多我以前做法是,来了视频数据,先找关键帧,只有收到关键帧,才开始把帧放入解码器进行解码。不过没收到,就保持视频窗口原状。你黑屏的产生是不是,不管第一个视频帧是那种类型的帧,都往解码器丢,所产生的啊。 directshow,怎么判断是不是关键帧呢? 不是考directshow来判断,这个判断由你自己写我以h264为例子,下面是找关键帧的函数,我们工程定义,关键帧,帧头以 00 00 00 01 67开头:/*the return value is the head offset*/int Ch264decode::findheader(unsigned char* databuf, int len){ int offset = 0; for(; offset< len -4; offset++,databuf++) { if(databuf[0] == 0x00 && databuf[1] == 0x00 && databuf[2] == 0x00 && databuf[3] == 0x01 && databuf[4] == 0x67) { m_frametype = H264_STP_A; m_isIframe = TRUE; return offset; } } m_frametype = H264_NONE; if(FALSE == m_isIframe) return len; return 0;} 你下的东西是 h264编码 还是mpeg4编码 或者是其他什么,你总知道撒知道了,就自己查RFC一般头字段都会有说明,然后你就可以接了如果下的是其他公司私有格式,那抱歉,你是接不出来的 我只看过h264和mpeg4,你自己查查你的视频格式啊。 我的就是mpeg4啊,你能留个邮箱不?或者QQ int findheader_h264(char* databuf, int len){ int offset = 0; int frametype; for(; offset< len -4; offset++,databuf++) { if(databuf[0] == 0x00 && databuf[1] == 0x00 && databuf[2] == 0x00 && databuf[3] == 0x01 && databuf[4] == 0x65) { frametype = H264_I; return frametype; } else if(databuf[0] == 0x00 && databuf[1] == 0x00 && databuf[2] == 0x00 && databuf[3] == 0x01 && databuf[4] == 0x67) { frametype = H264_STP_A; return frametype; } } frametype = H264_NONE; return frametype;}int findvol_mpeg4(char* databuf,int len){ int offset = 0; int frametype; for(; offset< len -4; offset++,databuf++) { if(databuf[0] == 0x00 && databuf[1] == 0x00 && databuf[2] == 0x01 && databuf[3] == 0x00) { frametype = MPEG_IFRAME; return frametype; } else if( (databuf[0] == 0x00 && databuf[1] == 0x00 && databuf[2] == 0x01 && databuf[3] == 0xb0) || (databuf[0] == 0x00 && databuf[1] == 0x00 && databuf[2] == 0x01 && databuf[3] == 0xb6) ) { frametype = MPEG_PFRAME; return frametype; } } frametype = MPEG_NONE; return frametype;} 参数databuf是什么,是一个Sample吗? MFC如何实现均匀排列已选元件 如何打开网页,并且自动进行一些操作? 请问在MFC中如何打开电脑中的图片并将该图片作为某个控件的背景图片 字符数组转CString类对象 使用MFC创建的Activex控件,使用控件测试容器看怎么只有一个椭圆?(半天结贴!) 请问CRecordset类用open打开数据库得到数据集时 菜鸟级问题! 为什么不能关闭通过webbrowser控件打开的doc文档? 关于消息循环控制 !!!!!!考过高级程序员的请进!!!!!!! 获得音频设备名不全怎么办 哥也.我想问一个关于单文档.多视图的问题.为啥要换一下GWL_ID?
我以前用的ffmpeg来做的,directshow我觉得开发过程应该都差不多
我以前做法是,来了视频数据,先找关键帧,只有收到关键帧,才开始把帧放入解码器进行解码。不过没收到,就保持视频窗口原状。
你黑屏的产生是不是,不管第一个视频帧是那种类型的帧,都往解码器丢,所产生的啊。
我以h264为例子,下面是找关键帧的函数,我们工程定义,关键帧,帧头以 00 00 00 01 67开头:
/*the return value is the head offset*/
int Ch264decode::findheader(unsigned char* databuf, int len)
{
int offset = 0;
for(; offset< len -4; offset++,databuf++)
{
if(databuf[0] == 0x00 && databuf[1] == 0x00 && databuf[2] == 0x00 && databuf[3] == 0x01 && databuf[4] == 0x67)
{
m_frametype = H264_STP_A;
m_isIframe = TRUE;
return offset;
}
}
m_frametype = H264_NONE;
if(FALSE == m_isIframe)
return len;
return 0;
}
知道了,就自己查RFC一般头字段都会有说明,然后你就可以接了
如果下的是其他公司私有格式,那抱歉,你是接不出来的
你能留个邮箱不?
或者QQ
{
int offset = 0;
int frametype;
for(; offset< len -4; offset++,databuf++)
{
if(databuf[0] == 0x00 && databuf[1] == 0x00 && databuf[2] == 0x00 && databuf[3] == 0x01 && databuf[4] == 0x65)
{
frametype = H264_I;
return frametype;
}
else if(databuf[0] == 0x00 && databuf[1] == 0x00 && databuf[2] == 0x00 && databuf[3] == 0x01 && databuf[4] == 0x67)
{
frametype = H264_STP_A;
return frametype;
}
}
frametype = H264_NONE;
return frametype;
}int findvol_mpeg4(char* databuf,int len)
{
int offset = 0;
int frametype;
for(; offset< len -4; offset++,databuf++)
{
if(databuf[0] == 0x00 && databuf[1] == 0x00 && databuf[2] == 0x01 && databuf[3] == 0x00)
{
frametype = MPEG_IFRAME;
return frametype;
}
else if( (databuf[0] == 0x00 && databuf[1] == 0x00 && databuf[2] == 0x01 && databuf[3] == 0xb0)
|| (databuf[0] == 0x00 && databuf[1] == 0x00 && databuf[2] == 0x01 && databuf[3] == 0xb6) )
{
frametype = MPEG_PFRAME;
return frametype;
}
}
frametype = MPEG_NONE;
return frametype;
}