Skip to main content
Topic: Manipulate displayed mp3 track length (Read 286 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Manipulate displayed mp3 track length


I want to change the track length that is displayed by windows or an audio player for a given .mp3 file. As I understand, the track length is calculated from information that is stored in the frame header(s). Is there a way to change some or all headers in such a way that a different track length is displayed?

I remember that from time to time I used to see an odd mp3 file that displayed the wrong track length for some reason (probably linked to VBR encoding), but which could still be played without a problem. If there was a way to replicate this type of "malfunction" this would be great and exactly what I needed...

Thanks a lot!


Re: Manipulate displayed mp3 track length

Reply #1
I don't know all of the details about the MP3 format (or where to find them) but maybe I can get you started -

A Hex Editor is a programmer's tool that allows you to view and the bytes of ANY file (as hex data). 

And, will show you the ASCII characters for any values that happen to represent alphanumeric characters.   For example, 4C (hex) = 76 (decimal) can represent an upper case "L".  That doesn't mean everywhere you find 4C it represents "L".  It could be audio data, etc., but you can search for the string "LAME" or the string "xing".   (The XING header may contain the playing time information that you want to corrupt but I also think there is a VBR header that's related.)

Note that the ASCII value for an alphanumeric digit is different from it's actual hex or decimal numerical value and I don't know if playing time is represented as a hex value or as ASCII digits (and I don't know if it's seconds or minutes & seconds, etc.).  For example, when I search for "LAME", I found "LAME3.98" and the "3" is represented in ASCII as 33 hex (51 decimal), not as 03 hex.

Here is some more information. 

And I forgot to mention - The Windows Calculator in Programmer Mode can convert between hex and decimal.


Re: Manipulate displayed mp3 track length

Reply #3
Thanks @DVDdoug and @saratoga! With your hints, I was able to successfully modify the xing header of a Lame encoded VBR mp3 file. Changing the corresponding bytes of the number of frames, lead to an mp3 file which showed a track duration according to:

Duration = Number of Frames * Samples Per Frame / Sampling Rate

with the file still being correctly played. This seems to work for winamp, vlc player and windows in general. Unfortunately, it does not seem to work for the proprietary software I have to use. When using that software, somehow the original track duration is identified.

Any other ideas on how the track duration could be calculated resp. fooled into displaying an arbitrary value?

Thanks a lot!

SimplePortal 1.0.0 RC1 © 2008-2019