Borewit / music-metadata

Stream and file based music metadata parser for node. Supporting a wide range of audio and tag formats.
MIT License
905 stars 90 forks source link

Does it support lyrics? #1974

Closed ptrzs3 closed 2 months ago

ptrzs3 commented 8 months ago

Has the question been asked before?

Question

I searched existed questions to find out if music-metadata support parse embeded lyrics while there isn't results. code like this below, this.lyrics is always null while the .mp3 file does exist embeded lyrics:

  async getMetadata() {
    this.lyrics = mm.common.lyrics ? mm.common.lyrics : ['null']
  }

To avoid the .mp3 file is broken, I tried other npm library like id3-parser, it can parse the embeded lyrics

ptrzs3 commented 8 months ago

Add supplementary note

const mm = await parseFile(this.filePath, { duration: true })
ffxsam commented 4 months ago

Would love to see lyrics support! It's an official ID3 tag.

Borewit commented 4 months ago

There is some lyrics support present, including the ID3v2 / ID3v2 SYLT tag.

Unit test covering this: https://github.com/Borewit/music-metadata/blob/ca9870493a1a286b22a5a049a0c97fdfb281277f/test/test-id3v2-lyrics.ts#L17-L20

Tag mapping (I know, very hard to scroll to the right side of the table): here.

But there maybe lyric standards which are not support yet, such as Lyrics3 v2.00, which I believe is requested here: Borewit/music-metadata#264.

ffxsam commented 4 months ago

Interesting. I can't tell what version of lyrics kid3 is using, but see the screenshot below:

CleanShot 2024-05-17 at 12 19 00

And (surprisingly) ffprobe can detect this too:

Input #0, wav, from 'quiet.wav':
  Metadata:
    genre           : Ambient
    creation_time   : 10:54:55
    time_reference  : 283583
    umid            : 0xBB6126C10EAD442384B897E045E2CC3200000000000000000000000000000000
    title           : Test Track
    artist          : Sam Hulick
    album           : Album Name
    track           : 1
    lyrics-eng      : Hello hello!
    date            : 2023

And actually, I do see lyrics in music-metadata's output! Just not where I thought it would be (under a USLT tag in native):

{
  native: {
    'ID3v2.3': [
      { id: 'TIT2', value: 'Test Track' },
      { id: 'TPE1', value: 'Sam Hulick' },
      { id: 'TALB', value: 'Album Name' },
      { id: 'TRCK', value: '1' },
      {
        id: 'USLT',
        value: { language: 'eng', description: '', text: 'Hello hello!' }
      },
      { id: 'TYER', value: '2023' },
      { id: 'TCON', value: 'Ambient' }
    ]
  },

So this really isn't a big issue. It would be nice if it appeared under common for easy access, but it's just a nice-to-have.

Borewit commented 4 months ago

Seems that an attempt to map USLT had defined, but was never really implemented properly.

https://github.com/Borewit/music-metadata/blob/6cc0ea2993bdbbc548b268afe826a6f2ffa2c6d2/lib/id3v2/ID3v24TagMapper.ts#L28

Borewit commented 2 months ago

Adding support for SYLT frame as well here: #2159

If there are other types of lyrics, please open issue, and provide solid sample data. Preferable very small samples.