Qt5 VideoPlayer: Does not play .mp4 file - qt

My problem is little bit strange for me. I wrote a mediaPlayer program.
And I move the executable file to another directory in the same machine. Put the dlls beside the exe. It works fine. It can plays .mp4,.avi etc. But when i move the exe and dlls another machine it doesn't play mp4 files.
I tried compile both MinGW and VS2012 and result is same. Didn't find why.
Is there a advice for me ?
Thanks.

Install a default codec pack onto the end user's machine or convert the mp4 to a codec sponsored by windows.
Codec Pack Recommendation
It is hard to go wrong with K-lite Basic Codec Pack. Just be careful when downloading because the main download site is riddled with ads and false download buttons.
My preferred way to install something like this on my development machine is to use chocolatey. First install chocolatey then in your admin cmd, run:
choco install k-litecodecpackbasic
Video Conversion Tool Recommendation
Handbrake. Occasionally ffmpeg or libav might be better suited, but for most cases go with Handbrake.
If You Can't Install New Codecs...
On the end user's machine (missing admin privileges) or something else, then you probably need to use vlc's library for video playback if you need to support more than the minimum supported out of the box by Windows.
Hope that helps.

Related

Error: Your GStreamer installation is missing a plugin: Deploying Gstreamer plugins with QML application

I am trying to create a package for a QML application which plays both audio and video and i'm stuck at GStreamer plugins. I use cqtdeployer to create this distribution package. This tool beautifully gathers the libraries and (qml)plugins that the executable needs. However, it cannot detect some libraries such as GStreamer and its plugins even if I increase the recursive depth.
If i install gstreamer1.0-libav from apt video and audio do play. However, I will be deploying this package offline.
I've checked the contents of this package https://packages.ubuntu.com/xenial/gstreamer1.0-libav and the only shared library it consists is libgstlibav.so, and I also copied it to my lib/ folder. Also installed gstreamer1.0-plugins-base on my development environment and copied everything under /usr/lib/x86_64-linux-gnu/gstreamer-1.0/ to my application's lib/ folder as well.
When I try and run the software on a virtual machine audio alone plays, however, the video does not play and gives the following error:
Warning: "No decoder available for type 'video/x-h264, stream-format=(string)main, codec_data.. etc.
Similar warning for audio as well when I attempt to play the video: "Warning: No decoder available for 'audio/mpeg, mpegversion=(int)4.. etc. But i suppose this is about video's playback audio. Because as I said, i can play audio alone.
Thanks for any help in advance. I can share an ugly list of libraries that I ship with my software if it helps.
Check https://gstreamer.freedesktop.org/documentation/gstreamer/running.html?gi-language=c. Specifically GST_PLUGIN_PATH you can set a directory to scan for plugins.
Note that plugins really are plugins. They are scanned and run at time. That is also the reason no qtdeploy script etc can detect potential missing plugins. The use of plugins is being done by names, not bt actually linking them to the application.

How to Save the downloaded Module

I want to install and setup QT + various modules, its says there is 20GB of downloads for what I have selected.
How can I save these somewhere for use on another PC and have them installed, by using the Maintenance Tool?
Is there a storage folder the downloads are kept?
20GB - that cannot be right, unless you are installing "everything". Just stick to a specific version of the framework for the compiler you want to use.
Also, no, Qt installations are not portable, thanks to a bunch of hard-coded paths. I may work if you put it example the same place it is on the other machine, I am not sure and I haven't tested this. There is also a binary patcher project, but it doesn't look to be maintained.
It would be more efficient to download the offline installer for the version you want, now that will work on other machines, so you can save yourself the downloading: https://download.qt.io/archive/qt/5.8/5.8.0/

deploying a Qt application

