qml中的相机不支持录像为什么? 使用笔记本电脑标准网络摄像头录制来自摄像头的视频,使用direcshow.net可以正常工作,但不能在qml中使用
ApplicationWindow {
title: qsTr("Hello World")
width: 640
height: 480
menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
text: qsTr("Record")
onTriggered: camera.videoRecorder.record()
}
MenuItem {
text: qsTr("stop")
onTriggered: camera.videoRecorder.stop()
}
MenuItem {
text: qsTr("test Avail")
onTriggered: console.log(camera.videoRecorder.recorderStatus)
}
}
}
Camera
{
id:camera
captureMode: Camera.CaptureVideo
videoRecorder.audioSampleRate: 48000
videoRecorder.audioBitRate: 96
videoRecorder.audioChannels: 1
videoRecorder.audioCodec: "audio/mpeg, mpegversion=(int)4"
videoRecorder.outputLocation:""
videoRecorder.frameRate: 30
videoRecorder.videoCodec: "video/x-h264"
videoRecorder.mediaContainer: "video/x-matroska"
videoRecorder.onRecorderStateChanged: {
if (camera.videoRecorder.recorderState == CameraRecorder.StartingStatus) {
console.log("saved to: " + camera.videoRecorder.outputLocation)
}
}
}
VideoOutput
{
id:out
source:camera
}
}
根据文档,在尝试检查recorderStatus时它是0。
价值说明
UnavailableStatus 0相机不支持录制。
UnloadedStatus 1录像机可用但未加载。 。 。
代码有问题或qml录制支持有限吗?