Using Qt Media Player on Raspberry Pi 1 - c++

I have a project built using Qt5 which has to play a video. Just like in the videowidget sample code.
I've followed these instructions to build qt5 on my Pi. And it went just fine. But when I try to run any qt program that uses QMediaPlayer, I get the error message:
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
Which means I don't have a backend to play the video, right? Is there any one that I can use which will with Qt, like ffmpeg? And how can I get it to work? Specially for h264 videos.
I've tried to install gstreamer as is told on this link, but it's not working. Will I have to rebuild the entire qt5 again?
P.S.: I have the raspberry pi 1 model B with raspbian installed.
Edit: As mentioned by Greenflow, I checked the ./configure log and saw that the GStreamer was compiled in, but the video apps are still not working...
The message on the log was like this:
GStreamer .............. yes (0.10)
And the message on Greenflow's log was like this:
GStreamer .............. yes (1.0)
Clearly it's another version of GStreamer, but is it the problem?
I've also found this post which says QtMultimedia on the Pi is rather useless, but the post is from 2013, so I'm not sure if it's really relevant. I'd like to have this app playing hardware accelerated videos on my Raspberry Pi, but I'm almost dropping the idea.
Anyways, thanks Greenflow for the head start.
Edit 2: Found this thread on the Qtcentre. Damn, this thing is not going to be easy to solve, I guess...

sudo apt-get install libqt5multimedia-plugins solved this for me.

Related

Wxpython mp3 player on raspberry pi

I found this mp3 player for wxpython http://www.blog.pythonlibrary.org/2010/04/20/wxpython-creating-a-simple-mp3-player/
It works fine on windows, but now I want to play the music on my raspberry pi.
But it gives an error that it can't play the music files. So what's wrong? Do I have to install another mediaplayer on the raspberry pi?
It would help matters if you posted what the error was.
However, I suspect that loading libwxgtk-media2.8-0 and any dependencies would probably help.
Notes:
There is also libwxgtk-media3.0-0 for later versions of wxpython
I believe that on Linux/Rpi it uses gstreamer0.10 which is, arguably, now defunct.

GStreamer encountered a general stream error in Qt5 raspberry pi

I'm trying to play a video using QtMediaPlayer in Raspberry pi 2 B. The source code is as follows:
QMediaPlayer *media;
QVideoWidget *video;
...
...
media = new QMediaPlayer(parent);
video = new QVideoWidget(parent);
media->setVideoOutput(video);
media->setMedia(QUrl::fromLocalFile("/home/pi/Desktop/test3.mp4"));
media->play();
But the result is a blank video screen and the following error:
** (Bus:2148): WARNING **: ffmpegcolorspace-vo: size 1105920 is not a
multiple of unit size 829440
Error: "GStreamer encountered a general stream error."
System Information
Running latest raspbian Jessie OS,
Installed Qt5.3,
Installed gstreamer0.10-plugins-good/bad/ugly/ffmpeg and
Installed Mpeg-2 License
Here is the video test3.mp4
I ran this code in Windows with Qt5 installed; it is working there. But it's not working in the Raspberry pi. Please tell me what I'm missing here.
Trying Pipe from Shell
Video playback on the Raspberry Pi is actually a bit of a tricky thing. The most common solution is to use OMXPlayer to play videos. It's a command line program, but there are lots of flags and repeated calls can control playback. All in all, it works pretty dang well for most smallish projects.
As far as actually using Qt, QMediaPlayer, and etc. I don't think you'll be able to make it work right out of the box. However, I found a blog that discusses this issue and has some Raspberry Pi firmware that fixes QtMultimedia support on the Raspberry Pi.

Qt camera example does not find the laptop's webcam