In a nutshell, the question is: I just finished my first application using Qt Creator on a computer running under Linux Ubuntu, now how do I make this available for everyone. Now follows the more detailed version ;)
I must apologize for asking this, I am aware that this question has probably been asked many times and that there is official documentation that I can read. I am just completely new to programming and I am very confused by everything I've read so far. If you are kind enough to help, please assume I know absolutely nothing :)
Here we go: I've just finished designing my first application (a scientific program) with Qt creator on my laptop which runs under Linux Ubuntu. It works fine and I'm very proud of it ;)
Here's what my project consists of: 40 header files, 42 source files, 1 pro file, 1 qrc file, 1 html file and 7 png files. In the code, I use #include for a bunch of fairly standard Qt classes (QWidget, QTextBrowser and so forth, maybe like 40 of those).
Now I'd like to make it available to other people. For Linux and Mac users, I've figured a way to do that: I can compress the folder containing my project, tell them to install Qt on their computer, then download and extract the files on their hard disk, open a terminal in the folder and run
qmake myProject.pro
qmake
make
That seems to work fine (by the way, does it matter that this is not precisely what Qt creator does? The qmake step there is qmake-qt4 myProject.pro -r -spec linux-g++ and the make step is make -w). Now, I assume there is a solution where I don't ask them to download and install something like 200Mo of Qt material. As for Microsoft Windows users, I don't have a clue.
I would be very grateful if you could explain to me in a very concrete way what I need to do. Needless to say, I'll go for the best and easiest solution, I don't need to understand everything about deployment. Many thanks in advance!
Edit: In case that's useful : I've been using Qt Creator 2.5.0 based on Qt 4.8.1 (64 bit), I'm working on a laptop with Ubuntu 12.04 64bits
For Linux and Mac users, I would compile the software for them in 32 and 64bit formats - no-one likes compiling unknown software from source. Obviously keep the source code option for those on more unusual architectures/OSs (and provide a shell script for them that mimics the commands Qt Creator calls!). As Qt runtimes are available from package managers on just about every distro (and come pre-installed on most anyway, KDE requires them for example), by not asking them to compile from source your users will have a much smaller download (if any) and won't require them to download software from a website potentially unknown to them. Of course the best way would be to try to get your software added as a package into the major distros' repositories, but that may take some time to organise.
Compile your software for Windows users for both 32 and 64bit formats. It's generally frowned upon to ask users to download runtime libraries they potentially don't know, and put them into their system32 folder... So most applications bundle all the libraries they need with their application. Qt-based applications are no different, and so put the runtimes into the folder where the executable is. Also it is much more professional to create a proper installer, there are a few free installer applications for Windows, a web search will give you the most popular (I think I saw a thread on SO about it as well).
As you can see the platforms aren't too dissimilar, the main point I would make is: Do not force people to compile from source! The vast majority of people on Earth do not even know what compiling is, so provide for the major arrchitectures/OSs yourself.

How to play an audio-cd with Phonon?

