Hey, so for my project I have developed a Qt Quick App.
I’d like to have my camera stream in the background and some UI in front.
Anyone have some experience on whats the best way to do it? I am trying 2 different things right now but I am stuck.
1)
I made a sample program, which uses QML Mediaplayer with a simple custom gstreamer pipeline. It works with videotestsrc.
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15
import QtMultimedia 5.15Window {
visible: true
width: 640
height: 480
title: qsTr(“Hello World”)VideoOutput { height: 480 width: 640 anchors.fill: parent source: mediaplayer MediaPlayer { id: mediaplayer source: "gst-pipeline: videotestsrc ! qtvideosink" //source: "gst-pipeline: nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1 ! videoconvert ! qtvideosink" //source: "file_example_MP4_480_1_5MG.mp4" autoPlay: true onPlaying: { bt.text = "mediaplayer"; } } } Button{ height: 500 width: 500 id: bt text: "Nothing." onPressed: { bt.text = "Button pressed."; mediaplayer.play(); } }
}
Now I’d like to have my camerastream displayed instead of videotestsrc.
nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1 ! qtvideosink
But of course
Now I’d like to have my camerastream displayed instead of videotestsrc.
nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)NV12, framerate=(fraction)30/1 ! qtvideosink
But of course, it is not compatible with qtvideosink right away giving caps error. Anyone has experience in which formats I have to convert and how to make it compatible?
2)
Another way would be to use QCamera and set enviroment variable: QT_GSTREAMER_CAMERABIN_VIDEOSRC to nvarguscamerasrc. But this did not work neither for me. I get this error:
CameraBin error: “GStreamer error: negotiation problem.”
I would be very thankful for any help.
I will post this to Qt Forum too, maybe they can also help.
Thank you very much,
jb