Hardware Accelerated Video with Qt 6 on the Raspberry Pi

Featured Video Play Icon

Getting hardware acceleration into Qt eglfs is tricky. Doing so on a Raspberry Pi is, unfortunately, still tricky after many years. Qt claimed to have reimplemented the Qt Multimedia module entirely, and one of their target was getting hardware acceleration where possibile. So, I thought I could start with a quick look.

Qt 5

Since Raspberry Pi was born, I had to solve the problem of hardware accelerated video in Qt. At the beginning, I wrote POT (PiOmxTextures) to solve this problem: https://github.com/carlonluca/pot. It used OpenMAX to stream decoded video into an OpenGL texture, which was then showed through a custom backend of Qt Multimedia in Qt 5. This approach worked fine, but won’t work on Pi 4/Qt 6. On the other hand, there is another component in the same repo, that includes a custom Qt Quick item to render video through omxplayer. This is the most performant approach, but has its limitations.

Qt Multimedia

I quickly tested Qt Multimedia in Qt 6 on the rpi. My build from this article should support gstreamer. All I got was a a warning on the console. I didn’t investigate further. Maybe I’ll spend more time on this in the future.

POTVL

As the classical POT is no more usable on Raspberry Pi 4, I started to have a look at POTVL, which is very simple to port to Qt 6. With a small patch, it is possible to build it. You’ll find updates on the repo.

Demo

The video is a 1080p video. As you can see, the framerate is acceptable up to a certain weight of the graphics. It seems that Qt 6 OpenGL backend still is a bit less performant than Qt 5 in this specific demo, as you can see from this test from a previous article:

so the result may even improve in the future.

The benchmark app can be found here: https://github.com/carlonluca/Fall.

Unfortunately POTVL is still not future proof, but it is the simplest and most efficient element to port to Qt 6. I may try something better in the near future.

Have fun! Bye ­čśë

11 thoughts on “Hardware Accelerated Video with Qt 6 on the Raspberry Pi”

  1. Hi,
    how did you install Qt6 , Qt6Quick and … on raspberry pi ??
    and can you help me how to run pyside6 app on raspberry pi?

  2. Hi Luca,

    I builded Qt6 with QtMultimedia based on GStreamer 1.0, but QMediaPlayer not play audio file . I have added GST_DBG and the log prints these msg:

    0:02:50.864485075 1406 0xa7f0b850 WARN baseparse gstbaseparse.c:3676:gst_base_parse_loop: error: Internal data stream error.

    0:02:50.864714740 1406 0xa7f0b850 WARN baseparse gstbaseparse.c:3676:gst_base_parse_loop: error: streaming stopped, reason not-linked (-1)

    QMediaPlayer slot error is triggered with “Invalid media type”.

    I obtains whetever file I try to play (also wave) , but if I try to launch a gstreamer pipeline outside Qt it works.

    Have you faced the same issue?

    1. Hello,
      I’m sorry but I did not investigate Qt Multimedia in any way. All I got was a segfault and I tested nothing more. Qt Multimedia was never useful in any way on the Pi, so I did not invest time on it.

      1. Thank you Luca,

        anyway if anyone is interested I opened a more detailed post here:

        https://stackoverflow.com/questions/70668976/qt6-multimedia-module-doesnt-play-audio-on-raspberry-pi-4

        I am interested to know if qtmultimedia works or not at least for audio. With qt5 I have always used qtmultimedia for audio and bus controlled omxplayer for video, but I would like to start doing some tests with vlc (using kms instead of fkms), since qtmultimedia is not yet usable.

  3. Hi,
    Is the source of POTVL/ PiOmxTexturesVideoLayer available? I can only find one mention of it on github, in your fall app

Leave a Reply

Your email address will not be published.