jacquesh / foo_openlyrics

An open-source lyric display panel for foobar2000
MIT License
445 stars 26 forks source link

[FR] Use USLT/SYLT tag instead of the generic TXXX for better compatibility #84

Closed hondrus31 closed 2 years ago

hondrus31 commented 2 years ago

Basically what the title says. I found out that outside fb2k, other music players and even my synced iPod just don't read the generic TXXX tag as a lyrics tag. This can be improved using dedicated tags like USLT for unsynchronized lyrics and SYLT for synchronized lyrics. Songs with these tags have no problems displaying lyrics everywhere you can read it.

I don't know if this feature is viable, but it will be a great step forward for a better standardized music library.

More info about the usage of the two tags here: ID3v2.3.0 Informal standard

jacquesh commented 2 years ago

If fb2k supports doing this then I could try it, but I don't recall seeing anything that obviously gave you access to other kinds of data stored in tags so I'm not particularly hopeful.

I'm curious if anybody else has encountered this issue? Do you know of other software that writes to this field (so that iPods or whatever can find it)?

abdonkov commented 2 years ago

Yes I have encountered the same problem. My main music player is MusicBee with MiniLyrics which I use for automatic synchronised lyrics search. There was a problem at one point with the MiniLyrics servers and the search wasn't working (it still isn't the best).

So I found about your plugin for foobar2k and tried it and the APIs that you use for synchronised lyrics work great. They find many lyrics that MiniLyrics can't.

Now to the point. Both MiniLyrics and MusicBee have support for the SYLT ID3v2 tag for synchronized lyrics and I can save the synchonized lyrics that MiniLyrics retrieves to the file and they will show in MusicBee. And vice versa.

So currently what I am doing is, I search for synced lyrics with your plugin for foobar. Open the editor, copy the lyrics. Go in MusicBee and save the synchronized lyrics from there.

So it will be great if your plugin is able to write to the SYLT tag directly.

This is what the MusicBee tag inspector show about the file for instance: image

daoxi commented 2 years ago

If fb2k supports doing this then I could try it, but I don't recall seeing anything that obviously gave you access to other kinds of data stored in tags so I'm not particularly hopeful.

I'm curious if anybody else has encountered this issue? Do you know of other software that writes to this field (so that iPods or whatever can find it)?

First of all, I've actually done quite some research and testing regarding embedding lyrics into ID3v2 tags and their compatibilities. fb2k does actually support unsynced lyrics frame (USLT) with the reserved field name "UNSYNCED LYRICS", although it does not support the synced lyrics frame (SYLT) so far.

In fact, other fb2k lyrics plugins like Lyric Show Panel 3 and ESLyric already support both unsynced lyrics (plain text) and synced lyrics (LRC format) that are embedded in the unsynced lyrics frame. The embedded synced lyrics (LRC format) in the unsynced lyrics frame can also auto-scroll (as if they came from sidecar .lrc files) in these plugins.

On a side note, embedding synced lyrics (LRC format) into the unsynced lyrics frame, is also the most well-supported way of embedding synced lyrics into ID3v2 tags, just to name a few players that support this (with auto-scroll capability): fb2k (with Lyric Show Panel 3 or ESLyric), MusicBee, MiniLyrics, Musicolet, GoneMAD Music Player, etc. (basically, players that support sidecar .lrc files, generally also support the embedded way).

If you would like to write to this unsynced lyrics frame (USLT) in fb2k, you can simply add a new field named UNSYNCED LYRICS (fb2k will recognize this reserved field name) and add your unsynced/synced lyrics there. Alternatively, you can also use Mp3tag with field name UNSYNCEDLYRICS to do it.

jacquesh commented 2 years ago

@daoxi If the only thing that is required is to tell fb2k to write to a particular tag that it recognises internally then this should work already (just set the save tag to the one you want to read from & write to). Is this not the case?

e.g you say that the only requirement is to write to the "UNSYNCED LYRICS" tag. So if you set that as your save tag for unsynced and synced lyrics then it should work as you expect and write to the USLT frame under the hood. Does it?

