[vlc-devel] (no subject)

Wieland Hoffmann themineo at gmail.com
Wed Jan 15 18:49:48 CET 2014

Hallo Jean-Baptiste Kempf:
> On 14 Jan, Wieland Hoffmann wrote :
> > The MusicBrainz *Album* ID that the current code uses is not what's gets
> > used for vlc_meta_TrackID (the UFID frame in ID3). The TrackID
> > corresponds to the MusicBrainz Recording ID, where a recording is a
> > peace of audio that later gets used as a track on one (or more) releases
> > (albums). The "official" definition of a recording is at [0].
> OK, then I'm confused. Great.
> What does acoustid return then?

Now that you've brought AcoustID into the conversation, I'm confused as
well. I'll try to explain this a bit better to get us on the same page:

What the 00_musicbrainz.lua script does is: it gets the MusicBrainz
Album ID (which is the ID for an album or, as it's called in MB, a
release [0]). To query the web service for output that indicates whether
or not the Cover Art Archive (CAA) has artwork for the release, it's
necessary to know the Album ID [3]. Finding that ID can happen through either

* searching for the release on MB with some known metadata like the
  artist and album name or the artist and recording (track) name, but
  not the MB Album ID. Let's put this one aside for a moment and focus

* getting the MusicBrainz Album ID directly from the tags of the audio
  or video file. MusicBrainz defines some standard tags in which its IDs
  should be kept in audio files through the tag mapping [1] which
  several MB-enabled tagging applications (Picard, beets, Jaikoz + some
  more) follow. VLC currently reads those tags for *some* of the media
  formats and tagging standards it supports:

  * In the case of ID3, the Track ID (which is a misnomer, it's actually
    the ID for the recording [2]) is read from the UFID frame. The
    MusicBrainz Album ID is read from the tags because it's saved in
    what ID3 calls a "user defined text information frame" which VLC
    (more specifically, ReadMetaFromID3v2 in
    modules/meta_engine/taglib.cpp) uses to populate the "extra_tags"
    member of the vlc_meta_t struct.

  * For FLAC files with Vorbis Comments, the tags get read properly as
    well - although I have to admit that, as someone usually not
    fiddling with C/C++, it's currently unclear to me, why that is.

  * For MP4, WMA and files with APE tags, the MB tags do not get read at
    all. (More on this point later on)

* Fingerprinting the audio files (which does not need to have any
  metadata) with the AcoustID/chromaprint library which gives us a
  fingerprint of the *audio* data of the track. We can then ask the
  AcoustID web service[4] for releases that the recording(s) that are
  associated with that fingerprint appear(s) on. (This is not the only
  way to get the release id from acoustid, but the others are very
  similar :) )

Now that we've got the MBID of the album, the existing try_query
function in share/lua/meta/art/00_musicbrainz.lua will work.
> > It is possible to get a list of all releases and their IDs
> > through the MB web service by first querying the /ws/2/recording
> > endpoint and then using one or more of the release IDs obtained through
> > that request to query the /ws/2/release endpoint.
> > The problem with that approach is that the release whose cover gets
> > chosen might not be the release the user has (because a recording can
> > appear on multiple releases) when we do in fact know exactly which
> > release it is: the one whose MusicBrainz Album ID is in the tags.
> OK. What do you suggest then?

The only problem in my explanation above is that currently, the Album ID
is not read from some files, even if the tags do actually contain it.
This means we can either

* add code to explicitly read the MusicBrainz {Album, Artist, Work,
  Album Artist} ID from the files. This is relatively easy because it
  boils down to asking taglib for the tag in readMetaFrom* and, if it
  exists, add it somewhere (either extra_tags or by extending
  vlc_meta_type_t). Adding it into extra_tags would mean that the
  MusicBrainz related tags do appear in the metadata dialog, but other
  tags that VLC doesn't know about do not.

* extend the respective readMetaFrom* methods to read *all* tags taglib
  gives us. That would mean adding a check like "has the tag that we're
  deadling with right now already been handled by populating ppsz_meta
  of vlc_meta_t (the well known tags like artist, album, etc.)".

> > The UI part was referring to the vlc_meta_AddExtra part above, which
> > automatically makes tags appear in the metadata dialog of at least the
> > Qt4 interface.
> I know.
> But our information dialog could get better, notably with links to
> information from mb.

In that case, I think it'd be best to normalise the names for the MBIDs
or use vlc_meta_type_t - otherwise, we'd need to change the display
logic depending on the file type.

[0] http://musicbrainz.org/doc/Release
[1] http://musicbrainz.org/doc/MusicBrainz_Picard/Tags/Mapping
[2] http://beta.musicbrainz.org/doc/Recording
[3] This is different from asking MusicBrainz for an ASIN which is
possible without knowing the Album ID
[4] http://acoustid.org/webservice#lookup


More information about the vlc-devel mailing list