Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Offscreen capturing



  • I am working on QML application that have single screen and outputs some images, videos, rectangles (QML Image MediaPlayer, Rectangle, ...)
    Current hardware is Odroid XU4 / Asus Tinker board with QT 5.9, build from QT source. My app is working nice ("./app -platform eglfs").
    Offscreen rendering is desired. My app does not need to emit to attached HDMI dispay, just to capture output. Hardware encoding should be for playing video.

    Objective: need to be able to capture output screen into image files (in real time).

    I did a research and found 2 possible ways

    Option 1 using QT's minimal / minimalEGL platform plugins

    • combination of QOpenGLPaintDevice / QPlatformBackingStore
    • save image in QMinimalEglBackingStore::flush

    Option 2 approach based on http://blog.qt.io/blog/2017/02/21/making-movies-qml/

    • combination of QOpenGLFramebufferObject / QOffscreenSurface
    • custom animation runner
    • save QOpenGLFramebufferObject to image

    I would appreciate help on few question below

    1. can offscreen surface be of any resolution (e.g. 3840 x 2160, of course limited by avail memory)
    2. any reason why in option #1, QPlatformBackingStore is not being invoked at all (when I run my app with "./app -platform minimalegl")
    3. any URL's to similar functionality ?
    4. any alternative / better suggestions to achieve objective above ?

    Thanks in advance.


  • Qt Champions 2017

    I used option#1 with QPA plugin mechanism to save the image. Not sure about memory resolution etc.


Log in to reply