Solved No Mp4 Playback on Release Deployment
-
This post is deleted! -
@JKSH
Hi, So now it works in release mode within VS.
Videos however still don't play if I deploy using -
windeployqt --qmldir C:\Users\me\Documents\incommand2017\InCommand\Resources\videos C:\Users\me\Documents\incommandCopy\Win32\DebugWhats weird is if I run the above command then try and run a release build from within VS the videos will also no longer play.
I have to delete all files from the release folder then rebuild the project and then it works again. -
@celica said in No Mp4 Playback on Release Deployment:
C:\Qt\5.12.2\msvc2017 to C:\Users\me\Documents\incommandCopy\Win32\Release
Great!
windeployqt --qmldir C:\Users\me\Documents\incommand2017\InCommand\Resources\videos C:\Users\me\Documents\incommandCopy\Win32\Debug
Debug or Release?
Whats weird is if I run the above command then try and run a release build from within VS the videos will also no longer play.
- Before you run
windeployqt
, your app tries to load DLLs from C:\Qt\5.12.2\msvc2017. windeployqt
copies DLLs from C:\Qt\5.12.2\msvc2017 to C:\Users\me\Documents\incommandCopy\Win32\Release- After you run
windeployqt
, your app won't try to load DLLs from C:\Qt\5.12.2\msvc2017 anymore. - After you run
windeployqt
, your app tries to load DLLs from C:\Users\me\Documents\incommandCopy\Win32\Release
Here's the thing: If
windeployqt
"forgets" to copy some DLLs from C:\Qt\5.12.2\msvc2017 to C:\Users\me\Documents\incommandCopy\Win32\Release, then your app won't work correctly. Yes, it can miss important DLLs; it is not perfect.So, use QT_DEBUG_PLUGINS and ListDLLs again to find out which DLLs are missing. Manually copy the missing DLLs from C:\Qt\5.12.2\msvc2017 to C:\Users\me\Documents\incommandCopy\Win32\Release.
IMPORTANT NOTE: You should only manually copy Qt DLLs. Do not touch non-Qt DLLs.
- Before you run
-
@JKSH Ah I see, that explains it
Ok I will bring the dlls over -The Listdll when working - https://easyupload.io/afhf4h
The Listdll when not working - https://easyupload.io/h895eqThe QT_DEBUG_PLUGINS when working - https://easyupload.io/r293gd
The QT_DEBUG_PLUGINS when not working - https://easyupload.io/b97tcj -
@celica said in No Mp4 Playback on Release Deployment:
Ok I will bring the dlls over
Which DLLs did you bring over? List them one-by-one.
Also, my earlier question still stands: What's inside C:\Users\me\Documents\incommand2017\Win32\Release\mediaservice\ ?
-
@JKSH Ok, I'll do that.
Those files were the status before I brought anything over just to let you knowIn C:\Users\me\Documents\incommand2017\Win32\Release\mediaservice\ are the following files:
dsengine.dll
qtmedia_audioengine.dll
wmfengine.dll -
@JKSH So the only difference between when it works and when it doesn't (in terms of the QT dlls, I have ignored all windows system files) are the following are omitted when it fails to work correctly but are included when it works.
I wonder why it fails to load anything located in the mediaservice folder0x0000000079c20000 0x42000 C:\Qt\5.12.2\msvc2017\plugins\mediaservice\dsengine.dll 0x000000007a650000 0x8a000 C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\LAVSplitter.ax 0x000000007a6e0000 0x23c000 C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\avutil-lav-56.dll 0x000000007bcc0000 0x389000 C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\avformat-lav-58.dll 0x000000007bc70000 0x49000 C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\libbluray.dll 0x0000000003f60000 0x1350000 C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\avcodec-lav-58.dll 0x000000007c050000 0x2d000 C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\avresample-lav-4.dll 0x000000007c090000 0x104000 C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\LAVVideo.ax 0x000000007c1a0000 0x37000 C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\avfilter-lav-7.dll 0x000000007c1e0000 0x94000 C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\swscale-lav-5.dll 0x000000007c280000 0x1d2000 C:\Program Files (x86)\K-Lite Codec Pack\Filters\DirectVobSub\vsfilter.dll 0x000000007c700000 0x44000 C:\Program Files (x86)\K-Lite Codec Pack\Filters\LAV\LAVAudio.ax
-
@celica said in No Mp4 Playback on Release Deployment:
@JKSH So the only difference between when it works and when it doesn't (in terms of the QT dlls, I have ignored all windows system files) are the following are omitted when it fails to work correctly but are included when it works.
Yep, that's what I found too.
I wonder why it fails to load anything located in the mediaservice folder
It's very strange... as far as I can tell, all your DLLs are in the right place.
Just as a sanity check, could you try to build the "Media Player Example" (https://doc.qt.io/qt-5/qtmultimedia-multimediawidgets-player-example.html ) and deploy that? Does that work?
I believe you can find the example in C:\Qt\Examples\Qt-5.14.1\multimediawidgets\player\
If that doesn't work, try uninstalling the K-Lite Codec Pack.
-
@JKSH Tried removing codecs no luck - went through my code to see if anything was amiss. Looks ok.
Did a build from a completely different PC and the same thing happens - fresh installs of VS 2017 & Q 5.12.2I can run the multimedia player ok - from within QT creator.
Do I need to deploy this example?
The deploy option is greyed out. -
@celica said in No Mp4 Playback on Release Deployment:
Do I need to deploy this example?
The deploy option is greyed out.The idea is to use
windeployqt
to produce a deployment that can play videos.This is to check if the problem is in your code or not.
-
@JKSH Ok thanks
It's gonna be a pain to convert this player example from working in QT Designer to work in Visual Studio -
@celica
Hi
Just as a note.
There is a Qt plugin for Visual Studio that allows the use of UI files
so nothing needs to be converted. -
@mrjj Yes, I have that but I'm getting lots of errors when for nearly all of the header includes
visual studio cannot open source QApplication -
@celica
Ok, it does sound like something in the setup didn't went all well.
Normally it just works and you can right click an UI files and it opens Designer.
So while not as good integration as in Creator it should compile fine. -
@celica said in No Mp4 Playback on Release Deployment:
It's gonna be a pain to convert this player example from working in QT Designer to work in Visual Studio
You don't have to build it in Visual Studio.
- Build the example in Release mode in Qt Creator.
- Check that the example runs correctly in Qt Creator.
- Run
windeployqt
. - Check that the deployed example runs correctly.
-
@JKSH Great, thank you.
So yes I deployed as a release build then used the command
windeployqt.exe C:\Qt\Examples\Qt-5.12.2\multimediawidgets\build-player-Desktop_Qt_5_12_2_MSVC2017_32bit-Release\releaseand it works fine.
https://ibb.co/9rSPFtj
See screenshot, what does this tell us? -
@JKSH Hi Guys
Sorry to bother you again but is there anything else I can try here or am I out of luck? -
@celica said in No Mp4 Playback on Release Deployment:
it works fine.
Hurray! 🎉🎉🎉
what does this tell us?
It tells us that there's nothing wrong with your copy of Qt and nothing wrong with your PC.
So, there might be something wrong with your app. Post your code from
main()
(Please post the code in the forum; no need to use a file upload service) -
@JKSH Here is main:
I have also included the cpp file which does most of the heavy lifting as an uploaded file (this is huge) .
https://easyupload.io/02m7h9#include "incommand.h" #include <QtWidgets/QApplication> #include "ButtonManager.h" #include <QtQuick/QQuickView> #include <QObject> #include <QtGlobal> int main(int argc, char *argv[]) { qputenv("QT_DEBUG_PLUGINS", QByteArray("1")); QCoreApplication::addLibraryPath("."); QApplication application(argc, argv); InCommand mainWindow; QObject::connect(&application, SIGNAL(focusChanged(QWidget*, QWidget*)), &mainWindow, SLOT(focusChanged(QWidget*, QWidget*))); mainWindow.setWindowFlags(Qt::FramelessWindowHint | Qt::Window); //Set borderless window type # QFile styleFile("Resources\\stylesheets\\defaultStyle.css"); QFile stylenightFile("Resources\\stylesheets\\NightStyleSheet.css"); if (stylenightFile.open(QIODevice::ReadOnly | QIODevice::Text)) { application.setStyleSheet(stylenightFile.readAll()); stylenightFile.close(); qDebug() << " -I: Stylesheet loaded OK"; } else { qDebug() << " -E: Can't access default stylesheet!"; } #ifndef TESTING_ON_PC application.setOverrideCursor(QCursor(Qt::BlankCursor)); #endif QObject::connect(&application, SIGNAL(aboutToQuit()), &mainWindow, SLOT(appClosing())); return application.exec(); } class MyApi : public QObject { Q_OBJECT public: Q_INVOKABLE virtual void setValue(int i); };
-
@celica said in No Mp4 Playback on Release Deployment:
QMediaPlayer *player = new QMediaPlayer; QMediaPlayer *playernew = new QMediaPlayer;
Here is your problem.
You must ensure that
QApplication
is the very first QObject that is constructed in your app.However, your
QMediaPlayer
s are initialized statically (in other words, they are initialized outside of a function), which means they can be created beforeQApplication
. When this happens, they look for the mediaservice plugin but they can't find it (becauseQApplication
hasn't loaded it yet), so they give up and they can't play your video.Go through you entire code base and make sure that you don't have any
QObject
s that are initialized statically.QCoreApplication::addLibraryPath(".");
This line is not necessary. Remove it.
(To understand why, read https://doc.qt.io/qt-5/qcoreapplication.html#libraryPaths )