daoxi commented 2 years ago

@daoxi If the only thing that is required is to tell fb2k to write to a particular tag that it recognises internally then this should work already (just set the save tag to the one you want to read from & write to). Is this not the case?

e.g you say that the only requirement is to write to the "UNSYNCED LYRICS" tag. So if you set that as your save tag for unsynced and synced lyrics then it should work as you expect and write to the USLT frame under the hood. Does it?

Yes, it does work exactly like you said, but the default field name given by OpenLyrics is "UNSYNCEDLYRICS" (without space) rather than "UNSYNCED LYRICS", that's where the problem is, I'll explain why:

Writing to field name "UNSYNCEDLYRICS" and "UNSYNCED LYRICS" may seem similar when viewed in fb2k, but they're fundamentally different under the hood:

Writing to "UNSYNCEDLYRICS": fb2k doesn't recognize "UNSYNCEDLYRICS", it therefore creates a text information (TXXX) frame (which can be named anything) named "UNSYNCEDLYRICS", this behavior is similar to when you write to "LYRICS" as fb2k doesn't recognize "LYRICS" either. Lyrics embedded by "UNSYNCEDLYRICS" can not be read by ESLyric, Lyric Show Panel 3, iTunes, or most players with embedded lyrics support.

Writing to "UNSYNCED LYRICS": Like you imagined, fb2k recognizes "UNSYNCED LYRICS" and writes to the USLT frame (which is actually the only lyrics frame supported by fb2k). Lyrics embedded this way can be read by ESLyric, Lyric Show Panel 3, iTunes, or all other players with embedded lyrics support. On a side note, even OpenLyrics itself already defaultly support reading from this too (either as unsynced or synced).

This is why you probably shouldn't offer "UNSYNCEDLYRICS" as the default option (most users aren't aware of what I just said), but perhaps offer "UNSYNCED LYRICS" instead.

Also, like I said in the earlier comment, you might wanna consider providing "UNSYNCED LYRICS" as the default option for synced lyrics as well, because it has way better compatibility (ESLyric, Lyric Show Panel 3, MusicBee, MiniLyrics, Musicolet, GoneMAD Music Player, etc. all support auto-scroll for it) than writing to a TXXX frame named "LYRICS".

jacquesh commented 2 years ago

Oh I see, yeah sure I can change the default, I didn't know fb2k handled some tag names specially. If I'm feeling industrious I could even put in a warning specifying that fb2k has this special behaviour for tags.

Do you have any recommendations for tools that show the difference between tags stored as TXXX and USLT? Historically I've been using kid3 but I don't recall it distinguishing between the two? At least not obviously so.

hondrus31 commented 2 years ago

Using MusicBee, when you edit a song in your library (select it, then Shift+Enter), you can find the Tag Inspector at the top of that window.

image

daoxi commented 2 years ago

Do you have any recommendations for tools that show the difference between tags stored as TXXX and USLT? Historically I've been using kid3 but I don't recall it distinguishing between the two? At least not obviously so.

If you're looking for a command line tool, you could try the pretty famous FFmpeg, use the command: -i "PathOfMp3" -f ffmetadata "PathOfExportFile.txt" to export the metadata (including lyrics) to a .txt file,

if it's embedded as USLT frame, you should see something like: lyrics-eng=here are the lyrics blablabla... if it's embedded as TXXX frame named "UNSYNCEDLYRICS", you should see something like: UNSYNCEDLYRICS=here are the lyrics blablabla...

As for kid3: I've used kid3 before as well (specifically, the command line tool kid3-cli), if I use kid-cli.exe to do something like: -c "get USLT:'LyricsFilename.lrc'" "MusicFilename.mp3" it should export the USLT frame only (for now, I recommend using the development version of kid3 because the recent fix for messed up lyrics line endings in Windows environment is only applied to the development version (on May1), but not the official version just yet.).

daoxi commented 2 years ago

