QMediaCaptureSession capture from QGraphicsScene?
-
If i have a QGraphicsScene (not necessarily connected to a view, or if required, an OFFSCREEN view), can i set its output as the input to a QMediaCaptureSession?
I see i can connect a QWindowCapture, but must that window be showing? can that window be invisible? eg: h.264 output in the background, unrelated to the showing (visible) windows?
I had asked this question a couple years ago, but times have changed and i wonder if it is now possible?
if it is not possible from QGraphicsScene directly, then how about a temporary buffer of QImage? Can i feed QMediaCaptureSession a QImageCapture class, then feed the QImageCapture class a series of QImage or QVideoFrame refs?
is there sample code for sending in-memory images into QMediaCaptureSession ?
-
from @artem.dyomin :
In 6.8, we added
QVideoFrameInput
, andQAudioBufferInput
, which can be connected toQMediaCaptureSession
as inputs.Note you cannot set
QGraphicsScene
as an input toQMediaCaptureSession
. Instead, you may renderQGraphicsScene
toQImage
, constructQVideoFrame
from the image, and send your sequence of images toQVideoFrameInput
, (which is connected toQMediaCaptureSession
).from @jøger.hansegård :
The current tests for encoding audio and video can be seen at this link. You may want to look at all the files in the test's directory
In an earlier version of the tests, the usage pattern is a bit more explicit.
-
@SGaist do you have any ideas?
-
Hi,
What exactly do you want to record ?
-
the output of the QGraphicsScene, frame by frame, into an h.264 file (ie: export movie of generated frames) @SGaist
-
This post is deleted!
-
from @artem.dyomin :
In 6.8, we added
QVideoFrameInput
, andQAudioBufferInput
, which can be connected toQMediaCaptureSession
as inputs.Note you cannot set
QGraphicsScene
as an input toQMediaCaptureSession
. Instead, you may renderQGraphicsScene
toQImage
, constructQVideoFrame
from the image, and send your sequence of images toQVideoFrameInput
, (which is connected toQMediaCaptureSession
).from @jøger.hansegård :
The current tests for encoding audio and video can be seen at this link. You may want to look at all the files in the test's directory
In an earlier version of the tests, the usage pattern is a bit more explicit.
-
-
Nice ! Thanks for the feedback
That was more or less what I wanted to suggest but I did not know about QDataFrameInput yet thus it's even simpler :-)