Video in eglfs mode much slower than ffmpeg directly to fb
-
I'm trying to pinpoint a performance issue on the STM32MP157 platform. I have it down to this scenario:
- A video played using ffmpeg with
-re(play at the fps specified in the video) and-f fbdev(output to the frame buffer) consumes around 60% of one core (30% of total CPU) and playback is smooth. - The same video in a QtQuick app, with a Main.qml consisting of a play button and the Video item, run with
QT_QPA_PLATFORM=eglfs, consumes all of one core and only manages around 1/8th of the intended fps.
There is no display server operating in either case. The platform has a 3D GPU (Vivante) but no video decoder.
This relationship is true across different encodings (mp4, divx, mpeg2, ProRes, etc.), resolutions and frame rates, as far as I can tell. That is, the performance within Qt is about 1/15th of that via ffmpeg directly.
Should I expect Qt can perform near the performance of ffmpeg on the same platform? How might I dive in and see where the bottleneck is?
- A video played using ffmpeg with
-
The Qt version is 6.8.3. The app is built in Release mode.
Here's the content of
Main.qml:import QtQuick import QtQuick.Controls.Basic import QtMultimedia Window { width: 1024 height: 600 visible: true title: qsTr("Hello World") Button { id: btnPlay text: "Play" x: 10 y: 10 width: 100 height: 50 onClicked: { console.log("Play!") if (vid.playbackState === MediaPlayer.PlayingState) { vid.pause(); } else { vid.play(); } } } Video { id:vid visible: true enabled: false x: 70 y: 70 //Set to same as video width: 768 height: 450 source: "qrc:/path/to/vid.avi" muted: true autoPlay: false loops: MediaPlayer.Infinite onErrorChanged: console.log("Video error occurred: ", errorString, "(", error, ")") } }Here's the output of ffmpeg:
# ./ffmpeg -re -i /path/to/vid.avi -pix_fmt rgb565 -f fbdev /dev/fb0 ffmpeg version N-121955-g413346bd06 Copyright (c) 2000-2025 the FFmpeg developers built with gcc 13.4.0 (GCC) configuration: --enable-cross-compile --target-os=linux --arch=armv7l --prefix=/path/to/build --extra-cflags=-I/path/to/build/include --extra-ldflags=-L/path/to/build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/path/to/bin --enable-gpl --enable-nonfree --disable-x86asm --disable-asm --cc='arm-dey-linux-gnueabi-gcc -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 --sysroot=/opt/dey/5.0-r2/ccmp15-dvk/sysroots/cortexa7t2hf-neon-vfpv4-dey-linux-gnueabi' --strip=arm-dey-linux-gnueabi-strip libavutil 60. 19.101 / 60. 19.101 libavcodec 62. 21.100 / 62. 21.100 libavformat 62. 6.103 / 62. 6.103 libavdevice 62. 2.100 / 62. 2.100 libavfilter 11. 10.101 / 11. 10.101 libswscale 9. 3.100 / 9. 3.100 libswresample 6. 2.100 / 6. 2.100 Input #0, avi, from '/path/to/vid.avi': Metadata: software : VLC Media Player - 3.0.21 Vetinari Duration: 00:00:23.87, start: 0.000000, bitrate: 1224 kb/s Stream #0:0: Video: msmpeg4v2 (DIV2 / 0x32564944), yuv420p, 768x456, 1224 kb/s, 15 fps, 15 tbr, 15 tbn Stream mapping: Stream #0:0 -> #0:0 (msmpeg4v2 (native) -> rawvideo (native)) Press [q] to stop, [?] for help [vist#0:0/msmpeg4v2 @ 0x46dee80] Resumed reading at pts 0.000 with rate 1.050 after a lag of 0.500s [swscaler @ 0xb520c080] No accelerated colorspace conversion found from yuv420p to rgb565le. [swscaler @ 0xb520c080] [swscaler @ 0xb5219280] No accelerated colorspace conversion found from yuv420p to rgb565le. [swscaler @ 0xb520c080] [swscaler @ 0xb5226220] No accelerated colorspace conversion found from yuv420p to rgb565le. [swscaler @ 0xb520c080] [swscaler @ 0xb52331c0] No accelerated colorspace conversion found from yuv420p to rgb565le. Output #0, fbdev, to '/dev/fb0': Metadata: software : VLC Media Player - 3.0.21 Vetinari encoder : Lavf62.6.103 Stream #0:0: Video: rawvideo (RGB[16] / 0x10424752), rgb565le(pc, gbr/unknown/unknown, progressive), 768x456, q=2-31, 84044 kb/s, 15 fps, 15 tbn Metadata: encoder : Lavc62.21.100 rawvideo [out#0/fbdev @ 0x46e1b40] video:59508KiB audio:0KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: unknown frame= 87 fps= 16 q=-0.0 Lsize=N/A time=00:00:05.80 bitrate=N/A speed=1.05x elapsed=0:00:05.53And here's the output of the Qt app:
# LD_LIBRARY_PATH="/opt/Qt/lib" QT_PLUGIN_PATH="/opt/Qt/plugins" QML2_IMPORT_PATH="/opt/Qt/lib/qml" QT_QPA_PLATFORM=eglfs /path/to/app Detected locale "C" with character encoding "ANSI_X3.4-1968", which is not UTF-8. Qt depends on a UTF-8 locale, but has failed to switch to one. If this causes problems, reconfigure your locale. See the locale(1) manual for more information. Failed to move cursor on screen HDMI1: -14 Failed to move cursor on screen HDMI1: -14 xkbcommon: ERROR: failed to add default include path /usr/share/X11/xkb Failed to create xkb context qt.multimedia.ffmpeg: Using Qt multimedia with FFmpeg version 6.1.2 LGPL version 2.1 or later Input #0, avi, from '/tmp/appIS3.OpUgoR.avi': Metadata: software : VLC Media Player - 3.0.21 Vetinari Duration: 00:00:23.87, start: 0.000000, bitrate: 1224 kb/s Stream #0:0: Video: msmpeg4v2 (DIV2 / 0x32564944), yuv420p, 768x456, 1224 kb/s, 15 fps, 15 tbr, 15 tbn qml: Play! qt.multimedia.playbackengine.codec: "No HW decoder found"