Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-135951

QMediaRecorder captures video at a much worse quality on Linux

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 6.8.3, 6.9.0
    • Multimedia
    • None
    • Linux/Wayland

    Description

      This problem is currently only observed on Linux (Ubuntu 22.04 and reportedly RHEL8). I've also tried Windows and macOS, and reproducer works well on those platforms.

      Anyway, build the attached reproducer against 6.8.3 or 6.9.0. The design is that it's going to pick up the .mp4 (one may need to change the path in QUrl::fromLocalFile()), feed it into QMediaPlayer and eventually QVideoSink. That QVideoSink is going to provide video frames to QVideoFrameInput which will be used in a QMediaCaptureSession and recorded by QMediaRecorder. Finally, it's going to output a .mp4 file next to the binary via QFile.

      The problem is that the output has a much worse quality than the original video. The frames seem to be badly pixelated. One can also see from the file size, the the output is around 600 kb while the original video is about 2mb.

      BTW, formatting has been explicitly specified:

          mediaFormat.setVideoCodec(QMediaFormat::VideoCodec::MPEG4);
          mediaFormat.setFileFormat(QMediaFormat::FileFormat::MPEG4);
          recorder.setMediaFormat(mediaFormat);
          recorder.setEncodingMode(QMediaRecorder::ConstantQualityEncoding);
          recorder.setQuality(QMediaRecorder::VeryHighQuality);
      

      That does not make things better though.

      I also uploaded the output video from my end. One can use that as a "reference" of a "bad quality".

      Attachments

        1. screenshot-1.png
          screenshot-1.png
          581 kB
        2. RecordedBunny.mp4
          611 kB
        3. QtMM_log
          42 kB
        4. qtdiag_log.txt
          11 kB
        5. QTBUG-135951.zip
          1.89 MB
        For Gerrit Dashboard: QTBUG-135951
        # Subject Branch Project Status CR V

        Activity

          People

            qtmultimediateam Qt Multimedia Team
            luqiaochen Luqiao Chen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change