-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat: store tracklist as tag comment on recording #13761
base: main
Are you sure you want to change the base?
feat: store tracklist as tag comment on recording #13761
Conversation
64079ce
to
5108a46
Compare
5108a46
to
acc29fb
Compare
void Encoder::addToTracklist(const QString& artist, | ||
const QString& title, | ||
std::chrono::seconds timecode) { | ||
auto recordedDuration = timecode.count(); | ||
m_trackList.append( | ||
QStringLiteral("%1: %2 - %3") | ||
.arg(QString("%1:%2:%3") | ||
.arg(recordedDuration / (60 * 60), | ||
2, | ||
'f', | ||
0, | ||
'0') // hours | ||
.arg((recordedDuration / 60) % 60, | ||
2, | ||
'f', | ||
0, | ||
'0') // minutes | ||
.arg(recordedDuration % 60, 2, 'f', 0, '0'), | ||
artist.trimmed().isEmpty() | ||
? QObject::tr("(Unknown Artist)") | ||
: artist, | ||
title.trimmed().isEmpty() | ||
? QObject::tr("(Unknown Title)") | ||
: title)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we already have logic for generating a tracklist in cuesheet format. IMO it would make more sense to simply write that in the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cuesheet have a specific, non-human friendly format.
The point of this formatting is to generate something like
00:11:22: An artist - A title
Since the formatting logic is meant to be unrelated (a change to CUE shouldn't impact metadata and vice versa), I thought it was alright to have a little bit of code duplication (that is for the timecode only)
considering the complications and tradeoffs there are with writing large metadata, why not write this tracklist as a separate file like the cuesheet? Is there that much value to having it part of the file metadata? |
Because that's not the feature 😃 We already support the ability to generate a cue file, but there was a requested feature to have the ability to store the track. I think that's a fair request as the cue file isn't embedded. |
fully agree, I just find it weird that its a different format from the cuesheet, so I figured these were two different features. |
Didn't check the code, but I was wondering: Is this only for MP3/ID3? For FLAC I think there is the |
Yes - only for MP3/ID3 and Wave so far. Since the FLAC encoder inherits the Wave one, it would also support the
Nice, I'm wondering how widely is this supported? It feels like some custom logic that could be added in the |
Closes #12855
Implemented for MP3 and Wave and tested with both.
ffprobe
example with MP3Note on MP3
After a long day of learning MP3 spec, it would appears that our implementation was somewhat flawed. My understanding is that the
Xing
frame that contains various parameter about the MP3 frames is expect in the beginning of the file, however we currently overwrite the first frames with it, leading to data loss. Since a frame is < 100ms, this is not something you can easily hear.Second point is, we currently only write IDv1 (automatically supported by lame) but this limits the comment to 30 bytes. In order to lift this limit (and reach the hard limit of 2**32), we need to write ID3v2, but those are expected as header (unlike ID3v1 which can be appended in the footer when flushing the file.
In an ideal world, we would want to shift the file content to fit the ID3 header + the Xing frame. Because this basically requires to tear down the whole
EncoderCallback
mecanism, this instead adds a static header of 10K, which will be filled with the header, leading to a hard limit for comment (limit which depends of the artist, title and album size, as well the Xing frame size.Appreciate this is far from optimal, but hopefully we can find an acceptable trade-off