Unsolved Recording QML items
-
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?
-
Hi @ben0027
I think QQuickRenderControl should be used.
Would you mind sharing your source code after recording QML items?
-
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. -
@Vincent007 It's there any more details for telling me how to use QQuickRenderControl to get QImage constantly? Thx