Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QML Camera: Loading QQmlApplication has large delay



  • I'm trying to show a video live stream from a USB device in my Qt5.12 QML interface on Ubuntu 18.04. The device is either a Webcam or a HDMI capture device (connected by USB). Following the examples, I added a QML Camera in my QML code. However, loading QQmlApplicationEngine in my main.cpp is now extremely slow (around 5 minutes until the UI starts). As soon as it is running, everything works as expected. I'm running it on a more than powerful workstation.

    This is all I'm doing:

        VideoOutput {
            source: camera
            anchors.fill: parent
    
            Camera {
                id: camera
            }
        }
    

    Does anyone know why this is so slow? Or is there a better solution to show a live stream from an USB device?



  • I was hoping that I can at least show the rest of the GUI using a Loader. This does not solve the initial problem with the delay, of course. But although the ApplicationWindow opens immediately now, nothing is shown inside until Camera is loaded (ApplicationWindow->StackLayout->...->Loader). I don't understand why Camera and Loader are not working as expected. Nobody seems to have this problems. I also checked the GStreamer version, which is 1.0.

        Loader {
            id: loader 
            asynchronous: true
            anchors.fill: parent
    
            sourceComponent: Item {
                anchors.fill: parent
                Camera {
                    id: camera
                }
    
                VideoOutput {
                    source: camera
                    anchors.fill: parent
                }
            }
        }

Log in to reply