Repository navigation
Description
Reproducer
I tried this code (same as #621 ):
fn get_metadata(path: &path::PathBuf) -> (Box<[Tag]>, u32) {
let tagged_file = Probe::open(path)
.expect("ERROR: file removed before processing")
.read()
.expect("ERROR: file in use");
let tags = tagged_file.tags().iter().cloned().collect();
let sample_rate = tagged_file
.properties()
.sample_rate()
.expect("ERROR: file has no sample rate");
(tags, sample_rate)
}
fn process_metadata(mut tags: Box<[Tag]>, peak: f32) -> Box<[Tag]> {
for tag in &mut tags {
tag.remove_empty();
// File peak will change due to processing
tag.remove_key(ItemKey::ReplayGainAlbumPeak);
// Paste the new peak value
tag.insert_text(ItemKey::ReplayGainTrackPeak, peak.to_string());
}
let mut id3v2_tags = tags.clone();
id3v2_tags
.iter_mut()
.for_each(|tag| tag.re_map(TagType::Id3v2));
let mut riff_tags = tags.clone();
riff_tags
.iter_mut()
.for_each(|tag| tag.re_map(TagType::RiffInfo));
id3v2_tags.into_iter().chain(riff_tags).collect()
}
fn write_tags(file_path: &Path, tags: Box<[Tag]>) {
for tag in tags {
_ = tag.save_to_path(file_path, WriteOptions::default());
}
}Summary
In response to #621 , I modified my Cargo.toml to depend on the main branch of lofty instead of waiting for 0.23.3. Reiterating here, my DSP project can take a FLAC with Vorbis Comments (none with ID3v2), convert those Vorbis Comments to ID3v2 and RIFF INFO tags, then apply those copied tags to a modified .wav file. I can understand why the USLT can be sourced from different tags (i.e. 'UNSYNCED LYRICS' or UNSYNCED_LYRICS or UNSYNCEDLYRICS, depending on the software used, which is why I actually use all three in my FLAC files), but I don't yet know why the LYRICS tag is dropped and maps to 'UNSYNCED LYRICS' instead. RIFF INFO tags don't support arbitrary tags, including SYLT and USLT, so it has to be the `.re_map(TagType::ID3v2)' producing a problem.
I don't know if this problem is limited to just the Vorbis -> ID3v2 remapping, so I'll try other files with different tag types while I wait.
Expected behavior
No response
Assets

Activity
NekoAlosama commentedon Mar 1, 2026
My only other files are MP3 files, for which foorbar2000 supports writing ID3v1, ID3v2.3 or ID3v2.4 (not both), and APEv2 tags, separately or all three at the same time.
ID3v1 doesn't support arbitrary tags, so it's not really counted here.
APEv2 has the same behavior, where APEv2 -> ID3v2 maps LYRICS to 'UNSYNCED LYRICS' and 'UNSYNCED LYRICS' maps to nothing.
ID3v2.3 and ID3v2.4, however, correctly maps 'UNSYNCED LYRICS', but now LYRICS maps to nothing. This implies that the
.remap()method doesn't return early if the input tag type is the same as the output tag type, but I don't know if there are further ramifications for doing so. It's not difficult for me to add a check in my code above.[-]Vorbis to ID3v2 maps LYRICS to 'UNSYNCED LYRICS'[/-][+]Vorbis or APE to ID3v2 maps LYRICS to 'UNSYNCED LYRICS', ID3v2 to ID3v2 maps LYRICS to nothing[/+]Serial-ATA commentedon Mar 1, 2026
That's a consequence of #561. See the docs for
ItemKey::Lyrics: https://docs.rs/lofty/latest/lofty/tag/enum.ItemKey.html#variant.LyricsNot sure what the best solution to the lyrics problem is. In this specific case, the solution would just be to favor
ItemKey::UnsyncLyricsand discardItemKey::Lyricswhen doing the generic conversion. If we only haveItemKey::Lyricsthough, we don't know if it's synchronized or not.[-]Vorbis or APE to ID3v2 maps LYRICS to 'UNSYNCED LYRICS', ID3v2 to ID3v2 maps LYRICS to nothing[/-][+]Vorbis or APE to ID3v2 maps LYRICS to 'UNSYNCED LYRICS'[/+]NekoAlosama commentedon Mar 1, 2026
I see, so LYRICS mapping to nothing is the intended behavior for now since there is no actual LYRICS tag in ID3v2 (though I don't know if you can arbitrarily make it), but LYRICS mapping to 'UNSYNCED LYRICS' with timecodes is still an issue here.
Aside from that, I updated the remapping section of my code above to skip remapping ID3v2 to ID3v2, then keeping only the tag(s) that have the most fields, and the same is done for the RIFF INFO tag.
Serial-ATA commentedon Mar 1, 2026
Both
ItemKey::LyricsandItemKey::UnsyncLyricsmap toUSLT. The issue is both fields are used for lyrics without timecodes in the wild. I'm open to removing support forItemKey::Lyricsin ID3v2, but AFAICT that field is more commonly used in other formats for unsynchronized lyrics, so that might be surprising behavior.