Leading zeros in MP4 Tags

I frequently get mp4 files from friends who strictly use MAC/iTunes.

I've read here that Mp3tag will not write leading zeros in Mp4 tags because the format does not support them. I also read that a custom "track" field was added at some point to accommodate this but then removed because iTunes choked on it.

I am curious then, as to why I have some Mp4 files that HAVE leading zeros in the track numbers and other don't. The ones that do can be written/converted back and forth and they retain the leading zeros, but there are some which will not, even though Mp3tag does not indicate there was a problem writing the data. The only difference I can see between the files is either the encoder or the version of iTunes listed, but even that is not consistent. The tag field ONLY shows "MP4 (MP4)" in both cases.

I have tried deleting the tags completely. Doesn't matter. The ones that can have leading zeros still can and the ones that can't still can't. Can someone explain why this is or if there is a work-around? Would it be possible to give the option of using the custom "track" field or not with a check box?

Few more questions:

  • Can an ID3v2 tag be written to an Mp4 file?

  • Will there be any support for other file types (.wav .aif, etc.)?
    I am able to write tags to these file types in Tag&Rename, and they read fine in other apps, but I have no idea how that application is doing it.

  • Will Mp4 be added to the options dialog so it can be checked unchecked for reading/writing?

Thank you for your time. This is a wonderful program that I've only recently discovered and it's already saved me a lot of headache getting things in order!

Unfortunately not. I've never encountered such files and still think that track numbers can be numeric only with MP4.


Not at the moment.

No, because it's the only tag format that is supported for MP4.

That's great! Thanks for the feedback :slight_smile:

Hey - Thanks for getting back to me. Would you like me to send you one of the MP4 files that accepts leading zeros? Smallest one I have is around 8MB. Please let me know when you have a moment. Thanks again!

Yes, you can upload one file to e.g. http://drop.io and send me the URL to support@mp3tag.de

Kind regards

Hey - drop.io is going through some changes and no longer allows free uploads. I used sendspace instead. You should have the link in your email now. Thanks!

OK just realized the file I linked you is an m4a. Since it showed up as (MP4) in the tag field, I didn't bother to look at the extension... I guess there's the answer, although I thought they were basically the same with the exception of copy-protection (which this file does not have).

It's a file that contains a Nero Digital tag which supports leading zeros for MP4 files and is displayed by Mp3tag.

Kind regards

If you have the ability to read it, can it be written via the same method or with some custom settings?

I recently downloaded some m4a files from the iTunes store and noticed that some of them showed leading zeros in Mp3tag. There didn't appear to be any Nero tags in the files, so I started deleting the extended tags one by one until the leading zeros disappeared.

Turns out, if the field TOTALDISCS exists (these were set to "1"), then Mp3tag will allow you to have leading zeros in the track numbers. As soon as I deleted this field, the leading zeros disappeared.

Not sure why this is, but I figured I'd pass on the info.

If you write only TOTALDISCS without DISCNUMBER you'll get nero tags.
So your leading zero is because of nero tags again.

Ha! Was going to ask about that - I didn't realize TOTALDISCS was in fact a Nero tag...

Based on Florian's original answer, I though there was some other hidden field written exclusively by Nero software that could only be seen with a HEX editor or something like that (like iTunes account info).

Is there any problem with using TOTALDISCS in an M4A file?

Thanks for the info!

TOTALDISCS is part of the DISCNUMBER tag. Instead of displaying
DISCNUMBER=1/4 you get


If you don't fill DISCNUMBER then the program cannot write a proper DISCNUMBER tag and it creates the nero tag.

Apologies for reviving such an old thread, but whatever has changed in the latest version regarding Nero tags has brought me back to my original question: Is there any way to have Mp3tag show track numbers with leading zeros for M4A files?

My existing M4A files now have "MP4 (MP4 Nero)" tags and no longer show a leading zero with v2.83j as they had done for years with previous versions simply by adding a TOTALDISCS tag to them.

The reason this is an issue for me is all my filenames are "00 - title.ext", so Tag -> Filename convert is no longer straightforward with M4A files when the track number is 1-9.

Convert Tag - Filename
Formatstring: $num(%track%,2) - %title%

The mp4 tags do not support leading zeros as the number is actually saved as number and not as a string as in MP3 tags.
So I doubt that the previous versions of MP3tag provided anything different.
What you can do, of course, is set your column definition to
Value: $num(%track%,2)
This still does not save any leading zeros in the data (because there can't be any) but it shows them in MP3tag.
For your filenames, do as poster poster offered.

How would you know? Especially, since the changelog clearly states that there have been changes w.r.t. MP4 tagging? Personally, I find it to be not very supportive to question that without having a complete understanding of how those things work internally.

deckard is right, I've changed the way different MP4 tag versions are treated after v2.83. Now Apple/QuickTime MP4 tags are displayed also if the file contains Nero MP4 tags. Before, a subset of the Nero tags was displayed — which does indeed support leading zeros for track numbers. It's just not very much supported in other programs.

To summarize, deckard found a way to write track numbers with leading zeros with previous versions of Mp3tag. However, those where not displayed in most other programs, e.g., iTunes.

Hi Florain - thanks for clarifying. So moving forward, the methods suggested here for displaying and converting tag > filename with leading zeros will work, but not in all cases with all file types, so ultimately it's not as seamless as I was doing previously.

I use foobar2000, which appears to always display leading zeros for track numbers. I took a file with an "MP4 (MP4 Nero)" tag, ran "Strip MP4 chapters" on it (or deleted the TOTALDISCS tag), which changed the tag to just "MP4 (MP4)" and I see leading zeros in foobar2000 either way. Same if viewing the files in Tag&Rename. I also observed that stripping/writing the TOTALDISCS tag now takes approx. 1 sec per track.

So to summarize what you said earlier, the current version of Mp3tag has the ability to detect whether or not Nero tags are present, but no longer displays them. Is this correct?

If so, can you think of a cleaner way to do what I was doing before?

Thanks again!