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. How to extract cover art from a media file using Qt Libraries
Qt 6.11 is out! See what's new in the release blog

How to extract cover art from a media file using Qt Libraries

Scheduled Pinned Locked Moved General and Desktop
10 Posts 5 Posters 5.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.
  • I Offline
    I Offline
    inblueswithu
    wrote on last edited by
    #1

    I'm trying to extract cover art from a media file.
    My application is QML Application. I have to feed the extracted cover image from media file from Qt to QML.

    I tried as following:
    @gui->setProperty("coverImage", (this->metaData("CoverArtImage")))@

    where this is QMediaPlayer class
    gui is QQuickItem
    coverImage is a string property in qml file.

    I'm giving this coverImage as source inside Image element.
    I came to know there is some conversion issue here, from Image to providing it as a string etc.
    When I tested this:
    @qDebug() << this->metaData("CoverArtImage").type();@

    it returned QVariant::Invalid

    How should I do this?

    Thanks & Regards,
    inblueswithu

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      What type of media file are you reading?
      Did you also try the CoverArtUrlSmall/CoverArtUrlLarge?
      Are you sure your media file has a cover-art embedded?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      D 1 Reply Last reply
      0
      • I Offline
        I Offline
        inblueswithu
        wrote on last edited by
        #3

        Im feeding mp3 files only. I'm sure few songs in my list have a Cover Art. Windows 8 music player app recognized them. If needed, I can give that song too for testing.

        Ya. I tried it.
        @qDebug() << this->metaData("CoverArtImage").type();
        qDebug() << this->metaData("CoverArtUrlLarge");
        qDebug() << this->metaData("CoverArtUrlSmall");@

        They too gave the same result.

        @QVariant::Invalid
        QVariant(Invalid)
        QVariant(Invalid) @

        1 Reply Last reply
        0
        • I Offline
          I Offline
          inblueswithu
          wrote on last edited by
          #4

          Anyone tried this???

          1 Reply Last reply
          0
          • raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #5

            [quote author="inblueswithu" date="1385402782"]I'm sure few songs in my list have a Cover Art. [/quote]
            Are you really sure? I'm asking because i wouldn't be surprised when the player just loads the coverart from the internet based on the artist and title provided. Use some tool which really reads the metadata from the media file (a quick google search came up with "this":http://id3tageditor.com/ for example)

            As a safe fall back i would recommend to use a free 3rd party lib for this. For example: "TagLib":http://taglib.github.io/

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            0
            • I Offline
              I Offline
              inblueswithu
              wrote on last edited by
              #6

              Ya. I have seen them before but failed to compile successfully. So, I chose to use default Qt libs.

              I didn't want to increase size of my application by adding these 3rd party libs. But it seems inevitable in my present situation.

              1 Reply Last reply
              0
              • raven-worxR raven-worx

                What type of media file are you reading?
                Did you also try the CoverArtUrlSmall/CoverArtUrlLarge?
                Are you sure your media file has a cover-art embedded?

                D Offline
                D Offline
                damianatorrpm
                wrote on last edited by
                #7

                @raven-worx said in How to extract cover art from a media file using Qt Libraries:

                What type of media file are you reading?
                Did you also try the CoverArtUrlSmall/CoverArtUrlLarge?
                Are you sure your media file has a cover-art embedded?
                @raven-worx

                Reviving this old topic.
                The CoverArtUrlSmall/CoverArtUrlLarge would only give URL's to existing files not to embedded inside the audio file right?

                mrjjM 1 Reply Last reply
                0
                • D damianatorrpm

                  @raven-worx said in How to extract cover art from a media file using Qt Libraries:

                  What type of media file are you reading?
                  Did you also try the CoverArtUrlSmall/CoverArtUrlLarge?
                  Are you sure your media file has a cover-art embedded?
                  @raven-worx

                  Reviving this old topic.
                  The CoverArtUrlSmall/CoverArtUrlLarge would only give URL's to existing files not to embedded inside the audio file right?

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Hi
                  yes its just URL (path)

                  A 1 Reply Last reply
                  1
                  • mrjjM mrjj

                    Hi
                    yes its just URL (path)

                    A Offline
                    A Offline
                    ahmad98
                    wrote on last edited by
                    #9

                    @mrjj
                    hello,can you explain me how to set song cover into an Image in qml please?
                    after loading song,i have this object from metadata :

                    QVariant(QImage, QImage(QSize(1000, 1000),format=QImage::Format_RGB32,depth=32,devicePixelRatio=1,bytesPerLine=4000,sizeInBytes=4000000))
                    

                    how can i find and use this Qimage url?should i set something to source attr of Image?i have no idead :((
                    thank you for helping

                    mrjjM 1 Reply Last reply
                    0
                    • A ahmad98

                      @mrjj
                      hello,can you explain me how to set song cover into an Image in qml please?
                      after loading song,i have this object from metadata :

                      QVariant(QImage, QImage(QSize(1000, 1000),format=QImage::Format_RGB32,depth=32,devicePixelRatio=1,bytesPerLine=4000,sizeInBytes=4000000))
                      

                      how can i find and use this Qimage url?should i set something to source attr of Image?i have no idead :((
                      thank you for helping

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @ahmad98

                      Hi
                      I think you you would use an image provider to send to QML
                      like here
                      https://stackoverflow.com/questions/20691414/qt-qml-send-qimage-from-c-to-qml-and-display-the-qimage-on-gui
                      the "Use an image provider" answer.

                      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