Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Showing a mp4 in my app
Forum Updated to NodeBB v4.3 + New Features

Showing a mp4 in my app

Scheduled Pinned Locked Moved Unsolved General and Desktop
44 Posts 5 Posters 12.6k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • JKSHJ Offline
    JKSHJ Offline
    JKSH
    Moderators
    wrote on last edited by JKSH
    #30

    @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;
    }
    

    Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

    MichRX7M 1 Reply Last reply
    2
    • JKSHJ JKSH

      @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;
      }
      
      MichRX7M Offline
      MichRX7M Offline
      MichRX7
      wrote on last edited by
      #31

      @JKSH

      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.

      JKSHJ 1 Reply Last reply
      0
      • MichRX7M Offline
        MichRX7M Offline
        MichRX7
        wrote on last edited by
        #32

        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::NoError

        Media 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.

        1 Reply Last reply
        0
        • MichRX7M MichRX7

          @JKSH

          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.

          JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #33

          @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 & inside of()

          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

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          MichRX7M 1 Reply Last reply
          0
          • JKSHJ JKSH

            @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 & inside of()

            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

            MichRX7M Offline
            MichRX7M Offline
            MichRX7
            wrote on last edited by MichRX7
            #34

            @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 & inside of()

            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;
            });

            JKSHJ 1 Reply Last reply
            0
            • MichRX7M 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 & inside of()

              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;
              });

              JKSHJ Offline
              JKSHJ Offline
              JKSH
              Moderators
              wrote on last edited by
              #35

              @MichRX7 said in Showing a mp4 in my app:

              qDebug() << "Error:" << error << player->errorString;
              

              Found it: errorString() needs parentheses

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              1 Reply Last reply
              1
              • MichRX7M Offline
                MichRX7M Offline
                MichRX7
                wrote on last edited by
                #36

                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 called

                QWidget::paintEngine: Should no longer be called
                QWidget::paintEngine: Should no longer be called

                In 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 called

                If 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.

                JKSHJ 1 Reply Last reply
                0
                • MichRX7M MichRX7

                  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 called

                  QWidget::paintEngine: Should no longer be called
                  QWidget::paintEngine: Should no longer be called

                  In 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 called

                  If 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.

                  JKSHJ Offline
                  JKSHJ Offline
                  JKSH
                  Moderators
                  wrote on last edited by
                  #37

                  @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.

                  Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                  1 Reply Last reply
                  0
                  • MichRX7M Offline
                    MichRX7M Offline
                    MichRX7
                    wrote on last edited by
                    #38

                    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 0

                    MOV 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 0

                    MOV 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

                    1 Reply Last reply
                    0
                    • MichRX7M Offline
                      MichRX7M Offline
                      MichRX7
                      wrote on last edited by
                      #39

                      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.

                      JKSHJ 1 Reply Last reply
                      0
                      • MichRX7M MichRX7

                        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.

                        JKSHJ Offline
                        JKSHJ Offline
                        JKSH
                        Moderators
                        wrote on last edited by
                        #40

                        @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

                        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                        MichRX7M 1 Reply Last reply
                        1
                        • JKSHJ JKSH

                          @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

                          MichRX7M Offline
                          MichRX7M Offline
                          MichRX7
                          wrote on last edited by
                          #41

                          @JKSH

                          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.

                          JKSHJ 1 Reply Last reply
                          0
                          • MichRX7M MichRX7

                            @JKSH

                            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.

                            JKSHJ Offline
                            JKSHJ Offline
                            JKSH
                            Moderators
                            wrote on last edited by
                            #42

                            @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?

                            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                            MichRX7M 1 Reply Last reply
                            0
                            • JKSHJ JKSH

                              @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?

                              MichRX7M Offline
                              MichRX7M Offline
                              MichRX7
                              wrote on last edited by
                              #43

                              @JKSH

                              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.

                              JKSHJ 1 Reply Last reply
                              0
                              • MichRX7M MichRX7

                                @JKSH

                                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.

                                JKSHJ Offline
                                JKSHJ Offline
                                JKSH
                                Moderators
                                wrote on last edited by
                                #44

                                @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!

                                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                                1 Reply Last reply
                                0

                                • Login

                                • Login or register to search.
                                • First post
                                  Last post
                                0
                                • Categories
                                • Recent
                                • Tags
                                • Popular
                                • Users
                                • Groups
                                • Search
                                • Get Qt Extensions
                                • Unsolved