Qt5 QCamera in windows environment - Unable to change any camera settings



  • So i have been smashing my head against the wall for a while now with this issue. I am simply unable to change the resolution and frame rate of the Webcam. I have even tested my code in linux environment and it works fine there but nothing seems to change the settings when i try them with windows 7.

    Since there is no direct way to change the resolution i have been trying to use the QMediaRecorder workaround, the main part of the code looks like this and works fine with linux as i said before. In windows it shows the video but the resolution is the defautl 640x480.

    @ camera = new QCamera(parent);
    vwidget = new VideoWidget(QSize(1280,720));
    camera->setCaptureMode(QCamera::CaptureVideo);
    recorder = new QMediaRecorder(camera);
    QVideoEncoderSettings videoSettings = recorder->videoSettings();
    videoSettings.setResolution(1280,720);
    videoSettings.setFrameRate(30.0);
    recorder->setEncodingSettings(recorder->audioSettings(),videoSettings);
    videorendercontrol = qobject_cast<QVideoRendererControl *>(camera->service()->requestControl("org.qt-project.qt.videorenderercontrol/5.0"));
    if(videorendercontrol)
    {
    videorendercontrol->setSurface(vwidget->videoSurface());
    }
    vwidget->show();
    camera->start();@

    So what i am asking is it even possible to change the resolution in windows environment at the moment without getting some external libraries? And if it is how is it done?


Log in to reply
 

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