Using QCamera with multiple cameras



  • Hello, I am trying to show the one camera output on two QLabel widget. However I am not able to do so. I encounter following error.

    Graph failed to connect filters -2147024809
    

    However I can see it on one screen not on another. If this is a wrong approach or is it not possible at all?

    cM = new QCamera(this);
    cM2 = new QCamera(this);
    cV = new QCameraViewfinder(this);
    cV2 = new QCameraViewfinder(this);
    mMenu = new QMenu("Options",this);
    cA = new QAction("one camera", this);
    cA2 = new QAction("both camera", this);
    mMenu->addActions({cA, cA2});
    ui->pushButton->setMenu(mMenu);
    cM->setViewfinder(cV);
    cM2->setViewfinder(cV2);
    cBox1 = new QVBoxLayout();
    cBox2 = new QVBoxLayout();
    cBox1->addWidget(cV);
    cBox2->addWidget(cV2);
    ui->label->setLayout(cBox1);
    ui->label_2->setLayout(cBox2);
    connect(cA, &QAction::triggered, [&](){
    
       
        cM->start();
    
        cM2->start();
    });


  • This post is deleted!

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should setup both your cameras explicitly using e.g. QCameraInfo.



  • @SGaist Hi Thank you for your reply. Main issue is regarding the device, I have one device which has two ports. This means i can only activate one at a time. In case, I need to change to another camera i always have to switch the channel. My idea was to display both at a time by switching channel very fast. So it looks like they are both working.

    Anyway is it possible to display one live stream on two different screens(same widget type)? However i could not find what this error means.

    Thank you for your reply.


  • Lifetime Qt Champion

    The error message indicates that the direct show backend failed the setup.

    What kind of camera is it ?



  • @SGaist Hey it finally worked... Thanks for the help


  • Lifetime Qt Champion

    You're welcome !

    What did you do to make it work ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.