Saturday, March 12, 2016

Fully Optimised Raspbian Jessie Lite with Accelerated Qt Multimedia Backend (Pi2)

This is a follow-up to the image provided in this article. The concept is identical, but in this case this firmware is smaller, it is based on Raspbian Jessie Lite and includes updated software. The firmware was 1.9GB while now is 759MB. This is the current setup (but I encourage to update to the latest possible firmware):

pi@raspberrypi:~ $ vcgencmd version
Feb 25 2016 14:25:47 
Copyright (c) 2012 Broadcom
version dea971b793dd6cf89133ede5a8362eb77e4f4ade (clean) (release)
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.1.18-v7+ #846 SMP Thu Feb 25 14:22:53 GMT 2016 armv7l GNU/Linux

Download the image here (torrent) (md5: 06d75d03f63674350be6cb807850bf09).
(Please be patient while downloading and decompressing)

The image includes:
  • Qt 5.6.0-rc1: built for armv7 with neon optimisations, including support for touch screens, gstreamer, libinput, tslib, and Bluetooth/Bluetooth BLE using bluez (complete configuration below).
  • QtWebKit 5.6.0: includes WebKit 1 and WebKit 2.
  • QtWebEngine 5.6.0-rc1: multimedia only based on ffmpeg.
  • Dependant libs: evdev, icu (not the one provided by raspbian), mtdev, libts.
  • Samples: samples from the repo to test POT.
  • POT: POT version 5.2.1 including ffmpeg 2.8.6.

Samples

To have a quick look at multimedia in Qt/QML test with this commands:
  • /usr/local/Qt-rasp2-5.6.0-rc1/bin/qmlscene "some_video_file" samples/video_simple.qml
  • /usr/local/Qt-rasp2-5.6.0-rc1/bin/qmlscene "some_url" samples/webkit_simple.qml
  • /usr/local/Qt-rasp2-5.6.0-rc1/bin/qmlscene "some_url" samples/webengine_simple.qml
  • /home/pi/piomxtextures_pocplayer --multipleanimtest "720p_video_1" "720p_video_2"
Please let me know if you find something wrong and file a bugreport on https://github.com/carlonluca/pi.
Have fun! ;-)

