Gstreamer support for Qt5 on Raspberry Pi - qt

I need to play audio from my Qt project deployed on Raspberry Pi. Everything works fine except that I don't get any audio out, instead I get the following error message
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
After googling around I have come to the conclusion that the problem is that Gstreamer is not installed and recognized by Qt (more precisely gst-omx). Also, I have tried for many days to proper install gst-omx on Raspberry Pi without much luck.
Can anyone guide me to how I solve this issue???
One hack would of course just to use an external application to play the audio like mpeg321 and just start it up by QProcess, but I need to control volume and be able to start, stop, and pause, so such a solution is not really feasible...

Short answer: Well man, you found what many people find. Qt won't work with the Raspberry Pi just like that. You might get it to work, but without accelerated decoding it will just run as slow as it can get, and crash every few seconds. Sorry.
Long Answer #1: Qt needs to be compiled with special routines in order to get access to the omx stuff. This is, accessing the dedicated hardware embedded into the board which handles accelerated decoding of the h.264 (an a few others) files.
You have two choices, one is to build a special module from here: Carlon Luca's Github or you get a baked in Raspbian image with everything compiled in place from here: The Bugfree Blog. If you are a newbie on this, building it might give you a very hard time but you will get rather stable code and your choice of Qt and an up to date raspbian. The precompiled image on the other hand is just a matter of download, burn and run, very easy!, but it has some older code, so it has some rough edges and it's a bit unstable (almost every video i've tried shows garbled for the first 2-3 seconds and had crashes from time to time), also you will get Qt 5.1.2 without some of the speedups Qt guys added at 5.2.x.
Long answer #2: There are indeed gst-omx libraries which supposedly work with Qt and supposedly are way more stable, I've never tested them. But you can check for yourself Google: Qt Bellagio, I tried to post the links for them, but had not enough rep. You will have to build your own Qt btw.
Update:
If what you need is video playback, i forgot to mention Boot2Qt for the Pi, but you have to pay Digia for the license. It's called Qt Enterprise Embedded, google it.

Related

How to combine a Qt-GUI with ROS?

I'm currently working on a Qt-GUI with which I plan to remote control a robot. The robot is ros-controlled and equipped with multiple cameras. The topic is completely new to me and I just started learning both Qt and ROS and have some basic questions. I didn't make any progress googling around so I finally decided to post it here:
How can I connect data from ROS with Qt? So let's say I kind of want to live-stream the recordings of the cameras into my GUI. How is the general procedure there?
I've seen this ROS Qt Creator Plug-in. Is that something I want to use for this project?
Thanks a lot to everyone answering.
This is my first post here so I hope I didn't mess anything up or flouted forum regulations.
Edit 1: I am working with C++.
Edit 2: In case it helps you giving me advice; the rostopic type of the camera topic is sensor_msgs/Image.
For question 1, since the images are coming over the sensor_msgs/Image topic, using ROS with OpenCV's cv_bridge in the Qt application to receive the the incoming image stream from ROS into the Qt-GUI is a good start. There are several tutorials that cover integrating OpenCV into a Qt project. An important advice is to keep track of the image properties (size, color format, etc.), which will help in displaying the image properly in the GUI. Disclaimer: I have worked with Qt libraries on the Python side, not with C++.
As for question 2, the information for setting up, building, and running the code within the Qt-Creator can be very convenient. There are times where it is prudent to use an IDE to build, run, and debug code (to deal with memory management, segmentation faults, etc.), while other for other times running "catkin_make" or "catkin build" in the root directory when the hardware is minimal.

Running QT5 in an embedded device with 64 MB RAM

I have been working with QML for a couple of weeks now. But now a new requirement has risen where I have to check whether I can run QT5 in an embedded device for my project. I need this for my GUI related operations. The device has an ARM processor (Intel ARM920T-PXA27x processor to be exact) with 64 MB RAM. 32 MB will be taken up for the OS and the rest will be available for application and QT.
I have to check whether this is possible. I have googled for some references and unable to find a suitable answer to my requirement with QT5. I need the GUI libraries but my project does not have advanced graphical requirements like swiping or animations. It contains basic controls like texts, buttons and lists/grids. Since I am new to QT especially to this part, I would like to hear whether
1) Is this a viable option and should I keep digging more into this? Any feedback would be welcome to know if it's worthy to spend time to attempt this or if it's a lost cause.
2) If there are options, could you point me in the right direction to look more into this?
It depends on the OS you are running on your SOC.
It's definitely possible when running Linux. You can e.g. use Qt Lite for configuring a minimal static build of Qt. Then you deploy your statically linked application to the device. You can check this blog post for experiences with Qt Lite.
One possibility is to go with Qt for Device Creation for the whole embedded Linux based software stack which boots to a UI implemented with Qt technologies.

