Showing a mp4 in my app
-
Good.
Then as next step, I would build and run the Media Player Example.
wrote on 12 Feb 2020, 21:57 last edited by@SGaist said in Showing a mp4 in my app:
Good.
Then as next step, I would build and run the Media Player Example.
I have, it won't play the mp4 videos, but it will play the mov video saved direct from an iPhone just like my other videowidget.
-
What are the specifications of that video ?
-
@SGaist said in Showing a mp4 in my app:
Good.
Then as next step, I would build and run the Media Player Example.
I have, it won't play the mp4 videos, but it will play the mov video saved direct from an iPhone just like my other videowidget.
wrote on 12 Feb 2020, 23:09 last edited by@MichRX7 said in Showing a mp4 in my app:
@SGaist said in Showing a mp4 in my app:
Good.
Then as next step, I would build and run the Media Player Example.
I have, it won't play the mp4 videos, but it will play the mov video saved direct from an iPhone just like my other videowidget.
File Type MPEG-4 Video
Total Size 5.8 MiB -
@SGaist recommended this earlier; it's still worth doing: Check the error signal. It could provide some clues as to why your video isn't playing.
Also, try connecting the status/state change signals and see what you get:
connect(player, QOverload<QMediaPlayer::Error>::of(&QMediaPlayer::error), [=](QMediaPlayer::Error error) { qDebug() << "Error:" << error << player->errorString(); }); connect(player, &QMediaPlayer::mediaStatusChanged, [=](QMediaPlayer::MediaStatus status) { qDebug() << "Media Status:" << status; } connect(player,, &QMediaPlayer::stateChanged, [=](QMediaPlayer::State state) { qDebug() << "State:" << state; }
-
@SGaist recommended this earlier; it's still worth doing: Check the error signal. It could provide some clues as to why your video isn't playing.
Also, try connecting the status/state change signals and see what you get:
connect(player, QOverload<QMediaPlayer::Error>::of(&QMediaPlayer::error), [=](QMediaPlayer::Error error) { qDebug() << "Error:" << error << player->errorString(); }); connect(player, &QMediaPlayer::mediaStatusChanged, [=](QMediaPlayer::MediaStatus status) { qDebug() << "Media Status:" << status; } connect(player,, &QMediaPlayer::stateChanged, [=](QMediaPlayer::State state) { qDebug() << "State:" << state; }
wrote on 13 Feb 2020, 04:31 last edited byThank you for the reply. I placed these in the file. When I do the first connect throws this issue:
/tmp/VisualGDB/c/projects/LinuxProject1/MainWindow.cpp:35: error: reference to non-static member function must be called; did you mean to call it with no arguments?The 2nd and 3rd connect's throw an error unless I put ); after the closing } for each connect.
I can't build the file until I figure out the issue with the first connect is. If I comment it out and place the ); after the 2nd and 3rd connects I can build the file, but I don't see any errors in the debug window in QT Creator if that is where I should be seeing issues.
-
wrote on 13 Feb 2020, 04:48 last edited by
When I run the build after commenting out the first connect that is giving me an issue I do see this in the debugger:
GStreamer; Unable to pause - "file:///home/pi/Videos/tomtiff.mp4"
Media Status: QMediaPlayer::LoadingMedia
GStreamer; Unable to pause - "file:///home/pi/Videos/tomtiff.mp4"
mediaStatus: QMediaPlayer::LoadingMedia error: QMediaPlayer::NoErrorMedia Status: QMediaPlayer::InvalidMedia
Error: "Resource not found."If I switch the file name to the known working MOV file and run the build I do not see this information or anything like it in the debugger.
-
Thank you for the reply. I placed these in the file. When I do the first connect throws this issue:
/tmp/VisualGDB/c/projects/LinuxProject1/MainWindow.cpp:35: error: reference to non-static member function must be called; did you mean to call it with no arguments?The 2nd and 3rd connect's throw an error unless I put ); after the closing } for each connect.
I can't build the file until I figure out the issue with the first connect is. If I comment it out and place the ); after the 2nd and 3rd connects I can build the file, but I don't see any errors in the debug window in QT Creator if that is where I should be seeing issues.
@MichRX7 said in Showing a mp4 in my app:
error: reference to non-static member function must be called; did you mean to call it with no arguments?
Remember to include the
&
insideof()
The 2nd and 3rd connect's throw an error unless I put ); after the closing } for each connect.
Oops! I've edited the post to fix the syntax
-
@MichRX7 said in Showing a mp4 in my app:
error: reference to non-static member function must be called; did you mean to call it with no arguments?
Remember to include the
&
insideof()
The 2nd and 3rd connect's throw an error unless I put ); after the closing } for each connect.
Oops! I've edited the post to fix the syntax
wrote on 13 Feb 2020, 05:25 last edited by MichRX7@JKSH said in Showing a mp4 in my app:
@MichRX7 said in Showing a mp4 in my app:
error: reference to non-static member function must be called; did you mean to call it with no arguments?
Remember to include the
&
insideof()
I copied it right from the page, this is what I have in my code that is throwing that error:
connect(player, QOverloadQMediaPlayer::Error::of(&QMediaPlayer::error), [=](QMediaPlayer::Error error)
{
qDebug() << "Error:" << error << player->errorString;
}); -
@JKSH said in Showing a mp4 in my app:
@MichRX7 said in Showing a mp4 in my app:
error: reference to non-static member function must be called; did you mean to call it with no arguments?
Remember to include the
&
insideof()
I copied it right from the page, this is what I have in my code that is throwing that error:
connect(player, QOverloadQMediaPlayer::Error::of(&QMediaPlayer::error), [=](QMediaPlayer::Error error)
{
qDebug() << "Error:" << error << player->errorString;
});@MichRX7 said in Showing a mp4 in my app:
qDebug() << "Error:" << error << player->errorString;
Found it:
errorString()
needs parentheses -
wrote on 13 Feb 2020, 05:52 last edited by
Well, there is a lot of output, not sure if you want to see all of it.
But, on the MOV file that plays correctly I see this near the end (after pressing the button to create the videowidget and play):
Thread 18 created.~"[New Thread 0x8d0fc390 (LWP 17529)]\n"
[New Thread 0x8d0fc390 (LWP 17529)]
*running,thread-id="18"
dNOTE: INFERIOR STILL RUNNING IN STATE InferiorRunOk.Media Status: QMediaPlayer::BufferedMedia
=thread-created,id="19",group-id="i1"
Thread 19 created.
~"[New Thread 0x8bbff390 (LWP 17530)]\n"
[New Thread 0x8bbff390 (LWP 17530)]
*running,thread-id="19"
dNOTE: INFERIOR STILL RUNNING IN STATE InferiorRunOk.~"[Thread 0x8bbff390 (LWP 17530) exited]\n"
[Thread 0x8bbff390 (LWP 17530) exited]
=thread-exited,id="19",group-id="i1"
Thread 19 in group i1 exited.In the MOV that won't play I see:
Thread 21 created.~"[New Thread 0x8ddf2390 (LWP 17432)]\n"
[New Thread 0x8ddf2390 (LWP 17432)]
*running,thread-id="21"
dNOTE: INFERIOR STILL RUNNING IN STATE InferiorRunOk.Media Status: QMediaPlayer::BufferedMedia
QWidget::paintEngine: Should no longer be called
QWidget::paintEngine: Should no longer be calledQWidget::paintEngine: Should no longer be called
QWidget::paintEngine: Should no longer be calledIn the MP4 that doesn't play:
Thread 21 created.~"[New Thread 0x8dbff390 (LWP 17705)]\n"
[New Thread 0x8dbff390 (LWP 17705)]
*running,thread-id="21"
dNOTE: INFERIOR STILL RUNNING IN STATE InferiorRunOk.Media Status: QMediaPlayer::BufferedMedia
QWidget::paintEngine: Should no longer be called
QWidget::paintEngine: Should no longer be calledIf you want to see the full debug section from when I hit the button to here I can paste it, but it is VERY long.
-
Well, there is a lot of output, not sure if you want to see all of it.
But, on the MOV file that plays correctly I see this near the end (after pressing the button to create the videowidget and play):
Thread 18 created.~"[New Thread 0x8d0fc390 (LWP 17529)]\n"
[New Thread 0x8d0fc390 (LWP 17529)]
*running,thread-id="18"
dNOTE: INFERIOR STILL RUNNING IN STATE InferiorRunOk.Media Status: QMediaPlayer::BufferedMedia
=thread-created,id="19",group-id="i1"
Thread 19 created.
~"[New Thread 0x8bbff390 (LWP 17530)]\n"
[New Thread 0x8bbff390 (LWP 17530)]
*running,thread-id="19"
dNOTE: INFERIOR STILL RUNNING IN STATE InferiorRunOk.~"[Thread 0x8bbff390 (LWP 17530) exited]\n"
[Thread 0x8bbff390 (LWP 17530) exited]
=thread-exited,id="19",group-id="i1"
Thread 19 in group i1 exited.In the MOV that won't play I see:
Thread 21 created.~"[New Thread 0x8ddf2390 (LWP 17432)]\n"
[New Thread 0x8ddf2390 (LWP 17432)]
*running,thread-id="21"
dNOTE: INFERIOR STILL RUNNING IN STATE InferiorRunOk.Media Status: QMediaPlayer::BufferedMedia
QWidget::paintEngine: Should no longer be called
QWidget::paintEngine: Should no longer be calledQWidget::paintEngine: Should no longer be called
QWidget::paintEngine: Should no longer be calledIn the MP4 that doesn't play:
Thread 21 created.~"[New Thread 0x8dbff390 (LWP 17705)]\n"
[New Thread 0x8dbff390 (LWP 17705)]
*running,thread-id="21"
dNOTE: INFERIOR STILL RUNNING IN STATE InferiorRunOk.Media Status: QMediaPlayer::BufferedMedia
QWidget::paintEngine: Should no longer be called
QWidget::paintEngine: Should no longer be calledIf you want to see the full debug section from when I hit the button to here I can paste it, but it is VERY long.
@MichRX7 said in Showing a mp4 in my app:
Well, there is a lot of output, not sure if you want to see all of it.
...
Thread 18 created. >~"[New Thread 0x8d0fc390 (LWP 17529)]\n" [New Thread 0x8d0fc390 (LWP 17529)] >*running,thread-id="18" dNOTE: INFERIOR STILL RUNNING IN STATE InferiorRunOk.
Looks like you ran it in the Debugger.
Run it normally (click "Run" instead of "Start Debugging" and you should see a lot less output.
-
wrote on 13 Feb 2020, 06:22 last edited by
Ok, here is the MP4 when I just run:
01:16:58: Starting /tmp/VisualGDB/c/projects/LinuxProject1/Debug/LinuxProject1...
qt5ct: using qt5ct plugin
qt5ct: D-Bus global menu: no
Media Status: QMediaPlayer::LoadingMedia
State: QMediaPlayer::PlayingState
mediaStatus: QMediaPlayer::LoadingMedia error: QMediaPlayer::NoError
Media Status: QMediaPlayer::BufferedMedia
01:17:08: /tmp/VisualGDB/c/projects/LinuxProject1/Debug/LinuxProject1 exited with code 0MOV file that plays as I expect:
01:18:52: Starting /tmp/VisualGDB/c/projects/LinuxProject1/Debug/LinuxProject1...
qt5ct: using qt5ct plugin
qt5ct: D-Bus global menu: no
Media Status: QMediaPlayer::LoadingMedia
State: QMediaPlayer::PlayingState
mediaStatus: QMediaPlayer::LoadingMedia error: QMediaPlayer::NoError
Media Status: QMediaPlayer::BufferedMedia
01:19:07: /tmp/VisualGDB/c/projects/LinuxProject1/Debug/LinuxProject1 exited with code 0MOV file that doesn't play (just get black window like MP4 file)
01:20:36: Starting /tmp/VisualGDB/c/projects/LinuxProject1/Debug/LinuxProject1...
qt5ct: using qt5ct plugin
qt5ct: D-Bus global menu: no
Media Status: QMediaPlayer::LoadingMedia
State: QMediaPlayer::PlayingState
mediaStatus: QMediaPlayer::LoadingMedia error: QMediaPlayer::NoError
Media Status: QMediaPlayer::BufferedMedia
QWidget::paintEngine: Should no longer be called
QWidget::paintEngine: Should no longer be called
QWidget::paintEngine: Should no longer be called
QWidget::paintEngine: Should no longer be called
01:20:49: /tmp/VisualGDB/c/projects/LinuxProject1/Debug/LinuxProject1 exited with code 0 -
wrote on 13 Feb 2020, 06:40 last edited by
Go figure, if I take the MOV that won't play into my video editor and export it as a WMV it plays.
Same goes with the MP4, convert it to WMV and it plays.Maybe there is an issue with my video software and MP4/MOV? Just odd that I can play them from the command line, but not from within my QT app.
-
Go figure, if I take the MOV that won't play into my video editor and export it as a WMV it plays.
Same goes with the MP4, convert it to WMV and it plays.Maybe there is an issue with my video software and MP4/MOV? Just odd that I can play them from the command line, but not from within my QT app.
@MichRX7 said in Showing a mp4 in my app:
Go figure, if I take the MOV that won't play into my video editor and export it as a WMV it plays.
Same goes with the MP4, convert it to WMV and it plays.Maybe there is an issue with my video software and MP4/MOV? Just odd that I can play them from the command line, but not from within my QT app.
Sounds like the video codecs aren't being loaded/used correctly in your Qt app.
What version of Qt are you using? What version of OS?
qt5ct: using qt5ct plugin
How did you install Qt?
mediaStatus: QMediaPlayer::LoadingMedia error: QMediaPlayer::NoError
Hmm... nothing in the log jumps out to me, unfortunately.
QWidget::paintEngine: Should no longer be called
This looks somewhat ominous; I'm not sure if this is a clue or not. https://stackoverflow.com/questions/45537627/qwidgetpaintengine-should-no-longer-be-called-appears-when-using-qmediaplay
-
@MichRX7 said in Showing a mp4 in my app:
Go figure, if I take the MOV that won't play into my video editor and export it as a WMV it plays.
Same goes with the MP4, convert it to WMV and it plays.Maybe there is an issue with my video software and MP4/MOV? Just odd that I can play them from the command line, but not from within my QT app.
Sounds like the video codecs aren't being loaded/used correctly in your Qt app.
What version of Qt are you using? What version of OS?
qt5ct: using qt5ct plugin
How did you install Qt?
mediaStatus: QMediaPlayer::LoadingMedia error: QMediaPlayer::NoError
Hmm... nothing in the log jumps out to me, unfortunately.
QWidget::paintEngine: Should no longer be called
This looks somewhat ominous; I'm not sure if this is a clue or not. https://stackoverflow.com/questions/45537627/qwidgetpaintengine-should-no-longer-be-called-appears-when-using-qmediaplay
wrote on 13 Feb 2020, 11:30 last edited byI am on a Rpi4 running Raspbian GNU/Linux 10 (buster).
I am running Qt Creator 4.8.2 Based on Qt 5.11.3 (GCC 8.3.0, 32 bit)I tried to install 5.14.1, but failed gloriously (lol). I will give it a try again some day, but wanted to try writing actual code. I believe the 5.11.3 came with Raspbian buster.
-
I am on a Rpi4 running Raspbian GNU/Linux 10 (buster).
I am running Qt Creator 4.8.2 Based on Qt 5.11.3 (GCC 8.3.0, 32 bit)I tried to install 5.14.1, but failed gloriously (lol). I will give it a try again some day, but wanted to try writing actual code. I believe the 5.11.3 came with Raspbian buster.
@MichRX7 said in Showing a mp4 in my app:
I tried to install 5.14.1, but failed gloriously (lol). I will give it a try again some day, but wanted to try writing actual code. I believe the 5.11.3 came with Raspbian buster.
When you're ready to try again, see https://www.tal.org/tutorials/building-qt-512-raspberry-pi as a good place to start.
For now, have a look at the list of multimedia dependencies in the link above. I wonder if the Raspbian's copy of the Qt5Multimedia library was built with all of those in place?
-
@MichRX7 said in Showing a mp4 in my app:
I tried to install 5.14.1, but failed gloriously (lol). I will give it a try again some day, but wanted to try writing actual code. I believe the 5.11.3 came with Raspbian buster.
When you're ready to try again, see https://www.tal.org/tutorials/building-qt-512-raspberry-pi as a good place to start.
For now, have a look at the list of multimedia dependencies in the link above. I wonder if the Raspbian's copy of the Qt5Multimedia library was built with all of those in place?
wrote on 14 Feb 2020, 12:48 last edited byYes, thank you for all your help and thank you for the insight from everyone on this thread. Right now just trying to do a proof of concept to show some people, and if I can get it to reliably show the wmv files that'll be fine for now.
I actually did try that page, and replaced 5.12.7 with 5.14.1. And it was my plan to try and figure out (using that page) what I did wrong when I'm ready to try again.
-
Yes, thank you for all your help and thank you for the insight from everyone on this thread. Right now just trying to do a proof of concept to show some people, and if I can get it to reliably show the wmv files that'll be fine for now.
I actually did try that page, and replaced 5.12.7 with 5.14.1. And it was my plan to try and figure out (using that page) what I did wrong when I'm ready to try again.
@MichRX7 said in Showing a mp4 in my app:
I actually did try that page, and replaced 5.12.7 with 5.14.1. And it was my plan to try and figure out (using that page) what I did wrong when I'm ready to try again.
I haven't developed for Raspbian before, but there a chance that the instructions for Qt 5.12.7 might not work with Qt 5.14.1 unmodified -- Some dependency might have changed between versions.
The instructions have been reported to work with Qt 5.12.7 on Raspbian Buster, so that combo will give you the best chance for success.
After you get it working with Qt 5.12.7, then try Qt 5.14.x (or even Qt 5.15: https://www.qt.io/blog/qt-5.15-alpha-released )
Yes, thank you for all your help and thank you for the insight from everyone on this thread. Right now just trying to do a proof of concept to show some people, and if I can get it to reliably show the wmv files that'll be fine for now.
You're welcome. All the best with your project!
36/44