I'm using Debian Jessie and dmesg | grep video returns:
[ 22.280407] Linux video capture interface: v2.00
[ 22.790704] uvcvideo: Found UVC 1.00 device Lenovo EasyCamera (13d3:5170)
[ 22.796546] usbcore: registered new interface driver uvcvideo
The example compiles fine but upon launch i get a dialog telling me that the camera service is missing. I'm using Qt 5.5.0. This question points to a similar issue but it's for windows. Also I've installed Qt using the installer provided at it's web site. I've tested my webcam with Cheese application and it works but QCameraInfo::availableCameras() returns nothing.
I don't know if this is a definitive answer, but in my experience the dreaded "camera service is missing" comes down to exactly what the message says; for some reason the media back-end that Qt uses to get video input from a camera is broken or miss-configured in some way. In my case I had this problem in the following situations:
1. Building Qt from source
Qt build system SILENTLY DISABLES FEATURES if you don't have all the dependencies that it requires to include them in the build. Make sure to read this official article very carefully for your platform. I lost count of the times this has ruined my <insert favourite period of time such as day/week/year here >, and not only for the multimedia module...
2. Missing some gstreamer packages on my Ubuntu
I develop for Linux & Debian mostly, and on those platforms Qt depends on gstreamer backend. gstreamer is basically a plugin architecture in the core with every single feature added as plugins, and with endless possibilities of manual intervention through configuration files. See where is this is going? Clue: make sure you have all the plugins you want installed and configured properly. Here is a link to some gstreamer tools you can use. Same probably goes for other back-ends on other platforms.
And a pro tip in the end: Since both Qt5.5 gstreamer0.1 (old) and gstreamer1.0 (new) are supported as back-ends, and since Qt5.6 the new one is default. This will give you some room for experimenting, for example if the old does not work, you can try the new etc.
Hope this was useful!

SFML Audio not Working

I was using SFML earlier and I decided to play around with the audio settings. I made an instance of sf::Music and tried to play a sound. However I got an error that came up saying
"The program can't start because openal32.dll is missing from your computer. Try reinstalling the program to fix this problem." I am making this as a project for the Ludum Dare so if this is a common problem I don't really want to have to use this. First off, where do I get openal32.dll? Is this a common problem? And what is an alternative that I can use in c++ for playing audio? Thanks!
OpenAL is an audio API that SFML is using internally. You have to make users install the OpenAL dlls, but the official site appears to be offline. You can try googling for a working link to download the OpenAL package.
You can use OpenAL-Soft instead:
http://kcat.strangesoft.net/openal.html
It also supports HRTF for binaural headphones. You can also package it with your application (LGPL). You might have to rename soft_oal.dll to OpenAL.dll.

Capture MacBook Pro iSight video with C++

I'd like to grab a frame from my MacBook Pro iSight in C++ and do some elaborations on it.
I already know how to do that in ObjC with QTKit, but is there any way to do the same thing in C++?
NOTE:
I tried to install OpenCV with macports, but the framework doesn't seem to support iSight cameras.
You could do that using OpenCV ( http://opencv.willowgarage.com/wiki/ )
And here is a sample code you can copy/paste to try it : http://www.geckogeek.fr/lire-le-flux-dune-webcam-camera-video-avec-opencv.html (article in french but code is in english)
You can also use the Integrating Vision Toolkit (http://ivt.sourceforge.net), which supports Mac OS X and Quicktime.
Here are the steps:
Install the Quicktime SDK, if you haven't yet.
Download the current version of the IVT and unpack the archive.
Set the flag 'USE_QUICKTIME = 0' to 'USE_QUICKTIME = 1' in IVT/src/Makefile.base
Run 'make' in IVT/src
Run 'make' in IVT/examples/CaptureApp
Run '../../files/make_app.sh CaptureApp captureapp' in IVT/examples/CaptureApp
Run the application, either by double clicking on the generated icon, or by typing 'open CaptureApp.app'.
If you have any questions, let me know (you can find my contact information on the IVT homepage). I also answer questions in the IVT Sourceforge forum usually quite fast.