rg2sc is removing the itunnorm field in mp4 files

When trying to convert the replaygain to soundcheck values on mp4/m4a files, I first noticed that no field was written, but then I discovered that the ITUNNORM field is removed if it's already there to start with... I have been using the script below and its album gain equivalent on thousands of files before with no problem.

[#0]
T=5
F=COMMENT ITUNNORM
1=$if($eql(%_extension%,mp3),$rg2sc(%REPLAYGAIN_TRACK_GAIN%),)

[#1]
T=5
F=ITUNNORM
1=$if($eql(%_extension%,m4a|mp4),$rg2sc(%REPLAYGAIN_TRACK_GAIN%),)

Any idea of what's happening? (I should probably try an older version of mp3tag and get back, and I will do that tomorrow...)

edit: Apparently the | symbol isn't doing what it used to anymore. I separated mp4 from the second step and added one more, and now it works...

edit 2: Noooo... :frowning: if m4a extension is used, mp3tag is still not using the itunnorm field, or deleting it. Darn.

I just don't get it.

In many of my existing .m4a files with converted replaygain values, I see tags that reads both "COMMENT ITUNNORM", just like in mp3's, and "ITUNNORM". Most have only "ITUNNORM" however. In .mp4 files it's exclusively "ITUNNORM".

As far as I know, I have tagged and converted replaygain values on files with both file extensions simultaneously many times before, without noticing anything special. But when trying an older version that I know I have used a lot, 2.41, it also doesn't write any itunnorm tags on m4a files, and deletes any it finds.

How the heck did those values come there in the first time? I have only used mp3tag and the rg2sc function, that's been a part of my ripping routine for over a year. Oh well, most of these files are going on the ipod anyway, so it doesn't matter with the file extension. It's only slightly awkward with mp4 on my pc, where I planned to try keeping mp4 music and video separated via the file extension.

How are these things working for the rest of you?

The | sign has no effect here, you must use
$if($or($eql(%_extension%,m4a),$eql(%_extension%,mp4)),$rg2sc(%REPLAYGAIN_TRACK_GAIN%),)

I didn't use the | sign (the edit in the first post), it looks like this:

[#0]
T=5
F=COMMENT ITUNNORM
1=$if($eql(%_extension%,mp3),$rg2sc(%REPLAYGAIN_ALBUM_GAIN%),)

[#1]
T=5
F=ITUNNORM
1=$if($eql(%_extension%,m4a),$rg2sc(%REPLAYGAIN_ALBUM_GAIN%),)

[#2]
T=5
F=ITUNNORM
1=$if($eql(%_extension%,mp4),$rg2sc(%REPLAYGAIN_ALBUM_GAIN%),)

Apparently there's something wrong with it, because only using the second step, m4a files gets tagged properly.

Can you only have two steps like these in an action file, or what?

edit: By the way, the $or script in dano's post didn't work at all.

However, I made the script to look for the tag instead for file extension, and now it does what I want it to:

[#0]
T=5
F=COMMENT ITUNNORM
1=$if($eql(%_extension%,mp3),$rg2sc(%REPLAYGAIN_ALBUM_GAIN%),)

[#1]
T=5
F=ITUNNORM
1=$if($eql(%_tag%,MP4),$rg2sc(%REPLAYGAIN_ALBUM_GAIN%),)

Still, I'd like to know why the other tries didn't work?

It's pretty simple: You're using the $if statement which also has an else part. In the above case the else part is used in action #2 which sets the field to an empty value.

Kind regards,
Florian