This post shows a workaround about how to embed video on your QT Qml application with high performance on i.MX8MPlus.
The demo works on Linux BSP L6.1.22_2.0.0 and weston branch weston-imx-11.0.
This demo set the glimagesink pipeline on weston top view and works for 1080p screen.
QT MediaPlayer
Since qmlglsink is not supported now on QT6, one way we can display video with QML application is to use MediaPlayer component. However, it has bad performance when playing with high resolution videos. From my test, while playing with 1080p60 video, cpu loading is around 50% and some frames will be lost.
With pure Gstreamer pipeline,
gst-launch-1.0 -vvv filesrc location=3.mp4 ! qtdemux ! vpudec ! video/x-raw,format=NV12 ! imxvideoconvert_g2d ! queue ! glimagesink
It works good with 1080p60 video.
Therefore, we could make it work with QML application to achieve the best performance on our platform.
Demo explanation
The demos works with QT6 qml and the Gstreamer pipeline is
gst_parse_launch("filesrc location=3.mp4 ! qtdemux ! vpudec ! video/x-raw,format=NV12 ! imxvideoconvert_g2d ! video/x-raw,format=BGRx,width=1280,height=720 ! queue ! glimagesink ",NULL);
You can change 3.mp4 to your video.
if you want to change the size of glimagesink output , you need also change the QML rectangle and weston.ini.
Compile Steps
Weston
git clone https://github.com/nxp-imx/weston-imx.git
git checkout weston-imx-11.0.1
git apply 0001_Weston_Fix_Glimagesink_Pos_and_QML_APP.patch
Follow the below link to compile weston-11 and copy them to the rootfs.
Weston-imx intergration guide - Graphics Technology Engineering Center - NXP Confluence
QML application
source toolchain
cmake .
make
In CMakeLists.txt, you need to modify the INCLUDE_DIRECTORIES to your toolchain path.
Run Steps
Add the following component to the shell section on the /etc/xdg/weston/weston.ini
qtapp is the name of your app.
qt_pos sets the initial x and y position of your app.
glsink_pos sets the initial x and y position of your gstreamer glimagesink pipeline.
These parameters can set your gstreamer video on your application rectangle for playing video, test and choose for your best.
systemctl restart weston
./FIXVIDEO
Result
You can see your Gstreamer video is always on top and you can control your pipeline by press the Start, Pause and Stop button.
Pending to do:
This is just a simple demo for 1080p screen and shows the video with 1280x720 rectangle. If your screen and show-rectangle is different, then you need to modify not only the qml file, the Gstreamer pipeline, but also the weston.ini to fit your video on the rectangle.
The video is fixed on the position you set and can not be moved.
Reference Link
i.MX8MPlus :https://www.nxp.com/design/design-center/development-boards/i-mx-evaluation-and-development-boards/e...
weston: https://github.com/nxp-imx/weston-imx
記事全体を表示