MP3 file serial number?

Is there a way to give each file a kind of serial number -- a detail that is never changed and passed along when converting bitrates, etc?

Now that I've renamed my entire library, all my playlists are broken. I figure, if there was one unique detail about the file that never changed, I wouldn't have to deal with this in the future.

That would depend a lot on the encoder - whether that respects existing tags.
In general: all ID3 tags can be changed by some program, so there is no "never".

You can add a user-defined field that you all SERIAL_NUMBER (or whatever you like) and then fill it with values of your choice.
Also, have a look at the list of supported fields in the documentation:

some files already come with identifiers or an official one could be added.

AFAIK there is no such unchangeable identificator for your mp3 files.
Theoretically, you could use some kind of watermark for your songs, integrated in the audio part of your songs. But I would not garantuee that such a watermark would survive every format change (let's say from Mp3 to wav to FLAC).

The linked wikipedia article about audio watermarking speaks about "difficult to remove", not "impossible" to remove.
One of the contra argument I read about: "It can interrupt and inevitably ruin the experience of the end-user listening to your audio file"

Just thought a bit about it:
If you want to achieve that the link between the playlist and the file is not broken, then also an internal identifier would not help as the playlist relies on filenames.
The filename is by definition already unique, there can only be one.
So if you want to keep the filename as a constant you can, of course, use a single field with a serial number or so as source to name the file - but I think this could be the filename already which you could put together from a standardized pattern for the tag fields in use.

What you could also think of: create a field that keeps the name of the playlist and you could then filter or sort that playlist field and reconstruct the playlist from the files. Then it would not matter what the file is called.

The nuclear option would be to just change all FILENAMEs to numbers and keep TITLEs intact

Benefits: you will never have to truncate very long songs name

Disadvantage: you will always have to use software / hardware capable or in such way that will display TITLEs data

I arrived to the same conclusion. The filename is as unique as a serial number. I'm using this code to keep as much info in the filename as I can when using Tag - Filename.

$replace(%albumartist% _ %album% _ $num(%track%,2) _ %year% _ %title%,:,~,/,+,?,^)

This is only true for a filename inside the same folder. You can have as much of the exactly same filename in as much different folders you want.
If you talk about an absolute "filename" including the drive letter, the root folder name, the subfolder name and the filename itself, then your conclusion is true.

Example for the filename
ABBA_Waterloo_02_1974_Sitting in the Palmtree.mp3
which can be saved in
and so on...

1 Like

I think that if you put these 3 files into a playlist, then I think the path would be added.
So you will get at least a partially qualiified filename or a fully qualified filename, where the partial is a relative one, and the full is the absolute filename.

The problem stays that as soon as you rename the file, the link between playlist and file is broken.
So, if you cannot guarantee that the filename stays the same, then it might be an idea to create a user-defined field that stores the playlist name.
And by filtering and sorting that field you could reconstruct the playlist.

The path can be added in a playlist text file, but that is not mandatory. If you place the M3U playlist in the same subfolder as the files itself, you can ommit the path, like in this example:

Unfortunately, if you can not guarantee that the filename stays the same, you can also not guarantee that a user-defined ID3 tag would never be wiped or changed.

possible approach from the opposite direction: Make yourself independent of fixed, filename-based playlists towards automatically filling, criteria-based playlists. There are plenty of programs for this, I recommend MediaMonkey, for example.

There's nothing quite like adding a few albums to the collection, and having playlists like "Best of 80s/Pop", "Newly Added Songs", etc. automatically updated immediately afterwards.

The more accurate and comprehensive you fill in tags, the greater the possibilities.

1 Like

You're right. I've spent the past two days rebuilding playlists because the files names changed. If the files all had a tag that could not be changed, I could have referenced this number and rebuilt everything much faster.

I would like to create a serial number tag for all of my files. Any idea how to do this?

Anything that you could edit easily can also be changed by other users.
Yet, if you use the files only locally, then it is very unlikely that you will remove this field.
In the workflow, though, you either add the serial number or identifier after you have completed all the other manipulations like bitrate or format changes.

The easiest way would be:
Load all files
Select all files
User Converter>Tag-Tag
for Field type in: SERIAL_NUMBER
Format string: $num(%_counter%,6)

This works for the set of files that you have now.
As soon as further files get added, you have to keep track of the highest number and then apply the converter again only this time with
Format string: $num($add(x,%_counter%),6)
where x is the last serial number of the previous cycle.

1 Like

This is great. I only use my files locally. I just converted bitrates on a bunch of files last night and iTunes stripped out the "Sort Album" tag from all of them. I able to fix that because I still have the original files, but I wonder if it would strip my serial number tags

Perhaps the serial number may be a little complicated ...
I still favour the idea of a (user-defined) field that holds the name of the playlist to which the file belongs, and possibly the position.
You could then filter and sort by that field and recreate the playlist with the metadata from the files ... because as soon as you e.g. change the file type from e.g. wav to flac, the extension changes, the link in the playlist is broken even though the serial number may still be stored in the file but you now have to go through all the playlists to see where that file is missing.

If you find that iTunes is messing up your tags and there is no technical reason to use iTunes, then don't use it but get decent player like Foobar2000

I don't know how else to get music onto my iPhone

as I said:

the synchronization with the iPhone seems to a technical reason.

1 Like

Another idea could be to fill a random number with always 5 digits with

The randomness seems to be improved since v3.13, but I would not garantuee if you use this function for lets say 99999 tracks that you never get a duplicated number. I could not find a way to tell this function to generate a value with 6 or more digits - maybe you could fill your user defined tag like this:
$num($rand(),5) - $num($rand(),5) - $num($rand(),5)

As long as this duplicate doesn't appear for the same folder it should not be a problem.

In iTunes, Edit>Preferences>Advanced (Tab) make sure you uncheck both "Keep iTunes Media folder organized" and "Copy files to iTunes Media folder when adding to library" to avoid having iTunes rename or move your files. It shouldn't remove tags for any reason any how, except if you make mass changes (not a good idea, and that is what you have mp3tag for!).

For the same reason with many iDevice users in my home, I still use iTunes. But I have no issues like this.

What program did you use to do this?

Perhaps that had some impact on this?

I used iTunes to convert the bitrates.

Other than using it to transfer files to your phones, and maybe streaming to AppleTV devices, I would avoid using iTunes for any other purpose. Obviously you are using mp3tag to update your metadata, so that is a big plus. For managing other changes like file conversion I would suggest you consider a specialized app like dBPoweramp or Foobar2000. Your audio files will thank you!