taglib / taglib

TagLib Audio Meta-Data Library
http://taglib.org/
GNU Lesser General Public License v2.1
1.18k stars 345 forks source link

Can't read pictures from FLAC file #941

Closed vividos closed 4 years ago

vividos commented 4 years ago

I'm currently trying to read FLAC tags from a .flac file that was tagged with Mp3Tag (version 3.99). I can read the textual properties without problems, but the attached picture can't be read. Here's a link to the file: https://github.com/vividos/winLAME/blob/master/source/winlame/unittest/res/Jungle_S-RepaidGa-10582_hifi.flac The code to read the .flac tag is based on reading XiphComment tags and can be found here: https://github.com/vividos/winLAME/blob/0253706091757974e5012c7f2dba04a09f8bcc7c/source/winlame/encoder/AudioFileTag.cpp#L224-L272 Am I doing wrong? I studied the TagLib code a bit and noticed that reading the pictures are implemented using a property "METADATA_BLOCK_PICTURE" with a base64 encoded content, but inspecting the .flac file shows that all normal properties are in the file, but not the METADATA_BLOCK_PICTURE. After the normal properties are listed in the file, the picture data follows without a header. I'm using TagLib 1.11.1, by the way. Thanks! Michael

vividos commented 4 years ago

by the way, here's the output from ffprobe:

ffprobe version 3.4.1 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, flac, from 'Jungle_S-RepaidGa-10582_hifi.flac':
  Metadata:
    SOFTWARE        : winLAME 2018 beta 1 (libsndfile-1.0.27)
    ALBUM           : flashkit Samples
    ARTIST          : RepaidGateman
    COMMENT         : Brought to you by flashkit.com. Just roaming the jungle, in hopes for a McDonald's. Lead Acid-synth, with backing bass, synth stabs, and a drum beat. 100bpm.
    GENRE           : Electronic
    TITLE           : Jungle Starvation
    album_artist    : RepaidGateman
    COMPOSER        : RepaidGateman
    disc            : 1
    DATE            : 2011
    track           : 42
  Duration: 00:00:10.37, start: 0.000000, bitrate: 183 kb/s
    Stream #0:0: Audio: flac, 44100 Hz, stereo, s16 (8 bit)
    Stream #0:1: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 398x200 [SAR 120:120 DAR 199:100], 90k tbr, 90k tbn, 90k tbc
    Metadata:
      comment         : Cover (front)

So the tool can see and read the added cover.

BZHDeveloper commented 4 years ago

picture data is stored in pictureList, not in xiphComment

TagLib::FLAC::File* file = new TagLib::FLAC::File ("Jungle_S-RepaidGa-10582_hifi.flac"); TagLib::List<TagLib::FLAC::Picture*> list = file->pictureList(); TagLib::FLAC::Picture* pic = list.front();

vividos commented 4 years ago

Thanks for the code, works in my project!