So I created a video sink in C++ that is displayed in qml thanks to the following link : How to use QVideoSink in QML in Qt6
It works perfectly.
Now I'm trying to use the MediaRecorder to record those images and save it, but I have no idea what to do to make it work.
The qml before trying anything looks like this :
VideoOutput
{
id: cameraDisplay
anchors.fill: parent
}
Producer
{
id:producer
objectName: "producer"
videoSink: cameraDisplay.videoSink
}
I create a simple button to control a recorder :
Button{
text: ""
Image {
id: recordImage
source: recorder.status == MediaRecorder.RecordingStatus ? "Images/Record.png" : "Images/Record.png"
width: parent.width
height: parent.height
}
onClicked: {
if (recorder.status == MediaRecorder.RecordingStatus) {
recorder.stop()
} else {
recorder.record()
}
}
}
and then added a MediaRecorder:
MediaRecorder {
id: recorder
}
but I have no idea how to select the "source" of the MediaRecorder so that it selects the video Sink, as there is no source property.
Any idea how to do this? I would like to save it as a mp4 file to a particular location Thanks!