Unsolved 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 -
Hi and welcome to devnet,
Do you have the GStreamer plugins packages installed ?
-
Hi, Thanks for your reply. Yes gstreamer 1.0 is installed.
-
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
-
Same user as when you run your Qt application ?
-
@SGaist yes
-
Something is not clear, are you using Qt 5.8 or 5.10 ?
-
Hi,
So I'm using Qt 5.10.1
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.
-
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.
-
One possible thing to do is rebuild the backend (and just the backend not the whole of Qt)