I am trying to play an audio CD with phonon under Windows. I use Qt 4.8.0.
I run a code like:
QString filepath = QString("E:\\")
myMusic = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource(Phonon::Cd, filepath));
myMusic->play();
There are any errors in the log window and any sound either. The disk does not spin in drive too.
So is there an option to play audio CD with phonon? If it is, how can I select proper track?
P.S. MP3 is played without issues
Ok, I think I have solved this issue. Currently I have code like this:
Phonon::MediaObject *myMusic = Phonon::createPlayer(Phonon::MusicCategory,Phonon::MediaSource Phonon::Cd, QString("E:\\")));
Phonon::MediaController myMediaController(myMusic);
myMediaController.setAutoplayTitles(true);
myMediaController.setCurrentTitle(7);
myMusic->play();
"E:\" is my cd-drive with inserted audio cd and I play the track #8 (track count starts from zero).
Other issue on my Windows 7 system was Phonon warning:
unable to load the TOC from the CD
This issue is related to Phonon Windows backend. Some Windows systems do not have CDDA codecs (or what is that thing is) installed. In this case Phonon application will not play Audio CD discs. You won't see any errors (except from above) and there won't be any cd drive activity.
To fix this issue you should:
Dowload proper cddareader.ax for your system (I used one from MPC HomeCinema Standalone Filters on http://sourceforge.net/projects/mpc-hc/files/)
Open command line and execute regsvr32.exe cddareader.ax
Reboot
This code is tested on WinXP x86 and Win7 x64. Linux machine have played audio cd without problems (with different path of cource)
Hope this information will be useful

How can I enable auto-updates in a Qt cross-platform application?

I love applications that are able to update themselves without any effort from the user (think: Sparkle framework for Mac). Is there any code/library I can leverage to do this in a Qt application, without having to worry about the OS details?
At least for Windows, Mac and user-owned Linux binaries.
I could integrate Sparkle on the Mac version, code something for the Linux case (only for a standalone, user-owned binary; I won't mess with distribution packaging, if my program is ever packaged), and find someone to help me on the Windows side, but that's horribly painful.
It is not a complete solution, but a cross-platform (Windows, Mac, Linux) tool for creating packages for auto-updates and installing them is available at https://github.com/mendeley/Update-Installer. This tool does not deal with publishing updates or downloading them.
This was written for use with a Qt-based application but to make the update installer small, standalone and easy to build, the installer uses only standard system libraries (C++ runtime, pthreads/libz/libbz2 on Linux/Mac, Win32 API on Windows, Cocoa on Mac, GTK with fallback on Linux). This simplifies delivering updates which include new versions of Qt and other non-system libraries that your application may depend on.
Before considering this though, I would suggest:
If you are only building for two platforms, consider using standard and well-tested auto-update frameworks for those platforms - eg. Sparkle on Mac, Google's Omaha on Windows or auto-update systems built into popular install frameworks (eg. InstallShield). I haven't tried BitRock.
On Mac, the Mac App Store may be a good option. See https://bugreports.qt.io/browse/QTBUG-16549 though.
On Linux, consider creating a .deb package and a simple repository to host it. Once users have a repository set up, the system-wide software update tools will take care of checking for and installing new releases. The steps for setting up a new repository however are too complex for many new Ubuntu/Debian users. What we did, and also what Dropbox and Google have done, is to create a .deb package which sets up the repository as part of the package installation.
A few other notes on creating an updater:
On Windows Vista/7, if the application is installed system-wide (eg. in C:\Program Files\$APPNAME) your users will see a scary UAC prompt when the updater tries to obtain permissions to write to the install directory. This can be avoided either by installing to a user-writable directory (I gather that this is what Google Chrome does) or by obtaining an Authenticode certificate and using it to sign the updater binary.
On Windows Vista/7, an application .exe or DLL cannot be deleted if in use, but the updater can move the existing .exe/DLL out of the way into a temporary directory and schedule it for deletion on the next reboot.
On Ubuntu, 3rd-party repositories are disabled after distribution updates. Google works around this by creating a cron-job to re-add the repository if necessary.
Shameless plug: Fervor, a simple multiplatform (Qt-based) application autoupdater inspired by Sparkle.
Shameless plug: this a relatively old question, but I thought that it may be useful to mention a library that I created recently, which I named "QSimpleUpdater". Aside from notifying you if there's a newer version, it allows you to download the change log in any format (such as HTML or RTF) and download the updates directly from your application using a dialog.
As you may expect from a Qt project, it works on any platform supported by Qt (tested on Windows, Mac & Linux).
Links:
Website
GitHub repository
Screenshot:
Though it works a bit differently than Sparkle, BitRock InstallBuilder contains an autoupdater written in Qt that can be used independently (disclaimer, I am the original BitRock developer). It is a commercial app, but we have free licenses for open source projects.
I've developed an auto-updater library which works beautifully on Mac OS X, Linux and pretty much every Unix that allows you to unlink a file while the file is still open. The reason being that I simply extracted the downloaded package on top of the existing application. Unfortunately, because I relied on this functionality, I ran into problems on Windows as Windows does not let you unlink an open file.
The only alternative I could find is to use MoveFileEx with the replace on reboot flag, but that is awful.
However, renaming the working directory of the application works on Windows 7 and Windows XP. I haven't tried Windows Vista yet.
I have found WebUpdate to be quite useful, though it's written with the wxWidgets. But don't worry, it's a separate app which handles your updates. The steps to integrate it are pretty simple - just write two XML files and run the updater. And yes, it's cross-platform.
The advantage of it is it will automatically download and unzip/install all you required and not just provide a popup with a notification about a new version and a link to download it. Another thing you can do with it is customizable actions.
Project's main page is here, you can read the docs or take a look at the official tutorial.
The blog post Mixing Cocoa and Qt may solve the problem for the Mac platform.
You can use UpdateNode which gives you all the possibilities to update your software. It's using a cross platform Qt client and is free for Open Source!
UPDATE
Just did some further analysis on that and really like this solution:
Pros:
Free for Open Source!!! Even the client is Open Source: https://github.com/updatenode/unclient
The client is already localized in several languages
Very flexible in terms of updates. You can even update single non-binaries.
Provides additionally a way to display messages though the client.
Ready to use binaries & installer for all common Linux distributions, single Windows binary, as well as installer and a solution for Mac (which I have not tried, as I don't have a Mac)
Easy to use web service, nice statistics and update check is integrated within few minutes
Cons:
I am missing a multi-user management in the online service. Maybe they will do it in future - I will definitely suggest that in their feedback portal
The client is a GUI client only - so, you will need to shrink it down to run without a GUI frontend (maybe only necessary for people like me ;-) )
So, bottom line, as this solution is quite new, I think there is lot of potential here. I will definitely use it in my project and I am looking forward for more from them! Thumbs up!
This is an old question but there is not Squirrel in answers which is BEST SOLUTION , here is what I'm doing in qt 5.12.4 with qt quick "my qml app" you can do this in any other language
I'm doing this in windows there is mac version of squirrel too, I don't know about Linux
download nuget package explorer release
https://github.com/NuGetPackageExplorer/NuGetPackageExplorer/releases
open nuget package explorer and add this directory 'lib/net45' it doesn't matter you have a .net app or not, I did this for my qt application otherwise it won't work.
add all files into this folder specify your version in the metadata
save nupkg file
download squirrel release https://github.com/Squirrel/Squirrel.Windows/releases
add squirrel to windows environment path
open cmd and cd to directory of nupkg file
squirrel --releasify file_name.nupkg -> now inide releases folder, there should be setup.exe file which will install app and other files.
to create new version do 2,3,4,7,8 again if its an update it will create delta file which is only needed file to update, put this files into your service directory for example in updates folder of your website which you need to disable directory browsing in IIS , and to auto-update application you need to call Update.exe which is in parent folder of application root directory appdir/../update.exe --update http://yourserver.com/upates/ after application restart app should start with new version
you can find documentation for squirrel in https://github.com/Squirrel/Squirrel.Windows/blob/develop/docs/getting-started/0-overview.md and nuget package explorer here https://github.com/NuGetPackageExplorer/NuGetPackageExplorer and you can use only nuget.exe too if you don't want to use nuget package explorer which can be used for dynamic generation of versions, which can be download from https://www.nuget.org/downloads
That easy. Now you have auto-update app which will download updates from the server and auto-update app. For more info you can read documentations.
note: for iis uses https://github.com/Squirrel/OldSquirrelForWindows/issues/205
I suggest you read on plugin and how to create and use them. If your application architecture is modular and be split into different plugins. Take a look at Google Auto Update utility http://code.google.com/p/omaha/. We use this.
Thibault Cuvelier is writing a tutorial (in French) to develop an updater. I know the explanations are in French (and everyone is not understanding French), but I think this can be readable with a web translator like Google Translate. With this you will have a cross-platform updater, but you need to write it by yourself.
For what I know, the only part of the updater that is explained in the tutorial, is the file downloading part. In the case this can help you, refer to the tutorial, Un updater avec Qt.
I hope that helps.
OK, so I guess I take it as a "no (cross-platform) way". It's too bad!
I have found a solution that can be automated with built-in self-extracting patches and updates. for windows. I have started using their sdk. take a look at the massive documentation here, https://agersoftware.com/docs/ the sdk is called securesdk and comes with their app, SecureDelta sdk. does a great job on any kind of files, better results than lzma-included delta updaters

Resources