提问人:LeXela-ED 提问时间:2/13/2021 最后编辑:LeXela-ED 更新时间:2/27/2021 访问量:916
QML中的一个源,两个视频输出
One source, two video output in QML
问:
我需要在 VideoOutput 组件中分别显示原始视频和预处理视频(来自单个来源)。但是,只有一个 VideoOutputs 显示源!似乎一次只有一个输出可以具有源。这是我的代码:
import QtMultimedia 5.9
Item {
// ...
Camera {
id: camera
}
VideoOutput {
id: videooutput1
source: camera
// ...
}
VideoOutput {
id: videooutput2
source: camera
// ...
}
}
有没有办法在多个视频输出之间共享单个源?还是我错过了什么?
答:
3赞
SajadBlog
2/13/2021
#1
您可以使用ShaderEffectSource来复制QML项目:
Item {
// ...
Camera {
id: camera
}
VideoOutput {
id: videooutput1
source: camera
// ...
}
ShaderEffectSource {
id: videooutput2
sourceItem: videooutput1
}
}
1赞
LeXela-ED
2/27/2021
#2
另一种解决方案如下(我个人更喜欢这个解决方案):
Item {
MediaPlayer {
id: mediaplayer
autoPlay: true
source: "url to your source"
videoOutput: [videooutput1, videooutput2]
}
VideoOutput {
id: videooutput1
anchors.fill: parent
}
Window {
visible: true
width: 480; height: 320
VideoOutput {
id: videooutput2
anchors.fill: parent
}
}
}
评论
0赞
Akshay
2/18/2022
这不适用于相机。仅视频文件
评论