Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Recording QML items

Recording QML items

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 1.7k Views
  • 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.
  • B Offline
    B Offline
    ben0027
    wrote on last edited by
    #1

    In Qml each Item has the grabToImage API which grabs the item into an in-memory image (like a screenshot of the item with all its content).
    Any ideas on how to "capture" the item into a video file (therby recording all the animations, camera output, etc)?
    The Help doc says: "This function will render the item to an offscreen surface and copy that surface from the GPU's memory into the CPU's memory, which can be quite costly. For "live" preview, use layers or ShaderEffectSource".

    Is there a way to record the layer with Qt Media classes? Is the recording just used for the camera output?

    1 Reply Last reply
    0
    • V Offline
      V Offline
      Vincent007
      wrote on last edited by
      #2

      Hi @ben0027

      I think QQuickRenderControl should be used.

      Would you mind sharing your source code after recording QML items?

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

        Hi Vincent,

        The QQuickRenderControl looks like a better way to produce frames, thanks. The question now is if there is a way to use the QMediaRecorder to record these frames into a video file. From what I've read it can accept a QMediaObject (camera, video stream, etc). If it could accept Images (uncompressed) and encode them along with Audio then it would work.
        Another way would be to use some external encoder like ffmpeg.

        1 Reply Last reply
        0
        • V Vincent007

          Hi @ben0027

          I think QQuickRenderControl should be used.

          Would you mind sharing your source code after recording QML items?

          D Offline
          D Offline
          dramasoft
          wrote on last edited by
          #4

          @Vincent007 It's there any more details for telling me how to use QQuickRenderControl to get QImage constantly? Thx

          1 Reply Last reply
          0

          • Login

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