当前位置:首页 >> 半导体技术突破 >> 【QML】qml+gstreamer显示的同时录像,避免卡顿,蓝光价格

【QML】qml+gstreamer显示的同时录像,避免卡顿,蓝光价格

cpugpu芯片开发光刻机 半导体技术突破 2
文件名:【QML】qml+gstreamer显示的同时录像,避免卡顿,蓝光价格 【QML】qml+gstreamer显示的同时录像,避免卡顿 1. 问题

使用QML的Camera+videoRecorder(Camera)+VideoOutput实现显示加录像功能。在Ubuntu上运行正常,视频流畅。但是在开发板上(RK3568)上出现明显卡顿,无法正常录像。

2. 解决方案 将摄像头数据通过gstreamer共享内存到某个位置(shmsink)qml中使用MediaPlayer显示和保存视频(MediaPlayer可以使用gstreamer命令) 3. 代码 3.1 shell中共享摄像头数据 gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,format=YUY2, width=640, height=480, framerate=30/1 ! videoconvert ! shmsink socket-path=/tmp/foo sync=true wait-for-connection=false shm-size=10000000 3.2 qml代码(显示+存储) import QtQuick 2.15import QtQuick.Window 2.15import QtMultimedia 5.15import QtQuick.Controls 2.15Window {width: 1000height: 800y: 0visible: truetitle: qsTr("Hello World")Rectangle{id: _mTopwidth: 500height: 600x: 0visible:truecolor: "blue"//显示MediaPlayer{id: gstreamTestsource: "gst-pipeline: shmsrc socket-path=/tmp/foo ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! videoconvert! autovideosink "Component.onCompleted:{play()}}//录像的输出VideoOutput{width: 500height: 500x: 0fillMode: Image.Stretchvisible: truesource: gstreamTest}}Rectangle{id: _mTop1width: 500height: 600x: 500visible:truecolor: "red"//保存MediaPlayer{id: gstreamTest1source: "gst-pipeline: shmsrc socket-path=/tmp/foo ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! videoconvert ! avenc_mpeg4 ! filesink location=1.mp4"Component.onCompleted:{play()}}}}

3.3 qml代码(多个窗口显示) import QtQuick 2.15import QtQuick.Window 2.15import QtMultimedia 5.15import QtQuick.Controls 2.15Window {width: 1000height: 800y: 0visible: truetitle: qsTr("Hello World")Rectangle{id: _mTopwidth: 500height: 600x: 0visible:truecolor: "blue"//显示MediaPlayer{id: gstreamTestsource: "gst-pipeline: shmsrc socket-path=/tmp/foo ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! videoconvert! autovideosink "Component.onCompleted:{play()}}//录像的输出VideoOutput{width: 500height: 500x: 0fillMode: Image.Stretchvisible: truesource: gstreamTest}}Rectangle{id: _mTop1width: 500height: 600x: 500visible:truecolor: "red"//显示MediaPlayer{id: gstreamTest1source: "gst-pipeline: shmsrc socket-path=/tmp/foo ! video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! videoconvert! autovideosink "Component.onCompleted:{play()}}VideoOutput{width: 500height: 500fillMode: Image.Stretchvisible: truesource: gstreamTest1}}}

4. 效果

目前在Ubuntu效果不错,开发板中gstreamer缺少插件,安装插件后再测试效果。

协助本站SEO优化一下,谢谢!
关键词不能为空
同类推荐
«    2025年12月    »
1234567
891011121314
15161718192021
22232425262728
293031
控制面板
您好,欢迎到访网站!
  查看权限
网站分类
搜索
最新留言
文章归档
网站收藏
友情链接