Re: [Interest] QMediaCaptureSession capture from QGraphicsScene?

2024-06-25 Thread David M. Cotter
I have attempted to replicate the code pattern you suggest

When I call `i_recorder.record()`, it returns immediately, without calling 
either of my slots (audio or video).

Do you have a fully working example project, that is zipped up and ready to 
“unzip and run” ?

-Dave

> On Jun 21, 2024, at 4:52 AM, Volker Hilsheimer  
> wrote:
> 
>> On 19 Jun 2024, at 20:14, David M. Cotter  wrote:
>> 
>> 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 ?
>> 
>> -Dave
> 
> 
> Hi Dave,
> 
> Forwarding Artem’s reply (which went to development@):
> 
> 
> Thanks for the questions! 
> 
> In 6.8, we added QVideoFramesInput, and QAudioBufferInput, which can be 
> connected toQMediaCaptureSession as inputs.
> Let's go through the questions.
> 
>> 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?
> 
> You cannot set QGraphicsScene as an input to QMediaCaptureSession. Instead, 
> you may render QGraphicsScene to QImage, construct QVideoFrame from the 
> image, and send your sequence of images to QVideoFrameInput, connected to 
> 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?
> 
> It’s platform-dependent. E.g. on Windows, we cannot capture invisible 
> windows. On other platforms, it’s to be double-checked and documented, the 
> ticket is https://bugreports.qt.io/browse/QTBUG-126552. 
> In general, the result of QWindowCapture::capturableWindows is designed to 
> represent the windows we can capture. If the list contains an invisible 
> window that QtMM cannot capture, a ticket might be reported.
> 
> 
>> 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?
> 
> QImageCapture is rather an output for capturing image shots from cameras, 
> screens, windows, so it doesn’t cover your needs. Please use 
> QVideoFrameInput. In 6.8, you may create video frames from QImage or from 
> your custom data via QAbstractVideoBuffer, see the constructors of 
> QVideoFrame.
> 
> 
>> is there sample code for sending in-memory images into QMediaCaptureSession ?
> 
> 
> There are no code samples in the public documentation yet. We have a ticket 
> for writing them:https://bugreports.qt.io/browse/QTBUG-126319.
> Until we add the snippets or examples, you may take a look at the tests:
> An early tests revision with a straight-forward flow.
> The current tests revision is a bit harder to learn from. 
> 
> 
> 
> Regards
> Artem
> 
> 

___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QMediaCaptureSession capture from QGraphicsScene?

2024-06-21 Thread Jøger Hansegård via Interest
> Do you have a link to that?

Unfortunately, the links to the tests were missing from the previous email. The 
current tests for encoding audio and video can be seen at 
https://github.com/qt/qtmultimedia/blob/dev/tests/auto/integration/qmediaframeinputsbackend/tst_qmediaframeinputsbackend.cpp.
 You may want to look at all the files in the test's directory: 
https://github.com/qt/qtmultimedia/tree/dev/tests/auto/integration/qmediaframeinputsbackend

In an earlier version of the tests, the usage pattern is a bit more explicit:
* 
https://github.com/qt/qtmultimedia/blob/c8ba076f80d1c100d237343a19887db51e091117/tests/auto/integration/qmediaframeinputsbackend/tst_qmediaframeinputsbackend.cpp

Thanks,
Jøger Hansegård
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QMediaCaptureSession capture from QGraphicsScene?

2024-06-21 Thread David M. Cotter
Do you have a link to that?

> On Jun 21, 2024, at 4:52 AM, Volker Hilsheimer  
> wrote:
> 
> An early tests revision with a straight-forward flow

___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QMediaCaptureSession capture from QGraphicsScene?

2024-06-21 Thread Volker Hilsheimer via Interest
> On 19 Jun 2024, at 20:14, David M. Cotter  wrote:
> 
> 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 ?
> 
> -Dave


Hi Dave,

Forwarding Artem’s reply (which went to development@):


Thanks for the questions! 

In 6.8, we added QVideoFramesInput, and QAudioBufferInput, which can be 
connected toQMediaCaptureSession as inputs.
Let's go through the questions.

>  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?

You cannot set QGraphicsScene as an input to QMediaCaptureSession. Instead, you 
may render QGraphicsScene to QImage, construct QVideoFrame from the image, and 
send your sequence of images to QVideoFrameInput, connected to 
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?

It’s platform-dependent. E.g. on Windows, we cannot capture invisible windows. 
On other platforms, it’s to be double-checked and documented, the ticket is 
https://bugreports.qt.io/browse/QTBUG-126552. 
In general, the result of QWindowCapture::capturableWindows is designed to 
represent the windows we can capture. If the list contains an invisible window 
that QtMM cannot capture, a ticket might be reported.


> 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?

QImageCapture is rather an output for capturing image shots from cameras, 
screens, windows, so it doesn’t cover your needs. Please use QVideoFrameInput. 
In 6.8, you may create video frames from QImage or from your custom data via 
QAbstractVideoBuffer, see the constructors of QVideoFrame.


> is there sample code for sending in-memory images into QMediaCaptureSession ?


There are no code samples in the public documentation yet. We have a ticket for 
writing them:https://bugreports.qt.io/browse/QTBUG-126319.
Until we add the snippets or examples, you may take a look at the tests:
An early tests revision with a straight-forward flow.
The current tests revision is a bit harder to learn from. 



Regards
Artem


___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


[Interest] QMediaCaptureSession capture from QGraphicsScene?

2024-06-19 Thread David M. Cotter
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 ?



-Dave___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest