Write mp4 tag name in lower case, or conditional "Case conversion" action?

I'm struggling to find a way to set the "rating wmp" tag for M4A files so it will be read correctly by NI Traktor. Traktor will only recognise the "rating wmp" tag in M4A/MP4 files when the field is in lower case.

I have to set the value for "RATING WMP" tag, and then do a case conversion to lower case on "_FIELDNAME".

However, I only want to do this for MP4 files otherwise it will break other stuff. So I need a way to conditionally execute the case conversion action.
e.g. if condition $stricmp(%_tag_read%,'MP4') then do case conversion.

Is this possible somehow?

Another approach (previously asked in another thread but now merged here), would be for mp3tag to write the mp4 field name in lower case in the first place. But not sure if that's possible with current mp3tag?

What about setting a filter
%_tag_read% HAS MP4

That allows to view only files with MP4 tag type, but I can't see how it will allow me to make an action conditional. Unless I'm missing something?

I'm looking for a way to make a single action which can set the rating for mp3, FLAC or m4a files in such a way that it can be read by NI Traktor.

For example, my action group for setting 3* rating looks like this:

But then for m4a files I need to run a further action manually otherwise Traktor won't read the tag:
image

Yes, a filter does not do anything conditional but it limits the amount of files to only those that match a criterion. And then you can run your action on only these files an be sure that only they are treated.
And to be honest: even if you have succeeded to convert "ALBUMARTIST" to "albumartist", then I am sure that something like "aART" will be written to MP4 files and "WM/AlbumArtist" will show up in WMA files.

I just wrote a reply to your reply on my other thread (the one asking how to simply write the tag field name in lower case in the first place). But then the thread disappeared. Maybe it got deleted as a duplicate? I will copy the reply here instead:

What I'm working with is AAC encoded audio in an MP4 container with file extension .m4a
Most of my music is mp3 or FLAC, but some files purchased on iTunes are AAC/M4A.

As you said "POPM" doesn't exist for MP4/M4A. I'm not trying to use this. I'm trying to use a custom field named "rating wmp". From the link you posted - https://help.mp3tag.de/main_tags.html , this would come under "Other fields". Most mp4 field names seem to be lower case, including other custom fields such as "initialkey". But mp3tag always writes field names upper case (or at least I can't find a way to change this).

Using exiftool -v3 I can see the raw tag data. Here's an excerpt when the rating has been set to 4* in Traktor:

  | | | | + [iTunesInfo directory]
  | | | | | Mean = com.apple.iTunes
  | | | | | - Tag 'mean' (20 bytes):
  | | | | |    1365b: 00 00 00 00 63 6f 6d 2e 61 70 70 6c 65 2e 69 54 [....com.apple.iT]
  | | | | |    1366b: 75 6e 65 73                                     [unes]
  | | | | | Name = rating wmp
  | | | | | - Tag 'name' (14 bytes):
  | | | | |    13677: 00 00 00 00 72 61 74 69 6e 67 20 77 6d 70       [....rating wmp]
  | | | | | Data = .204
  | | | | | - Tag 'data' (11 bytes):
  | | | | |    1368d: 00 00 00 01 00 00 00 00 32 30 34                [........204]

And if I then set the "RATING WMP" tag to 5* in mp3tag, it looks like this:

  | | | | + [iTunesInfo directory]
  | | | | | Mean = com.apple.iTunes
  | | | | | - Tag 'mean' (20 bytes):
  | | | | |    13229: 00 00 00 00 63 6f 6d 2e 61 70 70 6c 65 2e 69 54 [....com.apple.iT]
  | | | | |    13239: 75 6e 65 73                                     [unes]
  | | | | | Name = RATING WMP
  | | | | | - Tag 'name' (14 bytes):
  | | | | |    13245: 00 00 00 00 52 41 54 49 4e 47 20 57 4d 50       [....RATING WMP]
  | | | | | Data = .255
  | | | | | - Tag 'data' (11 bytes):
  | | | | |    1325b: 00 00 00 01 00 00 00 00 32 35 35                [........255]

