Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. export h.264 from QGraphicsScene?
Forum Updated to NodeBB v4.3 + New Features

export h.264 from QGraphicsScene?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 485 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    davecotter
    wrote on last edited by davecotter
    #1

    can i use QMediaRecorder and QMediaCaptureSession to write an h.264 file from a QGraphicsScene? or from a QVideoSink? or from a QGraphicsItem?

    like, i want to export an MP4 video (including audio) that i can currently play via a QGraphicsScene, and the scene does have a few layers: some graphics and text overlays.

    seems i can record live from a camera / window / screen, but can i record directly from a QGraphicsScene?

    or, how would i accomplish what i'm attempting, without using 3rd party libs?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Since you are talking about QVideoSink, you are using Qt 6.

      So QVideoSink would be an option AFAIK. Note that h264 might not be available for encoding without additional codec packages. In any case, if you want to recompress a video, you should rather use ffmpeg directly.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        davecotter
        wrote on last edited by
        #3

        my only platforms are macOS and Windows, and i believe both media back ends support export to h.264. so, say i am going to try to do this without ffmpeg, how would i connect the video sink to the built-in QMediaCaptureSession ?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by SGaist
          #4

          I think it should be doable with QMediaRecorder::serVideoSink.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • D Offline
            D Offline
            davecotter
            wrote on last edited by
            #5

            doesn't setVideoSink() tell the QMediaRecorder to send a copy of the video to a viewer? it's not setting the INPUT of the recorder, it's setting an output.

            How can i connect an audio stream input, and a QGraphicsScene video input, so the recorder creates a new mp4 file?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              You are correct, I misread the method documentation.

              Currently, from the looks of it, you cannot do it directly.

              Some sort of virtual camera would be needed as I don't see any generic "media object" class that can be used as input for QMediaRecorder.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • D davecotter referenced this topic on

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved