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. Problem with Qt Multimedia
Forum Updated to NodeBB v4.3 + New Features

Problem with Qt Multimedia

Scheduled Pinned Locked Moved Unsolved General and Desktop
c++multimediaqmediaplayerlogoutqt 5.8
65 Posts 4 Posters 45.8k 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.
  • K Offline
    K Offline
    KhoaTran Programmer
    wrote on last edited by
    #2

    Hi 6EQUJ5,

    Could you please show up more detail about your error?

    I've had times for working with Qt Multimedia for Embedded Linux, my experience is that Qt uses Gstreamer framework as the backend layer for Multimedia function. So maybe you must install Gstreamer on your Linux firstly.

    Best regards,
    Khoa

    6 1 Reply Last reply
    0
    • K KhoaTran Programmer

      Hi 6EQUJ5,

      Could you please show up more detail about your error?

      I've had times for working with Qt Multimedia for Embedded Linux, my experience is that Qt uses Gstreamer framework as the backend layer for Multimedia function. So maybe you must install Gstreamer on your Linux firstly.

      Best regards,
      Khoa

      6 Offline
      6 Offline
      6EQUJ5
      wrote on last edited by 6EQUJ5
      #3

      @KhoaTran-Programmer The errors are here:

      path/mainwindow.o In function `MainWindow::MainWindow(QWidget*)':

      path/mainwindow.cpp:-1: error: undefined reference to `QMediaPlayer::QMediaPlayer(QObject*, QFlagsQMediaPlayer::Flag)'

      :-1: error: collect2: error: ld returned 1 exit status

      Adding QT += multimedia in project_name.pro solved it. But, as I stated it logs me off for some reason when I run it.

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

        Hi and welcome to devnet,

        You are missing QT += multimediawidgets in your .pro file.

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

        6 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi and welcome to devnet,

          You are missing QT += multimediawidgets in your .pro file.

          6 Offline
          6 Offline
          6EQUJ5
          wrote on last edited by
          #5

          @SGaist The same problem happens. I tried adding just QT += multimedia, just QT += multimediawidgets, and both of them in my .pro file.

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

            Did you re-run qmake after modifying the QT variable ?

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

            6 1 Reply Last reply
            0
            • SGaistS SGaist

              Did you re-run qmake after modifying the QT variable ?

              6 Offline
              6 Offline
              6EQUJ5
              wrote on last edited by
              #7

              @SGaist Yes I did. I cleaned, ran qmake, then rebuilded.

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

                Ok, can you show how you create your QMediaPlayer object ?

                Re-reading the error message, it seems that you are trying to give it a QObject based parent rather than a QWidget based parent.

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

                6 1 Reply Last reply
                0
                • SGaistS SGaist

                  Ok, can you show how you create your QMediaPlayer object ?

                  Re-reading the error message, it seems that you are trying to give it a QObject based parent rather than a QWidget based parent.

                  6 Offline
                  6 Offline
                  6EQUJ5
                  wrote on last edited by
                  #9

                  @SGaist I created my QMediaPlayer object like this:

                  ___QMediaPlayer *player = new QMediaPlayer(this);

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

                    What is this ?

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

                    6 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      What is this ?

                      6 Offline
                      6 Offline
                      6EQUJ5
                      wrote on last edited by 6EQUJ5
                      #11

                      @SGaist this is MainWindow.

                      mainwindow.h

                      #ifndef MAINWINDOW_H
                      #define MAINWINDOW_H
                      
                      #include <QMainWindow>
                      #include <QtMultimedia/QMediaPlayer>
                      
                      namespace Ui
                      {
                          class MainWindow;
                      }
                      
                      class MainWindow : public QMainWindow
                      {
                          Q_OBJECT
                      
                      public:
                          explicit MainWindow(QWidget *parent = 0);
                          ~MainWindow();
                      
                      private:
                          QMediaPlayer *player = new QMediaPlayer(this);
                          Ui::MainWindow *ui;
                      };
                      
                      #endif // MAINWINDOW_H
                      
                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        KhoaTran Programmer
                        wrote on last edited by
                        #12

                        @6EQUJ5 ,

                        Could you please try to run some media player that has already had in Qt package

                        Qt5.8.0\Examples\Qt-5.8\multimedia\video\qmlvideo
                        Qt5.8.0\Examples\Qt-5.8\multimediawidgets\player

                        You should ensure that the Multimedia backend is available on your system or not?

                        Best regards,
                        Khoa

                        6 1 Reply Last reply
                        0
                        • K KhoaTran Programmer

                          @6EQUJ5 ,

                          Could you please try to run some media player that has already had in Qt package

                          Qt5.8.0\Examples\Qt-5.8\multimedia\video\qmlvideo
                          Qt5.8.0\Examples\Qt-5.8\multimediawidgets\player

                          You should ensure that the Multimedia backend is available on your system or not?

                          Best regards,
                          Khoa

                          6 Offline
                          6 Offline
                          6EQUJ5
                          wrote on last edited by 6EQUJ5
                          #13

                          @KhoaTran-Programmer With qmlvideo when I tried to play a video it logged me out again. With player it logged me out the moment I ran it.

                          Why do I get logged out when I try to run multimedia based Qt programs? And how do I ensure the multimedia back end is available on my system and install the multimedia backend?

                          K jsulmJ 2 Replies Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #14

                            You should start by testing with your distribution provided Qt to ensure that everything is working correctly.

                            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
                            • 6 6EQUJ5

                              @KhoaTran-Programmer With qmlvideo when I tried to play a video it logged me out again. With player it logged me out the moment I ran it.

                              Why do I get logged out when I try to run multimedia based Qt programs? And how do I ensure the multimedia back end is available on my system and install the multimedia backend?

                              K Offline
                              K Offline
                              KhoaTran Programmer
                              wrote on last edited by
                              #15

                              @6EQUJ5

                              How to ensure the multimedia backend is available or not? I try 2 methods before:

                              1. Use default application of Qt(qmlvideo, player, ...)
                                -> If one of them can run well, we can conclude it's OK
                              2. Download Qt everywhere package and install(I try on Linux Embedded)
                                -> When building Qt Multimedia component, qmake will automatically detect the backend, if it's not available some error info will display

                              For your information, multimedia backend is not same for each OS

                              • Windows: Directshow -> it's always available in Windows
                              • Linux: Gstreamer -> Most, if not all, Linux distributions provide packages of GStreamer. You should find these in your distribution's package repository.
                              • QNX: ???
                              • Android: StageFight(maybe)

                              Since your OS is Linux(Debian 8), so please confirm Gstreamer firstly. The fastest way, open termial and run some Gstreamer command line tools:
                              $ gst-inspect-1.0
                              $ gst-launch-1.0

                              For set up Gstreamer on Linux, please refer to:
                              https://gstreamer.freedesktop.org/documentation/installing/on-linux.html

                              Best regards,
                              Khoa

                              6 2 Replies Last reply
                              0
                              • 6 6EQUJ5

                                @KhoaTran-Programmer With qmlvideo when I tried to play a video it logged me out again. With player it logged me out the moment I ran it.

                                Why do I get logged out when I try to run multimedia based Qt programs? And how do I ensure the multimedia back end is available on my system and install the multimedia backend?

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

                                @6EQUJ5 Sounds like an issue with your graphics driver. Does any media player work?

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

                                1 Reply Last reply
                                0
                                • K KhoaTran Programmer

                                  @6EQUJ5

                                  How to ensure the multimedia backend is available or not? I try 2 methods before:

                                  1. Use default application of Qt(qmlvideo, player, ...)
                                    -> If one of them can run well, we can conclude it's OK
                                  2. Download Qt everywhere package and install(I try on Linux Embedded)
                                    -> When building Qt Multimedia component, qmake will automatically detect the backend, if it's not available some error info will display

                                  For your information, multimedia backend is not same for each OS

                                  • Windows: Directshow -> it's always available in Windows
                                  • Linux: Gstreamer -> Most, if not all, Linux distributions provide packages of GStreamer. You should find these in your distribution's package repository.
                                  • QNX: ???
                                  • Android: StageFight(maybe)

                                  Since your OS is Linux(Debian 8), so please confirm Gstreamer firstly. The fastest way, open termial and run some Gstreamer command line tools:
                                  $ gst-inspect-1.0
                                  $ gst-launch-1.0

                                  For set up Gstreamer on Linux, please refer to:
                                  https://gstreamer.freedesktop.org/documentation/installing/on-linux.html

                                  Best regards,
                                  Khoa

                                  6 Offline
                                  6 Offline
                                  6EQUJ5
                                  wrote on last edited by
                                  #17

                                  @KhoaTran-Programmer On https://gstreamer.freedesktop.org/documentation/installing/on-linux.html the instructions for Debian installation is this:

                                  Install GStreamre on Ubuntu or Debian
                                  Run the following command:
                                  
                                  apt-get install ....
                                  

                                  Which I'm not sure about. I tried running sudo aptitude install gstreamer which didn't work. Then after typing in sudo aptitude install gstreamer and pressing TAB a bunch of packages came up which I don't know which to install.

                                  Can you clarify how to install on Debian?

                                  jsulmJ 1 Reply Last reply
                                  0
                                  • 6 6EQUJ5

                                    @KhoaTran-Programmer On https://gstreamer.freedesktop.org/documentation/installing/on-linux.html the instructions for Debian installation is this:

                                    Install GStreamre on Ubuntu or Debian
                                    Run the following command:
                                    
                                    apt-get install ....
                                    

                                    Which I'm not sure about. I tried running sudo aptitude install gstreamer which didn't work. Then after typing in sudo aptitude install gstreamer and pressing TAB a bunch of packages came up which I don't know which to install.

                                    Can you clarify how to install on Debian?

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

                                    @6EQUJ5 You should install all the GStreamer plug-in packages.
                                    But I don't think it is related to the installed GStreamer packages: if something needed is missing you will not be able to play a media file, but you should not be logged off.

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

                                    1 Reply Last reply
                                    0
                                    • K KhoaTran Programmer

                                      @6EQUJ5

                                      How to ensure the multimedia backend is available or not? I try 2 methods before:

                                      1. Use default application of Qt(qmlvideo, player, ...)
                                        -> If one of them can run well, we can conclude it's OK
                                      2. Download Qt everywhere package and install(I try on Linux Embedded)
                                        -> When building Qt Multimedia component, qmake will automatically detect the backend, if it's not available some error info will display

                                      For your information, multimedia backend is not same for each OS

                                      • Windows: Directshow -> it's always available in Windows
                                      • Linux: Gstreamer -> Most, if not all, Linux distributions provide packages of GStreamer. You should find these in your distribution's package repository.
                                      • QNX: ???
                                      • Android: StageFight(maybe)

                                      Since your OS is Linux(Debian 8), so please confirm Gstreamer firstly. The fastest way, open termial and run some Gstreamer command line tools:
                                      $ gst-inspect-1.0
                                      $ gst-launch-1.0

                                      For set up Gstreamer on Linux, please refer to:
                                      https://gstreamer.freedesktop.org/documentation/installing/on-linux.html

                                      Best regards,
                                      Khoa

                                      6 Offline
                                      6 Offline
                                      6EQUJ5
                                      wrote on last edited by 6EQUJ5
                                      #19

                                      @KhoaTran-Programmer The Gstreamer command line tools doesn't work (no such command exists according to terminal even with sudo). But, trying to install the Gstreamer plugins such as gstreamer1.0-plugins-base with sudo apt-get install gstreamer1.0-plugins-base tells me it's already installed.

                                      @jsulm What do you mean "any" media player? The examples on Qt or any media player that is installed? If you mean any old media player GNOME MPlayer works.

                                      @SGaist Aren't I doing that already? By using this version: Qt 5.8.0 for Linux 64-bit (766 MB)

                                      jsulmJ 1 Reply Last reply
                                      0
                                      • 6 6EQUJ5

                                        @KhoaTran-Programmer The Gstreamer command line tools doesn't work (no such command exists according to terminal even with sudo). But, trying to install the Gstreamer plugins such as gstreamer1.0-plugins-base with sudo apt-get install gstreamer1.0-plugins-base tells me it's already installed.

                                        @jsulm What do you mean "any" media player? The examples on Qt or any media player that is installed? If you mean any old media player GNOME MPlayer works.

                                        @SGaist Aren't I doing that already? By using this version: Qt 5.8.0 for Linux 64-bit (766 MB)

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

                                        @6EQUJ5 Qt 5.8 is for sure not what Debian provides (maybe Unstable?), I guess you installed Qt 5.8 by yourself, right? What @SGaist means is: try with Qt provided by Debian.

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

                                        6 1 Reply Last reply
                                        0
                                        • jsulmJ jsulm

                                          @6EQUJ5 Qt 5.8 is for sure not what Debian provides (maybe Unstable?), I guess you installed Qt 5.8 by yourself, right? What @SGaist means is: try with Qt provided by Debian.

                                          6 Offline
                                          6 Offline
                                          6EQUJ5
                                          wrote on last edited by 6EQUJ5
                                          #21

                                          @jsulm Where can I get that? And yes I download the offline installer for Qt 5.8.0 for Linux 64-bit (766 MB) and installed Qt.

                                          jsulmJ 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