Unable to play videos on QML Qt6.4 on embedded platform
-
Hi,
I've developed a QML app on an embedded platform (Yocto + Qt6.4) and I'm experiencing an issue when trying to play videos.
Whether I use MediaPlayer + VideoOutput or Video components, I'm not able to view anything on the screen. Audio plays ok thoughThis is a snippet of my code, but video QML examples also doesn't work.
Video { id: video anchors.fill: parent source: "file:///home/root/turning_pages.avi" fillMode: Image.Stretch muted: false Component.onCompleted: play() onErrorOccurred: error => console.log('Error occurred:', errorString, error) onPlaying: console.log('playing stream', source) onStopped: console.log('stream stopped') onBufferProgressChanged: console.log('buffering:', bufferProgress) }
And this is the console output -no warnings nor errors-
====== AIUR: 4.7.3 build on Feb 3 2023 05:14:46. ====== Core: AVI_PARSER_03.06.08 build on Sep 26 2022 08:17:20 file: /usr/lib/imx-mm/parser/lib_avi_parser_arm_elinux.so.3.1 ------------------------ Track 00 [video_0] Enabled Duration: 0:00:15.533178000 Language: und Mime: image/jpeg, width=(int)160, height=(int)120, framerate=(fraction)500000/33333 ------------------------ ------------------------ Track 01 [audio_0] Enabled Duration: 0:00:15.533381000 Language: und Mime: audio/x-raw, format=(string)U8, channels=(int)1, layout=(string)interleaved, rate=(int)11024, bitrate=(int)88192
I'm able to play the video using gst-launch
gst-launch-1.0 playbin uri=file:///home/root/turning_pages.avi video-sink="waylandsink sync=false"
So it seems it's not a codec related issue.
Running Qt widgets examples does works and both video and audio works fin, so it seems only related to the QML side
When building Yocto I added the following lines:
IMAGE_INSTALL:append = " qtmultimedia qtmultimedia-plugins qtmultimedia-qmlplugins" PACKAGECONFIG:append_pn-qtmultimedia = " gstreamer gstreamer010" "
Solutions like propossed here doesn't work either.
Thks in advance
-
@imahgin which gstreamer version? check it out
gst-launch-1.0 --versionqml6 sink is available in the later versions of gstreamer. You can build it as well.
Take a look at qgroundcontrol source code. For Android, qml5sink is built from gstreamer source code. You can do the same thing for qml6sink. -
According to this information seems that Qt6 support for rendering video inside a QML scene is available only from version 1.22.0, and according to this NXP document (I'm using this MPU) this version is included in Rev. LF6.1.36_2.1.0 (page 9)
My distribution is previous to that revision and gstreamer version is 1.20.3.
As I'm not an experienced user in Yocto, I'll try to get some assistance to see if there is an 'easy' way to include this -or latest version- on my current Yocto compilation, without breaking other packages. -
@imahgin This is what I posted in gstreamer forum before. The latest gstreamer version is 1.22.6. Make sure that your video card is not too old if you use the latest gstreamer.
Get Source get source: git clone ​https://gitlab.freedesktop.org/gstreamer/gstreamer.git git tag -l <==== to list all tags git checkout tags/1.22.5 <==== for example Build and install cd gstreamer meson setup --prefix=/opt/thirdParties/gstreamer1-22-5 -Dlibdir=lib builddir ninja -C builddir sudo ninja install -C builddir
Do not install it in the default dir or under /usr/... because your new installation may mess up with the old installation. And it is hard for you to clean it up. If you purge the old installation, some of video tools installed may not work anymore. Set the proper paths for bin, libs and drivers of the newly installed gstreamer.
meson version may not match. Get the latest meson source and build it. -
Today I've successfully built a Yocto image with Qt 6.5 and gstreamer 1.22.0 but the problem remains :-(
Audio works fine, but I get blank image when playing videos on QML..
No errors are displayed and running gstreamer from CLI can play videos without issues.
Tried with both 'Video' and 'MediaPlayer' QML components with the same result. -
@imahgin make sure qml6sink in gstreamer is built and available. if your default Qt is 5, gstreamer build may not include qml6sink. Check the configure info to see if Qt6 is applied to gstreamer build.
FFMpeg is the backend in Qt6. I am not familiar with FFMpeg and do not know if you need qml6 sink in qml when you use Qt multimedia module.
-