DarwinAwardWinner / rganalysis

A script for adding replaygain tags to music files
31 stars 4 forks source link

m4a tags are itunes specific #4

Closed alidaf closed 7 years ago

alidaf commented 7 years ago

Both backends produce tags that are iTunes specific when analysing m4a files.

Resulting tags are also not recognised by trackinfo tool (part of python audio tools).

e.g. (viewing tags in Puddletag)

----:com.apple.iTunes:replaygain_album_gain ----:com.apple.iTunes:replaygain_album_peak ----:com.apple.iTunes:replaygain_track_gain ----:com.apple.iTunes:replaygain_track_peak

rather than

replaygain_album_gain replaygain_album_peak replaygain_track_gain replaygain_track_peak

alidaf commented 7 years ago

I've found the line in init.py that specifies it and removed the iTunes specific part.

Note: m4a files are not the exclusive domain of Apple/iTunes so this should be optional. I also think iTunes is now using something called sound check instead of replaygain but I don't use iTunes so can't give any info.

DarwinAwardWinner commented 7 years ago

Honestly, I very rarely use mp4 audio files, so I don't really know much about how tags are stored in them. I don't remember where I got my information about how to store tags for mp4 files, but it's certainly possible I got it wrong. Or more likely it's one of these situations:

If you know an authoritative source for how RG tags are meant to be stored in mp4 files, I'd be happy to update rganalysis to follow that source. If there really are multiple ways to do it supported by different players, I wouldn't be opposed to saving multiple copies of the tags in order to support all of them (although that will require a bit of extra work).

alidaf commented 7 years ago

Hi Ryan,

I only use them on my phone. I generally refuse to listen to MP3 but I'd need a huge SD card for a decent collection of FLAC files on my phone.

I don't have a definitive source because I don't think there is one. As far as I know, only MP3, FLAC and Vorbis have defined standards. Apple have their own standards for iTunes and tend to use the MP4 container (M4A for audio only). The problem with this is that it is essentially a hijacking. I use Linux and Android, neither of which recognise iTunes specific tags. It seems to me that Vorbis or FLAC tags are accepted regardless of the container but I could be totally wrong.

On Linux, Puddletag is the only tag editor that recognises more than the standard MP3/FLAC/Vorbis tags, and also recognises the iTunes tags, but the iTunes tags aren't recognised by the tools used to create them in rganalysis! I've not transferred any tracks with iTunes RG tags to my phone (Xperia, Android) but I can almost guarantee that they won't be recognised by the majority of apps. Poweramp may, but the problem with the Xperia is that it has specific quality enhancing hardware features that only work with the Xperia Walkman app. Another cynical attempt at vertical integration?

Removing the iTunes string from the Python code allows the Python Music Tools to recognise them.

My Python-Fu is weak otherwise I'd have committed modifications.

Regards

Darren

On 09/03/17 19:04, Ryan C. Thompson wrote:

Honestly, I very rarely use mp4 audio files, so I don't really know much about how tags are stored in them. I don't remember where I got my information about how to store tags for mp4 files, but it's certainly possible I got it wrong. Or more likely it's one of these situations:

https://camo.githubusercontent.com/92d38d547705ea1474852ca5927a13ee44cafab1/68747470733a2f2f696d67732e786b63642e636f6d2f636f6d6963732f7374616e64617264732e706e67

If you know an authoritative source for how RG tags are meant to be stored in mp4 files, I'd be happy to update rganalysis to follow that source. If there really are multiple ways to do it supported by different players, I wouldn't be opposed to saving multiple copies of the tags in order to support all of them (although that will require a bit of extra work).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DarwinAwardWinner/rganalysis/issues/4#issuecomment-285447826, or mute the thread https://github.com/notifications/unsubscribe-auth/ANhwwOb2Rgpo7MLqUK9fgP4pLwXoAGPQks5rkE1UgaJpZM4MYB3D.

DarwinAwardWinner commented 7 years ago

I took my cue for those tags from Quod Libet, another open source music player. For example, see here. This seems to be a fairly consistent standard, as seen in several other open source tools:

While searching for the above, I wasn't able to find any examples of tools that use the un-prefixed versions of the tags in MP4 files. This matches what I vaguely remember finding back when I implemented MP4 support. So it seems the iTunes-prefixed tags are the de facto standard for MP4 files.

Regardless, I suppose it probably wouldn't hurt anything if I wrote both sets of tags for MP4 files. So I'll try that.

DarwinAwardWinner commented 7 years ago

Interestingly, it seems that there might also be a bug in the tag writing that causes the prefix to be added twice. This could explain why that tags aren't working for you.

DarwinAwardWinner commented 7 years ago

Ok, I think I figured it out. Mutagen's MP4 code already adds the iTunes prefix to any freeform tags: https://github.com/quodlibet/mutagen/blob/598f0be6b5ed0fe18e8bf0560c54a9c070754d79/mutagen/easymp4.py#L149-L159. So when my code adds the prefix as well, it's adding a second prefix, resulting in the wrong tag. So in fact the solution is to make the code change that you were suggesting, since that will cause mutagen to write the tags that I actually wanted it to write in the first place.

alidaf commented 7 years ago

Have a look at this:

http://wiki.slimdevices.com/index.php/SlimServerSupportedTags

It has a table of each of the known standards.

iTunes tags are proprietry but AtomicParsley has the largest list as far as I can tell:

http://atomicparsley.sourceforge.net/mpeg-4files.html

On 12/03/17 10:26, Ryan C. Thompson wrote:

I took my cue for those tags from Quod Libet, another open source music player. For example, see here https://github.com/quodlibet/quodlibet/pull/1916/commits/9e256d3270c70daf2913bca41a3f3bdc93e14d26. This seems to be a fairly consistent standard, as seen in several other open source tools:

While searching for the above, I wasn't able to find any examples of tools that use the un-prefixed versions of the tags in MP4 files. This matches what I vaguely remember finding back when I implemented MP4 support. So it seems the iTunes-prefixed tags are the /de facto/ standard for MP4 files.

Regardless, I suppose it probably wouldn't hurt anything if I wrote both sets of tags for MP4 files. So I'll try that.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DarwinAwardWinner/rganalysis/issues/4#issuecomment-285935570, or mute the thread https://github.com/notifications/unsubscribe-auth/ANhwwBg69IhAsS5SLbkGp8DuqXsI9gweks5rk8hwgaJpZM4MYB3D.