Zazama / node-id3

Pure JavaScript ID3 Tag library
MIT License
284 stars 57 forks source link

[BuG] MP3 File is corrupted #151

Open EhsanFox opened 1 year ago

EhsanFox commented 1 year ago

Hey, Hope you are doing well, Before going deep into the project, I have to say, your work is amazing, keep up the good work,

So the issue is, I created some tags and saved them (with the write method) to the target file (which is MP3) And I wanted to check and see if the tags + image cover has been changed, but for some reason, the file now, seems like I would say "corrupted" and it's not playable.

By any chance, this might be something I do or something with the package perhaps, so I sent the tags-object that I pass on to the write function here as well!

{
  title: 'Ali Yasini - Nade Ghol | OFFICIAL TRACK علی یاسینی - نده قول',
  image: {
    mime: 'image/webp',
    type: { id: 3, name: 'front cover' },
    description: 'Image cover generated by music-engines',
    imageBuffer: <Buffer 52 49 46 46 46 76 01 00 57 45 42 50 56 50 38 20 3a 76 01 00 90 89 04 9d 01 2a 00 05 d0 02 3e 6d 32 95 48 a4 22 a2 26 23 b6 39 f8 c0 0d 89 69 68 d7 7c ... 95772 more bytes>
  },
  artist: 'Ali Yasini',
  artistUrl: [ 'https://www.youtube.com/@aliyasiniofficial' ],
  audioSourceUrl: 'https://www.youtube.com/watch?v=PABz4ySVrYE',
  length: '2',
  publisher: 'Project-mp - music-engines',
  publisherUrl: 'htps://ehsan.js.org',
  copyright: '2023',
  copyrightUrl: 'htps://ehsan.js.org',
  taggingTime: '2023-02-23',
  subtitle: 'Downloaded by Project-mp | htps://ehsan.js.org',
  fileOwner: 'Project-mp',
  encodingTime: '2023-02-23',
  encodedBy: 'Project-mp',
  commercialUrl: [ 'htps://ehsan.js.org' ],
  raw: {
    TIT2: 'Ali Yasini - Nade Ghol | OFFICIAL TRACK علی یاسینی - نده قول',
    APIC: {
      mime: 'image/webp',
      type: [Object],
      description: 'Image cover generated by music-engines',
      imageBuffer: <Buffer 52 49 46 46 46 76 01 00 57 45 42 50 56 50 38 20 3a 76 01 00 90 89 04 9d 01 2a 00 05 d0 02 3e 6d 32 95 48 a4 22 a2 26 23 b6 39 f8 c0 0d 89 69 68 d7 7c ... 95772 more bytes>
    },
    TPE1: 'Ali Yasini',
    WOAR: [ 'https://www.youtube.com/@aliyasiniofficial' ],
    WOAS: 'https://www.youtube.com/watch?v=PABz4ySVrYE',
    TLEN: '2',
    TPUB: 'Project-mp - music-engines',
    WPUB: 'htps://ehsan.js.org',
    TCOP: '2023',
    WCOP: 'htps://ehsan.js.org',
    TDTG: '2023-02-23',
    TIT3: 'Downloaded by Project-mp | htps://ehsan.js.org',
    TOWN: 'Project-mp',
    TDEN: '2023-02-23',
    TENC: 'Project-mp',
    WCOM: [ 'htps://ehsan.js.org' ]
  }
}
EhsanFox commented 1 year ago

Ok, so I've been playing around with it, I removed the image property from the tags, and the file seems to be playable again, but still, the other tags, such as title and others are not showing up (in the music player of mine, which is Windows 10 Groove Music)

But using node-id3 read functions, gives the object Example:

{
  title: 'Ali Yasini - Nade Ghol | OFFICIAL TRACK علی یاسینی - نده قول',
  artist: 'Ali Yasini',
  artistUrl: [ 'https://www.youtube.com/@aliyasiniofficial' ],
  audioSourceUrl: 'https://www.youtube.com/watch?v=PABz4ySVrYE',
  length: '2',
  publisher: 'Project-mp - music-engines',
  publisherUrl: 'htps://ehsan.js.org',
  copyright: '2023',
  copyrightUrl: 'htps://ehsan.js.org',
  taggingTime: '2023-02-23',
  subtitle: 'Downloaded by Project-mp | htps://ehsan.js.org',
  fileOwner: 'Project-mp',
  encodingTime: '2023-02-23',
  encodedBy: 'Project-mp',
  commercialUrl: [ 'htps://ehsan.js.org' ],
  raw: {
    TIT2: 'Ali Yasini - Nade Ghol | OFFICIAL TRACK علی یاسینی - نده قول',
    TPE1: 'Ali Yasini',
    WOAR: [ 'https://www.youtube.com/@aliyasiniofficial' ],
    WOAS: 'https://www.youtube.com/watch?v=PABz4ySVrYE',
    TLEN: '2',
    TPUB: 'Project-mp - music-engines',
    WPUB: 'htps://ehsan.js.org',
    TCOP: '2023',
    WCOP: 'htps://ehsan.js.org',
    TDTG: '2023-02-23',
    TIT3: 'Downloaded by Project-mp | htps://ehsan.js.org',
    TOWN: 'Project-mp',
    TDEN: '2023-02-23',
    TENC: 'Project-mp',
    WCOM: [ 'htps://ehsan.js.org' ]
  }
}
EhsanFox commented 1 year ago

Here is the screenshot of the app: image

EhsanFox commented 1 year ago

as my information goes further, seems like the problem is not just with Groove Music Player Seems like no one (besides the node-id3 can't seem to read the tags For example, the File Explorer of Windows 10: image

Zazama commented 1 year ago

Can you try writing without encodingTime and taggingTime? I think Windows 10 doesn't support the newer tags.

Zazama commented 1 year ago

Also, it might not handle the webp image format correctly, which is why it might not work with image. I'm not sure if it's a Windows 10 bug or a library bug, can you send the broken mp3 to my email jan.metzger@gmx.net?

EhsanFox commented 1 year ago

I've tried it with only the artist and title tag, and still, the same result came back

The idea about the image being webp can be true, so I skipped the image for now, but still, the tags are not showing up.

Zazama commented 1 year ago

I can't reproduce this on Windows 11, both File Explorer and the Music Player (not Groove anymore) show the correct title and artist grafik

My initial thought was that Windows 10 does not support ID3v2.4.0 tags, but node-id3 should only write ID3v2.3.0 for title and artist, not really sure what the problem is otherwise :/

EhsanFox commented 1 year ago

Sorry for late response,

I have no idea how is this possible or whatever is going on, But I've tried with only the artist and title tag,

And yet the result came back the same.

image image