无法在DirectShow中显示两个摄像机 [英] Unable to display two cameras in DirectShow

查看:130
本文介绍了无法在DirectShow中显示两个摄像机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用两个在单独的线程上运行的DirectShow图形来显示流式视频(使用单独的VMR 9)并捕获来自两个网络摄像头的帧(使用Sample Grabber).其中一个是内置网络摄像头(HP TrueVision HD),另一个是连接到USB端口的Creative VF0520.其他USB端口均未使用.

I'm using two DirectShow graphs, running on separate threads, to display streaming video (using VMR 9 on a seperate) and capture frames (using Sample Grabber) from two webcams. One of them is a built-in webcam (HP TrueVision HD) and the other is a Creative VF0520 connected to a USB port. None of the other USB ports are in use.

问题在于Creative相机已打开(LED点亮),但是没有流通过.即使禁用了内置网络摄像头,问题仍然存在.但是,如果在仅连接Creative凸轮的台式机上运行,​​则Creative cam可以工作.

The problem is that the Creative camera turns on (LED lights up), but no stream comes through. The problem persists even if I disabled the built-in webcam. However, the Creative cam works if running on a desktop where the Creative cam is the only camera connected.

该程序在每个摄像机都是唯一连接的摄像机时起作用(Creative VF0520是它是唯一一个连接到台式机的摄像机),但是当连接两个摄像机时,视频显示和抓帧仅适用于内置摄像机.在网络摄像头中.

The program works when each camera is the only one connected (the Creative VF0520 works when it is the only camera connected to a desktop), but when two cameras are connected, video display and frame-grabbing only work for the built-in webcam.

我怀疑问题可能是由捕获过滤器的绰号绑定引起的.我正在使用 MSDN中的修改后的代码.这是绑定绰号以捕获多台摄像机的滤镜的正确方法吗?

I suspect the problem may arise from moniker-binding with capture filters. I am using modified code from MSDN. Is this the correct way to bind monikers to capture filters for multiple cameras?

ULONG VideoPlayer::GetMonikers(IEnumMoniker *pEnum, std::vector<IMoniker *> *pListMonikers)
{
ULONG numRetrieved =  0;
IMoniker* pMoniker = NULL;

while (pEnum->Next(1, &pMoniker, &numRetrieved) == S_OK)
{
// Bind to vector
pListMonikers->push_back(pMoniker);

    IPropertyBag *pPropBag;
    HRESULT hr = pMoniker->BindToStorage(0, 0, IID_PPV_ARGS(&pPropBag));
    if (FAILED(hr))
    {
        (*ppMoniker)->Release();
        continue;  
    }
    // Get information to display

    pPropBag->Release();
}

return numRetrieved;
}

然后访问包含绰号的向量以绑定到捕获过滤器:

The vector containing the monikers is then accessed to bind to the capture filter:

hr = listMonikers[CAMERA_ID]->BindToObject(NULL, NULL, IID_IBaseFilter, (void**)&pCap);

推荐答案

这很可能与USB硬件有关.下载vlc并检查是否可以从2个不同的vlc实例的两个摄像机上获取视频.

This is most likely related to USB hardware. download vlc and check if you can get video from both cameras on 2 different vlc instances.

vlc.exe->媒体-> opencapturecapture

vlc.exe -> media -> opencapturecapture

如果您不能然后开始钻入USB.可能是您的第二个USB相机被USB 1.0控制器接走了.我不认为这是DirectShow,因为我可以让多台摄像机配合DirectShow使用.

If you can't then start drilling into usb. It could be that your your 2nd usb cameras is being picked up by a usb 1.0 controller. I dont think it is directshow because I can get multiple cameras to work with directshow.

我遇到了同样的问题,这与USB带宽和USB控制器有关.尝试将摄像头也插入不同的USB端口.可能会起作用.

I had the same problem and it was related to usb bandwidth, and usb controller. Try plugging the cameras into different usb ports aswell.. that might work.

这篇关于无法在DirectShow中显示两个摄像机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