QMediaPlayer is a wrapper over GStreamer in Linux? - qt

I am developing an audio player in Linux. I would like to use Gstreamer as backend. When I searched I came to know QMediaPlayer (Qt component) provides simple APIs for playback. Is QMediaPlayer is a wrapper over GStreamer APIs (QMediaplayer internally using GStreamer?) in Linux?

Yes, it is: https://wiki.qt.io/Qt_5.13_Multimedia_Backends. Qt6 also uses gstreamer. Qt 6.4 added a new ffmpeg backend.

Related

To switch between two video files in Qt or opencv python -seamlessly

Currently i'm using opencv (have an option to use QT as well) to play a video file (player) in full screen mode. My requirement is when i'm playing videofile-1 there could a request to play video file-2 and i need to switch to video file-2 seamlessly. Is it possible to do this in opencv or QT ? I know we can do this using RTSP or HTTP streaming.
OpenCV uses cv2.VideoCapture() to read from videofile and cv2.imshow() to project image/video to display. What are you doing between those you it is your choice, so answering your question I guess it's possible.

Can I create a .MP4 container with Qt APIs?

Is it possible to create a .mp4 container with Qt Multimedia or some other Qt APIs ?
I understand that Qt does not have encoding APIs, BUT if I've a library helping me to encode & decode, then can I use Qt to create the MP4 container and the additional third party library to encode video data into it ?
Qt (version 5.9.2 or earlier) does not have support for creating or writing to .mp4 files.
You might be able to do this with a third party add-on QtGstreamer

Recording IP Camera in QT

I am busy with writing a program that is able to view an IP camera and also have a playback option available.
To realize this i have been looking to record the feed that i now have running in my program using the Qmediaplayer.
From what i understand it is not possible to use Qmediarecorder to record this feed. All the examples that use Qmediarecorder use the Qcamera class.
Is there a way to record a stream from an IP camera (mjpeg, h.264 ) with the Qmediarecorder or any other QT tool ?
If not ? what is a good library to use for this kind of application?
libvlc may be the library you can looking for, there is also a c++ - qt wrapper that simplifies the usage of library in c++ and qt : vlc-qt library :https://vlc-qt.tano.si/ . record and playback availability of library of vlc player is present in this wrapper

Is there any way to use QtWebEngine without OpenGL?

I'm trying to get QtWebEngine running on a VM and am having difficulties. According to the answer to this question:
Eventually I realised that OpenGL 3.3 wouldn't work easily on virtual machines .. yet. I had to boot from ubuntu usb and work from there by installing latest mesa 3d package.
Is there a way to get QtWebEngine to work without OpenGL? I'm not directly using any OpenGL calls, nor do I need any 3d capabilities. I just want to embed a QWebEngineView to display dynamic HTML pages. I'm guessing this should be possible since Chrome works on the same VM without an issue.
I don't think there is a way to use the Qt WebEngine without OpenGL. It is not very explicitly said in the documentation, but here's what I understood from what I found.
About Chromium
As it is said here, QtWebEngine integrates chromium's fast moving web capabilities into Qt. Plus, it is Chromium that allows the manipulation of OpenGL via the Qt Quick scene graph (source) :
Chromium is tightly integrated to the Qt Quick scene graph, which is
based on OpenGL ES 2.0 or OpenGL 2.0 for its rendering. This provides
you with one-pass compositing of web content and all the Qt Quick UI.
The integration to Chromium is transparent to developers, who just
work with Qt and JavaScript.
It is also said that both the render process and the GUI process should share an OpenGL context :
Because the render process is separated from the GUI process, they
should ideally share an OpenGL context to enable one process to access
the resources uploaded by the other, such as images or textures.
About the Qt WebEngine itself
We just talked about the Qt's GUI : in fact, the Qt WebEngine is not dependent of this GUI (page rendering and JavaScript execution are separated from the GUI process into the Qt WebEngine process), but remember that if you want your application to work, you will need to share an OpenGL context between both processes. In particular, this is achieved by default with a QSurfaceFormat, which has a OpenGLContextProfile accessible by the function QSurfaceFormat::profile(). Now, we look back at the Qt WebEngine platform notes which states :
If a new default QSurfaceFormat with a modified OpenGL profile has to
be set, it should be set before the application instance is declared,
to make sure that all created OpenGL contexts use the same OpenGL
profile.
On OS X, if the default QSurfaceFormat is set after the application
instance, the application will exit with qFatal(), and print a message
that the default QSurfaceFormat should be set before the application
instance.
If we look at the source code of Qt, calls to OpenGL are made in several important files, like qtwebengine\src\core\web_engine_context.cpp or qtwebengine\src\webengine\api\qtwebengineglobal.cpp. Moreover, I also found calls to OpenGL in functions from the sources in qtwebengine\src\3rdparty\chromium\, so I suspect that Chromium needs to call OpenGL functions sometimes.
In short
The Qt WebEngine is using Chromium (which doesn't necessarily use OpenGL) and also Qt GUI, which uses an OpenGL context which has to be shared by the Web Engine. Thus, my conclusion is that you can't use the Qt WebEngine without OpenGL.
I had the same problem on my VM environment trying to start an application that uses QtWebEngine and it crashed.
I will add this answer as a reference - although Sergey Khasanov mentioned it already in the comment above
Use Software Qt Quick2DRenderer - see https://doc.qt.io/QtQuick2DRenderer/
To do that, simply set the environment variable:
export QMLSCENE_DEVICE=softwarecontext
then restart your application. It might still complain about
libEGL warning: GLX/DRI2 is not supported
libEGL warning: DRI2: failed to authenticate
but (in my case) it finally worked!

Qt audio editing

I want to create a qt application similar to Audacity that can run on mobile. Al that I want at the moment is the ability to change volume levels, pitch and tempo. I also want the ability to select, copy and paste parts of the audio file.
Do any of you know a API, SDK or something for Qt that would allow this?
All built in stuff I could find in Qt is QtMultimedia which allows me to import a audio file and then play it but it doesn't seem to have editing(except for bitrate, channel, etc.) or manipulation.
This is for Symbian, and can be built on windows or kubuntu.
Use one of the audio backends:
Audio plugins
Audio backends implement QAudioInput, QAudioOutput, QAudioDeviceInfo and QSoundEffect
Here is the list of the current audio backends:
Windows Multimedia
CoreAudio (Mac OS / iOS)
PulseAudio (Unix)
Alsa (Unix)
OpenSL ES (Android)
QNX
Only PulseAudio, CoreAudio, and QNX backends are actual plugins. The other backends are “#ifdef’ed” in the related classes.
References
Qt 5.4 Multimedia Backends
Qt 5.5.0 Multimedia Backends

Resources