RTSP with Qt and VLC - c++

I'm trying to use Qt5 to view a RTSP flow in a Windows 7 environment.
I read that QtMultimedia doesn't support RTSP (I did it well with videos of my computer and videos .mp4 on internet, but it doesn't seem to work with RTSP).
I can see the flow with VLC, so I came up with the idea of using vlc-qt
I found a sample code describing a basic usage of the library :
https://wiki.videolan.org/LibVLC_SampleCode_Qt
In order to make it work, I needed to include the libvlc.lib.
However I'm getting compiling errors such as:
QX11EmbedContainer not found
libvlc_exception_t not found
It seems that the libvlc_exception_t is deprecated in the newest version of VLC.
Are there any other possibilities? I wish I could only use Qt to include a live stream in a QWidget but I have not found anything.

Related

RTSP Server using ffmpeg code has wrong ffmpeg version?

I'm trying to reuse the sample code of next topic, but it does not run with ffmpeg-20190320.
Topic: FFMPEG to send RTSP encoded stream C++
I tried to change the include line to the right paths, but some files are simple gone.
All of the code can be found on the topic referring to.
I'm expecting the code from the referring topic to build and run as expected with the newer version of ffmpeg or to know what version was used so I can try to refactor it myself.
I've got the code building and running with
ffmpeg-2.0.1-win32-shared and
ffmpeg-2.0.1-win32-dev found on
https://ffmpeg.zeranoe.com/builds/win32/dev/ and https://ffmpeg.zeranoe.com/builds/win32/shared/, but I had to use the wayback machine.

Qt: no playback on linux

I have tried (I think) every possible way of playing audio in a Qt project, none of which have worked:
QSound::play(...)
QMediaPlayer
QAudioOutput, from http://doc.qt.io/qt-4.8/qaudiooutput.html
None of these solutions play WAV or MP3, and I have tried loading the files from a resource (qrc:media/file.wav) or simply from disk (/full/path/to/file.wav).
I think the problem is with codecs. QAudioDevice::supportedCodecs() returns an empty list. I'm on a linux system that has no problems playing audio/video (Ubuntu 14.04, usually playing in VLC... that uses its own codecs?).
Playing with QSound (WAV & MP3):
QSoundEffect(pulseaudio): Error decoding source
QMediaplayer (WAV): nothing happens
QMediaplayer (MP3):
GStreamer; Unable to play - "qrc:media/lowtone.mp3"
Qt uses specific media backends for each platform(link is qt5, but it was the same in Qt4). From the error it looks like your version is using GStreamer.
Check if the gstreamer dev packages on your distribution are well installed, because QAudioDevice::supportedCodecs must return at least audio/pcm. Work on the package setup until your test program show pcm. See https://wiki.qt.io/Building_Qt_for_Linux
You may also need to install plugins (also dev packages) before being able to play wav or mp3 using phonon.

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!

using QMediaPlayer on Windows system with code compiled on Linux

A project of mine is written with Qt5/c++, using the QMediaPlayer class to read audio files. Everything's ok as long as I run this project on Linux.
Since I want to run my program on Windows, I use MXE to compile my code and create a binary file for Windows systems.
The program seems ok, except this problem with the QMediaPlayer class. When the program runs on a Windows system, I read this message :
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer".
By googling around, I came to understand that the QMediaPlayer used several plugins, different on each platform. On Windows, The WMF plugin is Microsoft-only, DirectShow seems useless; others suggest to use other external plugins like portaudio, SdlAudio ou OpenAI.
How may I solve this problem ?
I found the problem and know how to fix it : according to this thread, just add the following line to your .pro file :
QTPLUGIN += dsengine qtmedia_audioengine

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.