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

mediafile saves track to multiple vorbis comment fields #52

Open
aereaux opened this issue Sep 6, 2021 · 5 comments
Open

mediafile saves track to multiple vorbis comment fields #52

aereaux opened this issue Sep 6, 2021 · 5 comments

Comments

@aereaux
Copy link

aereaux commented Sep 6, 2021

Simple reproduction:

Get empty file:

$ ffmpeg -f lavfi -i 'anullsrc=channel_layout=5.1:sample_rate=48000' -t 1 file.flac

Write track field

>>> from mediafile import MediaFile
>>> f = MediaFile('file.flac')
>>> f.track
>>> f.track = 1
>>> f.save()
>>> f.track
1

View result

$ metaflac --list "file.flac"
METADATA block #0
  type: 0 (STREAMINFO)
  is last: false
  length: 34
  minimum blocksize: 4608 samples
  maximum blocksize: 4608 samples
  minimum framesize: 26 bytes
  maximum framesize: 28 bytes
  sample_rate: 48000 Hz
  channels: 6
  bits-per-sample: 16
  total samples: 48000
  MD5 signature: 0dd0e989e9556334ac746c39d72d6aea
METADATA block #1
  type: 4 (VORBIS_COMMENT)
  is last: false
  length: 116
  vendor string: Lavf58.76.100
  comments: 4
    comment[0]: encoder=Lavf58.76.100
    comment[1]: WAVEFORMATEXTENSIBLE_CHANNEL_MASK=0x3f
    comment[2]: TRACK=1
    comment[3]: TRACKNUMBER=1
METADATA block #2
  type: 1 (PADDING)
  is last: true
  length: 8164

Specifically the TRACK and TRACKNUMBER fields. This is the case in all the files in my collection that are managed by beets. I haven't noticed this before, but I recently switched to ncmpc (for mpd), and noticed that the %track% format specifier outputs 1, 1. I saw this issue (MusicPlayerDaemon/ncmpc#71) and asked about it in the #mpd irc channel, where they said the problem was with my files having multiple track tags. I don't know how standardized the tag keys are, or where this bug belongs, but I'm filing this issue if it should be fixed here.

Side note: I also noticed this happens for a couple other fields like disc number as well

@sampsyo
Copy link
Member

sampsyo commented Sep 6, 2021

Hi there! Yes, this is actually intended behavior—a consequence of MediaFile's aim to maximize compatibility with a "read any, write all" policy. There's much more discussion in beetbox/beets#350. In short, it seems like most software is content to just show one value if multiple "tag mappings" are present, but ncmpcpp (and apparently ncmpc? Apparently they are more similar than I thought) is a notable exception.

@aereaux
Copy link
Author

aereaux commented Sep 6, 2021

Ah thanks, I did not find that beets issue when I was looking into this. It sounds like the consensus was that a strict_tags option would be accepted? And that that would require some work in mediafile? I might take a look into implementing that if I get a chance.

@sampsyo
Copy link
Member

sampsyo commented Sep 6, 2021

Yes and yes! It would be great to have help with that. It would indeed need to start with an option on MediaFile itself, which would work similarly to the current id3v23 flag. I'm worried it might be a little tricky to "plumb through" to all the fields correctly, but hopefully it's not too bad.

@aereaux
Copy link
Author

aereaux commented Sep 7, 2021

OK, thanks for the info. I have for now switched back to ncmpcpp (which has a config option to ignore duplicates) because I figured out how to configure columns there, so I'm not sure when/if I'll get a chance to look at this. It's still on my list for now, though

@jaum20
Copy link

jaum20 commented Apr 28, 2024

I also noted this beahavior with albumartist, which is set for three different fields:

comment[4]: ALBUM ARTIST=Yes
comment[5]: ALBUM_ARTIST=Yes
comment[6]: ALBUMARTIST=Yes

and mediainfo shows:

Album/Performer : Yes / Yes

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

3 participants