I am writing an application in C ++ / Qt / QML for recording video from a camera. When working with the Qt camera, a problem arises: the video resolution is bad and the recording is always only in ogg format.

I decided to use OpenCV to record video from the camera. Used practices https://github.com/chili-epfl/qml-cvcamera . But I remade the work of recording video from a web camera. During the work, the following difficulties arose: the recording goes well, but the maximum resolution is 640x480. No more. Testing course on the laptop camera. And she goes to 720p. So it should give a resolution of 1280x720, but I still get 640x480.

... //это пример cv::VideoCapture * m_capture; QSize size(1920,1080); ... //Это как в программе заиспользовано if (m_capture->set(CV_CAP_PROP_FRAME_WIDTH, size.width()) && m_capture->set(CV_CAP_PROP_FRAME_HEIGHT, size.height())) { int w = m_capture->get(CV_CAP_PROP_FRAME_WIDTH); int h = m_capture->get(CV_CAP_PROP_FRAME_HEIGHT); if (size.width() != w || size.height() != h) { h = (w * 9) / 16; m_capture->set(CV_CAP_PROP_FRAME_HEIGHT, h); m_cameraSize.setHeight(h); m_cameraSize.setWidth(w); } else { m_cameraSize = size; } emit cameraSizeChanged(m_cameraSize); } else { qWarning() << "AsyncCameraSize Can't set camera size. Using hardware cam size"; int w = m_capture->get(CV_CAP_PROP_FRAME_WIDTH); int h = m_capture->get(CV_CAP_PROP_FRAME_HEIGHT); m_cameraSize.setHeight(h); m_cameraSize.setWidth(w); emit cameraSizeChanged(m_cameraSize); } ... 

and I have in the logs:

 qml: size = QSize(640, 360) 

Help good people figure out how to make it work normally.

    0