Using POT Builds

As many have troubles building POT from sources I also try to provide builds. Each build contains Qt libs and POT (which includes also ffmpeg internally). This article explains quickly how to use Qt + POT builds and integrate into your image. It is actually pretty simple: I'll start from a clean Raspbian on Raspberry Pi 2. The Raspbian version for which the builds are supposed to work is always the latest one at the time of the publication.

Installing POT on a Running Device and Test

  1. Uncompress the archive and copy the Qt build into your Pi in /usr/local. Do not rename it as rpath is set.
  2. If provided, copy qtdeps into your Pi, wherever you want.
  3. Copy piomxtextures_pocplayer into your Pi, wherever you want. You'll need this only if you want to test it. Not needed when you'll run your application.
  4. Copy all the samples in the samples directory if you want to test those.
  5. Assign more RAM to the GPU (do this using the Pi config tool or by setting gpu_mem in /boot/config.txt to 256MB).
  6. Into your Pi add the qtdeps/lib path to the dynamic linker search path. You can do this by setting the LD_LIBRARY_PATH to that directory or by adding it to the /etc/ld.so.conf.d/pot.conf and running ldconfig.
  7. Now all the deps should be ok and you can try to run a sample app. Let's start from the C++ POCPlayer:
    1. ./piomxtextures_pocplayer /some/abs/path
  8. You can also try using qmlscene. Try for instance the simple video_position.qml:
    1. /usr/local/Qt-rasp2-5.5.0/bin/qmlscene video_simple.qml file:///.../big_buck_bunny_1080p_h264.mov
You can also change the paths if you want, but you'll have to see if everything keeps working or adapt the procedure for that.

Configuring