By the way, I've left a new comment regarding the extra space after timestamps, just giving a friendly reminder here because that issue has been closed.

jacquesh commented 2 years ago

Ah, ok so turns out this is actually documented, here: https://wiki.hydrogenaudio.org/index.php?title=Foobar2000:ID3_Tag_Mapping

Since fb2k doesn't support SYLT frames, I can't support it in OpenLyrics (well ok technically I can but it'd be a prohibitively large amount of work and I'm not going to do that). I'm not at all surprised either because the content of SYLT frames are required by the spec to have a specific format and without dedicated lyrics infrastructure fb2k has no way of enforcing that. If fb2k added a way to read & write SYLT frames then I can add support for them but I doubt that'll happen and until then I can do much on that front.

Which leaves us with support for USLT frames. I'm happy to change the default write-tag to "UNSYNCED LYRICS" so that it writes there. OpenLyrics supports separate write-tags for synced and unsynced lyrics but personally I'd be happy to set the default for both of them to "UNSYNCED LYRICS". OpenLyrics will detect whether the text given is synced or unsynced lyrics either way so it doesn't matter there, the only question is whether the same applies to other applications.

Its also worth noting that changing the default will not change the setting for any existing users, only for new users.

daoxi commented 2 years ago

Ah, ok so turns out this is actually documented, here: https://wiki.hydrogenaudio.org/index.php?title=Foobar2000:ID3_Tag_Mapping

That link was pretty helpful, thanks.

Since fb2k doesn't support SYLT frames, I can't support it in OpenLyrics

Perfectly understandable, ESLyric and Lyric Show Panel 3 doesn't support SYLT frame probably for this reason too. Users could go to fb2k's forum to request adding support for SYLT frame first (as Minilyrics, MusicBee, and JetAudio already support SYLT).

OpenLyrics supports separate write-tags for synced and unsynced lyrics but personally I'd be happy to set the default for both of them to "UNSYNCED LYRICS". OpenLyrics will detect whether the text given is synced or unsynced lyrics either way so it doesn't matter there, the only question is whether the same applies to other applications.

I think so, from my testing and experience, almost all (about 95%) of music players that support external .lrc files, also support synced lyrics (lrc format) embedded in the USLT frame (this seems to be the de facto standard for embedded synced lyrics nowadays, even more popular than the SYLT frame) For example, fb2k (OpenLyrics, ESLyric, Lyric Show Panel 3), MusicBee, MiniLyrics, Musicolet, Retro Music Player, Oto Music, FiiO Music, Pulsar Music Player, GoneMAD, BlackPlayer, Neutron Music Player, all support synced lyrics (lrc format) embedded in the USLT frame. Another big advantage is: when some music players (e.g. iTunes, Windows Media Player, MediaMonkey, Poweramp, Stellio, etc.) support embedded unsynced lyrics (but not embedded synced lyrics (lrc format)) in the USLT frame, you can still read the lyrics and even "manually" read the timestamps to keep track of what's being sung (although the lyrics can't auto-scroll). So it's basically killing 2 birds (synced/unsynced) with 1 stone (USLT).

NekoAlosama commented 1 year ago

Can OpenLyrics detect if a file is using ID3 tags? If so, I think we should be able to use UNSYNCED LYRICS for just ID3 tags and use LYRICS and/or UNSYNCEDLYRICS for other tagging systems like Vorbis comments to maximize compatibility with players. I personally use Opus files and the players I've tested do not detect UNSYNCED LYRICS, but are mixed on whether LYRICS, UNSYNCEDLYRICS, or both are detected.

jacquesh commented 1 year ago

@NekoAlosama If you only have files that use Vorbis comments instead of ID3 tags then you can always change the save tag to something that is better supported by the players you're using.

Supporting the use of lyrics data outside of openlyrics itself is very much a secondary concern and I strongly doubt it's worth the complexity involved in having different defaults for different file types.

As a side note, in future please can you open a new issue if you'd like to request something, rather than resurrecting and an issue from 4 months ago :)