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

QtMultimedia 5.8 Does not record on Raspberry - Stretch



  • Hi Fellow Qt Devs,

    I've written an application on Raspberry Pi Stretch (Qt5.10.1) using Qt Quick (2.1) and QtMultimedia (5.8) to capture the camera. This all works great other than I get on start a console warning 'Unable to query the parameter info: "Invalid argument"' however, it still seems to work OK, i.e. it captures the camera.
    My issue is with trying to record.
    I get the follow errors upon calling the .videoRecorder.record() method:

    qml: CSI Device Recording...
    Detaching from process 2677
    AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': No such file or directory
    AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': No such file or directory
    AL lib: (EE) ALCcaptureAlsa_open: Could not open capture device 'default': No such file or directory
    CameraBin warning: "not negotiated"
    CameraBin warning: "Could not open temporary device."
    CameraBin error: "Could not open device."
    CameraBin error: "Internal data stream error."​

    A file is generated, but with zero bytes.

    I've seen a few variants of this problem posted on varying forums, some have suggested to not specify resolution string, and keep defaults however this did not help for me.

    So can any of you guys shed a light on what is happening?

    Here is my code:
    `` Camera {
    id: csi2Device;
    objectName: "csi2Device";
    deviceId: QtMultimedia.availableCameras[0] ? QtMultimedia.availableCameras[0].deviceId : 0;
    captureMode: Camera.CaptureVideo;
    //cameraState: Camera.StandbyStatus;
    videoRecorder {
    resolution: "640x480";
    frameRate: 30;
    videoCodec: "h264";
    mediaContainer: "mp4"
    outputLocation: "test.mp4";
    onRecorderStateChanged: {
    if (csi2Device.videoRecorder.recorderState == CameraRecorder.StartingStatus) {
    DataModel.IsRecording = true;
    console.log("saved to: " + csi2Device.videoRecorder.outputLocation)
    }
    else {
    DataModel.IsRecording = false;
    }
    }
    }
    }
    VideoOutput {
    id: viewfinder;
    x: 0;
    y: 0;
    width: parent.width;
    height: parent.height;
    source: csi2Device;
    fillMode: VideoOutput.Stretch
    autoOrientation: true;
    }
    code_text


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Do you have the GStreamer plugins packages installed ?



  • Hi, Thanks for your reply. Yes gstreamer 1.0 is installed.

    a8b0f570-fc7e-4e83-897e-818d9fd57cdf-image.png

    dd126810-156a-425b-9793-3ae49bd8e782-image.png


  • Lifetime Qt Champion

    Can you do the recording from GStreamer directly successfully ?



  • Hi Thanks, again for your rapid response.
    Yes I can using:

    gst-launch-1.0  --gst-debug-level=3   -v   v4l2src device=/dev/video0 ! capsfilter caps="video/x-raw, width=648,height=480,framerate=30/1" ! queue ! videoconvert ! videorate ! queue ! omxh264enc ! queue ! avimux ! filesink location = test_video.mp4
    

  • Lifetime Qt Champion

    Same user as when you run your Qt application ?



  • @SGaist yes


  • Lifetime Qt Champion

    Something is not clear, are you using Qt 5.8 or 5.10 ?



  • Hi,

    So I'm using Qt 5.10.1
    f5b7f94e-0b67-482f-8566-8ffc898b9309-image.png

    With these imports in QML

    import QtQuick 2.10
    import QtMultimedia 5.8
    import DataModelTypes 1.0
    
    

    If I use import QtMultimedia 5.10, it builds, however it appears to not be installed on the Rpi qrc:/FPV.qml:2 module "QtMultimedia" version 5.10 is not installed, and thus the app crashes.


  • Lifetime Qt Champion

    The QML numbering might not reflect the Qt release you are using.

    One thing that comes to mind is that the pipeline generated in the GStreamer backend does not handle the camera as well as the one you are using on the command line.



  • Hmm, need to have a think on if I can do a work around. I need to be able to see the camera and record. Thanks for your help.


  • Lifetime Qt Champion

    One possible thing to do is rebuild the backend (and just the backend not the whole of Qt)


Log in to reply