Traktor does not pick up this rating change to 5* because the tag 'name' value is the wrong case, instead it restores the rating from the value it has saved in its internal database. Then there are 2 ratings stored like this:

  | | | | + [iTunesInfo directory]
  | | | | | Mean = com.apple.iTunes
  | | | | | - Tag 'mean' (20 bytes):
  | | | | |    131b7: 00 00 00 00 63 6f 6d 2e 61 70 70 6c 65 2e 69 54 [....com.apple.iT]
  | | | | |    131c7: 75 6e 65 73                                     [unes]
  | | | | | Name = RATING WMP
  | | | | | - Tag 'name' (14 bytes):
  | | | | |    131d3: 00 00 00 00 52 41 54 49 4e 47 20 57 4d 50       [....RATING WMP]
  | | | | | Data = .255
  | | | | | - Tag 'data' (11 bytes):
  | | | | |    131e9: 00 00 00 01 00 00 00 00 32 35 35                [........255]
<snip>
  | | | | + [iTunesInfo directory]
  | | | | | Mean = com.apple.iTunes
  | | | | | - Tag 'mean' (20 bytes):
  | | | | |    136b0: 00 00 00 00 63 6f 6d 2e 61 70 70 6c 65 2e 69 54 [....com.apple.iT]
  | | | | |    136c0: 75 6e 65 73                                     [unes]
  | | | | | Name = rating wmp
  | | | | | - Tag 'name' (14 bytes):
  | | | | |    136cc: 00 00 00 00 72 61 74 69 6e 67 20 77 6d 70       [....rating wmp]
  | | | | | Data = .204
  | | | | | - Tag 'data' (11 bytes):
  | | | | |    136e2: 00 00 00 01 00 00 00 00 32 30 34                [........204]

I think that the irritation comes from the use of an otherwise reserved field name.
What I also wonder: does MP3tag show 2 rating fields for the second case or just one?

When there are 2 rating fields, mp3tag just reads the first one it comes to.

Regarding field name case: I don't think it makes a difference that it's a reserved field name. From what I've seen, mp3tag just doesn't allow lower case characters in any field names it writes.

