Changing the LENGTH tag doesn't work for me

Has anyone else ever even attempted to change the LENGTH tag (the total amount of time of the file, for example 4:52) of an mp3 file?. This simply doesn't work for me. I can type anything in the space for LENGTH in the tag panel and save the file, but when I right click on the file itself in the Windows directory it's in and look at the Properties, it's still exactly the same as it was. This is generally not something you would ever need to do, but I often combine a lot of separate mp3 files into one, using the Windows command prompt. It works perfectly and the resulting files play fine, but Windows always keeps the tag data from the FIRST file you are combining, so the LENGTH tag is always wrong. That's one of the tags you can't change by looking at the Properties/Details tab. I can accomplish what I want by loading/saving the file using Audacity, and the LENGTH tag is automatically corrected, but that's a cumbersome and time-consuming way to do it.

In Mp3tag, LENGTH is an ID3 field.
Windows File Explorer does not use this to display the length of a MP3 track.
It is not necessary for a MP3 track to have an ID3 tag.
The file properties (eg. bitrate, size) are used to calculate the length.
If you want to populate the LENGTH field shown in your tag panel, use an action like this:
format Length field

That is not my experience.
For me, this command produces "newfile.mp3" with an accurate length shown in File Explorer.
copy /b file1.mp3 + file2.mp3 newfile.mp3

Just to make this crystal clear:
LENGTH is a user-defined field that can hold more or less any data,
_LENGTH is the property that the encoder writes in the file header - and this field cannot be modified by MP3tag as it describes the audio part and is no tag.
Any decent program that shows the properties of a file, like the length, would read the encoder-written property and not the user-defined field.

Are you sure about that?
Any time I try and find out how to programmatically determine the length of an audio file, the only methods I find involve calculations based on other file properties.
No answer ever says "read the header".

Here are 2 descriptions of an MP3 file structure: neither shows that length is part of the header.

It seems that there is not 1 header for a MP3 file, but that the file is composed of multiple frames, each with its own header.

I have some files for which different lengths are displayed, depending on which application reads them.
That seems unlikely if the length is hard-coded in a header.

I believe that whatever software displays the length must calculate it.
But I'm no expert. :slightly_smiling_face:
Maybe Florian will tell us how he determines the length of an audio file.

You are right - it's a calculation with header data.
Which means in return that it is no tag field which can freely be edited.

1 Like

This article says:

Well, those are estimates.
They might be good enough if only the audio data is considered.

For MP3 files, the size will be increased if there is an ID3 tag.
If the tag is large, the formula for CBR files will drastically over-estimate the length.

There has to be some way to find the size of the file without the tag.

btw Thanks, but I'm not looking for a method to calculate the length of an audio file. :slightly_smiling_face:

I think that at least MP3tag knows the tag size:

Variable Description
%_tag_size% Size of all tags in bytes
%_tag_size_appended% Size of all appended tags in bytes
%_tag_size_prepended% Size of all prepended tags in bytes

But: the thread was about a user-defined field LENGTH that got modified and that this modification did not show up anywhere else. And I think that this behaviour has been explained.

1 Like

For anyonde who wants to know how much information is in the lame-header and can be read by software:

1 Like