title: QT's QMediaRecorder not working - Unable to record from webcam
body: <p>I've been searching everywhere for a solution to this and I've seen some threads here about this problem but without a solution. </p>
  
  <p>I'm trying to record a video from two different webcams that I have on my computer. I am able to show the video for both of them but the problem is recording. When I try it nothing happens. No file is saved and the states also never change. Bellow I have attached the code that loads the cameras and the code that loads the QMediaRecorders. I also tried with just one of the cameras and it still doesn't work. The QT example "camera" does not work as well, the option for recording is always disabled.</p>
  
  <pre><code>void MainWindow::setCamera() {
      foreach (const QCameraInfo &amp;cameraInfo, QCameraInfo::availableCameras()) {
          qDebug() &lt;&lt; "Device Name: " + cameraInfo.deviceName();
          qDebug() &lt;&lt; "Device Description: " + cameraInfo.description();
          if (cameraInfo.description() == "Integrated Camera")
              camera1 = new QCamera(cameraInfo);
          else if(cameraInfo.description() == "QuickCam for Notebooks Pro")
              camera2 = new QCamera(cameraInfo);
      }
      camera1-&gt;setViewfinder(ui-&gt;camScreen1);
      camera2-&gt;setViewfinder(ui-&gt;camScreen2);
      camera1-&gt;setCaptureMode(QCamera::CaptureVideo);
      camera2-&gt;setCaptureMode(QCamera::CaptureVideo);
      camera1-&gt;start();
      camera2-&gt;start();
  
      qDebug() &lt;&lt; camera1-&gt;status();
      qDebug() &lt;&lt; camera1-&gt;state();
      qDebug() &lt;&lt; camera1-&gt;error();
  }
  
  void MainWindow::setVideoEncoding() {
      recorder1 = new QMediaRecorder(camera1);
      recorder2 = new QMediaRecorder(camera2);
  
      QVideoEncoderSettings settings = recorder1-&gt;videoSettings();
      settings.setCodec("video/mpeg2");
      settings.setQuality(QMultimedia::LowQuality);
      settings.setResolution(640,480);
      settings.setFrameRate(30.0);
  
      recorder1-&gt;setVideoSettings(settings);
      recorder2-&gt;setVideoSettings(settings);
  
      recorder1-&gt;setMetaData(QMediaMetaData::Title, QVariant(QLatin1String("Record1")));
      recorder2-&gt;setMetaData(QMediaMetaData::Title, QVariant(QLatin1String("Record2")));
  
      recorder1-&gt;setOutputLocation(QUrl::fromLocalFile(QCoreApplication::applicationDirPath() + "/" + "testvide1o.mp4"));
      recorder2-&gt;setOutputLocation(QUrl::fromLocalFile(QCoreApplication::applicationDirPath() + "/" + "testvideo2.mp4"));
  
      qDebug() &lt;&lt; recorder1-&gt;status();
      qDebug() &lt;&lt; recorder1-&gt;state();
      qDebug() &lt;&lt; recorder1-&gt;error();
  }
  </code></pre>
  
  <p>When I press the record button:</p>
  
  <pre><code>void MainWindow::toggleRecord(bool startRecord) {
      if(startRecord) {
          recorder1-&gt;record();
          recorder2-&gt;record();
      }
      else {
          recorder1-&gt;stop();
          recorder2-&gt;stop();
      }
  
      qDebug() &lt;&lt; recorder1-&gt;state();
      qDebug() &lt;&lt; recorder1-&gt;status();
      qDebug() &lt;&lt; recorder1-&gt;error();
  
      qDebug() &lt;&lt; recorder2-&gt;state();
      qDebug() &lt;&lt; recorder2-&gt;status();
      qDebug() &lt;&lt; recorder2-&gt;error();
  }
  </code></pre>
  
  <p>The state, status and error are as follows (every time I call them)</p>
  
  <p><strong>Camera:</strong>
  State: <code>QCamera::UnavailableStatus;</code>
  Status: <code>QCamera::ActiveState;</code>
  Error: <code>QCamera::NoError.</code></p>
  
  <p><strong>Recorder:</strong>
  State: <code>QMediaRecorder::UnavailableStatus;</code>
  Status: <code>QMediaRecorder::StoppedState;</code>
  Error: <code>QMediaRecorder::NoError.</code></p>
  
  <p>Thanks in advance for your time.</p>