Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read/Write lyrics #101

Open
rastaman111 opened this issue Aug 9, 2023 · 3 comments
Open

Read/Write lyrics #101

rastaman111 opened this issue Aug 9, 2023 · 3 comments

Comments

@rastaman111
Copy link

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
Copy link
Author

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

@chicio
Copy link
Owner

chicio commented Aug 10, 2023

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.

@rastaman111
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants