Thursday, August 8, 2013

Raspberry Pi Wheezy Image With OpenMAX-based Multimedia Backend

Please take into consideration that this firmware is based on an old firmware and an old PiOmxTextures version.

As I see still someone has troubles building PiOmxTextures, I built a new image based on the Raspbian wheezy image released the 26th of July (http://www.raspberrypi.org/downloads). This version of the image also contains Qt version 5.1.2 (35fe76d9c343f98ec55c7cacd8c402e90d91ef38) and an OpenMAX-based Qt Multimedia plugin (PiOmxTextures). The available Qt modules are:
  • qtbase
  • qtscript
  • qtxmlpatterns
  • qtjsbackend
  • qtdeclarative
  • qtsensors
  • qtquick1
  • qtgraphicaleffects
  • qtwebkit
  • qtwayland
  • qtsvg
  • qtserialport
  • qttolls
  • qttranslations
  • qtquickcontrols
  • qtmultimedia
  • qtimageformats
The mediaservice plugin installed is the openmaxil plugin (available here: https://github.com/carlonluca/pi). It is based on ffmpeg version 2.0 and that version of ffmpeg is statically built inside the PiOmxTextures library available in /usr/lib.
Note that the wayland module and the wayland and xkbcommon libs are available in the image, but I never tested those. Also, PiOmxTextures won't work with wayland but only using the eglfs platform plugin.

How to Test

Of course all this is experimental and if you seriously intend to use in production I suggest you start working on the sources in https://github.com/carlonluca/pi. I placed a build of the POCPlayer (sources are available in the same repository under tools/POCPlayer) in the home directory of the pi user. You can run it and see how it works:

./POCPlayer [video_file]

By pressing the "l" button, you can see the possible options. The POC player is experimental as well and it is entirely implemented in QML.
You can help improve and fix both PiOmxTextures lib and the openmaxil plugin by simply replacing libPiOmxTextures in /usr/lib and/or libopenmaxilmediaplayer.so in /usr/local/Qt-rasp-5.1.2/plugins/mediaservice.

How to Use

Refer to Raspberry Pi Wheezy Image With Qt and Wayland Support for instructions on how to use. The procedure is almost identical. Then, you can simply build your QtMultimedia-based application and test.

Where to Download

Unfortunately the download is over 1GB. You'll have to download from this ed2k link. You can download it with this excellent torrent. Thanks to the author.

Please let me know if you experience troubles downloading or with the image itself. Bye!

78 comments:

  1. Hi Luca,

    I would love to test the image but unfortunately eMule downloads the file with 1 - 3KB/s, estimating almost a week for the download. Could you please upload the file as a torrent or could you please send it using something like SoShare (https://soshareit.com/v2) or some other file sharing service ed2k is so damn slow.

    Thanks,
    Catalin

    ReplyDelete
    Replies
    1. Hi Luca,

      Thank you for your work!
      I have the same troubles as Cata.
      I managed to install qt on my raspberry Pi, but couldn't get qtwebkit and your video widget to work. Your all in one file is greatly appreciated :)

      If you could upload it somewhere else it would be great!

      Thanks.

      Delete
    2. Hi Lucas,

      Thanks for your terrific work on the raspberry, your are pushing the limit in every post !

      Following all the instruction in your post, I've succeeded to build QT5 and your custom mediaservice plugin based on omxplayer_lib. I have also succeed in running your QTMultimedia POCPlayer test app and your standalone PiOmxTextures app.

      But at the end, all my videos seems to be displayed with a 16 bits color depth ! So I have followed your post regarding forcing 32 bit color depth for EGLFS... I have rebuilt the pluqin libeglfs.so and the logs are indicating that I have now a 32 bit EGLFS config (RGBA(8, 8, 8, 8).) but I have still the same problem...

      It seems all QML elements (video images etc ...) are displayed in 16 bits color depth because I've also try the QT5 cinematic demo and all the gradient in background are dirty...

      On the other hand, omxplayer command line display a pure video in 32 bit color depth with the same video file. Of course I have already set a 256 Mb for gpu mem and a 32 bit framebuffer depth in config.txt...

      I am totally stuck on this color problem ... would you have any idea that could help me to fix this problem ?

      Bests regards,
      Thomas

      Delete
    3. I'm sorry, but unfortunately I need the bandwidth and providing more is impossible for me at the moment. There are 3 or 4 of you downloading concurrently at the moment.

      And for the other question: sorry, never tested 32bit color depth thoroughly. Are you saying QtWebKit is showing 32bit color depth while the rest of Qt is not?

      Delete
    4. As for the color depth issue, I don't exactly know where the problem is. Maybe in the eglfs plugin or in the policy used by the eglconvenience portion in the platform section. Anyway, I tried the same modification made in the other post and the images in QML seem to be rendered better. Couldn't test the video because I don't have a proper video. Don't you see any difference at all?

      Delete
    5. Dear Lucas,

      Thank you for your answer. I've tried the same test this morning using your pre-built image including Qt5.1.2 and your media service plugin. There is the same color depth problem that I've noticed in my own image.

      omxplayer display a smooth 720p h264/aac video with full true color and when trying with POCPlayer the result is jerky with a 16 bits color depth. You can see it on the screen capture that I've done here (https://mega.co.nz/#!nBh1VIIS). Wait for the apparition of the blue "bear" in his den, it's easy to notice the color depth problem (omxplayer first and then POCPlayer). The logs say that the same decoder is used (omx-h264) in each case.
      It's even worth with a 1080p video file.

      I've also check the CPU usage in the two cases : POCPlayer is around 40% and omxplayer is around 22%.

      Very strange...

      Best regards,
      Thomas

      Delete
    6. decryption key needed to download the file :

      D--e3BtClFCcutbHAPLYdn4FxxMMkAC0rBs8Mnf8CJ0

      Delete
    7. omxplayer is using an entirely different component. So comparing might be useful, but there is no reason I should expect the same performance.

      Delete
  2. There will be some interruptions in the data source for the ed2k link during the week, sorry. If you're in a hurry please be patient.

    ReplyDelete
  3. Just test to launch "http://html5test.com" and look the gradient in the background.

    Note : if you launch with qmlscene --transparent **.qml, then gradient are okay ...

    ReplyDelete
  4. It would be really great if you could upload this file to mega.co.nz or something. At the rate that ed2k uploads, I'd be amazed if a single person got the file from you, and even if someone does, he'd be the only one. I've been trying to get smooth video working on QtonPi for the better part of six months, and your code holds the key to that locker, I just wish I could have it.

    ReplyDelete
  5. Hi,
    I have finally downloaded your file and everything is working great!
    If a lot of people have trouble with the ed2k file I can upload it somewhere if Luca is OK with it.

    I tried to make a video loop with qml, but couldn't do it. I checked your code and it seems you return false in the OpenMAXILPlayerControl::isSeekable() function. I would like to change this part but last time I tried to compiled your module I failed.

    Do you see another way to bypass this problem (the loop video)?

    Thanks again!!

    ReplyDelete
    Replies
    1. Of course you can do whatever you want with the image, sharing on ed2k or uploading anywhere is ok for me.

      Unfortunately the seek functionality is still to be completed. I had difficulties integrating the one from omxplayer code, so some changes might be needed. It is in my TODO list, which is unfortunately getting longer and longer... :-) But do you need to seek to create a loop?

      Delete
    2. Well, First I tried this :

      onStopped: { play() }

      The sound is looping well but the video is stuck at the last frame. So I tried to force the loop by assigning a position to the video with the seek() function but as the seekable variable is still to false I couldn't do do it :(

      I might do this the wrong way...

      Delete
    3. Here is a torrent file which should be better :
      http://s000.tinyupload.com/index.php?file_id=29950714189124478933

      If anyone has found a way to make the video loop, I am still interrested :D

      Delete
    4. Checkout the latest revision. I implemented what was needed to restart the omxplayer component. I created a test sample and I'm currently over 170 consecutive iterations.

      Delete
    5. First, thx for the quick revision :D!

      So I tried to compiled and it went almost fine.
      I got an error with the prepare_openmaxil_backend.sh script: "pcre.h not found" I had to install "libpcre3-dev" on my raspberry and the copy back the "usr/lib" and "usr/include" to my computer.

      But anymway, it compiled and now I have two directories in my PiOmxTextures folder : "lib" and "include". I put the files from "PiOmxTextures/lib" into my raspberry (/usr/lib) and in my sysroot (/opt/rpi/sysroot/usr/lib) on my computer.

      I am not sure what to do next, in your article you talk about a "libopenmaxilmediaplayer.so" file but I don't know where it is.

      Now when i want to launch my programm I get this error :
      "defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer""

      which seems related to the "libopenmaxilmediaplayer.so" file.

      Thx

      Delete
    6. Refer to the other article for the build procedure.

      Delete
    7. I tried to follow the procedure of this article (http://thebugfreeblog.blogspot.it/2013/03/bring-up-qt-501-on-raspberry-pi-with.html), all my file are compiled in "/opt/rpi/sysroot" and I have copied those files into my raspberry.
      But again if I replace the libPiOmxTextures files in /usr/lib I get the same error as before ("defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer""), even after I replaced the old libopenmaxilmediaplayer.so by the new one.

      I don't know where is the problem. Do you have any ideas about this problem?

      Delete
    8. Use the QT_DEBUG_PLUGIN variable to get an idea of what is not ok. Check the needed libs are available, check with ldd etc...

      Delete
    9. Thanks a lot for the torrent, brosicle. 2,5 mbps sure beats 0,0 kbps. Will seed.

      Delete
    10. Erwan, please report back if you get it to work, I too am stuck with having successfully compiled the openmaxil backend, and not getting it to work after I copy it to the Pi.

      Delete
    11. Nope,I couldn't make it work :(
      From what I understood from previous article, you have to compile the qtmultimedia part with the openmaxil folder in it (after a patch). (See http://thebugfreeblog.blogspot.co.uk/2013_04_01_archive.html)
      But it didn't change anything for me. I probably copy the wrong file onto my Pi (or in the wrong location I don't know).
      Compilations are very long and I can't spend too much time on it so I stopped trying.

      It would be great if Luca could upload the new version for this plugin but I understand you can't keep compile and upload your work each time XD

      Anyway, Andreas, if you find a way to do it, I would be glad to know how!

      Delete
    12. Yes, pretty difficult to do something like that. Also pretty useless as this is a proof of concept. Not ready for production. Which means you should be able to work on it as well to make it work. I'll try to provide a more recent lib soon anyway.

      Delete
  6. Nice work but one question. I'm new on using QT5. How can i run the qtwebkit so i can display a webpage. Thx

    ReplyDelete
    Replies
    1. Read the docs: http://qt-project.org/doc/qt-5.0/qtwebkit/qml-qtwebkit3-webview.html.

      Delete
    2. Oh, btw, also read the article about 32 bit color depth. Unless it was implemented recently, it was not possible to use QtWebKit with something other than 32 bit color depth. And 32 bit colors where not working oob with eglfs AFAIK. Bye!

      Delete
    3. Hello Luca!

      Thx for helping me. But now i have an other problem. I can open some webpages with WebKit but if i want to open HTML5test.com i always get the warning message "WARNING: The web process experienced a crash on 'http://html5test.com/'." and the page will not be displayed.
      I use this code to display the Page:

      import QtQuick 2.0
      import QtWebKit 3.0


      WebView {
      url: "http://www.HTML5test.com/"
      width: 1920
      height: 1080
      }

      Delete
    4. It seems the web process crashed but your not providing any information about the crash.

      Delete
    5. How can i give you some extra information. Is there a switch to debug the error?

      Delete
    6. I'm sorry, I don't know. You can try with gdb, strace or similar. Also you can try to ask on #qtwebkit.

      Delete
  7. Hi guys, today I have test the image that you upload Luca and I test the POCPlayer and this is running good but I have a problem when I try compile someone personal basic proyect. I see the message "-bash: qmake: command not found"... The image dont have full install qt5 ???

    into de folder "/usr/local/Qt-rasp-5.1.2/" is not the all files (lconvert, lrelease, qmake, etc) missing many files but do not know why. Will I downloaded image is not complete ? I have to compile all QT5 ??

    I hope someone help me.

    Thanks.

    ReplyDelete
    Replies
    1. Those are not supposed to be on the device. Those are supposed to be on the host machine you use for development. I provided those files in the archive that also contains the image:

      total 34364
      -rwxr-xr-x 1 luca luca 1558488 Aug 4 19:59 lconvert
      -rwxr-xr-x 1 luca luca 1763296 Aug 4 19:59 lrelease
      -rwxr-xr-x 1 luca luca 2119748 Aug 4 19:59 lupdate
      -rwxr-xr-x 1 luca luca 1513436 Aug 4 17:26 moc
      -rwxr-xr-x 1 luca luca 1611740 Aug 4 17:26 qdbuscpp2xml
      -rwxr-xr-x 1 luca luca 1501136 Aug 4 17:26 qdbusxml2cpp
      -rwxr-xr-x 1 luca luca 2981428 Aug 4 17:26 qdoc
      -rwxr-xr-x 1 luca luca 16513079 Aug 4 17:04 qmake
      -rwxr-xr-x 1 luca luca 1210336 Aug 4 17:58 qmlmin
      -rwxr-xr-x 1 luca luca 1275832 Aug 7 00:00 qtwaylandscanner
      -rwxr-xr-x 1 luca luca 1255328 Aug 4 17:26 rcc
      -rwxr-xr-x 1 luca luca 49109 Aug 3 14:45 syncqt.pl
      -rwxr-xr-x 1 luca luca 1730464 Aug 4 17:26 uic
      -rwxr-xr-x 1 luca luca 77879 Aug 3 21:30 wayland-scanner

      Delete
    2. Well, I have not the development machine. I'm working with the twolife(qt5 repo/gstreamer), vontaene(gstreamer repo) and work very good for me but the last "piotexture" dont work any more. I looking for solution of problems.

      I'm work on qt5+gstreamer... I think this is the best combination.

      Thanks.

      Delete
    3. I'm not following you, anyway if you have problems with a specific revision of PiOmxTextures then report it to me and I'll have a look.

      Delete
  8. I was trying to say is that I have not a development machine so I'm not doing "CROSSCOMPILE". On the other hand, during this last time I have been working with the libraries QT5/Gstreamer twolife repo (twolife.be) and the new repo GStreamer (vontaene.de) that as I have seen and read work very well but I'm still putting together a project work with QT5 + gstreamer.

    Another problem that I have presented is that every time I try to compile "PiOmxTextures" throws me an error "/usr/include/features.h: 356:25: fatal error: sys/cdefs.h: No such file or directory ". Clearly I'll have that problem with any other project that requires the module "sys". Still do not understand that there is the folder "sys" with its modules.

    Someone could say that I can do to install these folders and fix that error message???
    How fast as I copied the folder "sys" from "Linaro toolchain". They work some compilations but do not know if he's quite right.

    I hope you can help me with this.
    Thank you very much.

    ReplyDelete
    Replies
    1. Sorry, I know nothing about those projects.
      And for the build of PiOmxTextures, you seem to have something very wrong in your env. Follow the instructions again.
      Bye.

      Delete
  9. Hi,

    >You can download it with this excellent torrent.

    wheezy_qt5_20130807.7z
    http://goo.gl/P1Zuws (Max 4.7 MB/sec)

    Overview of Google Drive
    https://support.google.com/drive/answer/2424384?p=ww_unsupported&rd=1&hl=en

    Google Drive lets you store and access your files anywhere -- on the web, on your hard drive, or on the go.

    [..]
    Store the first 15 GB of your stuff for free across Google Drive, Gmail, and Google+ Photos.

    Thanks.

    alanyih

    ReplyDelete
    Replies
    1. There seemed to be a limit as well: http://stackoverflow.com/questions/16856102/google-drive-limit-number-of-donwload.

      Delete
  10. Hi, can you tell me which commit hash is the qtWayland code in this image? Thanks

    ReplyDelete
    Replies
    1. Probably e48ea148aa285e81ab78c23ded3a5f6224883a05.

      Delete
  11. Hi Luca,
    thanks for your fantastic work. This is exactly what I've been looking for.
    I sadly do have a little problem with it.
    I am using the image you provided, set up QT and imported my application code.
    However if I try to play a (.mp4) video using the QT MediaPlayer I see nothing but a black screen and the overlaying QML components.

    This is the output in the Qt console:
    (...)
    [0;37mOpening video using OMX...

    [0;37m
    [0;34mvirtual OMX_TextureData* OpenMAXILPlayerControl::instantiateTexture(QSize)

    [0;37m [0;34mGetting EGL display...
    [0;37m [0;34mGetting OpenGL context...
    [0;37m [0;34mEnjoying with OpenGL structures...
    [0;37m
    [0;37mOpening audio using OMX...
    [0;37m
    [0;34mvoid OMX_MediaProcessor::setState(OMX_MediaProcessor::OMX_MediaProcessorState)
    [0;37m [0;37mMetadata update requested.

    [0;37m [0;34mvoid OpenMAXILVideoRendererControl::onTextureReady(const OMX_TextureData*)
    [0;37m [0;34mState changed...

    [0;37m

    Besides that the applications runs perfect.
    Do you have an idea how to fix that?
    Please tell me that I have forgotten something extremely obvious and this is easy to fix :-)

    Thank you so much!

    ReplyDelete
    Replies
    1. Does it happen with a specifc mp4 or with any video file?

      Delete
    2. It appears to happen with several mp4 and avi files.
      The output remains the same.

      Delete
    3. Would it be possible for you to provide one of those files?

      Delete
  12. This is one of them: http://www.auby.no/files/video_tests/h264_720p_hp_5.1_6mbps_ac3_planet.mp4

    I downloaded it, transferred it to project file on the Pi and launched it.
    Besides that I also tried the Windows sample file. ("Wildlife.mp4")

    ReplyDelete
    Replies
    1. Works perfectly here. But I'm using the lastest version in git (or anyway pretty similar).

      Delete
    2. It indeed does work using the command line POCPlayer.
      However it does not work straight out of QtMultimedia.

      Do you have any guesses why that might be the case?

      Thanks for your help!

      Delete
    3. POCPlayer uses nothing more than QtMultimedia. So maybe you're using it in a way slightly different... Check POCPlayer code to have an idea.

      Delete
  13. Hi Luca,
    I was wondering whether it would be possible to play http streams (MPEG2-TS format) with this backend and if it's possible whether you would be so kind to give me a hint on how to implement/use it?

    Thanks a lot!

    ReplyDelete
    Replies
    1. I only tested http once with an mp4 and it was "working". I never tested mpeg ts. ffmpeg should be able to demux and if h264 is inside it, then it might be played correctly. Did you try?
      Anyway, I think you'll have to work somehow on buffering: months ago omxplayer added a new buffering technique. My reimplementation of that anyway resulted in bad performance for local files. Fixing that might be necessary to play remote content.
      Bye.

      Delete
  14. Hi Luca,

    i keep getting the "Failed to get QQuickWindow." when running "POCPlayer test.h264".
    Shouldn't this be fixed/removed?
    Running off your wheezy image ...

    ReplyDelete
    Replies
    1. Yes it should, I didn't expect that t happen.

      Delete
    2. Hi Luca

      I'm getting the same error that mschorer reported...

      ERROR: [0;31mFailed to get QQuickWindow. [0m

      This happens everytime I instantiate a MediaPlayer component. Nevertheless It reproduces audio and video after 2 or 3 seconds...

      Delete
  15. Hi Luca,

    I try to build qt on host machine for this image (PiOmxTextures).
    I extract Qt-rasp-5.1.2.tar.bz2 and use qmake in Qt-rasp-5.1.2/bin/qmake.

    .qmake.conf:1: Cannot find feature qt_build_config
    Could not find qmake configuration file devices/linux-rasp-pi-g++.

    When `export QMAKEPATH=$THIS/Qt-rasp-5.1.2/`
    I got error "Project ERROR: Cannot load qmodule.pri!"


    Thanks a lot!, POCPlayer is work for me.

    ReplyDelete
    Replies
    1. Now i can qmake on raspberry pi with (qmake from http://twolife.be/raspbian/) and copy module to /usr/local/Qt-rasp-5.1.2/ for use PiOmxTextures and my module.

      Delete
    2. Maybe related to this? http://qt-project.org/forums/viewthread/24484

      Delete
  16. Just test the torrent ISO,

    The POCPlayer still get the bad color depth :( ( gradient in video are so ugly :( )

    ReplyDelete
    Replies
    1. As I already said: at the moment I have no interest in improving the color depth. It depends on how your env is set.

      Delete
  17. Hi Luca, I read through the introduction and comments, but I don't understand if QtMultimedia is build with gstreamer plugin. Anyway, I need to show a video stream provided by a /dev/video device, using v4l2 driver. Do you think your image is suitable for this?

    ReplyDelete
    Replies
    1. The gstreamer plugin is one of the plugins available. But the performance depends on the performance of gstreamer.
      This image has nothing to do with acquisition from camera. What exactly do you mean by "suitable"? Acquiring from camera only requires v4l2, which can be installed from apt.

      Delete
    2. I suppose there is something in PiOmxTextures about camera acquisition. But you'll have to work on that cause my Pi kernel used to crash by just plugging a camera in, so I couldn't work much on that. Now it seems to work better but work is not completed. Bye.

      Delete
  18. Hi, downloaded the file via torrent.
    Have tried username: pi and password: rasp as well as username: pi and password: raspberry and none of them work.
    I'm stuck at login.

    ReplyDelete
    Replies
    1. I don't have the image anymore but you can try: username: pi, password: raspberry.

      Delete
  19. somebody have the image? really need it.. i tried to install Qt but always fail...

    ReplyDelete
    Replies
    1. Download from the torrent (I just updated it).

      Delete
  20. Can you post actual link to image?

    ReplyDelete
    Replies
    1. I updated the link to the torrent. It is still available.

      Delete
    2. Hello Luca, Thanks for the image. I downloaded it and write to SD. I tryed to start ./POCPlayer myvideo and it worked.
      Now i want to setup qt cross-compile from Ubuntu. I use VMware player+ Ubuntu on them.
      I installed last version qt creator. I copyed lib to opt/rpi/sysroot from raspberry. and libs from Qt-rasp-5.1.2.tar.bz2
      1.Shoud i install any toolchane?
      2. Now i add new compiler to QTCreator. I use this path(/usr/local/Qt-rasp-5.1.2/bin/qmake) to QMAKE What path i shoud use for compilator? my qt i installed into /opt/qt/

      Delete
  21. Hello Luca,
    tnx for the huge work. After some attemps I could finally play videos.
    However there is some kind of tearing on the video that I couldn't solve and this issue does not appear playing the same with the repository version of omxplayer.
    Is this a known issue?
    My Qt version is 5.3.1 compiled with this configure command:
    ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /opt/raspbian-chroot/ -opensource -confirm-license -no-xcb -no-pch -no-icu -optimized-qmake -release -make libs -make tools -no-qml-debug -nomake tests -prefix /opt/Qt/5.3.1/arm/ and i'm using a chroot environment based on the Raspbian Wheezy released on raspberrypi.org on 2014-06-20.
    Extra packeges installer are: libv4l-dev libboost-all-dev libssl-dev libpcre3-dev

    ReplyDelete
    Replies
    1. Yes, it is known. I never bothered to implement the fix. Search the blog, you should find another discussion about this.

      Delete
  22. torrent not work. help!

    ReplyDelete
  23. This comment has been removed by a blog administrator.

    ReplyDelete