This may be standards compliant for some file formats, but I don't think it's appropriate for mp4. I haven't been able to find any official standards for tagging music in mp4 containers. It seems like most people just use reverse-engineered iTunes tags, and these do certainly use lower case characters in the custom tag field names. Some examples:

  | | | | + [iTunesInfo directory]
  | | | | | Mean = com.apple.iTunes
  | | | | | - Tag 'mean' (20 bytes):
  | | | | |    19103: 00 00 00 00 63 6f 6d 2e 61 70 70 6c 65 2e 69 54 [....com.apple.iT]
  | | | | |    19113: 75 6e 65 73                                     [unes]
  | | | | | Name = iTunSMPB
  | | | | | - Tag 'name' (12 bytes):
  | | | | |    1911f: 00 00 00 00 69 54 75 6e 53 4d 50 42             [....iTunSMPB]
  | | | | | Data = . 00000000 00000840 00000078 0000000001016748 00000000 00000000 0000[snip]
  | | | | | - Tag 'data' (124 bytes):
  | | | | |    19133: 00 00 00 01 00 00 00 00 20 30 30 30 30 30 30 30 [........ 0000000]
  | | | | |    19143: 30 20 30 30 30 30 30 38 34 30 20 30 30 30 30 30 [0 00000840 00000]
  | | | | |    19153: 30 37 38 20 30 30 30 30 30 30 30 30 30 31 30 31 [078 000000000101]
  | | | | |    19163: 36 37 34 38 20 30 30 30 30 30 30 30 30 20 30 30 [6748 00000000 00]
  | | | | |    19173: 30 30 30 30 30 30 20 30 30 30 30 30 30 30 30 20 [000000 00000000 ]
  | | | | |     [snip 44 bytes]
  | | | | + [iTunesInfo directory]
  | | | | | Mean = com.apple.iTunes
  | | | | | - Tag 'mean' (20 bytes):
  | | | | |    191bf: 00 00 00 00 63 6f 6d 2e 61 70 70 6c 65 2e 69 54 [....com.apple.iT]
  | | | | |    191cf: 75 6e 65 73                                     [unes]
  | | | | | Name = iTunNORM
  | | | | | - Tag 'name' (12 bytes):
  | | | | |    191db: 00 00 00 00 69 54 75 6e 4e 4f 52 4d             [....iTunNORM]
  | | | | | Data = . 00000478 0000043D 00003226 000031A9 0001F054 0001F054 00007F58 000[snip]
  | | | | | - Tag 'data' (98 bytes):
  | | | | |    191ef: 00 00 00 01 00 00 00 00 20 30 30 30 30 30 34 37 [........ 0000047]
  | | | | |    191ff: 38 20 30 30 30 30 30 34 33 44 20 30 30 30 30 33 [8 0000043D 00003]
  | | | | |    1920f: 32 32 36 20 30 30 30 30 33 31 41 39 20 30 30 30 [226 000031A9 000]
  | | | | |    1921f: 31 46 30 35 34 20 30 30 30 31 46 30 35 34 20 30 [1F054 0001F054 0]
  | | | | |    1922f: 30 30 30 37 46 35 38 20 30 30 30 30 37 46 39 36 [0007F58 00007F96]
  | | | | |     [snip 18 bytes]
  | | | | + [iTunesInfo directory]
  | | | | | Mean = com.apple.iTunes
  | | | | | - Tag 'mean' (20 bytes):
  | | | | |    19261: 00 00 00 00 63 6f 6d 2e 61 70 70 6c 65 2e 69 54 [....com.apple.iT]
  | | | | |    19271: 75 6e 65 73                                     [unes]
  | | | | | Name = iTunMOVI
  | | | | | - Tag 'name' (12 bytes):
  | | | | |    1927d: 00 00 00 00 69 54 75 6e 4d 4f 56 49             [....iTunMOVI]
  | | | | | Data = .<?xml version="1.0" encoding="UTF-8"?>.<!DOCTYPE plist PUBLIC "-//A[snip]
  | | | | | - Tag 'data' (281 bytes):
  | | | | |    19291: 00 00 00 01 00 00 00 00 3c 3f 78 6d 6c 20 76 65 [........<?xml ve]
  | | | | |    192a1: 72 73 69 6f 6e 3d 22 31 2e 30 22 20 65 6e 63 6f [rsion="1.0" enco]
  | | | | |    192b1: 64 69 6e 67 3d 22 55 54 46 2d 38 22 3f 3e 0a 3c [ding="UTF-8"?>.<]
  | | | | |    192c1: 21 44 4f 43 54 59 50 45 20 70 6c 69 73 74 20 50 [!DOCTYPE plist P]
  | | | | |    192d1: 55 42 4c 49 43 20 22 2d 2f 2f 41 70 70 6c 65 2f [UBLIC "-//Apple/]
  | | | | |     [snip 201 bytes]

Did you check the extended tags dialogue? Usually the rating column is not defined with a $meta() statement.

Sorry, meant to mention this: yes they do show up in Extended Tags. But if displayed in a column then only the first shows up using Value = %rating wmp%

To see multi-value-fields in a column, you have to use a similar definition as in columns for e.g. ARTIST: $meta_sep(artist,\\)
So it looks to me that MP3tag reads all the data, rewrites the data and MP3tag even copes with the multi-value-fields that Traktor creates.
What happens, if you modify the lower case field?

So yes, mp3tag is coping fine with multiple values, and doesn't mind the lower case field name when reading - though it displays it in upper case in Extended Tags. (And it does also show multiple values when using $meta_sep(rating wmp,\)

But if the value of the lower case field is changed by editing in Extended Tags, mp3tag rewrites the field name as upper case. And Traktor then ignores the new value and subsequently adds a 3rd "rating wmp" field in lower case.

I am out now.
I cannot decide how MP3tag will treat imported user defined fields.
Yet, I think you could also ask the Traktor people why they refuse to read fields in upper case.

I think it would make sense if Mp3tag supported lower case characters in MP4 custom field names. Mixed and lower case field names certainly seem to be in common use, and at least some applications treat these names as case sensitive.

I will attempt to raise the issue with Native Instruments, but I don't hold out much hope. From reading their support forums, it's clear that people have been trying for years to get them to fix their many inconsistencies with tag support, to no avail.

In general, Traktor will import ratings from various tags, but once imported it then sticks strictly to the Traktor way of doing things and any further changes to other ratings tags are ignored. I tend to edit ratings both in Traktor and mp3tag and need changes to work in both directions. The only way I have made this work is to match the Traktor format in mp3tag. It's a bit of a pain since every format I use (mp3, FLAC, mp4) needs different handling.

Interestingly, Traktor uses upper case "RATING WMP" in FLAC Vorbis Comments, although of course Vorbis field names are case insensitive by definition.