How to manage required codec for JavaFX application? - javafx

I want to show a video (mp4) with JavaFX, which requires a codec to be installed on the target machine.
How should I manage this situation? Bundle the codec? Ask the user to download and install it? And from where?
The application should be able to run on Win, Mac, Linux...

You only need to manage the codec on Linux.
Background on supported configurations
See the supported system configurations for JavaFX media.
Windows 7&8: The pre-installed Microsoft AAC and H.264 DirectShow decoder filters are used by default.
Similarly for OS X, built-in codecs that ship with OS X will be used.
For Linux:
You must install GLIB 2.28 in order to run JavaFX Media . . . to support AAC audio, MP3 audio, H.264 video, and HTTP Live Streaming: libavcodec53 and libavformat53 on Ubuntu Linux 12.04 or equivalent. On Linux platforms, installing libavformat automatically causes libavcodec to be installed.
Also note:
VP6 video support does not require any third party modules.
So VP6 should work out of the box on any platform. However you are using MP4 containers, so VP6 encoding does not apply to you as that is for FLV containers.
Arbitrary codecs are not supported in JavaFX 8
You must let the JavaFX system use either a codec it provides or pick a pre-installed codec according to its internal algorithms. The following feature request is not currently scheduled for implementation:
RT-2684 Media playback needs to be extensible. User defined codecs or media sources should be supported.
Recommendation
Package your application as a self-contained application. For Linux, this will be a debian package or for redhat type systems it will be an rpm. Those packages can specify dependencies on libavformat and glibc so that the correct versions of those packages will be installed when you install your application (e.g. yum install your-app.rpm).

Related

Qt Creator - windeployqt.exe in linux

I got an app, that is ready to release. On windows, I simply type 'windeployqt.exe MyApp.exe' inside 'release' folder of app build in special qt cmd. I'm trying to do the same on kali linux (I dont have time to install other deb based distro). I'm searching for solution for three hours, and I cant find anything good. So, how to make application executable on other linux computer without Qt Creator installed?
There are many ways to deploy Qt applications on Linux. AppImage created with the help of linuxdeployqt or linuxdeploy-plugin-qt is one option, perhaps even the simplest one but it has its drawbacks. From my personal experience I can think of two:
Your app won't generally be able to use native icon/font/other themes.
Sometimes your AppImages might occasionally cease to work due to some unexpected system update which would, for example, break the binary compatibility of OpenSSL libraries.
Other packaging options for Linux include:
Linking the application with static version of Qt. It is the
approach used e.g. by Telegram. The instructions can be found
here.
Beware, however, that using this approach for commercial closed
source applications generally requires commercial Qt license.
Probably it is possible to get away with LGPL but it would be very
cumbersome: you'd have to provide customers with compiled object
files so that they can replace them and re-link the app. Also beware
of the fact that if the application you intend to create is going to
be an open source one, the maintainers of Linux distributions would
generally not agree to distribute statically linked applications -
that violates the basic rules for many distros according to which
applications should not bundle their dependencies but instead should
use the system provided libraries. It is important from e.g.
security perspective - if some security threat is found in Qt in
future, it can be fixed within a Qt library itself and all
applications using that library would then also be secure -
something not that easily achievable with application built with
static version of Qt.
Creating native packages for target systems - i.e. deb packages for
Debian/Ubuntu systems and their derivatives, rpms for Fedora,
OpenSUSE and other rpm-based distros,
PKGBUILD for Arch
Linux and various other kinds of packages for various other distros,
hundreds of them. The advantage is good integration with the rest of the system: native themes etc. Also you get all the advantages of the security fixes for shared libraries.
Using flatpak or snap packages - these are modern app packaging formats developed by RedHat and Canonical respectively with the goal to simplify the management of app's dependencies.
Using the generic approach using shared libraries - with this approach you'd need to package your app as an archive containing a directory containing you app and all its dependencies in the form of shared libraries - something similar to the approach of deployment on Windows where you put the dlls alongside the app.
I would recommend trying an AppImage first and then creating native packages for target distros.

QT installation - OpenGL (No ANGLE)

I have installed the last version of QT but it seems that this one contains some DirectX calls, so I expect that the default installer use ANGLE !
I wish to install a 100% openGL version, but I can't find one !
Any idea ?
Thx
All official binary packages are configured with
-opengl dynamic
which means that programs can either use the installed (desktop) OpenGL driver, DirectX (via ANGLE), or an OpenGL emulation in software (Mesa) as OpenGL backends. If you always want to use Desktop OpenGL, you can force this by
Setting the environment variable QT_OPENGL to desktop
Calling QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL)
See also http://doc.qt.io/qt-5/windows-requirements.html#graphics-drivers .
If you want a Qt version that only supports the Desktop OpenGL backend, you have to build Qt from sources.

Qt + VTK +Ubuntu on VirtualBox

I need to run a Qt project with VTK on Ubuntu and I'm using VirtualBox, but I have an error:
GL version 2.1 with the gpu_shader4 extension is not supported by your
graphics driver but is required for the new OpenGL rendering backend.
Please update your OpenGL driver. If you are using Mesa please make
sure you have version 10.6.5 or later and make sure your driver in
Mesa supports OpenGL 3.2.
Recent version of VTK use a new rendering backend by default. In the CMake cache file used to configure your build, the corresponding cmake variable VTK_RENDERING_BACKEND has the value "OpenGL2" which assumes a minimum OpenGL API version of 2.1. But the problem is that a vanilla installation of VirtualBox does not grant access to 3D acceleration by default as it cannot presumably infer these informations from the host system.
So I think that you have several options here depending on your needs and constraints, you could install the VirtualBox Guest Additions to enable hardware 3D acceleration, allow access to a newer version of the OpenGL API and use in the end the host to performs the requested 3D operations. You could also use a recent version of the Mesa3D library to performs the needed 3D operations on the CPU (to choose preferably if you don't have graphics hardware on the host). For a presentation of its features, you can take a look here

Enabling mp4/mpeg4/avc support for Qt5 WebEngine on Linux

i installed Qt 5.4.1 x64 on LUbuntu and created an app which uses the new QtWebEngine.
I`m trying to display a html5 page with that component which is using the tag.
All works fine except if I try to playback a mp4 video. The video area remains black. It works if I use other video types like webm/ogg as source.
I know this is due to license restrictions, so that mp4 is deactivated by default in Ubuntu/Linux for Qt.
What is needed in Qt to activate it to allow mp4 playback and on what do I have pay attention in case of license terms (I read that statically linking the library is allowed?) ?
I`ve already tried to copy over the x64 distribution of libffmpegsuo.so which is included in Chrome (2,2Mb) over to the Qt directory to /plugins/webengine/ and replaced that one that was already there (1,1 Mb) but it had no effect.
In Chrome playback works fine btw.
If you need more details like paths etc. please tell me.
Thanks !
You can explicitly enable proprietary codecs (H264, MP3) when compiling Qt WebEngine:
In /path-to-qt-src-dir/qtwebengine execute:
qmake WEBENGINE_CONFIG+=use_proprietary_codecs
You should be able to see in the output that H264 codec is enabled, which is not the default configuration.

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