How much memory does linux kernel and base services use?

I'm doing and embedded linux+qt project and I was wondering what was the base memory consuption of the linux kernel plus some basic services. Just enough to run some framebuffer based application.
I ended up in here: http://qt-project.org/doc/qt-4.8/requirements-embedded-linux.html but as I'm reading that seems like it's just the qt requirements without counting the linux overhead.
Can someone point me to a more detailed resource on the topic?
The numbers in the table you cited look reasonable.
The actual answer is "it depends". Yes, Virginia: it is possible to have a working OS and a Qt-based GUI in under 4MB.
The actual memory usage will vary wildly, depending on:
Which kernel you use
How you configure your kernel build
Which kernel drivers you load at runtime
What you start up during system init
Etc etc
Book recommendation:
Embedded Linux Primer, Christopher Hallinan
ALSO: here's a list of prebuilt-distros with GUIs that all run on Pentium IVs with 512MB RAM:
http://www.osnews.com/story/26087
I would suggest using Yocto for such builds, but you can also take a look at the upcoming "Boot to Qt" project which is basic a Qt 5 replacement for Qt embedded with Qt 4. I would not suggest looking into the link you pasted in your question.
You should definitely focus on Qt 5 for several reasons. The foremost is probably because you can get hardware acceleration and Qt got a lot of utilization for embedded, including decoupling the QtWidgets module, and so forth.
Here you can find the technology preview that the guy in Norway are working on. This is just for future reference:
http://blog.qt.digia.com/blog/2013/05/21/introducing-boot-to-qt-a-technology-preview/
I would start using the Yocto project for now. We have worked on a "meta-qt5" layer which is not perfect, but good enough. Yocto will also take care of the Linux with "minimal images", et cetera.
Not sure if you had seen the classic example a couple of years ago, but there was a "Qt boot" for an embedded Linux board which happened within a second. Here is the link to the reading material. Unfortunately, the original video does not seem to be available anymore.
http://www.embedded-bits.co.uk/2011/1-second-linux-boot-to-qt/

Porting Qt3 to a different OS

I have to port the application which is using the Qt3 library to a new embedded OS.
If the OS is not yet selected but it is known that it is not Linux/Windows, what is the general way of porting procedure? I mean what files should be changed and what are independed and can be left as is?
If it's not Linux or Windows you could be pretty stuck out the door. Qt is highly dependent on libraries being available for it to be able to build. This is not a no however, it has been ported to Symbian which is obviously not Linux or Windows. The big thing on that though is that it was ported by Nokia, who had amount of time and amount of developers, where those X's are reasonably big numbers.
Start by getting the Qt everywhere source code, work out what bits you're going to need and which bits you won't. If the platform has gcc/g++/another reasonably well understood C++ compiler you're in luck and you should be able to build the bits as needed. Qt does depend on standard libraries throughout so make sure they're also available in some form for the platform, and it does use some non-standard ones for some components so you'll need to know which aspects of Qt you're working on. You should be able to get some sort of toolchain from there.
I'd stick to platforms that Qt supports though, if you go off the beaten track you're looking into increasing your dev times and having very little useful support.

Cross compile Qt source the Angstrom toolchain(any linux supported embedded toolchain would do)

I am new to cross compiling and willing to get started with cross compiling Qt for beagleboard. Can some one give me specific instructions for this or recently tried tutorial. Please do not assume any knowledge on my part so can not handle instructions like "you may have to edit this to your architecture". I have a few important questions.
how to build Angstrom tool chain and how to prepare it for cross compiling. (I have tried the anstrom web site and never found such random instrutions in my life).
How to cross compile Qt after installing.
The process is a little daunting for the first time developer. I used this blog to give me a start,
http://treyweaver.blogspot.com/2010/10/setting-up-qt-development-environment.html
but like all of the other instructions, sometimes there will be deviations. It took me a while to sort it all out. You are going to have to read and study to to this. It is a worthy thing to do however. As far as Angstom, there are ready made images available. I started with that. You should use Ubuntu to do all of your work. Linux makes it a lot easier.

Resources