72 comments:

  1. Hi and thanks for this great job ! Do you think is possible to include https://github.com/qtproject/qt-labs-qtsensehat in the next release ?

    ReplyDelete
    Replies
    1. Ok thanks. Otherwise your build work fine on raspberry pi 3 !

      Delete
  2. Hi,
    thank you for your work!
    I used your image and it seems to work fine. However, I get this line when starting a qml file:

    qt.qpa.input: X-less xkbcommon not available, not performing key mapping


    and keyboard input is not working. Do I have to install any runtime libraries? ...I installed libxkbcomon0 but it didn't help.
    Thank you!

    ReplyDelete
    Replies
    1. Actually I didn't test the keyboard, only the mouse. I will have a look.

      Delete
    2. Thank you!
      Would you prefer if I created a github issue?

      Delete
  3. Hello Luca,

    Thanks for this great project. It is just what I was looking for. I have a question. This image is fine, by the way I added GUI, because I need to look at the logs my application makes. I followed your post http://thebugfreeblog.blogspot.rs/2013/03/raspberry-pi-wheezy-image-with-qt-and.html for copying everything needed back to my PC. The problem now is I don't know what to put in my /usr/local/ as qmake. I saw that there is a qmake included on the image, so I copied the entire Qt-rasp2-5.6.7-rc1 folder back to my PC. The problem is that it doesn't have a Mkspec for qmake I copied from RPi. What should I do about that Mkspec and how can I solve this problem?

    Thanks in advance.

    ReplyDelete
    Replies
    1. You need to set the system to crossbuild properly. You should follow a crossbuild guide.

      Delete
    2. This comment has been removed by the author.

      Delete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Hello,
    Many thanks first for you raspbian image, it allowed us to make some tests with qml apps.
    Since we want to compile some QT C++ code onto the Raspberry pi itself, we want to know if you have a qmake compiled or functionnal on the rapsberry pi. Your binary folder on the Rpi contains qml for ARM, but qmake for x86. We are just looking for a proper environment for testing purposes, and your image with pre-build QT was really helpful for that, and would be perfect with a functionnal compiling environment.
    Regards.

    ReplyDelete
    Replies
    1. I'm sorry, I only crossbuild, so I don't have a qmake for ARM.

      Delete
  6. Ok thank you for your answer. We'll manage to compile the QT environment by our own. Do you have any tutorial to follow ? (excepting the QT wiki's one)

    ReplyDelete
    Replies
    1. I'm sorry but I never build on the device itself.

      Delete
  7. Hello, we're currently trying to cross-compile Qt Quick and other components with some difficulties. Qt Base compiled successfully according the wiki's instructions (https://wiki.qt.io/RaspberryPi2EGLFS), but we can't manage to cross-compile other modules, including Qt Quick. Did you follow a particular tutorial ? Did you write any instructions when you successfully managed to compile Qt Quick ? Thanks in advance.

    ReplyDelete
    Replies
    1. There are a couple of procedures in this blog. Look older articles and you'll find them. Nothing changed since then. The procedure still is similar.

      Delete
    2. Hi Luca!

      I have found your blogspot when I was trying to cross-compile qt5.6 for Rasperry Pi 2.
      It's great inspiration for me! Thanks to that I have managed to cross-compile qt library on Ubuntu myself :)

      However, I am stuck with qtwebengine :( I saw you have succeeded building it for your POT. Would you share some tips what is required to cross-compile it?
      Despite installing and syncing with sysroot all dependant libraries, I still recieve following errors:

      Running configure tests
      Checking for khr... yes
      Checking for libcap... yes
      Checking for snappy... yes
      Checking for srtp... yes
      System zlib or minizip not found. Using Chromium's copies.
      System libwebp or libwebpdemux not found. Using Chromium's copies.
      System libxml2 or libxslt not found. Using Chromium's copies.
      System libevent not found. Using Chromium's copy.
      System jsoncpp not found. Using Chromium's copy.
      System opus not found. Using Chromium's copy.
      System vpx >= 1.4 not found. Using Chromium's copy.
      Certificate handling.............. Using bundled BoringSSL
      ICU............................... Using internal copy (Default, force system ICU with WEBENGINE_CONFIG+=use_system_icu)
      FFMPEG............................ Using internal copy (Default, force system FFMPEG with WEBENGINE_CONFIG+=use_system_ffmpeg)
      Proprietary codecs (H264, MP3).... Not enabled (Default, enable with WEBENGINE_CONFIG+=use_proprietary_codecs)

      Unmet dependency: xcomposite
      Unmet dependency: xcursor
      Unmet dependency: xi
      Unmet dependency: xrandr
      Unmet dependency: xscrnsaver
      Unmet dependency: xtst
      QtWebEngine will not be built.
      make: Nothing to be done for 'first'.
      make: Nothing to be done for 'install'.


      Thanks!

      Delete
    3. It seems you are missing deps. But I didn't build with X11 support.

      Delete
    4. I have configured qt to build in 'eglfs mode' (the same configuration as yours). Everything else cross-compiles for me in this mode for raspberry (headless jessie). That's why I was wondering if qtwebengine required something else when I saw you have managed to build it in your image ;)

      Delete
    5. I have the same problem, also using the sysroot from Lucas image, so all deps should be resolved...

      Did you manage to compile qtwebengine somehow?
      please let me know if so!

      Delete
  8. Hi Luca,

    I apologize for my stupid questions before. I just had to read older posts better and it worked well. Videos work very well now so thanks again for that.

    The application I am developing can work in two modes. First one is playing videos and it works perfect now. In second mode application receives base64 jpeg images over UDP socket and I show them in UI with image QML element. I was wondering does this jessie lite image provide some better way that loads images faster by using hardware acceleration. Image QML elements load my jpegs rather slow, so I had to implement some kind of circular buffer to avoid blinking, and I still get about half a second delay which it takes to load image after receiving it.

    I hope my question was clear. In one of your first posts(http://thebugfreeblog.blogspot.rs/2012/12/decoding-and-rendering-compressed.html) you wrote about rendering images, but I didn't find a post about rendering images in QML.

    Thanks in advance.

    ReplyDelete
    Replies
    1. Hello, yes Jessie image should provide acceleration for jpeg decoding. I implemented that in the past in Qt. But that implementation is not included in current POT. The QML Image element will use the regular jpeg library, probably turbo jpeg. There is work to be done to use acceleration: start from my article, download the sources and try to start from there.

      Delete
    2. Thanks I will try that when time allows.

      Delete
  9. Hello Luca!
    Unfortunately the image seems to be no longer available under the link you provide above.
    Could you re-upload the image or make the link working again?
    Thank you for your work!

    ReplyDelete
  10. I downloaded the image and try the examples however the video doesn't show up on the screen :S

    http://pastebin.com/52Nqrmtx

    I tried from ssh and direct on the rpi2 :(

    ReplyDelete
    Replies
    1. Is that the only video not being played? Is the 1080p version ok?

      Delete
    2. 720p and 1080p work but 480p doesn't :s there is any setting to make 480p work? BTW using 480p should be the reason why I havent been able to play the video on the RPi1 :s

      Delete
    3. I tested another 480p and it seems to work. You can however open an issue in github.

      Delete
  11. To be able to cross compile I need to compile Qt again using the sysroot of this image, right? Can't I use a previous compiled Qt for an older image?

    ReplyDelete
    Replies
    1. No, the image contains all you need to build and run Qt apps. It has a build of Qt and the x86_64 tools needed to crossbuild. No need to build Qt again.

      Delete
    2. Found the Qt tools compiled :)

      I copied "gcc-linaro-arm-linux-gnueabihf-raspbian" to /opt/rpi but qmake can't find it:

      ze@ze-MacBookPro:~$ cd qmlcpp/
      ze@ze-MacBookPro:~/qmlcpp$ ~/raspi2/qt5/bin/qmake -r
      Could not find qmake configuration file devices/linux-rasp-pi2-g++.

      Delete
    3. You need a crossbuilding guide probably. Also I never used mac os for this, can't tell you if and how it works.

      Delete
    4. I'm on ubuntu. I need to know where you point the gcc-linaro-arm-linux-gnueabihf-raspbian during qmake build so I can put the tools there.

      Delete
    5. copy Qt-rasp2-5.6.0-rc1 to /opt/rpi/sysroot/usr/local sovled the problem:
      "ze@ze-MacBookPro:/opt/rpi$ sudo rsync -avz pi@192.168.1.70:/usr/local/Qt-rasp2-5.6.0-rc1 ./sysroot/usr/local"

      Delete
  12. Hello Luca,
    We are trying to cross compile simple applications using QtWebEngine with your image. We have difficulties installing a proper cross-compiler environment with Qt. We had already retrieved the raspberry pi tools github repo with the linaro compiler and successfully compiled some apps, but how we can retrieve your image libraries for cross-compiling ? We want to compile an app using the QtWebEngine. Many thanks

    ReplyDelete
    Replies
    1. You need to cerate the sysroot. Read a cross-build manual or a Qt tutorial to do that.

      Delete
  13. Hello my friend. I have some questions if you can answer me please:

    1) I'm decompressing this thing and it takes more than 8hours.(for the time being failed once) Is this normal?(I use lrzuntar on a low power laptop with lubuntu)

    2) This image will allow me to make programs using the QtMultimedia library(I want to make use of mp3s or wavs)? I want to make programs with UI accecible via VNC.

    3) (this is a little bit hard to know) I tried installing on my RasPi3 Qt.(Qt5.3.x installed from official repos) For some reason(xkb as I searched) the keymap layout, only for the Qt, was totaly wrong.(e.x. I press "d" key, "f" key comes up) I use tightvnc server to access my Raspi3.

    ReplyDelete
    Replies
    1. 1) Possible, depends on the hardware. Use a current hardware to decompress.
      2) Yes, you can play mp3s and (probably) wave formats.
      3) This image does not include X11 at all. It is designed with the purpose of removing that software.

      Delete
    2. Thank you my friend for your (+fast) answer!

      1) Decompress (maybe) "normally" on my i5 laptop with a lubuntu VM in 2-3 hours. Please post the MD5 or sha1 of the img if it's possible.

      2-3) I guess I can install the X windowing system again(maybe tightvnc install it by default). Is the Qt configured though to not work with GUI enviroments?

      P.S.: If you want, I can help by uploading the image somewhere more accecible to everyone - like dropbox. Also I can wrap the "img" into a "tar.bzip" to be more friendly for everyone.

      Delete
    3. 1) I don't have the image anymore. You have the md5 of the archive. If you have the image you can confirm it is not corrupted by using it. Or maybe someone else can answer.
      2) Qt is built without X11 support. GUI is rendered without it to guarantee much better performance. If you are targeting X11 this image is completely wrong for you.

      You can do whatever you want with the image. I tried to use dropbox but they suspended my account in one or two days because I reached the limit of bytes downloaded. I'm serving many gigabytes of data, this is the best way I found.

      Delete
    4. You have any idea then, how I can use Qt 5.6 with QtMultimedia for UI application in RasPI? I have no clue how I can do this. I tried what the offical Qt guides say but with no luck at all!

      Delete
  14. This comment has been removed by the author.

    ReplyDelete
  15. Where should I copy qtdeps? thank you

    ReplyDelete
    Replies
    1. Wherever you prefer. The lib directory obviously must be in the library search path.

      Delete
  16. "i@raspberrypi:~/qmlcpp/bin $ ldd qmlcpp
    linux-vdso.so.1 (0x7ecd8000)
    /usr/lib/arm-linux-gnueabihf/libarmmem.so (0x76fe0000)
    libQt5Quick.so.5 => not found
    libQt5Gui.so.5 => not found
    libQt5Qml.so.5 => not found
    libQt5Network.so.5 => not found
    libQt5Core.so.5 => not found
    libGLESv2.so => /opt/vc/lib/libGLESv2.so (0x76faf000)
    libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x76f87000)
    libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0x76eab000)
    libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x76e30000)
    libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x76e03000)
    libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x76cc1000)
    libEGL.so => /opt/vc/lib/libEGL.so (0x76c88000)
    libbcm_host.so => /opt/vc/lib/libbcm_host.so (0x76c62000)
    libvchiq_arm.so => /opt/vc/lib/libvchiq_arm.so (0x76c4c000)
    libvcos.so => /opt/vc/lib/libvcos.so (0x76c32000)
    libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0x76c1e000)
    librt.so.1 => /lib/arm-linux-gnueabihf/librt.so.1 (0x76c07000)
    /lib/ld-linux-armhf.so.3 (0x54aac000)
    pi@raspberrypi:~/qmlcpp/bin $ ./qmlcpp
    ./qmlcpp: error while loading shared libraries: libQt5Quick.so.5: cannot open shared object file: No such file or directory
    pi@raspberrypi:~/qmlcpp/bin $"

    why couldn't it found the libraries?

    ReplyDelete
    Replies
    1. Because for some reason the libs are not in the library search path. In this image the position is also added with an rpath so did you move the libs?

      Delete
    2. I solved the above with ldconfig.

      Compiling on the PC I'm having problems: http://pastebin.com/kW3fawkS

      Delete
    3. copied qtdeps to sysroot, done :)

      Delete
  17. Hey Luca,

    I got a Banana Pi few days ago. It has a a better processor then my Raspberry, so naturally I wanted to use it to run my applications. I tried booting the image I got from here, but it couldn't boot that way.

    Are you maybe planning to create a image for banana pi in the future? If not which files do you think I would have to copy from your image to banana pi image for everything to run as on raspberry? Do you think it is even possible or not?

    Thanks in advance.

    ReplyDelete
  18. banana pi is a different CPU so it wont work! You should look into https://github.com/wang-bin/QtAV

    ReplyDelete
    Replies
    1. Thanks for fast answer, but I think you are wrong mostly because I didn't provide you with correct information.

      Raspberry Pi 2(sorry I didn't mention it was RPi 2) has a ARM Cortex-A7 CPU, as does Banana Pi M2(sorry again). and also Banana Pi M3, which I am thinking about buying in the future. So I am using RPi 2, so CPU is the same. That's why I thought about just copying files as the easiest solution.

      I will look into the link you provided, but it'd be really great if the easier way of copying files to image is possible :)

      Delete
    2. Architecture is the same but the CPU, peripherals, GPU, etc are different and you can't just use the RPi image on the banana pi.

      Delete
    3. Yes, I tried and it didn't work of course. That's what I expected after all but I tried anyway. ^^

      My question is can I copy files from directories like /usr/local/Qt-rasp2-5.6.0-rc1 and /home/pi/qtdeps which contain files that Qt needs and perhaps from some others directories from the image I downloaded here, and use them on Raspbian image for Banana Pi? If those files are compiled to run on ARM Cortex-A7 CPU I suppose they can be used on other OS image right? I would leave all other files on new image as they were, just add those from Luca's image needed to run Qt applications.

      Delete
    4. No. Because that files will look into other files that doesn't match what they expected.

      BTW did you look at QtAV?

      Delete
  19. I get a error when playing a video many times after each other (same video) this is the error,
    COMXVideo::Decode - OMX_EmptyThisBuffer() failed with result(0x80001018)
    do you no how to fix it?

    ReplyDelete
    Replies
    1. Try to update the firmware with rpi-update and the POT libs. If the problem persists please report the bug on github with a minimal code reproducing the issue.

      Delete
  20. Hi Luca,

    I am developing some kind of virtual bingo app. Let me briefly tell you how it works. It plays three videos in a sequence non stopping. All videos are full HD by the way. First one is always the same. It is video of announcer telling players to get ready for next number. The second video loads dynamically based on next number received from server. It shows that number being picked. The third one is also loaded based on next number and it shows announcer telling players which number was picked. That sequence is looping on client application non stopping.

    The first problem I got was loading new videos(in other Video QML elements ofc) while some video i playing. I found spot in statically loaded video where missing few frames isn't a problem so that is fixed.

    The second problem is the only real one here. The thing is that at some time the app just stops and stays frozen. Sometimes that happens few seconds after app is started, other times app runs smoothly for much longer periods, but the thing is it isn't stable. Do you know, or have any idea, what could be the problem based on my story?

    I also tried loading all videos on start and playing them when needed, but then memory gets filled too fast and it says "eglCreateImageKHR: failed to create image for buffer 0x36 target 12465 error 0x300c". I am running app on Raspberry Pi 2, with memory split in such way that GPU gets 512MB. I tried to give GPU 768MB, but that doesn't fix the problem either.

    ReplyDelete
    Replies
    1. Just to add that fastest freezing happens just after loading second and third video for the first time(I load them both at once), but it also happens in other moments randomly.

      Delete
  21. Hey Luca,

    I am developing some kind of virtual bingo game. Briefly it looks like this. I play three videos in loop. All videos are full HD by the way. First one is always the same and it is announcer telling players to get ready for next number. Second and third one are loaded dynamically based on which number is next and I get that number from server. Second is number being picked and third is announcer saying which number was picked. Those three videos run non stopping the entire time.

    The problem I got is that sometimes application just stops and freezes. This can happen as soon as I load dynamic videos for first numbers, but sometimes the app runs smoothly for much longer periods but then it freezes at some point of time. I gave GPU 512MB, giving it 768MB doesn't fix problem either. Loading all videos on start is also impossible since it fills entire memory and all fails. Do you know, or have any idea, base od what I've told you what could be the problem? I am using Raspberry Pi 2 by the way.

    P.S. The post above is also mine, you can delete it, it was a mistake.

    ReplyDelete
    Replies
    1. Sounds like this: https://github.com/raspberrypi/firmware/issues/449. Update the POT libraries with the latest releases and update the firmware as broadcom release a critical fix. Use rpi-update on this image if you want.

      Delete
  22. Hi Luca

    Do you know which formats(beside mp4) can be played in full HD resolution? I found that mov, m4v, 3gp and avi sometimes work well(didn't try them on full HD tbh but they are played). The problem is that avi is usually producing InvalidMedia status, but sometimes also works. Did you maybe tested more formats and know which can be played always with no worries?

    ReplyDelete
    Replies
    1. Most h264 should be supported. Refer to broadcom spefications to know the exceptions. If you bought also other codecs you can decode those as well, like mpeg2. Broadcom offers some.

      Delete
  23. Hello Luca,

    I was reading your older blog posts, and stumbled upon this one http://thebugfreeblog.blogspot.rs/2012/11/32-bit-color-depth-qt-on-raspberry-pi.html, and one that was linked from there http://thebugfreeblog.blogspot.rs/2013/03/bring-up-qt-501-on-raspberry-pi-with.html.

    I also noticed before that no matter what I set with fbset color depth stays same(as mentioned in first linked blog). I am using firmware 4.4.27-v7+ which I updated to a few days ago using rpi-update if it is even relevant for this topic.

    I am using this image, so I was wondering do you have prebuild libraries needed to run Qt QML applications in 32 depth mode(or 24 maybe) since you made this image, and have mentioned building needed libraries with 32 depth before?

    Thanks in advance.

    P.S.If you do not and I would have to build it myself would this http://thebugfreeblog.blogspot.rs/2012/11/32-bit-color-depth-qt-on-raspberry-pi.html be enough to make it work? Also which version of Qt source code should be used for building libraries in order to work with Qt you built on this image.

    ReplyDelete
    Replies
    1. Have a look at POCPlayer. Is it rendering 24 bits properly?

      Delete
    2. I tested POCPlayer. I'm not quite sure is it 24 or maybe 32, because video I checked with has no opacity, but POCPlayer uses at least 24 bits since video looks much better then in my application.

      Delete
    3. In that case check POCPlayer source code. Probably during initial setup the proper EGL configuration is selected. The configuration of the fb is not probably taken into configuration by Qt.

      Delete
  24. It worked, thanks.

    ReplyDelete
  25. What is the decryption key for the image file?

    ReplyDelete