社区
多媒体/流媒体开发
帖子详情
关于视频媒体格式
King_Dragon
2004-04-13 09:13:10
1、连接时怎样识别视频设备的媒体格式?
2、怎样设置媒体格式为YUY2或其它YUV媒体类型?(需要显示)
3、怎样抓取YUY2类型的图片?
...全文
139
7
打赏
收藏
关于视频媒体格式
1、连接时怎样识别视频设备的媒体格式? 2、怎样设置媒体格式为YUY2或其它YUV媒体类型?(需要显示) 3、怎样抓取YUY2类型的图片?
复制链接
扫一扫
分享
举报
写回复
配置赞助广告
用AI写文章
7 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
happydeer
2004-04-22
打赏
举报
回复
可以直接保存yuy2到bmp文件,我试过。
注意,mBasicVideo为从Filter Graph Manager上获得的IBasicVideo接口。
BOOL CDXGraph::GetCurrentImage(const char * inFile)
{
if (!mBasicVideo)
{
return FALSE;
}
long bitmapSize = 0;
if (SUCCEEDED(mBasicVideo->GetCurrentImage(&bitmapSize, 0)))
{
BOOL pass = FALSE;
BYTE * buffer = new BYTE[bitmapSize];
if (SUCCEEDED(mBasicVideo->GetCurrentImage(&bitmapSize, (long *)buffer)))
{
BITMAPFILEHEADER hdr;
LPBITMAPINFOHEADER lpbi;
lpbi = (LPBITMAPINFOHEADER)buffer;
int nColors = 1 << lpbi->biBitCount;
if (nColors > 256)
nColors = 0;
hdr.bfType = ((WORD) ('M' << 8) | 'B'); // always is "BM"
hdr.bfSize = bitmapSize + sizeof( hdr );
hdr.bfReserved1 = 0;
hdr.bfReserved2 = 0;
hdr.bfOffBits = (DWORD) (sizeof(BITMAPFILEHEADER) + lpbi->biSize +
nColors * sizeof(RGBQUAD));
CFile bmpFile(inFile, CFile::modeReadWrite | CFile::modeCreate | CFile::typeBinary);
bmpFile.Write(&hdr, sizeof(BITMAPFILEHEADER));
bmpFile.Write(buffer, bitmapSize);
bmpFile.Close();
pass = TRUE;
}
delete [] buffer;
return pass;
}
return TRUE;
}
King_Dragon
2004-04-17
打赏
举报
回复
对于问题三,能不能给个示例代码,YUY2能直接保存为BMP文件吗?
happydeer
2004-04-16
打赏
举报
回复
1. 通过Capture Pin上的IAMStreamConfig接口可以枚举得到该Pin上支持的所有媒体类型。参考AMCap例子。
2. 还是通过IAMStreamConfig::SetFormat
3. 抓取YUY2格式的数据,直接将它保存为BMP文件也是可以的。当然转成RGB格式后再保存也可以。
King_Dragon
2004-04-16
打赏
举报
回复
人气太冷清,我顶!
dreameasy
2004-04-13
打赏
举报
回复
1. GetMediaType()
2. SetMediaType()
3 YUV2->RGB32,做一个转换函数
King_Dragon
2004-04-13
打赏
举报
回复
SetMediaType(),偶已经使用过,但一旦在连接Sample Grabber或绑定显示窗口时设置媒体格式为YUV2,此时视频不能正常显示,且 hr = m_pBuilder->RenderStream(
&PIN_CATEGORY_CAPTURE,
&MEDIATYPE_Video,
m_pCap,
pGrabberF,
NULL);返回失败。
我想是不是设备不支持该种媒体类型,所以想先获取设备所有支持媒体类型,再根据其支持值进行设置!
King_Dragon
2004-04-13
打赏
举报
回复
to dreameasy(自由哥哥)
对于问题一,如果视频设备设备输出的媒体格式是自定义,怎样根据AM_MEDIA_TYPE(例如SUBTYPE)提取其媒体类型信息,并显示。如果能枚举设备所支持的所有媒体类型(包括自定义媒体格式的描述)则更佳。
对于问题二,如果设备(譬如摄像头)不支持YUV2输出,是否能将媒体格式设置为YUV2?
对于问题三,偶是想抓取YUV2视频数据,并进行分析(相当于视频抓取,但偶是想获取YUV2而不是RGB类型的数据)。
希望能给出相关问题的示例代码,如果能解决问题,可以另外加分。
【Leetcode】205. 同构字符串(Isomorphic Strings)
Leetcode - 205 Isomorphic Strings (Easy) Input: s = "egg", t = "add" Output: true Input: s = "foo", t = "bar" Output: false 解题思路:判断上一次字母出现的位置是否相同。 public boolean isIsomorphic(String s, String t) { ...
[LeetCode]205. Isomorphic Strings 解题报告(C++)
[LeetCode]205. Isomorphic Strings 解题报告(C++) 题目描述 Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occu...
leetcode 205: Isomorphic Strings
Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with a
[LeetCode 205] Isomorphic Strings
Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with another
LeetCode205 Isomorphic Strings
LeetCode205 Isomorphic StringsDescriptionGiven two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a char
多媒体/流媒体开发
2,554
社区成员
20,277
社区内容
发帖
与我相关
我的任务
多媒体/流媒体开发
专题开发/技术/项目 多媒体/流媒体开发
复制链接
扫一扫
分享
社区描述
专题开发/技术/项目 多媒体/流媒体开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章