QtMultimedia on Rockchip ARM Boards?
-
Hi all I have been experimenting with Qt lately in addition to exploring boards such as the Orange Pi 3b and the Orange Pi 5. I took the time to cross compile Qt for these boards following the below tutorial with some modifications: https://github.com/MuyePan/CrossCompileQtForRpi. First of which when compiling gcc as a cross compiler according to the tutorial I changed out the https://github.com/raspberrypi/linux headers with https://github.com/orangepi-xunlong/linux-orangepi headers. Secondly I didn’t use qtbase-everywhere-src-6.5.1 and I instead used the qt5 git repo checked out to 6.5.3 for the source code.
The 3b board is running Debian 12 and the 5 board is running Armbian (23.8.1) aarch64. The uname outputs are below:
3b uname -a: Linux orangepi3b 5.10.160-rockchip-rk356x #1.0.0 SMP Tue Aug 22 11:38:20 CST 2023 aarch64 GNU/Linux 5 uname -a: Linux orangepi5 5.10.160-legacy-rk35xx #1 SMP Mon Aug 28 01:21:24 UTC 2023 aarch64 GNU/Linux
After going through this the first time my program ran on both boards but gave me this error:
QtMultimedia is not currently supported on this platform or compiler.
A little concerned I decided to do some research and found the following stack overflow post detailing to use the provisioning scripts from qt to install ffmpeg headers to use when compiling qt from source, I downloaded the arm version for my purposes:
https://stackoverflow.com/questions/75025298/qt6-qtmultimedia-ffmpeg-backend-preview-procedure
Additionally it mentions to set -DFFMPEG_DIR=%ffmpegpath% to the headers installed above.
So my modified command to configure is this (Note: I am using custom dir names like experiment and pi):
cmake ../../qt5 -GNinja -DCMAKE_BUILD_TYPE=Release -DINPUT_opengl=es2 -DQT_BUILD_EXAMPLES=OFF -DQT_BUILD_TESTS=OFF -DQT_HOST_PATH=$HOME/experiment/host -DCMAKE_STAGING_PREFIX=$HOME/experiment/pi -DCMAKE_INSTALL_PREFIX=/usr/local/qt6 -DCMAKE_TOOLCHAIN_FILE=$HOME/experiment/toolchain.cmake -DQT_QMAKE_TARGET_MKSPEC=devices/linux-rasp-pi4-aarch64 -DQT_FEATURE_xcb=ON -DFEATURE_xcb_xlib=ON -DQT_FEATURE_xlib=ON -DFFMPEG_DIR=$HOME/FFmpeg-n6.0
From there everything configured and compiled fine but when running my program on both boards I now got these errors:
3b Error:
could not load multimedia backend "ffmpeg" QtMultimedia is not currently supported on this platform or compiler. Failed to initialize QMediaPlayer "Not available" Failed to create QVideoSink "Not available" arm_release_ver: g13p0-01eac0, rk_so_ver: 3
5 Error:
could not load multimedia backend "ffmpeg" QtMultimedia is not currently supported on this platform or compiler. Failed to initialize QMediaPlayer "Not available" Failed to create QVideoSink "Not available" libEGL warning: DRI2: failed to authenticate
As I am writing this I find that ffmpeg ............................... no is in my configure command results so my problem may result here but if including the -DFFMPEG_DIR didn’t enable it how do I enable it?
So my main questions here are:
Is QtMultimedia Compatible with these boards at all?
Are my errors the result of user error and I need to go back and rectify a mistake?
If these boards are not supported is there anywhere where I could place a feature request for possible support in the future?Thank you for any assistance with this ahead of time!
Basic Source Code Example:
mainwindow.cpp#include "mainwindow.h" #include <QMediaPlayer> #include <QVideoWidget> #include <QVBoxLayout> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { QMediaPlayer *player = new QMediaPlayer(this); QVideoWidget *videoWidget = new QVideoWidget(this); player->setVideoOutput(videoWidget); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(videoWidget); QWidget *centralWidget = new QWidget; centralWidget->setLayout(layout); setCentralWidget(centralWidget); player->setSource(QUrl::fromLocalFile("/home/wallpulse/videos/video1.mp4")); player->play(); showFullScreen(); } MainWindow::~MainWindow() { }
-
Hi and welcome to devnet,
Might be a silly question but you do have an ffmpeg version built for ARM ?
You can also check the cmake logs to see what failed with regard to the ffmpeg checks.
-
Thank you for your quick reply, I took a look around for a log file that might contain the information you're looking for but I did not see anything in the base build dir or in CMakeFiles.
Doing a grep -r "ffmpeg" . search in the build dir turned up the following :
CMakeCache.txt
./CMakeCache.txt:FEATURE_ffmpeg:BOOL=OFF ./CMakeCache.txt://ffmpeg ./CMakeCache.txt:FEATURE_webengine_system_ffmpeg:BOOL=OFF ./CMakeCache.txt:QT_FEATURE_LABEL_ffmpeg:INTERNAL=FFmpeg ./CMakeCache.txt:QT_FEATURE_LABEL_webengine_system_ffmpeg:INTERNAL=ffmpeg ./CMakeCache.txt://Qt feature: ffmpeg ./CMakeCache.txt:QT_FEATURE_ffmpeg:INTERNAL=OFF
Others:
./qtmultimedia/src/multimedia/qtmultimedia-config_p.h:#define QT_FEATURE_ffmpeg -1 ./qtmultimedia/src/multimedia/qt_lib_multimedia_private.pri:QT.multimedia_private.disabled_features = ffmpeg alsa avfoundation coreaudio videotoolbox evr gstreamer_photography gpu_vivante vaapi mmrenderer wmsdk opensles wasm wmf
I don't know if the above information is helpful at all...still have a alot to learn regarding compiling things myself.
As for your first point no, would I essentially have to install it on my host system first and then use the DFFMPEG_DIR variable to point to it? I did try to cross compile ffmpeg before for arm on my host but that did not work due to the assembler not recognizing certain instructions. That is why I went to using the install_ffmpeg.sh script from qt provisioning and then pointing because I thought that would be sufficient.
Would I be able to download a precompiled version of arm ffmpeg from my package manager then point to it then during configuration?
-
Does your board come with a Linux distribution ? If so, you can install ffmpeg (with corresponding dev packages) and then sync that back to your host. That way you have your arm based dependencies ready to be used.
-
Thank you for your suggestion! It took some fiddling but it worked! Want to post my findings here to possibly help others in case they run into something like this.
What I did was I used
apt-cache search ffmpeg
to get a list of all the ffmpeg related packages. (Note: Run this on your board not your host machine and make sure to have done apt-get update && apt-get upgrade before hand)
From there I transferred the list into a simple apt-get install command and installed all the libs. After rsyncing everything over and reconfiguring/recompiling it worked like a dream on the board. No need to set an extra switch or anything.
Thank you for your help and I hope this helps someone else out!
-