There are a few features that are not available in Qt API (at least not that I know). You can control these features with env variables before running your app (changing those dynamically is not possible, but it is simple to implement if you want to contribute). These are the variables:
  • POT_HALF_FRAMERATE_MODE: if set to 1 the number of frames sent to the renderer are halved. This is needed mostly when using deinterlacing.
  • POT_TEXTURE_COUNT: number of texture to be used when buffering. Default is 4.
  • POT_DEINTERLACE_MODE: the type of deinterlacing; 0 means off, 1 means auto and 2 means on.
  • POT_DEINTERLACE_QPU: 0 or 1; indicates whether to use the QPU for deinterlacing.
  • AUDIO_OUT (I'll soon add POT_AUDIO_OUT; AUDIO out will probably remain for backward compatibility): you can use this to set the audio output to use:
    • hdmi means output to HDMI;
    • local means output to headphones;
    • both means... well both the above;
    • default is HDMI.

Building Your Own App

You can use the Qt build to build your own app. To do this place your sysroot into /opt/rpi/sysroot and the Raspbian toolchain in /opt/rpi/gcc-linaro-arm-linux-gnueabihf-raspbian on your host and use the qmake command in /opt/rpi/sysroot/usr/local/Qt-rasp(2)-5.5.0/bin to build your application.

[More details to come for this]

44 comments:

  1. Hi Luca, I have a question ?
    The above steps are to make applications using cross-compile ???

    Thanks for your fantastic work.

    ReplyDelete
  2. Hello Luca,
    Is there a way how to build my own app on 32bit system ? I think you binary files (qmake) are 64bit.

    ReplyDelete
  3. I have followed the procedure and everything seems fine but when I try to play video using pocplayer it return only black screen.
    And one more question is can this player run with xcb platform?If not can I build to work it with xcb??

    ReplyDelete
    Replies
    1. Please post the logs you get running pocplayer.
      I'm sorry, I never tried on xcb.

      Delete
    2. I forgot to say that now the player won't start the video immediately. So use the mouse or the keyboard to make the bar appear and play the video to make it start.

      Delete
  4. Hi,

    i just stumbled about your really promising posts. But i still have a few general questions.
    I would like to use your binaries to run videos hw accelerated on the rpi using qtmultimedia.

    1) That's what your binaries are meant for, right?
    2) I will cross compile qt5.5.1 from my linux host pc (actually upgrading from v5.3). Do i need to change anything in the cross-compile-process, e.g. "configure" options?
    3) I plan to enable gstreamer1.0 support, just in case. Does it interfer with your binaries, or should i rather not enable it?

    Thanks a lot for your help,
    Ben

    ReplyDelete
    Replies
    1. 1) yes.
      2) change from what? It depends from what you start. The builds however include most Qt modules already.
      3) No, and the builds also contain it. Although performance are bad for some reason. However you need to hide that when running your app or gstreamer takes precedence.

      Delete
    2. Ah ok, now i understand.I can use your binaries with my own raspbian wheezy image. Cool.
      So, then i have some follow up questions:

      10) >If provided, copy qtdeps into your Pi, wherever you want.
      What are qtdeps? Further dependencies for qt? Aren't they included in your binary?

      11) >To do this place your sysroot into /opt/rpi/sysroot
      Which sysroot do you mean? Is that included in your package?

      12) >However you need to hide that when running your app or gstreamer takes precedence.
      Ok, i am not going to compile qt any more, i will use your binaries. Do i still have to take care of that, when running my own apps? If yes, how?

      13) I have qt5.3 on my RPI, do i have to remove it? How can i do that?


      Thanks so much for providing this package, much easier than compiling it myself.

      Ben

      Delete
    3. 10) Qt deps not included in raspbian.
      11) No, it is the sysroot of your Pi.
      12) No, it is already placed in another path.
      13) Depends on your setup. Qt typically adds a rpath, so you may not need it. You can have multiple Qt installations.

      Delete
  5. 10) ok, so i simpy use the qtdeps folder from your binary package?
    11) ok, i am not sure what exactly i have to do. The sysroot refers to a basic file system of the rpi, right?
    So, i create a sysroot folder and copy a few folders from my rpi to that? Which ones? /lib, /usr/include, /usr/local
    Or is there a program/command "create sysroot"?

    thanks for your help

    ReplyDelete
  6. 10) yes
    11) you should follow a regular crossbuild guide.

    ReplyDelete
  7. Hi Luca,

    i followed your instructions but get the following error when starting "./piomxtextures_pocplayer"
    How can i find out, what i did wrong?

    Thanks,
    Ben

    >This application failed to start because it could not find or load the Qt platform plugin "eglfs".
    >Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, xcb.
    >Reinstalling the application may fix this problem.
    >Aborted

    ReplyDelete
    Replies
    1. Are the libs in qtdeps in the dynamic linker search path?

      Delete
    2. I think so. Is there a way to check?

      1) That's the content of /etc/ld.so.conf.d/pot.conf:
      /home/pi/piview/lib/qtdeps
      2) Then i called: sudo ldconfig

      Ben

      Delete
    3. ok, my fault. I added /qtdeps and not /qtdeps/lib.
      Now it seems to start but the screen stays dark.
      Any ideas?
      Ben

      pi@raspberrypi ~/piview/lib $ ./piomxtextures_pocplayer big_buck_bunny_1080p_h264.mov
      Unable to query physical screen size, defaulting to 100 dpi.
      To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
      defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
      QDeclarativeAudio::itemChange
      QMediaPlayer::onItemChanged
      QDeclarativeAudio::itemChange
      QMediaPlayer::onItemChanged
      19:58:15.946 INFORMATION: Showing media: big_buck_bunny_1080p_h264.mov.
      19:58:15.951 VERBOSE: Can't find extension for .
      19:58:15.953 VERBOSE: Can't find extension for image/jp2.
      19:58:15.955 VERBOSE: Can't find extension for image/vnd.microsoft.icon.
      19:58:15.957 VERBOSE: Can't find extension for image/x-dds.
      19:58:15.959 VERBOSE: Can't find extension for image/x-icns.
      19:58:15.961 VERBOSE: Can't find extension for image/x-mng.

      Delete
    4. Yes my fault, I disables auto start but now no one can understand what is happening. Click with the mouse or the keyboard and click the play button on the bar that appears. You should see the mouse pointer.

      Delete
    5. ah ok thanks.
      I am working through ssh on the pi, so no mouse or keyboard attached.
      I tried your second example with qmlscene, but get similar results:

      1) qmlscene with "video_simple.qml" and a video -> screen stays black:
      $ /usr/local/Qt-rasp-5.5.0/bin/qmlscene samples/video_simple.qml big_buck_bunny_1080p_h264.mov

      Unable to query physical screen size, defaulting to 100 dpi.
      To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
      file:///home/pi/piview/lib/big_buck_bunny_1080p_h264.mov:1 Expected token `numeric literal'
      file:///home/pi/piview/lib/big_buck_bunny_1080p_h264.mov:1 Expected a qualified name id


      2) qmlscene without any qml and video file will display a file open dialog, so qmlscene seems to work.
      $ /usr/local/Qt-rasp-5.5.0/bin/qmlscene

      Ben

      Delete
    6. Qml samples require uris not simple paths.

      Delete
    7. To be clearer, something like:
      /usr/local/Qt-rasp-5.5.0/bin/qmlscene samples/video_simple.qml file:///home/pi/big_buck_bunny_1080p_h264.mov
      This is to make samples as simple as possible.

      Delete
    8. The URI makes no difference here:
      /usr/local/Qt-rasp-5.5.0/bin/qmlscene /home/pi/piview/lib/samples/video_simple.qml file:///home/pi/piview/lib/samples/big_buck_bunny_1080p_h264.mov

      => this leads to:
      >Unable to query physical screen size, defaulting to 100 dpi.
      >To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
      >defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
      >QDeclarativeAudio::itemChange
      >QMediaPlayer::onItemChanged
      >QDeclarativeAudio::itemChange
      >QMediaPlayer::onItemChanged

      Any ideas?
      Is the "..no service found.." a hint?
      Does it matter if the display is connected through hdmi or vga? I am using hdmi.

      Ben

      Delete
    9. Did you follow step 6 properly?

      Delete
    10. At least, i think so:
      *) That's the content of /etc/ld.so.conf.d/pot.conf:
      /home/pi/piview/lib/qtdeps/lib
      *) Then i called: sudo ldconfig

      1) Do you think that's correct?
      2) Do i miss some other libraries, that are not included in qtdeps?

      Delete
    11. You should know if you have all the dependencies or not. Use export QT_DEBUG_PLUGINS=1 to find out what is wrong.

      Delete
    12. Tataaaah :-)
      My PI is playing movies..

      Thanks for your help, i upgraded my packages and added some missing libraries.
      Great work!!

      BUT:
      1) using qmlscene and video_simple.qml the bunny movies stops after a few seconds and then it is repeated again.(POT v.4.5.0 and qt5.5.0) -> any idea why?
      2) Are there any options for POT (e.g. env. variabels) that i can set?

      Ben

      Delete
    13. 1) No, not without the logs. However POT 4.5.0 is pretty old. You've better use 5.0.0 or 5.1.0 at least.
      2) Not sure what you mean.

      Delete
    14. 1) I upgraded to POT 5.0.0 (Pi1, wheezy), still the same. After a few seconds the movie starts again. I tried different sample videos, with h264 encoding.
      Can i send you the console output somehow? pretty much to paste it into this blog, or should i?

      2) In POT v5.1.0 you introduced the environment variable POT_HALF_FRAMERATE_MODE. Are there more except that one?

      Delete
    15. 1) you can file an issue on github if you want. Or use pastebin.
      2) yes:

      grep -R qgetenv *
      piomxtextures_src/omx_staticconf.cpp: QByteArray ba = qgetenv("POT_HALF_FRAMERATE_MODE");
      piomxtextures_src/omx_staticconf.cpp: QByteArray ba = qgetenv("POT_TEXTURE_COUNT");
      piomxtextures_src/omx_staticconf.cpp: QByteArray ba = qgetenv("POT_DEINTERLACE_MODE");
      piomxtextures_src/omx_staticconf.cpp: QByteArray ba = qgetenv("POT_DEINTERLACE_QPU");
      piomxtextures_src/omx_mediaprocessor.cpp: QByteArray a = qgetenv("AUDIO_OUT");

      I described those in an article, and the AUDIO_OUT in a github issue. More info in the sources.

      Delete
    16. I added more info to the article.

      Delete
  8. Hi,

    I am trying to setup my crosscompilation environment, but don't know which compiler to use.
    My Host is: 64Bit Debian
    POT Qmake v5.0.0 for jessy PI1, which is 64 Bit as well, i guess

    I tried: /opt/rpi/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++
    but qtcreator shows an error: .. no compiler can compile code for this qt version.

    Thanks for your help,
    Ben

    ReplyDelete
  9. Sorry, found it ...
    I just had to download the 64 Bit version of the toolchain

    ReplyDelete
  10. Hello sir
    Can i use the POT Builds with othe than Raspbian?
    Currently I use arch linux arm
    Thank you

    ReplyDelete
    Replies
    1. I have no idea, sorry. I don't think so unless all the dependencies are compatible.

      Delete
    2. Of course I referred to the builds I provide. You can build on your own and I suppose it should work.

      Delete
  11. Hello luca, thank for your sharing,
    i couldn't use your code to build my own apps on raspberry pi2, so i managed to replace my libqt5multimedia.so with yours, it worked after some struggling, but i have the same poor performance, then i replaced the gstmediaplayer.so plugin in mediaservice folder but same poor performance also. please do you have an idea have it works

    ReplyDelete
    Replies
    1. Not sure why you want to replace libqt5multimedia with yours. What I provide is sufficient to build and run your apps just like mine. You have the qmake binary and all the libs.

      Delete
    2. thanks Luca, the problem is that i have installed QT5 using raspbian jessie repository because i couldn't build my own QT5. However I tried to set qtcreator for cross compiling using your build, but seems that your qmake is 64 bit exe and i have ubuntu 32 bit system.
      please can you help how i could set a cross compiling environement using your build?
      thank you very much for your amazing sharing

      Delete
    3. Follow Qt documentation for the setup. Use a 64bit system if you want to use this implementation. I can't speak for the repo Qt5, I never used that.

      Delete
  12. Hi Luca,
    I'm trying to use those builds on my rPi 2 (and 3).
    I followed all the instructions for the installation even in the comments but when I try to start piomxtextures_pocplayer or even a sample .qml I always get "Illegal instruction" error.
    I tried different POT builds but without any result...

    Thank you in advice for an answer

    ReplyDelete
  13. Hi Luca,
    I'm trying to install and run one of your latest versions (5.4.0) on a RPi3 with a clean install of Raspbian jessie lite. Unfortunately I keep running into dependancy issues; libfontconfig and libxslt for example. I might be able to install them through apt-get, but from what I read all dependancies should be included.
    Thanks!

    ReplyDelete
    Replies
    1. Only dependencies not available in raspbian repos are included. Those available in regular raspbian repos are not included: you can simply install using apt-get.

      Delete
  14. Hello Luca,
    "AUDIO_OUT (I'll soon add POT_AUDIO_OUT; AUDIO out will probably remain for backward compatibility): you can use this to set the audio output to use:
    hdmi means output to HDMI;
    local means output to headphones;
    both means... well both the above;
    default is HDMI."

    it it works on POT version 5.7.0 ? (built by myself)
    Thanks.

    ReplyDelete