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
QtWS25 Last Chance

Showing a mp4 in my app

Scheduled Pinned Locked Moved Unsolved General and Desktop
44 Posts 5 Posters 10.3k Views
  • 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.
  • MichRX7M Offline
    MichRX7M Offline
    MichRX7
    wrote on last edited by
    #18

    Hahaha, of course though I take a .mp4 into my video editing software and export it is a .mov and it won't play either. So is there a way to tell what I need to do to a video to get it to play or how I install the codec's I need in QT? I don't want to have to use only non-edited iPhone vids, lol...

    (Seriously, so glad to just see a video play... thank you all for the help so far.)

    jsulmJ 1 Reply Last reply
    0
    • MichRX7M MichRX7

      Hahaha, of course though I take a .mp4 into my video editing software and export it is a .mov and it won't play either. So is there a way to tell what I need to do to a video to get it to play or how I install the codec's I need in QT? I don't want to have to use only non-edited iPhone vids, lol...

      (Seriously, so glad to just see a video play... thank you all for the help so far.)

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #19

      @MichRX7 Most safe method is to install all GStreamer plug-ins your distribution is providing.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      MichRX7M 1 Reply Last reply
      0
      • jsulmJ jsulm

        @MichRX7 Most safe method is to install all GStreamer plug-ins your distribution is providing.

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

        @jsulm And I'm stuck again (of course), so I did the following on my Rpi4:
        sudo apt-get install gstreamer1.0-tools
        Reading package lists... Done
        Building dependency tree
        Reading state information... Done
        gstreamer1.0-tools is already the newest version (1.14.4-1).
        0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

        So, I already had the newest version of gstreamer installed. Is there something else I need to do to download specific codec's or all codec's? I tried going to the gstreamer website, but not seeing anything on codecs.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #21

          The codec are provided in the gstreamer plugins packages. See the gstreamer1.0-plugins-XXX packages.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          MichRX7M 1 Reply Last reply
          1
          • SGaistS SGaist

            The codec are provided in the gstreamer plugins packages. See the gstreamer1.0-plugins-XXX packages.

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

            @SGaist said in Showing a mp4 in my app:

            The codec are provided in the gstreamer plugins packages. See the gstreamer1.0-plugins-XXX packages.

            Thanks, will look into that on my lunch break.

            Or, if even easier, figure out why a .mov would play when it comes direct from an iPhone, but not if I take a mp4 and convert it into a mov in my video editing software. I mean, if I can convert to .mov and get it to work I'll just do that for now. :)

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

              @SGaist said in Showing a mp4 in my app:

              gstreamer1.0-plugins

              Ok, well tried to install codecs, not sure if I'm doing it right. Did the following three entries, and now going to reboot because my videos didn't play:
              apt-get install gstreamer1.0-plugins-*
              apt-get install gstreamer1.0-plugins-*
              apt-get install libavcodec-extra

              If this is not correct, I can't figure out how to get them properly.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #24

                Can you play your video directly with GStreamer from the command line ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                MichRX7M 1 Reply Last reply
                0
                • SGaistS SGaist

                  Can you play your video directly with GStreamer from the command line ?

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

                  @SGaist said in Showing a mp4 in my app:

                  Can you play your video directly with GStreamer from the command line ?

                  Yes, using:
                  gst-launch-1.0 playbin uri=file:///home/pi/Videos/tomtiph.mp4

                  or

                  gst-play-1.0 /home/pi/Videos/tomtiph.mp4

                  both those commands play the video

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #26

                    Good.

                    Then as next step, I would build and run the Media Player Example.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    MichRX7M 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      Good.

                      Then as next step, I would build and run the Media Player Example.

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

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

                      MichRX7M 1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #28

                        What are the specifications of that video ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        0
                        • MichRX7M MichRX7

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

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

                          @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

                          1 Reply Last reply
                          0
                          • 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

                                          • Login

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