ID3TagEditor icon indicating copy to clipboard operation
ID3TagEditor copied to clipboard

Read/Write lyrics

Open rastaman111 opened this issue 2 years ago • 3 comments

Hi

I am reading the metadata of a file AVAsset has lyrics After saving the metadata let id3Tag = ID32v4TagBuilder() .lyricist(frame: ID3FrameWithStringContent(content: asset.lyrics ?? "")) .build()

try id3TagEditor.write( tag: id3tag, to: videoURL.path, andSaveTo: destinationURL2?.path)

The following happens Lyrics are removed from AVAsset and written to the metadata under the id3/TEXT key

How can I leave lyrics in AVAsset?

rastaman111 avatar Aug 09 '23 08:08 rastaman111

Read file

 if let id3Tag = try id3TagEditor.read(from: sourceFilePath.path) {
          let contentReader = ID3TagContentReader(id3Tag: id3Tag)
          print(contentReader.lyricist())
          for i in contentReader.unsynchronizedLyrics() {
               print(i.content)
          }
}

lyricist can't see lyrics but unsynchronizedLyrics sees it

rastaman111 avatar Aug 09 '23 08:08 rastaman111

Hi @rastaman111, ID3TagEditor expect to receive as input the mp3 file as 'Data'. AVAsset is container type created by Apple to hide the complexity of managing different types of media assets. This means it has a proprietary in some way. My bet is that the problem could be:

  • AVAsset doesn't respect the id3 standard and skip the tag created by ID3TagEditor
  • ID3TagEditor write the id3 tag on the file, and in this case (AVAsset) it could be the mp3 with additional data written by Apple (and so it results in corrupted data)

I would suggest to try to write the id3 tag directly on the mp3 data (by accessing it with some AVAsset api).

Fabrizio.

chicio avatar Aug 10 '23 06:08 chicio

I do it I take an mp3 file, read AVAsset from it, the default code for lyrics is "identifier=id3/USLT"

And after saving through ID3TagEditor .lyricist(frame: ID3FrameWithStringContent(content: asset.lyrics ?? "")) it converts to "identifier=id3/TEXT"

And already AVAsset can't read it

rastaman111 avatar Aug 10 '23 06:08 rastaman111